patch 'net/virtio: deduce IP length for TSO checksum' has been queued to stable release 21.11.4

Kevin Traynor ktraynor at redhat.com
Wed Mar 15 15:36:02 CET 2023


Hi,

FYI, your patch has been queued to stable release 21.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 03/20/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/c41493361c87e730459ead9311c68528eb0874aa

Thanks.

Kevin

---
>From c41493361c87e730459ead9311c68528eb0874aa Mon Sep 17 00:00:00 2001
From: Boleslav Stankevich <boleslav.stankevich at oktetlabs.ru>
Date: Fri, 3 Mar 2023 14:19:29 +0300
Subject: [PATCH] net/virtio: deduce IP length for TSO checksum

[ upstream commit d069c80a5d8c0a05033932421851cdb7159de0df ]

The length of TSO payload could not fit into 16 bits provided by the
IPv4 total length and IPv6 payload length fields. Thus, deduce it
from the length of the packet.

Fixes: 696573046e9e ("net/virtio: support TSO")

Signed-off-by: Boleslav Stankevich <boleslav.stankevich at oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
 drivers/net/virtio/virtio_rxtx.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 4795893ec7..14a8224109 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -405,7 +405,7 @@ virtio_tso_fix_cksum(struct rte_mbuf *m)
 			m->l4_len)) {
 		struct rte_ipv4_hdr *iph;
-		struct rte_ipv6_hdr *ip6h;
 		struct rte_tcp_hdr *th;
-		uint16_t prev_cksum, new_cksum, ip_len, ip_paylen;
+		uint16_t prev_cksum, new_cksum;
+		uint32_t ip_paylen;
 		uint32_t tmp;
 
@@ -413,19 +413,26 @@ virtio_tso_fix_cksum(struct rte_mbuf *m)
 					struct rte_ipv4_hdr *, m->l2_len);
 		th = RTE_PTR_ADD(iph, m->l3_len);
+
+		/*
+		 * Calculate IPv4 header checksum with current total length value
+		 * (whatever it is) to have correct checksum after update on edits
+		 * done by TSO.
+		 */
 		if ((iph->version_ihl >> 4) == 4) {
 			iph->hdr_checksum = 0;
 			iph->hdr_checksum = rte_ipv4_cksum(iph);
-			ip_len = iph->total_length;
-			ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) -
-				m->l3_len);
-		} else {
-			ip6h = (struct rte_ipv6_hdr *)iph;
-			ip_paylen = ip6h->payload_len;
 		}
 
+		/*
+		 * Do not use IPv4 total length and IPv6 payload length fields to get
+		 * TSO payload length since it could not fit into 16 bits.
+		 */
+		ip_paylen = rte_cpu_to_be_32(rte_pktmbuf_pkt_len(m) - m->l2_len -
+					m->l3_len);
+
 		/* calculate the new phdr checksum not including ip_paylen */
 		prev_cksum = th->cksum;
 		tmp = prev_cksum;
-		tmp += ip_paylen;
+		tmp += (ip_paylen & 0xffff) + (ip_paylen >> 16);
 		tmp = (tmp & 0xffff) + (tmp >> 16);
 		new_cksum = tmp;
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-15 14:30:20.836954409 +0000
+++ 0009-net-virtio-deduce-IP-length-for-TSO-checksum.patch	2023-03-15 14:30:20.559123609 +0000
@@ -1 +1 @@
-From d069c80a5d8c0a05033932421851cdb7159de0df Mon Sep 17 00:00:00 2001
+From c41493361c87e730459ead9311c68528eb0874aa Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit d069c80a5d8c0a05033932421851cdb7159de0df ]
+
@@ -11 +12,0 @@
-Cc: stable at dpdk.org
@@ -17 +17,0 @@
- .mailmap                         |  1 +
@@ -19 +19 @@
- 2 files changed, 17 insertions(+), 9 deletions(-)
+ 1 file changed, 16 insertions(+), 9 deletions(-)
@@ -21,10 +20,0 @@
-diff --git a/.mailmap b/.mailmap
-index a9f4f28fba..8e7d78f37e 100644
---- a/.mailmap
-+++ b/.mailmap
-@@ -168,4 +168,5 @@ Bin Zheng <zhengbin.89740 at bytedance.com>
- Björn Töpel <bjorn.topel at intel.com>
- Bo Chen <box.c.chen at intel.com>
-+Boleslav Stankevich <boleslav.stankevich at oktetlabs.ru>
- Boon Ang <bang at vmware.com>
- Boris Pismenny <borisp at mellanox.com>
@@ -32 +22 @@
-index 2d0afd3302..e48ff3cca7 100644
+index 4795893ec7..14a8224109 100644



More information about the stable mailing list