Skip to content

Commit b59f9f7

Browse files
Jay VosburghJeff Garzik
authored andcommitted
bonding: Rework / fix multiple gratuitous ARP support
Support for sending multiple gratuitous ARPs during failovers was added by commit: commit 7893b24 Author: Moni Shoua <[email protected]> Date: Sat May 17 21:10:12 2008 -0700 bonding: Send more than one gratuitous ARP when slave takes over This change modifies that support to remove duplicated code, add support for ARP monitor (the original only supported miimon), clear the grat ARP counter in bond_close (lest a later "ifconfig up" immediately start spewing ARPs), and add documentation for the module parameter. Also updated driver version to 3.3.0. Signed-off-by: Jay Vosburgh <[email protected]> Signed-off-by: Jeff Garzik <[email protected]>
1 parent 01f3109 commit b59f9f7

File tree

3 files changed

+35
-22
lines changed

3 files changed

+35
-22
lines changed

Documentation/networking/bonding.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,17 @@ mode
539539
swapped with the new curr_active_slave that was
540540
chosen.
541541

542+
num_grat_arp
543+
544+
Specifies the number of gratuitous ARPs to be issued after a
545+
failover event. One gratuitous ARP is issued immediately after
546+
the failover, subsequent ARPs are sent at a rate of one per link
547+
monitor interval (arp_interval or miimon, whichever is active).
548+
549+
The valid range is 0 - 255; the default value is 1. This option
550+
affects only the active-backup mode. This option was added for
551+
bonding version 3.3.0.
552+
542553
primary
543554

544555
A string (eth0, eth2, etc) specifying which slave is the

drivers/net/bonding/bond_main.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,14 +1195,7 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
11951195
old_active);
11961196

11971197
bond->send_grat_arp = bond->params.num_grat_arp;
1198-
if (!test_bit(__LINK_STATE_LINKWATCH_PENDING,
1199-
&bond->curr_active_slave->dev->state)) {
1200-
bond_send_gratuitous_arp(bond);
1201-
bond->send_grat_arp--;
1202-
} else {
1203-
dprintk("delaying gratuitous arp on %s\n",
1204-
bond->curr_active_slave->dev->name);
1205-
}
1198+
bond_send_gratuitous_arp(bond);
12061199

12071200
write_unlock_bh(&bond->curr_slave_lock);
12081201
read_unlock(&bond->lock);
@@ -2241,17 +2234,6 @@ static int __bond_mii_monitor(struct bonding *bond, int have_locks)
22412234
* program could monitor the link itself if needed.
22422235
*/
22432236

2244-
if (bond->send_grat_arp) {
2245-
if (bond->curr_active_slave && test_bit(__LINK_STATE_LINKWATCH_PENDING,
2246-
&bond->curr_active_slave->dev->state))
2247-
dprintk("Needs to send gratuitous arp but not yet\n");
2248-
else {
2249-
dprintk("sending delayed gratuitous arp on on %s\n",
2250-
bond->curr_active_slave->dev->name);
2251-
bond_send_gratuitous_arp(bond);
2252-
bond->send_grat_arp--;
2253-
}
2254-
}
22552237
read_lock(&bond->curr_slave_lock);
22562238
oldcurrent = bond->curr_active_slave;
22572239
read_unlock(&bond->curr_slave_lock);
@@ -2492,6 +2474,13 @@ void bond_mii_monitor(struct work_struct *work)
24922474
read_unlock(&bond->lock);
24932475
return;
24942476
}
2477+
2478+
if (bond->send_grat_arp) {
2479+
read_lock(&bond->curr_slave_lock);
2480+
bond_send_gratuitous_arp(bond);
2481+
read_unlock(&bond->curr_slave_lock);
2482+
}
2483+
24952484
if (__bond_mii_monitor(bond, 0)) {
24962485
read_unlock(&bond->lock);
24972486
rtnl_lock();
@@ -2657,6 +2646,8 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
26572646
/*
26582647
* Kick out a gratuitous ARP for an IP on the bonding master plus one
26592648
* for each VLAN above us.
2649+
*
2650+
* Caller must hold curr_slave_lock for read or better
26602651
*/
26612652
static void bond_send_gratuitous_arp(struct bonding *bond)
26622653
{
@@ -2666,9 +2657,13 @@ static void bond_send_gratuitous_arp(struct bonding *bond)
26662657

26672658
dprintk("bond_send_grat_arp: bond %s slave %s\n", bond->dev->name,
26682659
slave ? slave->dev->name : "NULL");
2669-
if (!slave)
2660+
2661+
if (!slave || !bond->send_grat_arp ||
2662+
test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
26702663
return;
26712664

2665+
bond->send_grat_arp--;
2666+
26722667
if (bond->master_ip) {
26732668
bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip,
26742669
bond->master_ip, 0);
@@ -3172,6 +3167,12 @@ void bond_activebackup_arp_mon(struct work_struct *work)
31723167
if (bond->slave_cnt == 0)
31733168
goto re_arm;
31743169

3170+
if (bond->send_grat_arp) {
3171+
read_lock(&bond->curr_slave_lock);
3172+
bond_send_gratuitous_arp(bond);
3173+
read_unlock(&bond->curr_slave_lock);
3174+
}
3175+
31753176
if (bond_ab_arp_inspect(bond, delta_in_ticks)) {
31763177
read_unlock(&bond->lock);
31773178
rtnl_lock();
@@ -3846,6 +3847,7 @@ static int bond_close(struct net_device *bond_dev)
38463847

38473848
write_lock_bh(&bond->lock);
38483849

3850+
bond->send_grat_arp = 0;
38493851

38503852
/* signal timers not to re-arm */
38513853
bond->kill_timers = 1;

drivers/net/bonding/bonding.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
#include "bond_3ad.h"
2323
#include "bond_alb.h"
2424

25-
#define DRV_VERSION "3.2.5"
26-
#define DRV_RELDATE "March 21, 2008"
25+
#define DRV_VERSION "3.3.0"
26+
#define DRV_RELDATE "June 10, 2008"
2727
#define DRV_NAME "bonding"
2828
#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
2929

0 commit comments

Comments
 (0)