diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:32 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:43 -0800 |
commit | 180222f08861d8206b3ff1c6392101e29d4ae161 (patch) | |
tree | 4ce7f73dc463164f8539bdc40f627b4b0808b95e /drivers/net/bonding/bond_options.c | |
parent | b98d9c66e1c3823c50a3cd5e8e59f12b97d7ba5d (diff) |
bonding: convert primary to use the new option API
This patch adds the necessary changes so primary would use
the new bonding option API.
Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_options.c')
-rw-r--r-- | drivers/net/bonding/bond_options.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index cb515d94864..f094a313adb 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -207,6 +207,16 @@ static struct bond_option bond_opts[] = { .values = bond_intmax_tbl, .set = bond_option_miimon_set }, + [BOND_OPT_PRIMARY] = { + .id = BOND_OPT_PRIMARY, + .name = "primary", + .desc = "Primary network device to use", + .flags = BOND_OPTFLAG_RAWVAL, + .unsuppmodes = BOND_MODE_ALL_EX(BIT(BOND_MODE_ACTIVEBACKUP) | + BIT(BOND_MODE_TLB) | + BIT(BOND_MODE_ALB)), + .set = bond_option_primary_set + }, { } }; @@ -885,23 +895,19 @@ int bond_option_arp_all_targets_set(struct bonding *bond, return 0; } -int bond_option_primary_set(struct bonding *bond, const char *primary) +int bond_option_primary_set(struct bonding *bond, struct bond_opt_value *newval) { + char *p, *primary = newval->string; struct list_head *iter; struct slave *slave; - int err = 0; block_netpoll_tx(); read_lock(&bond->lock); write_lock_bh(&bond->curr_slave_lock); - if (!USES_PRIMARY(bond->params.mode)) { - pr_err("%s: Unable to set primary slave; %s is in mode %d\n", - bond->dev->name, bond->dev->name, bond->params.mode); - err = -EINVAL; - goto out; - } - + p = strchr(primary, '\n'); + if (p) + *p = '\0'; /* check to see if we are clearing primary */ if (!strlen(primary)) { pr_info("%s: Setting primary slave to None.\n", @@ -934,7 +940,7 @@ out: read_unlock(&bond->lock); unblock_netpoll_tx(); - return err; + return 0; } int bond_option_primary_reselect_set(struct bonding *bond, int primary_reselect) |