diff options
author | sfeldma@cumulusnetworks.com <sfeldma@cumulusnetworks.com> | 2013-12-12 17:10:24 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-14 01:07:32 -0500 |
commit | 06151dbcf3f76edbe900138cde9e862f429918c9 (patch) | |
tree | 84622a95346240f5ca72ca1451c3fb8d815725c8 /drivers/net/bonding/bond_options.c | |
parent | 9f53e14e86c46a2300f17309f6308ad0dfbb53ff (diff) |
bonding: add arp_interval netlink support
Add IFLA_BOND_ARP_INTERVAL to allow get/set of bonding parameter
arp_interval 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 | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 6fc7bbf0b85f..a84e729d02ef 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
@@ -259,3 +259,50 @@ int bond_option_use_carrier_set(struct bonding *bond, int use_carrier) | |||
259 | 259 | ||
260 | return 0; | 260 | return 0; |
261 | } | 261 | } |
262 | |||
263 | int bond_option_arp_interval_set(struct bonding *bond, int arp_interval) | ||
264 | { | ||
265 | if (arp_interval < 0) { | ||
266 | pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n", | ||
267 | bond->dev->name, arp_interval, INT_MAX); | ||
268 | return -EINVAL; | ||
269 | } | ||
270 | if (BOND_NO_USES_ARP(bond->params.mode)) { | ||
271 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n", | ||
272 | bond->dev->name, bond->dev->name); | ||
273 | return -EINVAL; | ||
274 | } | ||
275 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | ||
276 | bond->dev->name, arp_interval); | ||
277 | bond->params.arp_interval = arp_interval; | ||
278 | if (arp_interval) { | ||
279 | if (bond->params.miimon) { | ||
280 | pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | ||
281 | bond->dev->name, bond->dev->name); | ||
282 | bond->params.miimon = 0; | ||
283 | } | ||
284 | if (!bond->params.arp_targets[0]) | ||
285 | pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", | ||
286 | bond->dev->name); | ||
287 | } | ||
288 | if (bond->dev->flags & IFF_UP) { | ||
289 | /* If the interface is up, we may need to fire off | ||
290 | * the ARP timer. If the interface is down, the | ||
291 | * timer will get fired off when the open function | ||
292 | * is called. | ||
293 | */ | ||
294 | if (!arp_interval) { | ||
295 | if (bond->params.arp_validate) | ||
296 | bond->recv_probe = NULL; | ||
297 | cancel_delayed_work_sync(&bond->arp_work); | ||
298 | } else { | ||
299 | /* arp_validate can be set only in active-backup mode */ | ||
300 | if (bond->params.arp_validate) | ||
301 | bond->recv_probe = bond_arp_rcv; | ||
302 | cancel_delayed_work_sync(&bond->mii_work); | ||
303 | queue_delayed_work(bond->wq, &bond->arp_work, 0); | ||
304 | } | ||
305 | } | ||
306 | |||
307 | return 0; | ||
308 | } | ||