patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 19.11] net/netvsc: fix calculation of checksums based on mbuf flag
@ 2022-07-14 21:16 longli
  2022-07-14 21:16 ` [PATCH 19.11] net/netvsc: fix vmbus device reference in multi-process longli
  2022-07-15  5:04 ` [PATCH 19.11] net/netvsc: fix calculation of checksums based on mbuf flag Christian Ehrhardt
  0 siblings, 2 replies; 4+ messages in thread
From: longli @ 2022-07-14 21:16 UTC (permalink / raw)
  To: stable; +Cc: christian.ehrhardt, Long Li

From: Long Li <longli@microsoft.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")
Cc: stable@dpdk.org

Signed-off-by: Long Li <longli@microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@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 af702dafe6..ece242f84b 100644
--- a/drivers/net/netvsc/hn_rxtx.c
+++ b/drivers/net/netvsc/hn_rxtx.c
@@ -1262,8 +1262,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;
@@ -1277,9 +1280,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.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-15  5:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 21:16 [PATCH 19.11] net/netvsc: fix calculation of checksums based on mbuf flag longli
2022-07-14 21:16 ` [PATCH 19.11] net/netvsc: fix vmbus device reference in multi-process longli
2022-07-15  5:04   ` Christian Ehrhardt
2022-07-15  5:04 ` [PATCH 19.11] net/netvsc: fix calculation of checksums based on mbuf flag Christian Ehrhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).