summaryrefslogtreecommitdiff
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-01-22 14:53:39 +0100
committerDavid S. Miller <davem@davemloft.net>2014-01-22 15:38:44 -0800
commit4325b374f84e59226851636df946f2500d0bfeba (patch)
treeaf0f136b629b6a9717502fd379d87e8c3e2b7d4b /drivers/net/bonding/bond_options.c
parent105c8fb6c55e9c5055798184cbb5ef61343139b4 (diff)
bonding: convert lp_interval to use the new option API
This patch adds the necessary changes so lp_interval 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.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index 1373093d1c6a..60d700139811 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -118,6 +118,11 @@ static struct bond_opt_value bond_resend_igmp_tbl[] = {
{ NULL, -1, 0}
};
+static struct bond_opt_value bond_lp_interval_tbl[] = {
+ { "minval", 1, BOND_VALFLAG_MIN | BOND_VALFLAG_DEFAULT},
+ { "maxval", INT_MAX, BOND_VALFLAG_MAX},
+};
+
static struct bond_option bond_opts[] = {
[BOND_OPT_MODE] = {
.id = BOND_OPT_MODE,
@@ -288,6 +293,13 @@ static struct bond_option bond_opts[] = {
.values = bond_resend_igmp_tbl,
.set = bond_option_resend_igmp_set
},
+ [BOND_OPT_LP_INTERVAL] = {
+ .id = BOND_OPT_LP_INTERVAL,
+ .name = "lp_interval",
+ .desc = "The number of seconds between instances where the bonding driver sends learning packets to each slave's peer switch",
+ .values = bond_lp_interval_tbl,
+ .set = bond_option_lp_interval_set
+ },
{ }
};
@@ -1101,15 +1113,10 @@ int bond_option_min_links_set(struct bonding *bond,
return 0;
}
-int bond_option_lp_interval_set(struct bonding *bond, int lp_interval)
+int bond_option_lp_interval_set(struct bonding *bond,
+ struct bond_opt_value *newval)
{
- if (lp_interval <= 0) {
- pr_err("%s: lp_interval must be between 1 and %d\n",
- bond->dev->name, INT_MAX);
- return -EINVAL;
- }
-
- bond->params.lp_interval = lp_interval;
+ bond->params.lp_interval = newval->value;
return 0;
}