[dpdk-stable] patch 'net: fix checksum offload for outer IPv4' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:28:52 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

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/12/21. 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/8cbd4cec761f50557d0a0b174e4b1bbd1de58fd9

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 8cbd4cec761f50557d0a0b174e4b1bbd1de58fd9 Mon Sep 17 00:00:00 2001
From: Mohsin Kazmi <mohsin.kazmi14 at gmail.com>
Date: Tue, 7 Sep 2021 12:49:16 +0200
Subject: [PATCH] net: fix checksum offload for outer IPv4
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 818ce1132ab69c5bb34ede0120776f71969dc091 ]

Preparation of the headers for the hardware offload
misses the outer IPv4 checksum offload.
It results in bad checksum computed by hardware NIC.

This patch fixes the issue by setting the outer IPv4
checksum field to 0.

Fixes: 4fb7e803eb1a ("ethdev: add Tx preparation")

Signed-off-by: Mohsin Kazmi <mohsin.kazmi14 at gmail.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
---
 lib/librte_net/rte_net.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
index 434435ffa2..42639bc154 100644
--- a/lib/librte_net/rte_net.h
+++ b/lib/librte_net/rte_net.h
@@ -125,11 +125,22 @@ rte_net_intel_cksum_flags_prepare(struct rte_mbuf *m, uint64_t ol_flags)
 	 * Mainly it is required to avoid fragmented headers check if
 	 * no offloads are requested.
 	 */
-	if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG)))
+	if (!(ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_L4_MASK | PKT_TX_TCP_SEG |
+			  PKT_TX_OUTER_IP_CKSUM)))
 		return 0;
 
-	if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6))
+	if (ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6)) {
 		inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
+		/*
+		 * prepare outer IPv4 header checksum by setting it to 0,
+		 * in order to be computed by hardware NICs.
+		 */
+		if (ol_flags & PKT_TX_OUTER_IP_CKSUM) {
+			ipv4_hdr = rte_pktmbuf_mtod_offset(m,
+					struct rte_ipv4_hdr *, m->outer_l2_len);
+			ipv4_hdr->hdr_checksum = 0;
+		}
+	}
 
 	/*
 	 * Check if headers are fragmented.
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:04.249069977 +0800
+++ 0048-net-fix-checksum-offload-for-outer-IPv4.patch	2021-11-10 14:17:01.804079970 +0800
@@ -1 +1 @@
-From 818ce1132ab69c5bb34ede0120776f71969dc091 Mon Sep 17 00:00:00 2001
+From 8cbd4cec761f50557d0a0b174e4b1bbd1de58fd9 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 818ce1132ab69c5bb34ede0120776f71969dc091 ]
@@ -14 +16,0 @@
-Cc: stable at dpdk.org
@@ -20 +22 @@
- lib/net/rte_net.h | 15 +++++++++++++--
+ lib/librte_net/rte_net.h | 15 +++++++++++++--
@@ -23 +25 @@
-diff --git a/lib/net/rte_net.h b/lib/net/rte_net.h
+diff --git a/lib/librte_net/rte_net.h b/lib/librte_net/rte_net.h
@@ -25,2 +27,2 @@
---- a/lib/net/rte_net.h
-+++ b/lib/net/rte_net.h
+--- a/lib/librte_net/rte_net.h
++++ b/lib/librte_net/rte_net.h


More information about the stable mailing list