diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2013-12-12 17:10:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-14 01:07:31 -0500 |
commit | c7461f9bf5a11bf88fdbd05b26c6d55b77dcd46d (patch) | |
tree | 2c80c47d2ef00b0c4cdf64835865612c73682cfb /drivers/net/bonding/bond_options.c | |
parent | 25852e29dfc58d249ad0db235996b36c33db6d61 (diff) |
bonding: add downdelay netlink support
Add IFLA_BOND_DOWNDELAY to allow get/set of bonding parameter
downdelay via netlink.
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
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.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index ae94b847ffcc..2914d649ee34 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
@@ -216,3 +216,32 @@ int bond_option_updelay_set(struct bonding *bond, int updelay) | |||
216 | 216 | ||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | |||
220 | int bond_option_downdelay_set(struct bonding *bond, int downdelay) | ||
221 | { | ||
222 | if (!(bond->params.miimon)) { | ||
223 | pr_err("%s: Unable to set down delay as MII monitoring is disabled\n", | ||
224 | bond->dev->name); | ||
225 | return -EPERM; | ||
226 | } | ||
227 | |||
228 | if (downdelay < 0) { | ||
229 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | ||
230 | bond->dev->name, downdelay, 0, INT_MAX); | ||
231 | return -EINVAL; | ||
232 | } else { | ||
233 | if ((downdelay % bond->params.miimon) != 0) { | ||
234 | pr_warn("%s: Warning: down delay (%d) is not a multiple of miimon (%d), delay rounded to %d ms\n", | ||
235 | bond->dev->name, downdelay, | ||
236 | bond->params.miimon, | ||
237 | (downdelay / bond->params.miimon) * | ||
238 | bond->params.miimon); | ||
239 | } | ||
240 | bond->params.downdelay = downdelay / bond->params.miimon; | ||
241 | pr_info("%s: Setting down delay to %d.\n", | ||
242 | bond->dev->name, | ||
243 | bond->params.downdelay * bond->params.miimon); | ||
244 | } | ||
245 | |||
246 | return 0; | ||
247 | } | ||