aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
authorJay Vosburgh <fubar@us.ibm.com>2006-02-21 19:36:44 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-03 20:58:00 -0500
commit8f903c708fcc2b579ebf16542bf6109bad593a1d (patch)
tree8fb890c05d962c2dd63f8dbc960efbd0b09802d2 /drivers/net/bonding/bond_main.c
parentebe19a4ed78d4a11a7e01cdeda25f91b7f2fcb5a (diff)
[PATCH] bonding: suppress duplicate packets
Originally submitted by Kenzo Iwami; his original description is: The current bonding driver receives duplicate packets when broadcast/ multicast packets are sent by other devices or packets are flooded by the switch. In this patch, new flags are added in priv_flags of net_device structure to let the bonding driver discard duplicate packets in dev.c:skb_bond(). Modified by Jay Vosburgh to change a define name, update some comments, rearrange the new skb_bond() for clarity, clear all bonding priv_flags on slave release, and update the driver version. Signed-off-by: Kenzo Iwami <k-iwami@cj.jp.nec.com> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index bcf9f17daf0d..623c87a83615 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1040,6 +1040,10 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
1040 if ((bond->params.mode == BOND_MODE_TLB) || 1040 if ((bond->params.mode == BOND_MODE_TLB) ||
1041 (bond->params.mode == BOND_MODE_ALB)) { 1041 (bond->params.mode == BOND_MODE_ALB)) {
1042 bond_alb_handle_active_change(bond, new_active); 1042 bond_alb_handle_active_change(bond, new_active);
1043 if (old_active)
1044 bond_set_slave_inactive_flags(old_active);
1045 if (new_active)
1046 bond_set_slave_active_flags(new_active);
1043 } else { 1047 } else {
1044 bond->curr_active_slave = new_active; 1048 bond->curr_active_slave = new_active;
1045 } 1049 }
@@ -1443,15 +1447,16 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1443 1447
1444 switch (bond->params.mode) { 1448 switch (bond->params.mode) {
1445 case BOND_MODE_ACTIVEBACKUP: 1449 case BOND_MODE_ACTIVEBACKUP:
1446 /* if we're in active-backup mode, we need one and only one active 1450 /* if we're in active-backup mode, we need one and
1447 * interface. The backup interfaces will have their NOARP flag set 1451 * only one active interface. The backup interfaces
1448 * because we need them to be completely deaf and not to respond to 1452 * will have their SLAVE_INACTIVE flag set because we
1449 * any ARP request on the network to avoid fooling a switch. Thus, 1453 * need them to be drop all packets. Thus, since we
1450 * since we guarantee that curr_active_slave always point to the last 1454 * guarantee that curr_active_slave always point to
1451 * usable interface, we just have to verify this interface's flag. 1455 * the last usable interface, we just have to verify
1456 * this interface's flag.
1452 */ 1457 */
1453 if (((!bond->curr_active_slave) || 1458 if (((!bond->curr_active_slave) ||
1454 (bond->curr_active_slave->dev->flags & IFF_NOARP)) && 1459 (bond->curr_active_slave->dev->priv_flags & IFF_SLAVE_INACTIVE)) &&
1455 (new_slave->link != BOND_LINK_DOWN)) { 1460 (new_slave->link != BOND_LINK_DOWN)) {
1456 dprintk("This is the first active slave\n"); 1461 dprintk("This is the first active slave\n");
1457 /* first slave or no active slave yet, and this link 1462 /* first slave or no active slave yet, and this link
@@ -1492,6 +1497,8 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
1492 * is OK, so make this interface the active one 1497 * is OK, so make this interface the active one
1493 */ 1498 */
1494 bond_change_active_slave(bond, new_slave); 1499 bond_change_active_slave(bond, new_slave);
1500 } else {
1501 bond_set_slave_inactive_flags(new_slave);
1495 } 1502 }
1496 break; 1503 break;
1497 default: 1504 default:
@@ -1724,13 +1731,8 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1724 addr.sa_family = slave_dev->type; 1731 addr.sa_family = slave_dev->type;
1725 dev_set_mac_address(slave_dev, &addr); 1732 dev_set_mac_address(slave_dev, &addr);
1726 1733
1727 /* restore the original state of the 1734 slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
1728 * IFF_NOARP flag that might have been 1735 IFF_SLAVE_INACTIVE);
1729 * set by bond_set_slave_inactive_flags()
1730 */
1731 if ((slave->original_flags & IFF_NOARP) == 0) {
1732 slave_dev->flags &= ~IFF_NOARP;
1733 }
1734 1736
1735 kfree(slave); 1737 kfree(slave);
1736 1738
@@ -1816,12 +1818,8 @@ static int bond_release_all(struct net_device *bond_dev)
1816 addr.sa_family = slave_dev->type; 1818 addr.sa_family = slave_dev->type;
1817 dev_set_mac_address(slave_dev, &addr); 1819 dev_set_mac_address(slave_dev, &addr);
1818 1820
1819 /* restore the original state of the IFF_NOARP flag that might have 1821 slave_dev->priv_flags &= ~(IFF_MASTER_8023AD | IFF_MASTER_ALB |
1820 * been set by bond_set_slave_inactive_flags() 1822 IFF_SLAVE_INACTIVE);
1821 */
1822 if ((slave->original_flags & IFF_NOARP) == 0) {
1823 slave_dev->flags &= ~IFF_NOARP;
1824 }
1825 1823
1826 kfree(slave); 1824 kfree(slave);
1827 1825
@@ -4061,14 +4059,17 @@ void bond_set_mode_ops(struct bonding *bond, int mode)
4061 bond_dev->hard_start_xmit = bond_xmit_broadcast; 4059 bond_dev->hard_start_xmit = bond_xmit_broadcast;
4062 break; 4060 break;
4063 case BOND_MODE_8023AD: 4061 case BOND_MODE_8023AD:
4062 bond_set_master_3ad_flags(bond);
4064 bond_dev->hard_start_xmit = bond_3ad_xmit_xor; 4063 bond_dev->hard_start_xmit = bond_3ad_xmit_xor;
4065 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34) 4064 if (bond->params.xmit_policy == BOND_XMIT_POLICY_LAYER34)
4066 bond->xmit_hash_policy = bond_xmit_hash_policy_l34; 4065 bond->xmit_hash_policy = bond_xmit_hash_policy_l34;
4067 else 4066 else
4068 bond->xmit_hash_policy = bond_xmit_hash_policy_l2; 4067 bond->xmit_hash_policy = bond_xmit_hash_policy_l2;
4069 break; 4068 break;
4070 case BOND_MODE_TLB:
4071 case BOND_MODE_ALB: 4069 case BOND_MODE_ALB:
4070 bond_set_master_alb_flags(bond);
4071 /* FALLTHRU */
4072 case BOND_MODE_TLB:
4072 bond_dev->hard_start_xmit = bond_alb_xmit; 4073 bond_dev->hard_start_xmit = bond_alb_xmit;
4073 bond_dev->set_mac_address = bond_alb_set_mac_address; 4074 bond_dev->set_mac_address = bond_alb_set_mac_address;
4074 break; 4075 break;