aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-01-22 08:53:29 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-22 18:38:43 -0500
commit9e5f5eebe765b340af0318dba261e5de0f2aaf32 (patch)
tree1a2e1854202ee94bd52f7c83dcdde91f41297e7b /drivers/net/bonding/bond_options.c
parent633ddc9e9bafd168861dee1000b2c6ff725e85c5 (diff)
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[] = {
78 { NULL, -1, 0}, 78 { NULL, -1, 0},
79}; 79};
80 80
81static struct bond_opt_value bond_ad_select_tbl[] = {
82 { "stable", BOND_AD_STABLE, BOND_VALFLAG_DEFAULT},
83 { "bandwidth", BOND_AD_BANDWIDTH, 0},
84 { "count", BOND_AD_COUNT, 0},
85 { NULL, -1, 0},
86};
87
81static struct bond_option bond_opts[] = { 88static struct bond_option bond_opts[] = {
82 [BOND_OPT_MODE] = { 89 [BOND_OPT_MODE] = {
83 .id = BOND_OPT_MODE, 90 .id = BOND_OPT_MODE,
@@ -171,6 +178,14 @@ static struct bond_option bond_opts[] = {
171 .values = bond_intmax_tbl, 178 .values = bond_intmax_tbl,
172 .set = bond_option_min_links_set 179 .set = bond_option_min_links_set
173 }, 180 },
181 [BOND_OPT_AD_SELECT] = {
182 .id = BOND_OPT_AD_SELECT,
183 .name = "ad_select",
184 .desc = "803.ad aggregation selection logic",
185 .flags = BOND_OPTFLAG_IFDOWN,
186 .values = bond_ad_select_tbl,
187 .set = bond_option_ad_select_set
188 },
174 { } 189 { }
175}; 190};
176 191
@@ -1048,24 +1063,12 @@ int bond_option_lacp_rate_set(struct bonding *bond,
1048 return 0; 1063 return 0;
1049} 1064}
1050 1065
1051int bond_option_ad_select_set(struct bonding *bond, int ad_select) 1066int bond_option_ad_select_set(struct bonding *bond,
1067 struct bond_opt_value *newval)
1052{ 1068{
1053 if (bond_parm_tbl_lookup(ad_select, ad_select_tbl) < 0) { 1069 pr_info("%s: Setting ad_select to %s (%llu).\n",
1054 pr_err("%s: Ignoring invalid ad_select value %d.\n", 1070 bond->dev->name, newval->string, newval->value);
1055 bond->dev->name, ad_select); 1071 bond->params.ad_select = newval->value;
1056 return -EINVAL;
1057 }
1058
1059 if (bond->dev->flags & IFF_UP) {
1060 pr_err("%s: Unable to update ad_select because interface is up.\n",
1061 bond->dev->name);
1062 return -EPERM;
1063 }
1064
1065 bond->params.ad_select = ad_select;
1066 pr_info("%s: Setting ad_select to %s (%d).\n",
1067 bond->dev->name, ad_select_tbl[ad_select].modename,
1068 ad_select);
1069 1072
1070 return 0; 1073 return 0;
1071} 1074}