Skip to contentSkip to conversation

bnx2x: fix tunneling CSUM calculation

PATCH Applied Dmitry Kravkov 3 participants 3 messages Jul 11, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bnx2x: fix tunneling CSUM calculation

Since commit c957d09ffda417f6c8e3d1f10e2b05228607d6d7 "bnx2x: Remove sparse and coccinelle warnings" driver provided wrong partial csum for HW in tunneing scenarios.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +3 -3
index 3353efe..ee350bd 100644
@@ -3543,9 +3543,9 @@ static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb,
 	/* outer IP header info */
 	if (xmit_type & XMIT_CSUM_V4) {
 		struct iphdr *iph = ip_hdr(skb);
-		u16 csum = (__force u16)(~iph->check) -
-			   (__force u16)iph->tot_len -
-			   (__force u16)iph->frag_off;
+		u32 csum = (__force u32)(~iph->check) -
+			   (__force u32)iph->tot_len -
+			   (__force u32)iph->frag_off;
 
 		pbd2->fw_ip_csum_wo_len_flags_frag =
 			bswab16(csum_fold((__force __wsum)csum));
Signature · 1 line
1.8.1.4
Tested-by on v1 1/1
#1 lore raw
Quoted 22 lines · Dmitry Kravkov

Since commit c957d09ffda417f6c8e3d1f10e2b05228607d6d7 "bnx2x: Remove sparse and coccinelle warnings" driver provided wrong partial csum for HW in tunneing scenarios.

---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +0 -0
index 3353efe..ee350bd 100644
@@ -3543,9 +3543,9 @@ static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb,
 	/* outer IP header info */
 	if (xmit_type & XMIT_CSUM_V4) {

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c static void bnx2x_update_pbds_gso_enc(struct sk_buff *skb, · line 3551

Quoted 10 lines
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +3 -3
 		struct iphdr *iph = ip_hdr(skb);
-		u16 csum = (__force u16)(~iph->check) -
-			   (__force u16)iph->tot_len -
-			   (__force u16)iph->frag_off;
+		u32 csum = (__force u32)(~iph->check) -
+			   (__force u32)iph->tot_len -
+			   (__force u32)iph->frag_off;
 
 		pbd2->fw_ip_csum_wo_len_flags_frag =
 			bswab16(csum_fold((__force __wsum)csum));

Thanks guys !

lpq83:~# ethtool -K gre1 tso on 
lpq83:~# ./netperf -H 7.7.8.84
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 7.7.8.84 () port 0 AF_INET
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

87380 16384 16384 10.00 5723.17

lpq83:~# ethtool -K gre1 tso off
lpq83:~# ./netperf -H 7.7.8.84
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 7.7.8.84 () port 0 AF_INET
Recv   Send    Send                          
Socket Socket  Message  Elapsed              
Size   Size    Size     Time     Throughput  
bytes  bytes   bytes    secs.    10^6bits/sec  

87380 16384 16384 10.00 3813.60

maintainer Applied
#2 lore raw

From: Eric Dumazet <[email protected]>
Date: Thu, 11 Jul 2013 06:54:12 -0700

Quoted 11 lines · Dmitry Kravkov
Quoted 10 lines

Since commit c957d09ffda417f6c8e3d1f10e2b05228607d6d7 "bnx2x: Remove sparse and coccinelle warnings" driver provided wrong partial csum for HW in tunneing scenarios.

...

Quoted 1 line

Applied, thanks everyone.