summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov2014-01-22 14:53:37 +0100
committerDavid S. Miller2014-01-23 00:38:44 +0100
commit3df011625135fa1c670cb8e24618fc7ca38e00b0 (patch)
treeea2b9dcd8d94be3cace8fc3bb73934989d601f09 /drivers/net/bonding/bond_options.c
parentbonding: convert queue_id to use the new option API (diff)
downloadkernel-qcow2-linux-3df011625135fa1c670cb8e24618fc7ca38e00b0.tar.gz
kernel-qcow2-linux-3df011625135fa1c670cb8e24618fc7ca38e00b0.tar.xz
kernel-qcow2-linux-3df011625135fa1c670cb8e24618fc7ca38e00b0.zip
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 <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.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 8775c724c700..7fafc34ca47b 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;