[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A681F63.7060001@gmail.com>
Date: Thu, 23 Jul 2009 10:29:23 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Or Gerlitz <ogerlitz@...taire.com>
CC: Jay Vosburgh <fubar@...ibm.com>,
David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
Eilon Greenstein <eilong@...adcom.com>,
Michael Chan <mchan@...adcom.com>
Subject: [PATCH net-next-2.6] bnx2: Update vlan_features
Or Gerlitz a écrit :
> 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.
>
Here is the bnx2 patch I cooked to test this vlan_features propagation on bonding.
Everything fine so far !
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth1 (bnx2 driver)
MII Status: up
Link Failure Count: 2
Permanent HW addr: 00:1e:0b:ec:d3:d2
Slave Interface: eth2 (tg3 driver)
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:1e:0b:92:78:50
# ethtool -k bond0
Offload parameters for bond0:
Cannot get device rx csum settings: Operation not supported
rx-checksumming: off
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: off
generic-receive-offload: off
large-receive-offload: off
# ip link add link bond0 vlan.103 type vlan id 103
# ethtool -k vlan.103
Offload parameters for vlan.103:
rx-checksumming: off
tx-checksumming: on
scatter-gather: on
tcp-segmentation-offload: on
udp-fragmentation-offload: off
generic-segmentation-offload: on
generic-receive-offload: off
large-receive-offload: off
Thanks Or & Jay
[PATCH net-next-2.6] bnx2: Update vlan_features
In order to get full use of some advanced features of BNX2, we now need to
fill dev->vlan_features.
Patch successfully tested with vlan devices built on top of bonding.
(bond0 : one bnx2 slave, one tg3 slave (not yet vlan_features enabled)
Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
---
drivers/net/bnx2.c | 36 ++++++++++++++++++++++++++++++------
1 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index b70cc99..0868673 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3485,6 +3485,20 @@ static int bnx2_poll(struct napi_struct *napi, int budget)
return work_done;
}
+static void inline vlan_features_add(struct net_device *dev, unsigned long flags)
+{
+#ifdef BCM_VLAN
+ dev->vlan_features |= flags;
+#endif
+}
+
+static void inline vlan_features_del(struct net_device *dev, unsigned long flags)
+{
+#ifdef BCM_VLAN
+ dev->vlan_features &= ~flags;
+#endif
+}
+
/* Called with rtnl_lock from vlan functions and also netif_tx_lock
* from set_multicast.
*/
@@ -7068,11 +7082,17 @@ bnx2_set_tso(struct net_device *dev, u32 data)
if (data) {
dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
- if (CHIP_NUM(bp) == CHIP_NUM_5709)
+ vlan_features_add(dev, NETIF_F_TSO | NETIF_F_TSO_ECN);
+ if (CHIP_NUM(bp) == CHIP_NUM_5709) {
dev->features |= NETIF_F_TSO6;
- } else
+ vlan_features_add(dev, NETIF_F_TSO6);
+ }
+ } else {
dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_TSO_ECN);
+ vlan_features_del(dev, NETIF_F_TSO | NETIF_F_TSO6 |
+ NETIF_F_TSO_ECN);
+ }
return 0;
}
@@ -8064,16 +8084,20 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
memcpy(dev->perm_addr, bp->mac_addr, 6);
dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
- if (CHIP_NUM(bp) == CHIP_NUM_5709)
+ vlan_features_add(dev, NETIF_F_IP_CSUM | NETIF_F_SG);
+ if (CHIP_NUM(bp) == CHIP_NUM_5709) {
dev->features |= NETIF_F_IPV6_CSUM;
-
+ vlan_features_add(dev, NETIF_F_IPV6_CSUM);
+ }
#ifdef BCM_VLAN
dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
#endif
dev->features |= NETIF_F_TSO | NETIF_F_TSO_ECN;
- if (CHIP_NUM(bp) == CHIP_NUM_5709)
+ vlan_features_add(dev, NETIF_F_TSO | NETIF_F_TSO_ECN);
+ if (CHIP_NUM(bp) == CHIP_NUM_5709) {
dev->features |= NETIF_F_TSO6;
-
+ vlan_features_add(dev, NETIF_F_TSO6);
+ }
if ((rc = register_netdev(dev))) {
dev_err(&pdev->dev, "Cannot register net device\n");
goto error;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists