patch 'net/mlx5: zero UDP checksum over IPv4 in encapsulation' has been queued to stable release 21.11.6

Kevin Traynor ktraynor at redhat.com
Thu Nov 16 14:23:46 CET 2023


Hi,

FYI, your patch has been queued to stable release 21.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 11/21/23. 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/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/d4a1dc78a3bfee522eba22386c422f01d7ba4ee2

Thanks.

Kevin

---
>From d4a1dc78a3bfee522eba22386c422f01d7ba4ee2 Mon Sep 17 00:00:00 2001
From: Eli Britstein <elibr at nvidia.com>
Date: Mon, 13 Nov 2023 09:29:41 +0200
Subject: [PATCH] net/mlx5: zero UDP checksum over IPv4 in encapsulation

[ upstream commit e407221d58ffdfd9b7c80f8e4fff99f67cdbd6e9 ]

A zero UDP csum indicates it should not be validated by the receiver.
The HW may not calculate UDP csum after encap.

The cited commit made sure the UDP csum is zero for UDP over IPv6,
mistakenly not handling UDP over IPv4. Fix it.

Fixes: bf1d7d9a033a ("net/mlx5: zero out UDP checksum in encapsulation")

Signed-off-by: Eli Britstein <elibr at nvidia.com>
Acked-by: Suanming Mou <suanmingm at nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 1b6467e1b1..0c66c76ef5 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4254,4 +4254,5 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)
 	struct rte_ether_hdr *eth = NULL;
 	struct rte_vlan_hdr *vlan = NULL;
+	struct rte_ipv4_hdr *ipv4 = NULL;
 	struct rte_ipv6_hdr *ipv6 = NULL;
 	struct rte_udp_hdr *udp = NULL;
@@ -4270,10 +4271,6 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)
 	}
 
-	/* HW calculates IPv4 csum. no need to proceed */
-	if (proto == RTE_ETHER_TYPE_IPV4)
-		return 0;
-
 	/* non IPv4/IPv6 header. not supported */
-	if (proto != RTE_ETHER_TYPE_IPV6) {
+	if (proto != RTE_ETHER_TYPE_IPV4 && proto != RTE_ETHER_TYPE_IPV6) {
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ACTION,
@@ -4281,11 +4278,18 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)
 	}
 
-	ipv6 = (struct rte_ipv6_hdr *)next_hdr;
+	if (proto == RTE_ETHER_TYPE_IPV4) {
+		ipv4 = (struct rte_ipv4_hdr *)next_hdr;
+		/* ignore non UDP */
+		if (ipv4->next_proto_id != IPPROTO_UDP)
+			return 0;
+		udp = (struct rte_udp_hdr *)(ipv4 + 1);
+	} else {
+		ipv6 = (struct rte_ipv6_hdr *)next_hdr;
+		/* ignore non UDP */
+		if (ipv6->proto != IPPROTO_UDP)
+			return 0;
+		udp = (struct rte_udp_hdr *)(ipv6 + 1);
+	}
 
-	/* ignore non UDP */
-	if (ipv6->proto != IPPROTO_UDP)
-		return 0;
-
-	udp = (struct rte_udp_hdr *)(ipv6 + 1);
 	udp->dgram_cksum = 0;
 
-- 
2.41.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-11-16 13:21:54.078353833 +0000
+++ 0064-net-mlx5-zero-UDP-checksum-over-IPv4-in-encapsulatio.patch	2023-11-16 13:21:52.603946821 +0000
@@ -1 +1 @@
-From e407221d58ffdfd9b7c80f8e4fff99f67cdbd6e9 Mon Sep 17 00:00:00 2001
+From d4a1dc78a3bfee522eba22386c422f01d7ba4ee2 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit e407221d58ffdfd9b7c80f8e4fff99f67cdbd6e9 ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -22 +23 @@
-index 9753af2cb1..115d730317 100644
+index 1b6467e1b1..0c66c76ef5 100644
@@ -25 +26 @@
-@@ -4714,4 +4714,5 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)
+@@ -4254,4 +4254,5 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)
@@ -31 +32 @@
-@@ -4730,10 +4731,6 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)
+@@ -4270,10 +4271,6 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)
@@ -43 +44 @@
-@@ -4741,11 +4738,18 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)
+@@ -4281,11 +4278,18 @@ flow_dv_zero_encap_udp_csum(void *data, struct rte_flow_error *error)



More information about the stable mailing list