patch 'net/netvsc: fix calculation of checksums based on mbuf flag' has been queued to stable release 20.11.6

Xueming Li xuemingl at nvidia.com
Tue Jun 21 10:01:14 CEST 2022


Hi,

FYI, your patch has been queued to stable release 20.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/23/22. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/a61bd9df25dc6bb7d3d2d0e2b2a3fb1ee5266947

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From a61bd9df25dc6bb7d3d2d0e2b2a3fb1ee5266947 Mon Sep 17 00:00:00 2001
From: Long Li <longli at microsoft.com>
Date: Thu, 24 Mar 2022 10:46:08 -0700
Subject: [PATCH] net/netvsc: fix calculation of checksums based on mbuf flag
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 559a1f2eeaaddccc83e1668a8ee375c34699e48b ]

The netvsc should use RTE_MBUF_F_TX_L4_MASK and check the masked value
to decide the correct way to calculate checksums.

Not checking for RTE_MBUF_F_TX_L4_MASK results in incorrect RNDIS
packets sent to VSP and incorrect checksums calculated by the VSP.

Fixes: 4e9c73e96e ("net/netvsc: add Hyper-V network device")

Signed-off-by: Long Li <longli at microsoft.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit at xilinx.com>
---
 drivers/net/netvsc/hn_rxtx.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c
index 94ca3af20a..44a8eb4c0e 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1348,8 +1348,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
 			*pi_data = NDIS_LSO2_INFO_MAKEIPV4(hlen,
 							   m->tso_segsz);
 		}
-	} else if (m->ol_flags &
-		   (PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM)) {
+	} else if ((m->ol_flags & PKT_TX_L4_MASK) ==
+			PKT_TX_TCP_CKSUM ||
+		   (m->ol_flags & PKT_TX_L4_MASK) ==
+			PKT_TX_UDP_CKSUM ||
+		   (m->ol_flags & PKT_TX_IP_CKSUM)) {
 		pi_data = hn_rndis_pktinfo_append(pkt, NDIS_TXCSUM_INFO_SIZE,
 						  NDIS_PKTINFO_TYPE_CSUM);
 		*pi_data = 0;
@@ -1363,9 +1366,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
 				*pi_data |= NDIS_TXCSUM_INFO_IPCS;
 		}
 
-		if (m->ol_flags & PKT_TX_TCP_CKSUM)
+		if ((m->ol_flags & PKT_TX_L4_MASK) ==
+				PKT_TX_TCP_CKSUM)
 			*pi_data |= NDIS_TXCSUM_INFO_MKTCPCS(hlen);
-		else if (m->ol_flags & PKT_TX_UDP_CKSUM)
+		else if ((m->ol_flags & PKT_TX_L4_MASK) ==
+				PKT_TX_UDP_CKSUM)
 			*pi_data |= NDIS_TXCSUM_INFO_MKUDPCS(hlen);
 	}
 
-- 
2.35.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-21 15:37:49.656804844 +0800
+++ 0008-net-netvsc-fix-calculation-of-checksums-based-on-mbu.patch	2022-06-21 15:37:48.961117647 +0800
@@ -1 +1 @@
-From 559a1f2eeaaddccc83e1668a8ee375c34699e48b Mon Sep 17 00:00:00 2001
+From a61bd9df25dc6bb7d3d2d0e2b2a3fb1ee5266947 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 559a1f2eeaaddccc83e1668a8ee375c34699e48b ]
@@ -13 +15,0 @@
-Cc: stable at dpdk.org
@@ -23 +25 @@
-index 3e3488f1b8..1afc14f280 100644
+index 94ca3af20a..44a8eb4c0e 100644
@@ -26 +28 @@
-@@ -1346,8 +1346,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
+@@ -1348,8 +1348,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
@@ -31,6 +33,6 @@
--		   (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM)) {
-+	} else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
-+			RTE_MBUF_F_TX_TCP_CKSUM ||
-+		   (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
-+			RTE_MBUF_F_TX_UDP_CKSUM ||
-+		   (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM)) {
+-		   (PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM)) {
++	} else if ((m->ol_flags & PKT_TX_L4_MASK) ==
++			PKT_TX_TCP_CKSUM ||
++		   (m->ol_flags & PKT_TX_L4_MASK) ==
++			PKT_TX_UDP_CKSUM ||
++		   (m->ol_flags & PKT_TX_IP_CKSUM)) {
@@ -40 +42 @@
-@@ -1361,9 +1364,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
+@@ -1363,9 +1366,11 @@ static void hn_encap(struct rndis_packet_msg *pkt,
@@ -44,3 +46,3 @@
--		if (m->ol_flags & RTE_MBUF_F_TX_TCP_CKSUM)
-+		if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
-+				RTE_MBUF_F_TX_TCP_CKSUM)
+-		if (m->ol_flags & PKT_TX_TCP_CKSUM)
++		if ((m->ol_flags & PKT_TX_L4_MASK) ==
++				PKT_TX_TCP_CKSUM)
@@ -48,3 +50,3 @@
--		else if (m->ol_flags & RTE_MBUF_F_TX_UDP_CKSUM)
-+		else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) ==
-+				RTE_MBUF_F_TX_UDP_CKSUM)
+-		else if (m->ol_flags & PKT_TX_UDP_CKSUM)
++		else if ((m->ol_flags & PKT_TX_L4_MASK) ==
++				PKT_TX_UDP_CKSUM)


More information about the stable mailing list