[dpdk-stable] patch 'net: fix unneeded replacement of TCP checksum 0' has been queued to LTS release 18.11.10

Kevin Traynor ktraynor at redhat.com
Thu Aug 20 17:33:24 CEST 2020


Hi,

FYI, your patch has been queued to LTS release 18.11.10

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/25/20. 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-queue

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

Thanks.

Kevin.

---
>From 0c4ca42257f40b58bac2e35fbdbc62771eca8cef Mon Sep 17 00:00:00 2001
From: Hongzhi Guo <guohongzhi1 at huawei.com>
Date: Fri, 10 Jul 2020 14:55:51 +0800
Subject: [PATCH] net: fix unneeded replacement of TCP checksum 0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit d5df2ae0428a147b80bbb65d623f88f75d28b226 ]

Per RFC768:
If the computed checksum is zero, it is transmitted as all ones.
An all zero transmitted checksum value means that the transmitter
generated no checksum.

RFC793 for TCP has no such special treatment for the checksum of zero.

Fixes: 6006818cfb26 ("net: new checksum functions")

Signed-off-by: Hongzhi Guo <guohongzhi1 at huawei.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
---
 lib/librte_net/rte_ip.h | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 2c78ba6cf6..728a045b9d 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -317,6 +317,5 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
  *   The pointer to the beginning of the L4 header.
  * @return
- *   The complemented checksum to set in the IP packet
- *   or 0 on error
+ *   The complemented checksum to set in the IP packet.
  */
 static inline uint16_t
@@ -337,5 +336,10 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
 	cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
 	cksum = (~cksum) & 0xffff;
-	if (cksum == 0)
+	/*
+	 * Per RFC 768:If the computed checksum is zero for UDP,
+	 * it is transmitted as all ones
+	 * (the equivalent in one's complement arithmetic).
+	 */
+	if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP)
 		cksum = 0xffff;
 
@@ -426,5 +430,10 @@ rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr)
 	cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff);
 	cksum = (~cksum) & 0xffff;
-	if (cksum == 0)
+	/*
+	 * Per RFC 768: If the computed checksum is zero for UDP,
+	 * it is transmitted as all ones
+	 * (the equivalent in one's complement arithmetic).
+	 */
+	if (cksum == 0 && ipv6_hdr->proto == IPPROTO_UDP)
 		cksum = 0xffff;
 
-- 
2.26.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-08-20 16:26:16.560303769 +0100
+++ 0019-net-fix-unneeded-replacement-of-TCP-checksum-0.patch	2020-08-20 16:26:15.805324152 +0100
@@ -1 +1 @@
-From d5df2ae0428a147b80bbb65d623f88f75d28b226 Mon Sep 17 00:00:00 2001
+From 0c4ca42257f40b58bac2e35fbdbc62771eca8cef Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit d5df2ae0428a147b80bbb65d623f88f75d28b226 ]
+
@@ -17 +18,0 @@
-Cc: stable at dpdk.org
@@ -27 +28 @@
-index 292f63fd74..a9ffc33571 100644
+index 2c78ba6cf6..728a045b9d 100644
@@ -30 +31 @@
-@@ -325,6 +325,5 @@ rte_ipv4_phdr_cksum(const struct rte_ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
+@@ -317,6 +317,5 @@ rte_ipv4_phdr_cksum(const struct ipv4_hdr *ipv4_hdr, uint64_t ol_flags)
@@ -38 +39 @@
-@@ -345,5 +344,10 @@ rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr)
+@@ -337,5 +336,10 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr)
@@ -50 +51 @@
-@@ -439,5 +443,10 @@ rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr)
+@@ -426,5 +430,10 @@ rte_ipv6_udptcp_cksum(const struct ipv6_hdr *ipv6_hdr, const void *l4_hdr)



More information about the stable mailing list