From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 46C1241E9F for ; Wed, 15 Mar 2023 15:37:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 43217427F5; Wed, 15 Mar 2023 15:37:02 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 90A8440A7A for ; Wed, 15 Mar 2023 15:37:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678891020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f/sdrXcY43S4FI0SYzh/EKKi3znZlW058nVdsdLxYfU=; b=dXZg4qFP95WoeDKYffvzf2scaB3HLBvJ/YaV+ZQhsdo2GYGNWAZuaay/FzSICOJIPLU1Oz 0OloeTem3MWwqN4DGJRgrAkIRvM2f3aDt8NhMBBTwjT8rH9Jzi2kFfXN+KS2+idy6MxK7i n+5PZu2ScZkqo6BYNXZC3whk5aR4j10= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-440-GcUKin6KMECPTySXO_WrGw-1; Wed, 15 Mar 2023 10:36:56 -0400 X-MC-Unique: GcUKin6KMECPTySXO_WrGw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 65F98884635; Wed, 15 Mar 2023 14:36:56 +0000 (UTC) Received: from rh.Home (unknown [10.39.192.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87C9440C6E69; Wed, 15 Mar 2023 14:36:55 +0000 (UTC) From: Kevin Traynor To: Boleslav Stankevich Cc: Andrew Rybchenko , Maxime Coquelin , dpdk stable Subject: patch 'net/virtio: deduce IP length for TSO checksum' has been queued to stable release 21.11.4 Date: Wed, 15 Mar 2023 14:36:02 +0000 Message-Id: <20230315143640.677317-9-ktraynor@redhat.com> In-Reply-To: <20230315143640.677317-1-ktraynor@redhat.com> References: <20230315143640.677317-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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 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 Reviewed-by: Andrew Rybchenko Reviewed-by: Maxime Coquelin --- 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@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 - Björn Töpel - Bo Chen -+Boleslav Stankevich - Boon Ang - Boris Pismenny @@ -32 +22 @@ -index 2d0afd3302..e48ff3cca7 100644 +index 4795893ec7..14a8224109 100644