[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>
This commit is contained in:
Jay Vosburgh
2006-02-21 16:36:44 -08:00
committed by Jeff Garzik
parent ebe19a4ed7
commit 8f903c708f
6 changed files with 85 additions and 27 deletions

View File

@ -1446,8 +1446,29 @@ static inline struct net_device *skb_bond(struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
if (dev->master)
if (dev->master) {
/*
* On bonding slaves other than the currently active
* slave, suppress duplicates except for 802.3ad
* ETH_P_SLOW and alb non-mcast/bcast.
*/
if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
if (dev->master->priv_flags & IFF_MASTER_ALB) {
if (skb->pkt_type != PACKET_BROADCAST &&
skb->pkt_type != PACKET_MULTICAST)
goto keep;
}
if (dev->master->priv_flags & IFF_MASTER_8023AD &&
skb->protocol == __constant_htons(ETH_P_SLOW))
goto keep;
kfree_skb(skb);
return NULL;
}
keep:
skb->dev = dev->master;
}
return dev;
}
@ -1591,6 +1612,9 @@ int netif_receive_skb(struct sk_buff *skb)
orig_dev = skb_bond(skb);
if (!orig_dev)
return NET_RX_DROP;
__get_cpu_var(netdev_rx_stat).total++;
skb->h.raw = skb->nh.raw = skb->data;