Subject: Re: zero features for a vlan over bond / vlan features

From: Jay Vosburgh <[email-masked]>
Date: Thu, 23 Apr 2009 16:47:41 -0700

Or Gerlitz <[email-masked]> wrote:

>Jay Vosburgh wrote:
>> The features system now has a dev->vlan_features that lists the
>> features that will work through a vlan; bond_compute_features isn't
>> using netdev_increment/fix_features to additionally compute the vlan_features, 
>> so that's ending up always empty even if the underlying device supports vlan passthrough.
>> I'm working on a patch; I'll see what I can come up with.  
>
>Great, I will be happy to test the patch once you have it...

	Ok, here's a patch, but I'm not sure it's the right patch.

	I'm not entirely sure if the vlan_features should be amassed as
the regular features are, or if it should be a strict subset
(slave0->vlan_features & slave1->vlan_features, etc).  This patch does
the former, collecting the vlan_features in a manner analagous to the
regular features.

	This is strictly a test patch, it's still got printks and such
in it.

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 99610f3..967c5b6 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1341,6 +1341,7 @@ static int bond_compute_features(struct bonding *bond)
 	struct slave *slave;
 	struct net_device *bond_dev = bond->dev;
 	unsigned long features = bond_dev->features;
+	unsigned long vlan_features = 0;
 	unsigned short max_hard_header_len = max((u16)ETH_HLEN,
 						bond_dev->hard_header_len);
 	int i;
@@ -1352,11 +1353,18 @@ static int bond_compute_features(struct bonding *bond)
 		goto done;
 
 	features &= ~NETIF_F_ONE_FOR_ALL;
-
+	vlan_features = bond->first_slave->dev->vlan_features;
+	printk("vf %lx\n", vlan_features);
 	bond_for_each_slave(bond, slave, i) {
 		features = netdev_increment_features(features,
 						     slave->dev->features,
 						     NETIF_F_ONE_FOR_ALL);
+		vlan_features = netdev_increment_features(vlan_features,
+						  slave->dev->vlan_features,
+							  NETIF_F_ONE_FOR_ALL);
+		printk("slave %s (f %lx vf %lx) new f %lx vf %lx\n",
+		       slave->dev->name, slave->dev->features,
+		       slave->dev->vlan_features, features, vlan_features);
 		if (slave->dev->hard_header_len > max_hard_header_len)
 			max_hard_header_len = slave->dev->hard_header_len;
 	}
@@ -1364,6 +1372,8 @@ static int bond_compute_features(struct bonding *bond)
 done:
 	features |= (bond_dev->features & BOND_VLAN_FEATURES);
 	bond_dev->features = netdev_fix_features(features, NULL);
+	bond_dev->vlan_features = netdev_fix_features(vlan_features, NULL);
+	printk("bd->vf %lx\n", bond_dev->vlan_features);
 	bond_dev->hard_header_len = max_hard_header_len;
 
 	return 0;

	-J

---
	-Jay Vosburgh, IBM Linux Technology Center, [email-masked]