diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-01-22 14:53:33 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-22 15:38:43 -0800 |
commit | 388d3a6d4aa356b885bcd023c185060df9ea2484 (patch) | |
tree | 4d48b059fc62aac5d47907eca55cc1f10379636c /drivers/net/bonding/bond_options.c | |
parent | 180222f08861d8206b3ff1c6392101e29d4ae161 (diff) |
bonding: convert primary_reselect to use the new option API
This patch adds the necessary changes so primary_reselect 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 | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index f094a313adb..eaa3d4057cd 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -92,6 +92,13 @@ static struct bond_opt_value bond_num_peer_notif_tbl[] = { { NULL, -1, 0} }; +static struct bond_opt_value bond_primary_reselect_tbl[] = { + { "always", BOND_PRI_RESELECT_ALWAYS, BOND_VALFLAG_DEFAULT}, + { "better", BOND_PRI_RESELECT_BETTER, 0}, + { "failure", BOND_PRI_RESELECT_FAILURE, 0}, + { NULL, -1}, +}; + static struct bond_option bond_opts[] = { [BOND_OPT_MODE] = { .id = BOND_OPT_MODE, @@ -217,6 +224,13 @@ static struct bond_option bond_opts[] = { BIT(BOND_MODE_ALB)), .set = bond_option_primary_set }, + [BOND_OPT_PRIMARY_RESELECT] = { + .id = BOND_OPT_PRIMARY_RESELECT, + .name = "primary_reselect", + .desc = "Reselect primary slave once it comes up", + .values = bond_primary_reselect_tbl, + .set = bond_option_primary_reselect_set + }, { } }; @@ -943,18 +957,12 @@ out: return 0; } -int bond_option_primary_reselect_set(struct bonding *bond, int primary_reselect) +int bond_option_primary_reselect_set(struct bonding *bond, + struct bond_opt_value *newval) { - if (bond_parm_tbl_lookup(primary_reselect, pri_reselect_tbl) < 0) { - pr_err("%s: Ignoring invalid primary_reselect value %d.\n", - bond->dev->name, primary_reselect); - return -EINVAL; - } - - bond->params.primary_reselect = primary_reselect; - pr_info("%s: setting primary_reselect to %s (%d).\n", - bond->dev->name, pri_reselect_tbl[primary_reselect].modename, - primary_reselect); + pr_info("%s: setting primary_reselect to %s (%llu).\n", + bond->dev->name, newval->string, newval->value); + bond->params.primary_reselect = newval->value; block_netpoll_tx(); write_lock_bh(&bond->curr_slave_lock); |