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 E96D543C60 for ; Thu, 7 Mar 2024 02:34:46 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E24EB42EE4; Thu, 7 Mar 2024 02:34:46 +0100 (CET) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mails.dpdk.org (Postfix) with ESMTP id 9C4D642E64 for ; Thu, 7 Mar 2024 02:34:45 +0100 (CET) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-40fd72f7125so3434625e9.1 for ; Wed, 06 Mar 2024 17:34:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709775285; x=1710380085; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zXGYVly6K2sBaf3jl1D47jeVOOK1809yMHHOkP1HZsg=; b=eVKg5nhnE2fKIXFdGqwl1BzJa8+v4V3m7T1YKxhnatY/aHQHHV1XylUbnfb2fx4GNR L8Qk4KLfjTqPrfp8V89o1rWTKuAlWYuTKBsTEIlqGiluLCLzKhfPi/9np0wsj+3U1pS6 y7qhny9SSvMp1hRR00NM51QXdFBXSG58yrTPaJo03QeDgfJBFFurfFBdSjrLjT6ZxHmd oDxC4G66V+CBV16EfYRHtbYuwcGFtk8B4boQnIk//6RGK8oqxTX8ysQnT44phRoyF3Ax 3cvKr0oLDETbxGfNqHd31k81K65viimrK5rCYOeLoKux8pLSN41R9i9Ykc1dDRdXHY3y ERIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709775285; x=1710380085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zXGYVly6K2sBaf3jl1D47jeVOOK1809yMHHOkP1HZsg=; b=VMxctGs7dNAAWhUW+YdanB7EQ+D1/BlyNdvbXJ0mFgCz2KdeC3gxI04zf1L2WhXH1t c2FEF9swc6xgviDeCR3J1TJsv8s6CYVhqyiFmTojNJLY7pTfEoX0UKD5dyfpmWKt+dxE Ix/7NP0JwgHLS14sJxpFlvujRamHwUGLeQ7RbIl9TgzI0VbFEkrkS+ed7RniNnKn684A bbZf+V0SFOruztIkxypVsnLTgTN/Neip8hI/Fc3G0IkEPn7DFrRoA8D2WBMVQuSdvnlb HdE2+ZW/e+0OioNFhx6qwg15oiCaHMu5N04z5ydLY2XGqWAMxb1Og/JZP/wHlwyS6k+0 RJUw== X-Forwarded-Encrypted: i=1; AJvYcCV8PM1DI/FUkgLibCjagOj0eADLCa0K00KWFg2MD5Rc5LX+mmf8P4FsQugqNiqGUirBCiuhXRNmcOWuUxhytz4= X-Gm-Message-State: AOJu0YyWpkc6grSmgE8C74GLd3+Jx17rjVgZzufWWZgOKPSWs8x3SCu0 jid995ucfkIC03NaWy8WhOzpAxvt6NGPTmByI8Mn39n5UG2twizy X-Google-Smtp-Source: AGHT+IFmdvi2lMTibiGH7O4WOEWnkWZDSJCsql5ave7K2yvmEDNP4UW/W5Aprn0m5IJler2YrgYiJQ== X-Received: by 2002:a05:600c:4e49:b0:412:f751:3aba with SMTP id e9-20020a05600c4e4900b00412f7513abamr2366639wmq.37.1709775285009; Wed, 06 Mar 2024 17:34:45 -0800 (PST) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id q12-20020adf9dcc000000b0033e5c54d0d9sm1525751wre.38.2024.03.06.17.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 17:34:44 -0800 (PST) From: luca.boccassi@gmail.com To: Kaiwen Deng Cc: =?UTF-8?q?Morten=20Br=C3=B8rup?= , dpdk stable Subject: patch 'net: fix TCP/UDP checksum with padding data' has been queued to stable release 22.11.5 Date: Thu, 7 Mar 2024 01:31:01 +0000 Message-Id: <20240307013159.1735343-44-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240307013159.1735343-1-luca.boccassi@gmail.com> References: <20240307013159.1735343-1-luca.boccassi@gmail.com> MIME-Version: 1.0 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 22.11.5 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/09/24. 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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/3dab00d897a3d411f13ea6a2838259121a2501fd Thanks. Luca Boccassi --- >From 3dab00d897a3d411f13ea6a2838259121a2501fd Mon Sep 17 00:00:00 2001 From: Kaiwen Deng Date: Thu, 14 Dec 2023 17:22:59 +0800 Subject: [PATCH] net: fix TCP/UDP checksum with padding data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [ upstream commit e55ea3d5d970dfff2989e4a1c65b76d02512bce0 ] IEEE 802 packets may have a minimum size limit. The data fields should be padded when necessary. In some cases, the padding data is not zero. In 'rte_ipv4_udptcp_cksum_mbuf()', as payload length "mbuf->pkt_len - l4_off" is used, which includes padding and if padding is not zero it will end up producing wrong checksum. This patch will use IP header to get the payload size to calculate TCP/UDP checksum. Fixes: d178f693bbfe ("net: add UDP/TCP checksum in mbuf segments") Signed-off-by: Kaiwen Deng Reviewed-by: Morten Brørup --- lib/net/rte_ip.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h index 0cafb980ef..8da23660c6 100644 --- a/lib/net/rte_ip.h +++ b/lib/net/rte_ip.h @@ -420,11 +420,14 @@ __rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m, { uint16_t raw_cksum; uint32_t cksum; + uint16_t len; - if (l4_off > m->pkt_len) - return 0; + if (unlikely(l4_off > m->pkt_len)) + return 0; /* invalid params, return a dummy value */ - if (rte_raw_cksum_mbuf(m, l4_off, m->pkt_len - l4_off, &raw_cksum)) + len = rte_be_to_cpu_16(ipv4_hdr->total_length) - (uint16_t)rte_ipv4_hdr_len(ipv4_hdr); + + if (rte_raw_cksum_mbuf(m, l4_off, len, &raw_cksum)) return 0; cksum = raw_cksum + rte_ipv4_phdr_cksum(ipv4_hdr, 0); @@ -650,10 +653,10 @@ __rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m, uint16_t raw_cksum; uint32_t cksum; - if (l4_off > m->pkt_len) - return 0; + if (unlikely(l4_off > m->pkt_len)) + return 0; /* invalid params, return a dummy value */ - if (rte_raw_cksum_mbuf(m, l4_off, m->pkt_len - l4_off, &raw_cksum)) + if (rte_raw_cksum_mbuf(m, l4_off, rte_be_to_cpu_16(ipv6_hdr->payload_len), &raw_cksum)) return 0; cksum = raw_cksum + rte_ipv6_phdr_cksum(ipv6_hdr, 0); -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-07 01:05:38.713364961 +0000 +++ 0044-net-fix-TCP-UDP-checksum-with-padding-data.patch 2024-03-07 01:05:34.778939592 +0000 @@ -1 +1 @@ -From e55ea3d5d970dfff2989e4a1c65b76d02512bce0 Mon Sep 17 00:00:00 2001 +From 3dab00d897a3d411f13ea6a2838259121a2501fd Mon Sep 17 00:00:00 2001 @@ -8,0 +9,2 @@ +[ upstream commit e55ea3d5d970dfff2989e4a1c65b76d02512bce0 ] + @@ -21 +22,0 @@ -Cc: stable@dpdk.org @@ -30 +31 @@ -index 6fa98a5a0f..0d103d4127 100644 +index 0cafb980ef..8da23660c6 100644 @@ -33 +34 @@ -@@ -419,11 +419,14 @@ __rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m, +@@ -420,11 +420,14 @@ __rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m, @@ -51 +52 @@ -@@ -663,10 +666,10 @@ __rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m, +@@ -650,10 +653,10 @@ __rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m,