From 3df011625135fa1c670cb8e24618fc7ca38e00b0 Mon Sep 17 00:00:00 2001 From: Nikolay Aleksandrov Date: Wed, 22 Jan 2014 14:53:37 +0100 Subject: bonding: convert all_slaves_active to use the new option API This patch adds the necessary changes so all_slaves_active would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov Signed-off-by: David S. Miller --- drivers/net/bonding/bond_options.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'drivers/net/bonding/bond_options.c') diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 8775c724c70..7fafc34ca47 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -105,6 +105,12 @@ static struct bond_opt_value bond_use_carrier_tbl[] = { { NULL, -1, 0} }; +static struct bond_opt_value bond_all_slaves_active_tbl[] = { + { "off", 0, BOND_VALFLAG_DEFAULT}, + { "on", 1, 0}, + { NULL, -1, 0} +}; + static struct bond_option bond_opts[] = { [BOND_OPT_MODE] = { .id = BOND_OPT_MODE, @@ -261,6 +267,13 @@ static struct bond_option bond_opts[] = { .flags = BOND_OPTFLAG_RAWVAL, .set = bond_option_queue_id_set }, + [BOND_OPT_ALL_SLAVES_ACTIVE] = { + .id = BOND_OPT_ALL_SLAVES_ACTIVE, + .name = "all_slaves_active", + .desc = "Keep all frames received on an interface by setting active flag for all slaves", + .values = bond_all_slaves_active_tbl, + .set = bond_option_all_slaves_active_set + }, { } }; @@ -1049,25 +1062,17 @@ int bond_option_num_peer_notif_set(struct bonding *bond, } int bond_option_all_slaves_active_set(struct bonding *bond, - int all_slaves_active) + struct bond_opt_value *newval) { struct list_head *iter; struct slave *slave; - if (all_slaves_active == bond->params.all_slaves_active) + if (newval->value == bond->params.all_slaves_active) return 0; - - if ((all_slaves_active == 0) || (all_slaves_active == 1)) { - bond->params.all_slaves_active = all_slaves_active; - } else { - pr_info("%s: Ignoring invalid all_slaves_active value %d.\n", - bond->dev->name, all_slaves_active); - return -EINVAL; - } - + bond->params.all_slaves_active = newval->value; bond_for_each_slave(bond, slave, iter) { if (!bond_is_active_slave(slave)) { - if (all_slaves_active) + if (newval->value) slave->inactive = 0; else slave->inactive = 1; -- cgit v1.2.3-70-g09d2