diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2013-12-12 14:10:02 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-14 01:07:31 -0500 |
commit | 25852e29dfc58d249ad0db235996b36c33db6d61 (patch) | |
tree | 9bd0ce9103aed2d5c40b2988260f03e65b1a1b3c /drivers/net/bonding/bond_options.c | |
parent | eecdaa6e20284efbe9e76eebd44eac2b22f7b5d7 (diff) | |
download | linux-25852e29dfc58d249ad0db235996b36c33db6d61.tar.gz linux-25852e29dfc58d249ad0db235996b36c33db6d61.tar.bz2 linux-25852e29dfc58d249ad0db235996b36c33db6d61.zip |
bonding: add updelay netlink support
Add IFLA_BOND_UPDELAY to allow get/set of bonding parameter
updelay 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 8ae42d36f11f..ae94b847ffcc 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c @@ -187,3 +187,32 @@ int bond_option_miimon_set(struct bonding *bond, int miimon) } return 0; } + +int bond_option_updelay_set(struct bonding *bond, int updelay) +{ + if (!(bond->params.miimon)) { + pr_err("%s: Unable to set up delay as MII monitoring is disabled\n", + bond->dev->name); + return -EPERM; + } + + if (updelay < 0) { + pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n", + bond->dev->name, updelay, 0, INT_MAX); + return -EINVAL; + } else { + if ((updelay % bond->params.miimon) != 0) { + pr_warn("%s: Warning: up delay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n", + bond->dev->name, updelay, + bond->params.miimon, + (updelay / bond->params.miimon) * + bond->params.miimon); + } + bond->params.updelay = updelay / bond->params.miimon; + pr_info("%s: Setting up delay to %d.\n", + bond->dev->name, + bond->params.updelay * bond->params.miimon); + } + + return 0; +} |