aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMoni Shoua <monis@voltaire.com>2007-10-09 22:43:42 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-15 14:20:46 -0400
commit1053f62c24faa6d4ee6f5bfddeca847b84f67a95 (patch)
tree50ce488c64e9fccbfc9b85e6a523714828d063a6 /drivers/net
parent3158bf7d414b69fdc0c715d0a4d82e12b74ef974 (diff)
net/bonding: Delay sending of gratuitous ARP to avoid failure
Delay sending a gratuitous_arp when LINK_STATE_LINKWATCH_PENDING bit in dev->state field is on. This improves the chances for the arp packet to be transmitted. Signed-off-by: Moni Shoua <monis at voltaire.com> Acked-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/bonding/bond_main.c24
-rw-r--r--drivers/net/bonding/bonding.h1
2 files changed, 22 insertions, 3 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 7be23364a9d6..19fd35175a77 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1103,8 +1103,14 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1103 if (new_active && !bond->do_set_mac_addr) 1103 if (new_active && !bond->do_set_mac_addr)
1104 memcpy(bond->dev->dev_addr, new_active->dev->dev_addr, 1104 memcpy(bond->dev->dev_addr, new_active->dev->dev_addr,
1105 new_active->dev->addr_len); 1105 new_active->dev->addr_len);
1106 1106 if (bond->curr_active_slave &&
1107 bond_send_gratuitous_arp(bond); 1107 test_bit(__LINK_STATE_LINKWATCH_PENDING,
1108 &bond->curr_active_slave->dev->state)) {
1109 dprintk("delaying gratuitous arp on %s\n",
1110 bond->curr_active_slave->dev->name);
1111 bond->send_grat_arp = 1;
1112 } else
1113 bond_send_gratuitous_arp(bond);
1108 } 1114 }
1109} 1115}
1110 1116
@@ -2073,6 +2079,17 @@ void bond_mii_monitor(struct net_device *bond_dev)
2073 * program could monitor the link itself if needed. 2079 * program could monitor the link itself if needed.
2074 */ 2080 */
2075 2081
2082 if (bond->send_grat_arp) {
2083 if (bond->curr_active_slave && test_bit(__LINK_STATE_LINKWATCH_PENDING,
2084 &bond->curr_active_slave->dev->state))
2085 dprintk("Needs to send gratuitous arp but not yet\n");
2086 else {
2087 dprintk("sending delayed gratuitous arp on on %s\n",
2088 bond->curr_active_slave->dev->name);
2089 bond_send_gratuitous_arp(bond);
2090 bond->send_grat_arp = 0;
2091 }
2092 }
2076 read_lock(&bond->curr_slave_lock); 2093 read_lock(&bond->curr_slave_lock);
2077 oldcurrent = bond->curr_active_slave; 2094 oldcurrent = bond->curr_active_slave;
2078 read_unlock(&bond->curr_slave_lock); 2095 read_unlock(&bond->curr_slave_lock);
@@ -2474,7 +2491,7 @@ static void bond_send_gratuitous_arp(struct bonding *bond)
2474 2491
2475 if (bond->master_ip) { 2492 if (bond->master_ip) {
2476 bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip, 2493 bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip,
2477 bond->master_ip, 0); 2494 bond->master_ip, 0);
2478 } 2495 }
2479 2496
2480 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) { 2497 list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
@@ -4280,6 +4297,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4280 bond->current_arp_slave = NULL; 4297 bond->current_arp_slave = NULL;
4281 bond->primary_slave = NULL; 4298 bond->primary_slave = NULL;
4282 bond->dev = bond_dev; 4299 bond->dev = bond_dev;
4300 bond->send_grat_arp = 0;
4283 INIT_LIST_HEAD(&bond->vlan_list); 4301 INIT_LIST_HEAD(&bond->vlan_list);
4284 4302
4285 /* Initialize the device entry points */ 4303 /* Initialize the device entry points */
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index ad9c632f88e4..e0e06a84b5b9 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -187,6 +187,7 @@ struct bonding {
187 struct timer_list arp_timer; 187 struct timer_list arp_timer;
188 s8 kill_timers; 188 s8 kill_timers;
189 s8 do_set_mac_addr; 189 s8 do_set_mac_addr;
190 s8 send_grat_arp;
190 struct net_device_stats stats; 191 struct net_device_stats stats;
191#ifdef CONFIG_PROC_FS 192#ifdef CONFIG_PROC_FS
192 struct proc_dir_entry *proc_entry; 193 struct proc_dir_entry *proc_entry;