diff mbox

[2/3] bonding: Fix ALB mode to balance traffic on VLANs

Message ID 1225849876-8930-3-git-send-email-fubar@us.ibm.com
State Accepted, archived
Delegated to: Jeff Garzik
Headers show

Commit Message

Jay Vosburgh Nov. 5, 2008, 1:51 a.m. UTC
The current ALB function that processes incoming ARPs
does not handle traffic for VLANs configured above bonding.  This causes
traffic on those VLANs to all be assigned the same slave.  This patch
corrects that misbehavior by locating the bonding interface nested below
the VLAN interface.

	Bug reported by Sven Anders <anders@anduras.de>, who also
tested an earlier version of this patch and confirmed that it resolved
the problem.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
---
 drivers/net/bonding/bond_alb.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

Comments

Duncan Gibb April 14, 2009, 11:15 p.m. UTC | #1
On 05 Nov 2008 at 01:51, Jay Vosburgh wrote:

JV> The current ALB function that processes incoming ARPs does
JV> not handle traffic for VLANs configured above bonding.  This
JV> causes traffic on those VLANs to all be assigned the same slave.
JV> This patch corrects that misbehavior by locating the bonding
JV> interface nested below the VLAN interface.

> diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
> index 87437c7..e170fa2 100644
> --- a/drivers/net/bonding/bond_alb.c
> +++ b/drivers/net/bonding/bond_alb.c

> @@ -368,6 +372,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
>  
>  	if (arp->op_code == htons(ARPOP_REPLY)) {
>  		/* update rx hash table for this ARP */
> +		printk("rar: update orig %s bond_dev %s\n", orig_dev->name,
> +		       bond_dev->name);
> +		bond = bond_dev->priv;
>  		rlb_update_entry_from_arp(bond, arp);
>  		dprintk("Server received an ARP Reply from client\n");
>  	}

Is the printk() in this patch necessary?

We recently put a 2.6.29 kernel on a router with multiple ALB bonds each
of several e1000 devices.  It now generates a log entry every time an
arp is-at packet arrives at a bonded interface.  I'm not sure that's a
feature...

Cheers


Duncan
David Miller April 14, 2009, 11:43 p.m. UTC | #2
From: Duncan Gibb <duncan.gibb@siriusit.co.uk>
Date: Wed, 15 Apr 2009 00:15:04 +0100

> On 05 Nov 2008 at 01:51, Jay Vosburgh wrote:
>>  	if (arp->op_code == htons(ARPOP_REPLY)) {
>>  		/* update rx hash table for this ARP */
>> +		printk("rar: update orig %s bond_dev %s\n", orig_dev->name,
>> +		       bond_dev->name);
>> +		bond = bond_dev->priv;
>>  		rlb_update_entry_from_arp(bond, arp);
>>  		dprintk("Server received an ARP Reply from client\n");
>>  	}
> 
> Is the printk() in this patch necessary?
> 
> We recently put a 2.6.29 kernel on a router with multiple ALB bonds each
> of several e1000 devices.  It now generates a log entry every time an
> arp is-at packet arrives at a bonded interface.  I'm not sure that's a
> feature...

That's pretty annoying.  Jay can we just remove this?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 87437c7..e170fa2 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -346,14 +346,18 @@  static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp)
 
 static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct packet_type *ptype, struct net_device *orig_dev)
 {
-	struct bonding *bond = bond_dev->priv;
+	struct bonding *bond;
 	struct arp_pkt *arp = (struct arp_pkt *)skb->data;
 	int res = NET_RX_DROP;
 
 	if (dev_net(bond_dev) != &init_net)
 		goto out;
 
-	if (!(bond_dev->flags & IFF_MASTER))
+	while (bond_dev->priv_flags & IFF_802_1Q_VLAN)
+		bond_dev = vlan_dev_real_dev(bond_dev);
+
+	if (!(bond_dev->priv_flags & IFF_BONDING) ||
+	    !(bond_dev->flags & IFF_MASTER))
 		goto out;
 
 	if (!arp) {
@@ -368,6 +372,9 @@  static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
 
 	if (arp->op_code == htons(ARPOP_REPLY)) {
 		/* update rx hash table for this ARP */
+		printk("rar: update orig %s bond_dev %s\n", orig_dev->name,
+		       bond_dev->name);
+		bond = bond_dev->priv;
 		rlb_update_entry_from_arp(bond, arp);
 		dprintk("Server received an ARP Reply from client\n");
 	}
@@ -818,7 +825,7 @@  static int rlb_initialize(struct bonding *bond)
 
 	/*initialize packet type*/
 	pk_type->type = __constant_htons(ETH_P_ARP);
-	pk_type->dev = bond->dev;
+	pk_type->dev = NULL;
 	pk_type->func = rlb_arp_recv;
 
 	/* register to receive ARPs */