Skip to contentSkip to conversation

i40e: Fix tunnel checksum offload with fragmented traffic

PATCH In review Mateusz Palczewski 2 participants 2 messages Jul 27, 2022 – Aug 1, 2022

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

PATCH 1/1 i40e: Fix tunnel checksum offload with fragmented traffic

From: Przemyslaw Patynowski <[email protected]>

Fix checksum offload on VXLAN tunnels.
In case, when mpls protocol is not used, set l4 header to transport header of skb. This fixes case, when user tries to offload checksums of VXLAN tunneled traffic.

Steps for reproduction (requires link partner with tunnels):
ip l s enp130s0f0 up
ip a f enp130s0f0
ip a a 10.10.110.2/24 dev enp130s0f0
ip l s enp130s0f0 mtu 1600
ip link add vxlan12_sut type vxlan id 12 group 238.168.100.100 dev \
enp130s0f0 dstport 4789
ip l s vxlan12_sut up
ip a a 20.10.110.2/24 dev vxlan12_sut
iperf3 -c 20.10.110.1 #should connect

Without this patch, TX descriptor was using wrong data, due to l4 header pointing wrong address. NIC would then drop those packets internally, due to incorrect TX descriptor data, which increased GLV_TEPC register.

Fixes b4fb2d33514a ("i40e: Add support for MPLS + TSO")
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +5 -3
index 7bc1174edf6b..af69ccc6e8d2 100644
@@ -3204,11 +3204,13 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
 
 	protocol = vlan_get_protocol(skb);
 
-	if (eth_p_mpls(protocol))
+	if (eth_p_mpls(protocol)) {
 		ip.hdr = skb_inner_network_header(skb);
-	else
+		l4.hdr = skb_checksum_start(skb);
+	} else {
 		ip.hdr = skb_network_header(skb);
-	l4.hdr = skb_checksum_start(skb);
+		l4.hdr = skb_transport_header(skb);
+	}
 
 	/* set the tx_flags to indicate the IP protocol type. this is
 	 * required so that checksum header computation below is accurate.
Signature · 6 lines
2.27.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v1 1/1
#1 lore raw

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Quoted 47 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Mateusz Palczewski
Sent: środa, 27 lipca 2022 11:20
To: [email protected]
Cc: Patynowski, PrzemyslawX <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v1] i40e: Fix tunnel checksum offload with fragmented traffic

From: Przemyslaw Patynowski <[email protected]>

Fix checksum offload on VXLAN tunnels.
In case, when mpls protocol is not used, set l4 header to transport header of skb. This fixes case, when user tries to offload checksums of VXLAN tunneled traffic.

Steps for reproduction (requires link partner with tunnels):
ip l s enp130s0f0 up
ip a f enp130s0f0
ip a a 10.10.110.2/24 dev enp130s0f0
ip l s enp130s0f0 mtu 1600
ip link add vxlan12_sut type vxlan id 12 group 238.168.100.100 dev \
enp130s0f0 dstport 4789
ip l s vxlan12_sut up
ip a a 20.10.110.2/24 dev vxlan12_sut
iperf3 -c 20.10.110.1 #should connect

Without this patch, TX descriptor was using wrong data, due to l4 header pointing wrong address. NIC would then drop those packets internally, due to incorrect TX descriptor data, which increased GLV_TEPC register.

Fixes b4fb2d33514a ("i40e: Add support for MPLS + TSO")
Signed-off-by Przemyslaw Patynowski

<[email protected]>

---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +0 -0
index 7bc1174edf6b..af69ccc6e8d2 100644

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan