diff options
author | Nikolay Aleksandrov | 2014-01-22 14:53:22 +0100 |
---|---|---|
committer | David S. Miller | 2014-01-23 00:38:42 +0100 |
commit | 1df6b6aa334c99b39f9366f4199b7f5e479a8899 (patch) | |
tree | db9fc82c70ba94d02bd646650b914cb910ff8f80 /drivers/net/bonding/bond_options.c | |
parent | bonding: convert arp_all_targets to use the new option API (diff) | |
download | kernel-qcow2-linux-1df6b6aa334c99b39f9366f4199b7f5e479a8899.tar.gz kernel-qcow2-linux-1df6b6aa334c99b39f9366f4199b7f5e479a8899.tar.xz kernel-qcow2-linux-1df6b6aa334c99b39f9366f4199b7f5e479a8899.zip |
bonding: convert fail_over_mac to use the new option API
This patch adds the necessary changes so fail_over_mac would use
the new bonding option API. Also fixes a trivial copy/paste error in
bond_check_params where the wrong variable was used for the error msg.
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 | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index e136e7525a02..c73d3acbdd37 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -59,6 +59,13 @@ static struct bond_opt_value bond_arp_all_targets_tbl[] = { { NULL, -1, 0}, }; +static struct bond_opt_value bond_fail_over_mac_tbl[] = { + { "none", BOND_FOM_NONE, BOND_VALFLAG_DEFAULT}, + { "active", BOND_FOM_ACTIVE, 0}, + { "follow", BOND_FOM_FOLLOW, 0}, + { NULL, -1, 0}, +}; + static struct bond_option bond_opts[] = { [BOND_OPT_MODE] = { .id = BOND_OPT_MODE, @@ -98,6 +105,14 @@ static struct bond_option bond_opts[] = { .values = bond_arp_all_targets_tbl, .set = bond_option_arp_all_targets_set }, + [BOND_OPT_FAIL_OVER_MAC] = { + .id = BOND_OPT_FAIL_OVER_MAC, + .name = "fail_over_mac", + .desc = "For active-backup, do not set all slaves to the same MAC", + .flags = BOND_OPTFLAG_NOSLAVES, + .values = bond_fail_over_mac_tbl, + .set = bond_option_fail_over_mac_set + }, { } }; @@ -864,24 +879,12 @@ int bond_option_primary_reselect_set(struct bonding *bond, int primary_reselect) return 0; } -int bond_option_fail_over_mac_set(struct bonding *bond, int fail_over_mac) +int bond_option_fail_over_mac_set(struct bonding *bond, + struct bond_opt_value *newval) { - if (bond_parm_tbl_lookup(fail_over_mac, fail_over_mac_tbl) < 0) { - pr_err("%s: Ignoring invalid fail_over_mac value %d.\n", - bond->dev->name, fail_over_mac); - return -EINVAL; - } - - if (bond_has_slaves(bond)) { - pr_err("%s: Can't alter fail_over_mac with slaves in bond.\n", - bond->dev->name); - return -EPERM; - } - - bond->params.fail_over_mac = fail_over_mac; - pr_info("%s: Setting fail_over_mac to %s (%d).\n", - bond->dev->name, fail_over_mac_tbl[fail_over_mac].modename, - fail_over_mac); + pr_info("%s: Setting fail_over_mac to %s (%llu).\n", + bond->dev->name, newval->string, newval->value); + bond->params.fail_over_mac = newval->value; return 0; } |