summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-01-22 14:53:29 +0100
committerDavid S. Miller <davem@davemloft.net>2014-01-22 15:38:43 -0800
commit9e5f5eebe765b340af0318dba261e5de0f2aaf32 (patch)
tree1a2e1854202ee94bd52f7c83dcdde91f41297e7b /drivers/net/bonding/bond_options.c
parent633ddc9e9bafd168861dee1000b2c6ff725e85c5 (diff)
downloadblackbird-op-linux-9e5f5eebe765b340af0318dba261e5de0f2aaf32.tar.gz
blackbird-op-linux-9e5f5eebe765b340af0318dba261e5de0f2aaf32.zip
bonding: convert ad_select to use the new option API
This patch adds the necessary changes so ad_select 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.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index f8821696f823..081ab9b5d48a 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -78,6 +78,13 @@ static struct bond_opt_value bond_lacp_rate_tbl[] = {
{ NULL, -1, 0},
};
+static struct bond_opt_value bond_ad_select_tbl[] = {
+ { "stable", BOND_AD_STABLE, BOND_VALFLAG_DEFAULT},
+ { "bandwidth", BOND_AD_BANDWIDTH, 0},
+ { "count", BOND_AD_COUNT, 0},
+ { NULL, -1, 0},
+};
+
static struct bond_option bond_opts[] = {
[BOND_OPT_MODE] = {
.id = BOND_OPT_MODE,
@@ -171,6 +178,14 @@ static struct bond_option bond_opts[] = {
.values = bond_intmax_tbl,
.set = bond_option_min_links_set
},
+ [BOND_OPT_AD_SELECT] = {
+ .id = BOND_OPT_AD_SELECT,
+ .name = "ad_select",
+ .desc = "803.ad aggregation selection logic",
+ .flags = BOND_OPTFLAG_IFDOWN,
+ .values = bond_ad_select_tbl,
+ .set = bond_option_ad_select_set
+ },
{ }
};
@@ -1048,24 +1063,12 @@ int bond_option_lacp_rate_set(struct bonding *bond,
return 0;
}
-int bond_option_ad_select_set(struct bonding *bond, int ad_select)
+int bond_option_ad_select_set(struct bonding *bond,
+ struct bond_opt_value *newval)
{
- if (bond_parm_tbl_lookup(ad_select, ad_select_tbl) < 0) {
- pr_err("%s: Ignoring invalid ad_select value %d.\n",
- bond->dev->name, ad_select);
- return -EINVAL;
- }
-
- if (bond->dev->flags & IFF_UP) {
- pr_err("%s: Unable to update ad_select because interface is up.\n",
- bond->dev->name);
- return -EPERM;
- }
-
- bond->params.ad_select = ad_select;
- pr_info("%s: Setting ad_select to %s (%d).\n",
- bond->dev->name, ad_select_tbl[ad_select].modename,
- ad_select);
+ pr_info("%s: Setting ad_select to %s (%llu).\n",
+ bond->dev->name, newval->string, newval->value);
+ bond->params.ad_select = newval->value;
return 0;
}
OpenPOWER on IntegriCloud