tg3: Work around HW/FW limitations with vlan encapsulated frames
Subsystems (3)
PATCH 1/1 tg3: Work around HW/FW limitations with vlan encapsulated frames
TG3 appears to have an issue performing TSO and checksum offloading correclty when the frame has been vlan encapsulated (non-accelrated). In these cases, tcp checksum is not correctly updated.
This patch attempts to work around this issue. After the patch, 802.1ad vlans start working correctly over tg3 devices.
--- drivers/net/ethernet/broadcom/tg3.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +18 -2
@@ -7914,8 +7914,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) entry = tnapi->tx_prod; base_flags =0 ; -if (skb->ip_summed ==CHECKSUM_PARTIAL ) - base_flags |=TXD_FLAG_TCPUDP_CSUM ; mss =skb_shinfo (skb)->gso_size;if (mss) {
@@ -7929,6 +7927,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) hdr_len =skb_transport_offset (skb) +tcp_hdrlen (skb) -ETH_HLEN ; +/* HW/FW can not correctly segment packets that have been +* vlan encapsulated. +*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) +return tg3_tso_bug (tp, tnapi, txq, skb); +if (!skb_is_gso_v6 (skb)) {if (unlikely ((ETH_HLEN + hdr_len) >80 ) &&tg3_flag (tp,TSO_BUG ))
@@ -7979,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) base_flags |= tsflags <<12 ; } } + }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +/* HW/FW can not correctly checksum packets that have been +* vlan encapsulated. +*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) { +if (skb_checksum_help (skb)) + goto drop; + }else { + base_flags |=TXD_FLAG_TCPUDP_CSUM ; + } } if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&
Signature · 1 line
1.9.3
Quoted 3 lines · Vladislav Yasevich
TG3 appears to have an issue performing TSO and checksum offloading correclty when the frame has been vlan encapsulated (non-accelrated). In these cases, tcp checksum is not correctly updated.
Yes that is true for inline vlan headers, to clarify was TSO and checksum offload working for accelerated 802.1ad packets ?
Quoted 24 lines
This patch attempts to work around this issue. After the patch, 802.1ad vlans start working correctly over tg3 devices.
CC Prashant Sreedharan <[email protected]>CC Michael Chan <[email protected]>Signed-off-by Vladislav Yasevich <[email protected]>--- drivers/net/ethernet/broadcom/tg3.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)drivers/net/ethernet/broadcom/tg3.c +0
-2@@ -7914,8 +7914,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) entry = tnapi->tx_prod; base_flags =0 ; -if (skb->ip_summed ==CHECKSUM_PARTIAL ) - base_flags |=TXD_FLAG_TCPUDP_CSUM ; mss =skb_shinfo (skb)->gso_size;if (mss) {
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 7935
Quoted 9 lines
drivers/net/ethernet/broadcom/tg3.c +6
-0@@ -7929,6 +7927,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) hdr_len =skb_transport_offset (skb) +tcp_hdrlen (skb) -ETH_HLEN ; +/* HW/FW can not correctly segment packets that have been +* vlan encapsulated. +*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) +return tg3_tso_bug (tp, tnapi, txq, skb);
I think skb_gso_segment() would return skbs that would still have checksum offloaded to the chip.
Quoted 12 lines
drivers/net/ethernet/broadcom/tg3.c +5
-0+if (!skb_is_gso_v6 (skb)) {if (unlikely ((ETH_HLEN + hdr_len) >80 ) &&tg3_flag (tp,TSO_BUG ))@@ -7979,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) base_flags |= tsflags <<12 ; } } + }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +/* HW/FW can not correctly checksum packets that have been +* vlan encapsulated. +*/
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 8000
Quoted 10 lines
drivers/net/ethernet/broadcom/tg3.c +7
-0+if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) { +if (skb_checksum_help (skb)) + goto drop; + }else { + base_flags |=TXD_FLAG_TCPUDP_CSUM ; + } } if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&
Instead of the above workarounds since the chips supported by tg3 does not support checksum offload and TSO for inline vlan headers, these features can be disabled/cleared in dev->vlan_features. Side effect is accelerated vlan headers will also have TSO and checksum offload disabled.
Also as part of this review, found a problem with the receive section of the driver it was not checking for 802.1ad vlan protocol and dropping 802.1ad vlan packets of size > mtu + ETH_HLEN
(quoted diff) +0 -0
b/drivers/net/ethernet/broadcom/tg3.c
index cb77ae9..620887a 100644
drivers/net/ethernet/broadcom/tg3.c +0 -0
@@ -6918,7 +6918,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int
budget)
skb->protocol = eth_type_trans(skb, tp->dev);
if (len > (tp->dev->mtu + ETH_HLEN) &&
- skb->protocol != htons(ETH_P_8021Q)) {
+ skb->protocol != htons(ETH_P_8021Q) &&
+ skb->protocol != htons(ETH_P_8021AD)) {
dev_kfree_skb_any(skb);
goto drop_it_no_recycle;
}Quoted 7 lines · Prashant Sreedharan
Quoted 3 lines · Vladislav Yasevich
TG3 appears to have an issue performing TSO and checksum offloading correclty when the frame has been vlan encapsulated (non-accelrated). In these cases, tcp checksum is not correctly updated.
Yes that is true for inline vlan headers, to clarify was TSO and checksum offload working for accelerated 802.1ad packets ?
We don't accelerate 802.1ad if the driver doesn't claim offload support. If I had to guess, the TSO would probably work, but the packet would be encapsulated as 802.1Q by the FW/HW and connection would fail.
Quoted 28 lines
Quoted 28 lines
This patch attempts to work around this issue. After the patch, 802.1ad vlans start working correctly over tg3 devices.
CC Prashant Sreedharan <[email protected]>CC Michael Chan <[email protected]>Signed-off-by Vladislav Yasevich <[email protected]>--- drivers/net/ethernet/broadcom/tg3.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)drivers/net/ethernet/broadcom/tg3.c +0
-2@@ -7914,8 +7914,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) entry = tnapi->tx_prod; base_flags =0 ; -if (skb->ip_summed ==CHECKSUM_PARTIAL ) - base_flags |=TXD_FLAG_TCPUDP_CSUM ; mss =skb_shinfo (skb)->gso_size;if (mss) {@@ -7929,6 +7927,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) hdr_len =skb_transport_offset (skb) +tcp_hdrlen (skb) -ETH_HLEN ;
Quoted 9 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 7935
Quoted 6 lines
drivers/net/ethernet/broadcom/tg3.c +6
-0+/* HW/FW can not correctly segment packets that have been +* vlan encapsulated. +*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) +return tg3_tso_bug (tp, tnapi, txq, skb);I think
skb_gso_segment()would return skbs that would still have checksum offloaded to the chip.
Doesn't appear to. If I don't do this, then netperf throughput drops to 45.75 Mbps. If I put the above back in, the throughput goes to to 940Mbps.
Quoted 22 lines
Quoted 22 lines
drivers/net/ethernet/broadcom/tg3.c +12
-0+if (!skb_is_gso_v6 (skb)) {if (unlikely ((ETH_HLEN + hdr_len) >80 ) &&tg3_flag (tp,TSO_BUG ))@@ -7979,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) base_flags |= tsflags <<12 ; } } + }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +/* HW/FW can not correctly checksum packets that have been +* vlan encapsulated. +*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) { +if (skb_checksum_help (skb)) + goto drop; + }else { + base_flags |=TXD_FLAG_TCPUDP_CSUM ; + } }
Quoted 7 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 8000
Quoted 1 line
drivers/net/ethernet/broadcom/tg3.c +0
-0if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&Instead of the above workarounds since the chips supported by tg3 does not support checksum offload and TSO for inline vlan headers, these features can be disabled/cleared in
dev->vlan_features. Side effect is accelerated vlan headers will also have TSO and checksum offload disabled.
I didn't want to impact normal accelerated usage. The non-accelerated case is rather rare especially since tg3 driver doesn't allow you to turn off vlan acceleration. One has to put a software device between tg3 and vlan that allow you to turn off vlan acceleration (ex: bridge) and turn off acceleration on the bridge to get this to happen for 802.1Q vlans. People don't normally turn off vlan acceleration though as evidenced by this bug (and issues in other drivers) being around for a _very_ long time.
Quoted 4 lines
Also as part of this review, found a problem with the receive section of the driver it was not checking for 802.1ad vlan protocol and dropping 802.1ad vlan packets of size > mtu +
ETH_HLEN
Good catch. I should have run the TCP_MAERTS test. :)
I'll update the patch with the below hunk and resubmit if we can agree on using the tg3_tso_bug workaround.
-vlad
Quoted 19 lines
drivers/net/ethernet/broadcom/tg3.c +2
-1@@ -6918,7 +6918,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) skb->protocol = eth_type_trans(skb, tp->dev);if (len > (tp->dev->mtu +ETH_HLEN ) && - skb->protocol !=htons (ETH_P_8021Q )) { + skb->protocol !=htons (ETH_P_8021Q ) && + skb->protocol !=htons (ETH_P_8021AD )) {dev_kfree_skb_any (skb); goto drop_it_no_recycle;}
Quoted 6 lines · Vlad Yasevich
Quoted 5 lines · Prashant Sreedharan
Quoted 3 lines · Vladislav Yasevich
TG3 appears to have an issue performing TSO and checksum offloading correclty when the frame has been vlan encapsulated (non-accelrated). In these cases, tcp checksum is not correctly updated.
Quoted 7 lines
Quoted 2 lines
Yes that is true for inline vlan headers, to clarify was TSO and checksum offload working for accelerated 802.1ad packets ?
We don't accelerate 802.1ad if the driver doesn't claim offload support. If I had to guess, the TSO would probably work, but the packet would be encapsulated as 802.1Q by the FW/HW and connection would fail.
In your initial mail you mentioned when you strip the vlan header and set vlan_tci it worked for you. But as you guessed it will not, as the chip does not support 802.1AD. Thanks for clarifying.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
This patch attempts to work around this issue. After the patch, 802.1ad vlans start working correctly over tg3 devices.
CC Prashant Sreedharan <[email protected]>CC Michael Chan <[email protected]>Signed-off-by Vladislav Yasevich <[email protected]>--- drivers/net/ethernet/broadcom/tg3.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)drivers/net/ethernet/broadcom/tg3.c +0
-0@@ -7914,8 +7914,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
Quoted 4 lines
Quoted 4 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 7918
Quoted 4 lines
drivers/net/ethernet/broadcom/tg3.c +0
-2entry = tnapi->tx_prod; base_flags =0 ; -if (skb->ip_summed ==CHECKSUM_PARTIAL ) - base_flags |=TXD_FLAG_TCPUDP_CSUM ;
Check comment below
Quoted 17 lines
Quoted 7 lines
Quoted 7 lines
drivers/net/ethernet/broadcom/tg3.c +0
-0mss =skb_shinfo (skb)->gso_size;if (mss) {@@ -7929,6 +7927,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) hdr_len =skb_transport_offset (skb) +tcp_hdrlen (skb) -ETH_HLEN ;Quoted 9 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 7935
Quoted 6 lines
drivers/net/ethernet/broadcom/tg3.c +6
-0+/* HW/FW can not correctly segment packets that have been +* vlan encapsulated. +*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) +return tg3_tso_bug (tp, tnapi, txq, skb);I think
skb_gso_segment()would return skbs that would still have checksum offloaded to the chip.
Quoted 3 lines
Doesn't appear to. If I don't do this, then netperf throughput drops to 45.75 Mbps. If I put the above back in, the throughput goes to to 940Mbps.
Two things either the skb is having the "encap_hdr_csum" set forcing skb_segment() to do the checksum calculation OR the second workaround "skb_checksum_help" below will do the checksum for the list of skbs returned by skb_gso_segment().
Also you can move the above workaround further up after skb_cow_head() succeeds.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
drivers/net/ethernet/broadcom/tg3.c +4
-0+if (!skb_is_gso_v6 (skb)) {if (unlikely ((ETH_HLEN + hdr_len) >80 ) &&tg3_flag (tp,TSO_BUG ))@@ -7979,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) base_flags |= tsflags <<12 ; } } + }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +/* HW/FW can not correctly checksum packets that have been +* vlan encapsulated.
Quoted 8 lines
Quoted 8 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 7997
Quoted 8 lines
drivers/net/ethernet/broadcom/tg3.c +8
-0+*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) { +if (skb_checksum_help (skb)) + goto drop; + }else { + base_flags |=TXD_FLAG_TCPUDP_CSUM ; + }
tg3 supports various family of chips (around 20+ )I need to check if LSO offload is ok without setting TXD_FLAG_TCPUDP_CSUM for all of them and some of these chips are pretty old too, so instead you can clear the TXD_FLAG_TCPUDP_CSUM flag if skb_checksum_help() succeeds and leave the initial setting of base_flags as it is thus avoiding any regressions.
Quoted 10 lines
Quoted 9 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 8000
Quoted 3 lines
drivers/net/ethernet/broadcom/tg3.c +0
-0} if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&Instead of the above workarounds since the chips supported by tg3 does not support checksum offload and TSO for inline vlan headers, these features can be disabled/cleared in
dev->vlan_features. Side effect is accelerated vlan headers will also have TSO and checksum offload disabled.
Quoted 8 lines
I didn't want to impact normal accelerated usage. The non-accelerated case is rather rare especially since tg3 driver doesn't allow you to turn off vlan acceleration. One has to put a software device between tg3 and vlan that allow you to turn off vlan acceleration (ex: bridge) and turn off acceleration on the bridge to get this to happen for 802.1Q vlans. People don't normally turn off vlan acceleration though as evidenced by this bug (and issues in other drivers) being around for a _very_ long time.
Ok, since this is rare we can go with the workaround
Quoted 9 lines
Quoted 4 lines
Also as part of this review, found a problem with the receive section of the driver it was not checking for 802.1ad vlan protocol and dropping 802.1ad vlan packets of size > mtu +
ETH_HLENGood catch. I should have run the
TCP_MAERTStest. :)I'll update the patch with the below hunk and resubmit if we can agree on using the
tg3_tso_bugworkaround.
yes please include. thanks.
Quoted 23 lines
-vlad
Quoted 19 lines
drivers/net/ethernet/broadcom/tg3.c +2
-1@@ -6918,7 +6918,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) skb->protocol = eth_type_trans(skb, tp->dev);if (len > (tp->dev->mtu +ETH_HLEN ) && - skb->protocol !=htons (ETH_P_8021Q )) { + skb->protocol !=htons (ETH_P_8021Q ) && + skb->protocol !=htons (ETH_P_8021AD )) {dev_kfree_skb_any (skb); goto drop_it_no_recycle;}
Quoted 58 lines · Prashant Sreedharan
Quoted 6 lines · Vlad Yasevich
Quoted 5 lines · Prashant Sreedharan
Quoted 3 lines · Vladislav Yasevich
TG3 appears to have an issue performing TSO and checksum offloading correclty when the frame has been vlan encapsulated (non-accelrated). In these cases, tcp checksum is not correctly updated.
Quoted 7 lines
Quoted 2 lines
Yes that is true for inline vlan headers, to clarify was TSO and checksum offload working for accelerated 802.1ad packets ?
We don't accelerate 802.1ad if the driver doesn't claim offload support. If I had to guess, the TSO would probably work, but the packet would be encapsulated as 802.1Q by the FW/HW and connection would fail.
In your initial mail you mentioned when you strip the vlan header and set
vlan_tciit worked for you. But as you guessed it will not, as the chip does not support 802.1AD. Thanks for clarifying.Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
This patch attempts to work around this issue. After the patch, 802.1ad vlans start working correctly over tg3 devices.
CC Prashant Sreedharan <[email protected]>CC Michael Chan <[email protected]>Signed-off-by Vladislav Yasevich <[email protected]>--- drivers/net/ethernet/broadcom/tg3.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)drivers/net/ethernet/broadcom/tg3.c +0
-0@@ -7914,8 +7914,6 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)Quoted 4 lines
Quoted 4 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 7918
Quoted 4 lines
drivers/net/ethernet/broadcom/tg3.c +0
-2entry = tnapi->tx_prod; base_flags =0 ; -if (skb->ip_summed ==CHECKSUM_PARTIAL ) - base_flags |=TXD_FLAG_TCPUDP_CSUM ;Check comment below
Quoted 17 lines
Quoted 16 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 7935
Quoted 13 lines
drivers/net/ethernet/broadcom/tg3.c +6
-0mss =skb_shinfo (skb)->gso_size;if (mss) {@@ -7929,6 +7927,13 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) hdr_len =skb_transport_offset (skb) +tcp_hdrlen (skb) -ETH_HLEN ; +/* HW/FW can not correctly segment packets that have been +* vlan encapsulated. +*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) +return tg3_tso_bug (tp, tnapi, txq, skb);I think
skb_gso_segment()would return skbs that would still have checksum offloaded to the chip.
Quoted 8 lines
Quoted 3 lines
Doesn't appear to. If I don't do this, then netperf throughput drops to 45.75 Mbps. If I put the above back in, the throughput goes to to 940Mbps.
Two things either the skb is having the "
encap_hdr_csum" set forcingskb_segment()to do the checksum calculation OR the second workaround "skb_checksum_help" below will do the checksum for the list of skbs returned byskb_gso_segment().
I traced this an it looks like checksum_help will do the checksum for segments when tg3_start_xmit() is called for every skb on the segmented list.
Quoted 4 lines
Also you can move the above workaround further up after
skb_cow_head()succeeds.
Ok.
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
drivers/net/ethernet/broadcom/tg3.c +10
-0+if (!skb_is_gso_v6 (skb)) {if (unlikely ((ETH_HLEN + hdr_len) >80 ) &&tg3_flag (tp,TSO_BUG ))@@ -7979,6 +7984,17 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) base_flags |= tsflags <<12 ; } } + }else if (skb->ip_summed ==CHECKSUM_PARTIAL ) { +/* HW/FW can not correctly checksum packets that have been +* vlan encapsulated. +*/ +if (skb->protocol ==htons (ETH_P_8021Q ) || + skb->protocol ==htons (ETH_P_8021AD )) { +if (skb_checksum_help (skb)) + goto drop; + }else {
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 7997
Quoted 2 lines
drivers/net/ethernet/broadcom/tg3.c +2
-0+ base_flags |=TXD_FLAG_TCPUDP_CSUM ; + }tg3 supports various family of chips (around 20+ )I need to check if LSO offload is ok without setting
TXD_FLAG_TCPUDP_CSUMfor all of them and some of these chips are pretty old too, so instead you can clear theTXD_FLAG_TCPUDP_CSUMflag ifskb_checksum_help()succeeds and leave the initial setting ofbase_flagsas it is thus avoiding any regressions.
Hm, OK, will fix.
Thanks
-vlad
Quoted 57 lines
Quoted 11 lines
Quoted 10 lines
drivers/net/ethernet/broadcom/tg3.c static netdev_tx_t tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 8000
Quoted 4 lines
drivers/net/ethernet/broadcom/tg3.c +0
-0} if (tg3_flag(tp, USE_JUMBO_BDFLAG) &&Instead of the above workarounds since the chips supported by tg3 does not support checksum offload and TSO for inline vlan headers, these features can be disabled/cleared in
dev->vlan_features. Side effect is accelerated vlan headers will also have TSO and checksum offload disabled.Quoted 8 lines
I didn't want to impact normal accelerated usage. The non-accelerated case is rather rare especially since tg3 driver doesn't allow you to turn off vlan acceleration. One has to put a software device between tg3 and vlan that allow you to turn off vlan acceleration (ex: bridge) and turn off acceleration on the bridge to get this to happen for 802.1Q vlans. People don't normally turn off vlan acceleration though as evidenced by this bug (and issues in other drivers) being around for a _very_ long time.
Ok, since this is rare we can go with the workaround
Quoted 9 lines
Quoted 4 lines
Also as part of this review, found a problem with the receive section of the driver it was not checking for 802.1ad vlan protocol and dropping 802.1ad vlan packets of size > mtu +
ETH_HLENGood catch. I should have run the
TCP_MAERTStest. :)I'll update the patch with the below hunk and resubmit if we can agree on using the
tg3_tso_bugworkaround.yes please include. thanks.
Quoted 23 lines
-vlad
Quoted 19 lines
drivers/net/ethernet/broadcom/tg3.c +2
-1@@ -6918,7 +6918,8 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) skb->protocol = eth_type_trans(skb, tp->dev);if (len > (tp->dev->mtu +ETH_HLEN ) && - skb->protocol !=htons (ETH_P_8021Q )) { + skb->protocol !=htons (ETH_P_8021Q ) && + skb->protocol !=htons (ETH_P_8021AD )) {dev_kfree_skb_any (skb); goto drop_it_no_recycle;}
David Miller
maintainerFrom: Vladislav Yasevich <[email protected]>
Date: Thu, 18 Sep 2014 10:31:17 -0400
Quoted 10 lines
TG3 appears to have an issue performing TSO and checksum offloading correclty when the frame has been vlan encapsulated (non-accelrated). In these cases, tcp checksum is not correctly updated.
This patch attempts to work around this issue. After the patch, 802.1ad vlans start working correctly over tg3 devices.
CC Prashant Sreedharan <[email protected]>CC Michael Chan <[email protected]>Signed-off-by Vladislav Yasevich <[email protected]>
Applied and queued up for -stable.