summaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_options.c
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-01-22 14:53:25 +0100
committerDavid S. Miller <davem@davemloft.net>2014-01-22 15:38:42 -0800
commit25a9b54a4b4a996e5a996c1e841c265d40db1d40 (patch)
treedbd8f877a0893d7c900b63684c3d274932796466 /drivers/net/bonding/bond_options.c
parent4fb0ef585eb2825ef4e542c2b1d302dc53f36860 (diff)
bonding: convert downdelay to use the new option API
This patch adds the necessary changes so downdelay would use the new bonding option API. Also some trivial style fixes. 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.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index df5f007ddaa..03514f7e17b 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -135,6 +135,13 @@ static struct bond_option bond_opts[] = {
.flags = BOND_OPTFLAG_RAWVAL,
.set = bond_option_arp_ip_targets_set
},
+ [BOND_OPT_DOWNDELAY] = {
+ .id = BOND_OPT_DOWNDELAY,
+ .name = "downdelay",
+ .desc = "Delay before considering link down, in milliseconds",
+ .values = bond_intmax_tbl,
+ .set = bond_option_downdelay_set
+ },
{ }
};
@@ -580,31 +587,25 @@ int bond_option_updelay_set(struct bonding *bond, int updelay)
return 0;
}
-int bond_option_downdelay_set(struct bonding *bond, int downdelay)
+int bond_option_downdelay_set(struct bonding *bond,
+ struct bond_opt_value *newval)
{
- if (!(bond->params.miimon)) {
+ if (!bond->params.miimon) {
pr_err("%s: Unable to set down delay as MII monitoring is disabled\n",
bond->dev->name);
return -EPERM;
}
-
- if (downdelay < 0) {
- pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n",
- bond->dev->name, downdelay, 0, INT_MAX);
- return -EINVAL;
- } else {
- if ((downdelay % bond->params.miimon) != 0) {
- pr_warn("%s: Warning: down delay (%d) is not a multiple of miimon (%d), delay rounded to %d ms\n",
- bond->dev->name, downdelay,
- bond->params.miimon,
- (downdelay / bond->params.miimon) *
- bond->params.miimon);
- }
- bond->params.downdelay = downdelay / bond->params.miimon;
- pr_info("%s: Setting down delay to %d.\n",
- bond->dev->name,
- bond->params.downdelay * bond->params.miimon);
+ if ((newval->value % bond->params.miimon) != 0) {
+ pr_warn("%s: Warning: down delay (%llu) is not a multiple of miimon (%d), delay rounded to %llu ms\n",
+ bond->dev->name, newval->value,
+ bond->params.miimon,
+ (newval->value / bond->params.miimon) *
+ bond->params.miimon);
}
+ bond->params.downdelay = newval->value / bond->params.miimon;
+ pr_info("%s: Setting down delay to %d.\n",
+ bond->dev->name,
+ bond->params.downdelay * bond->params.miimon);
return 0;
}