diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2013-12-12 17:10:02 -0500 |
---|---|---|
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) |
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) | |||
187 | } | 187 | } |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | |||
191 | int bond_option_updelay_set(struct bonding *bond, int updelay) | ||
192 | { | ||
193 | if (!(bond->params.miimon)) { | ||
194 | pr_err("%s: Unable to set up delay as MII monitoring is disabled\n", | ||
195 | bond->dev->name); | ||
196 | return -EPERM; | ||
197 | } | ||
198 | |||
199 | if (updelay < 0) { | ||
200 | pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n", | ||
201 | bond->dev->name, updelay, 0, INT_MAX); | ||
202 | return -EINVAL; | ||
203 | } else { | ||
204 | if ((updelay % bond->params.miimon) != 0) { | ||
205 | pr_warn("%s: Warning: up delay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n", | ||
206 | bond->dev->name, updelay, | ||
207 | bond->params.miimon, | ||
208 | (updelay / bond->params.miimon) * | ||
209 | bond->params.miimon); | ||
210 | } | ||
211 | bond->params.updelay = updelay / bond->params.miimon; | ||
212 | pr_info("%s: Setting up delay to %d.\n", | ||
213 | bond->dev->name, | ||
214 | bond->params.updelay * bond->params.miimon); | ||
215 | } | ||
216 | |||
217 | return 0; | ||
218 | } | ||