summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov2014-01-22 14:53:32 +0100
committerDavid S. Miller2014-01-23 00:38:43 +0100
commit180222f08861d8206b3ff1c6392101e29d4ae161 (patch)
tree4ce7f73dc463164f8539bdc40f627b4b0808b95e /drivers/net/bonding/bond_options.c
parentbonding: convert miimon to use the new option API (diff)
downloadkernel-qcow2-linux-180222f08861d8206b3ff1c6392101e29d4ae161.tar.gz
kernel-qcow2-linux-180222f08861d8206b3ff1c6392101e29d4ae161.tar.xz
kernel-qcow2-linux-180222f08861d8206b3ff1c6392101e29d4ae161.zip
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.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index cb515d94864d..f094a313adb3 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)