diff mbox

[net-next-2.6] bonding: propogate vlan_features to bonding master

Message ID 3463.1248298460@death.nxdomain.ibm.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Jay Vosburgh July 22, 2009, 9:34 p.m. UTC
Propogate the vlan_features of the slave devices to the bonding
master device, using the same logic as for regular features.

	Tested by Or Gerlitz <ogerlitz@voltaire.com>, who also removed
the debug logic from the original test patch.

Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

--
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

Comments

Eric Dumazet July 23, 2009, 6:03 a.m. UTC | #1
Jay Vosburgh a écrit :
> 	Propogate the vlan_features of the slave devices to the bonding
> master device, using the same logic as for regular features.
> 
> 	Tested by Or Gerlitz <ogerlitz@voltaire.com>, who also removed
> the debug logic from the original test patch.
> 
> Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
> Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

Seems pretty cool, but I could not test it on my dev machine,
since tg3 and bnx2 drivers dont advertize yet vlan_features

> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 3bf0cc6..5a8b882 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1331,6 +1331,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;
>  	unsigned short max_hard_header_len = max((u16)ETH_HLEN,
>  						bond_dev->hard_header_len);
>  	int i;
> @@ -1343,10 +1344,14 @@ static int bond_compute_features(struct bonding *bond)
>  
>  	features &= ~NETIF_F_ONE_FOR_ALL;
>  
> +	vlan_features = bond->first_slave->dev->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);
>  		if (slave->dev->hard_header_len > max_hard_header_len)
>  			max_hard_header_len = slave->dev->hard_header_len;
>  	}
> @@ -1354,6 +1359,7 @@ 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);
>  	bond_dev->hard_header_len = max_hard_header_len;
>  
>  	return 0;

--
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
Or Gerlitz July 23, 2009, 7:24 a.m. UTC | #2
Eric Dumazet wrote:
> Jay Vosburgh a écrit :
>> Propogate the vlan_features of the slave devices to the bonding master device, using the same logic as for regular features.
> Seems pretty cool, but I could not test it on my dev machine, since tg3 and bnx2 drivers dont advertize yet vlan_features
The bnx2x maintainer posted yesterday a patch that does so, I assume a 
similar patch could work for at least one of tg3 or bnx2. I copied both 
maintainers on this email, in  the hope they can come up with a patch.

Or.

--
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
Patrick McHardy July 23, 2009, 11:03 a.m. UTC | #3
Jay Vosburgh wrote:
> 	Propogate the vlan_features of the slave devices to the bonding
> master device, using the same logic as for regular features.
> 
> 	Tested by Or Gerlitz <ogerlitz@voltaire.com>, who also removed
> the debug logic from the original test patch.
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 3bf0cc6..5a8b882 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1354,6 +1359,7 @@ 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);


You need to call netdev_features_change() to make sure the VLAN
code notices the change.
--
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_main.c b/drivers/net/bonding/bond_main.c
index 3bf0cc6..5a8b882 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1331,6 +1331,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;
 	unsigned short max_hard_header_len = max((u16)ETH_HLEN,
 						bond_dev->hard_header_len);
 	int i;
@@ -1343,10 +1344,14 @@  static int bond_compute_features(struct bonding *bond)
 
 	features &= ~NETIF_F_ONE_FOR_ALL;
 
+	vlan_features = bond->first_slave->dev->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);
 		if (slave->dev->hard_header_len > max_hard_header_len)
 			max_hard_header_len = slave->dev->hard_header_len;
 	}
@@ -1354,6 +1359,7 @@  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);
 	bond_dev->hard_header_len = max_hard_header_len;
 
 	return 0;