aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.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 /net/core/dev.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 'net/core/dev.c')
-rw-r--r--net/core/dev.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 225e38ff57c4..ef56c035d44e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1446,8 +1446,29 @@ static inline struct net_device *skb_bond(struct sk_buff *skb)
1446{ 1446{
1447 struct net_device *dev = skb->dev; 1447 struct net_device *dev = skb->dev;
1448 1448
1449 if (dev->master) 1449 if (dev->master) {
1450 /*
1451 * On bonding slaves other than the currently active
1452 * slave, suppress duplicates except for 802.3ad
1453 * ETH_P_SLOW and alb non-mcast/bcast.
1454 */
1455 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1456 if (dev->master->priv_flags & IFF_MASTER_ALB) {
1457 if (skb->pkt_type != PACKET_BROADCAST &&
1458 skb->pkt_type != PACKET_MULTICAST)
1459 goto keep;
1460 }
1461
1462 if (dev->master->priv_flags & IFF_MASTER_8023AD &&
1463 skb->protocol == __constant_htons(ETH_P_SLOW))
1464 goto keep;
1465
1466 kfree_skb(skb);
1467 return NULL;
1468 }
1469keep:
1450 skb->dev = dev->master; 1470 skb->dev = dev->master;
1471 }
1451 1472
1452 return dev; 1473 return dev;
1453} 1474}
@@ -1591,6 +1612,9 @@ int netif_receive_skb(struct sk_buff *skb)
1591 1612
1592 orig_dev = skb_bond(skb); 1613 orig_dev = skb_bond(skb);
1593 1614
1615 if (!orig_dev)
1616 return NET_RX_DROP;
1617
1594 __get_cpu_var(netdev_rx_stat).total++; 1618 __get_cpu_var(netdev_rx_stat).total++;
1595 1619
1596 skb->h.raw = skb->nh.raw = skb->data; 1620 skb->h.raw = skb->nh.raw = skb->data;