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 025F1A00C2 for ; Thu, 3 Nov 2022 10:33:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8E9340694; Thu, 3 Nov 2022 10:33:30 +0100 (CET) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mails.dpdk.org (Postfix) with ESMTP id 0A04E40693 for ; Thu, 3 Nov 2022 10:33:30 +0100 (CET) Received: by mail-wm1-f43.google.com with SMTP id n39-20020a05600c3ba700b003cf71011cddso3320244wms.1 for ; Thu, 03 Nov 2022 02:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=cWE748wcKCmh9NgS27FIoHARdZ3XhFl5mK1cvAFP2Zg=; b=Dl9iNjn2WKpz9930PeA1b2OaUghCmJS7GG86MBAz4m8Z2fKOkvdSDySI+toNCINC9t YdbaG67SHZ8lSaMc3oOGEnLqddVGH8Qiqf396TJ2BO9nxjBZ1Jv062WZOmuIlqg+Xxg9 Qi7vuLPIoBvL5bg8tGnpx/9iE8fOAetM3eOAR09SLNa12AcQ3qt3oF+M9xQMBjs85WO2 MlMrI9hM+6bAfAbvmtstBB50mMkRYnyIjLMlssjCJp60E1umggcGAVPkNLgo/KxSyxeU wTfKAUHYSS9vzkR4PWtWWkUbA3M/eb4F+GvpNHaalBobxR0b7XSzoqMyzEES6ncOxUou /Ttg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=cWE748wcKCmh9NgS27FIoHARdZ3XhFl5mK1cvAFP2Zg=; b=qcUO/kx+UtcBo68JQoBMX+7DxxXsz9vAN3G5SzTY6CfMK7r6Sd+49WpOIl3fdkkgSK R8y0ue9jRZUSvRJ7erwGppYKy4cPpJVmeVede6KDDtg4lALXnzl+WhAAgAmL0XTYPnGT 9ZoDuC5zPIa+wR5nHraqGezrak0mBlAdeZf0yMmAdZ/BrAp4SM2dpGR1BH2JBUT+Qlpi Cz7pY0oP5OMoaPxW4tLpIqiJ8Ytp9sCZDVzVyOedsER7Bwt4r60mWLMq3Ydfv7yDqxiT b6V+VaGNoN+Y7phIgJIHoqOg7SwSlDmFHjFkgfCdELHMx1wvUGi+MPlqEj4pmAImizUV 17Zw== X-Gm-Message-State: ACrzQf0hvdzFfFr4QLzOFeyiutKyYPJMHFIMm7KKrHEMZ6e6sZBAbTPX XaXlBXZmKjgROWv2wrOHFuI9GWrWsH6LXzvF X-Google-Smtp-Source: AMsMyM5CoR0jzUujRzOVNJT+hAhy8wzfCPUWV5kCRTleTxSxVKUOyRgN26xFUtDAfhkuzM+8ze5nGQ== X-Received: by 2002:a05:600c:5d3:b0:3cf:6bbf:9ee3 with SMTP id p19-20020a05600c05d300b003cf6bbf9ee3mr14932751wmd.15.1667468009680; Thu, 03 Nov 2022 02:33:29 -0700 (PDT) Received: from localhost ([137.220.119.58]) by smtp.gmail.com with ESMTPSA id n10-20020a05600c4f8a00b003cf77e6091bsm5122629wmq.11.2022.11.03.02.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 02:33:29 -0700 (PDT) From: luca.boccassi@gmail.com To: Jun Qiu Cc: Jiayu Hu , dpdk stable Subject: patch 'gro: trim tail padding bytes' has been queued to stable release 20.11.7 Date: Thu, 3 Nov 2022 09:27:54 +0000 Message-Id: <20221103092758.1099402-96-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221103092758.1099402-1-luca.boccassi@gmail.com> References: <20221103092758.1099402-1-luca.boccassi@gmail.com> MIME-Version: 1.0 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 20.11.7 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/05/22. 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/7d752ff94e93f38e780bb53d7e6a44d423aeca6b Thanks. Luca Boccassi --- >From 7d752ff94e93f38e780bb53d7e6a44d423aeca6b Mon Sep 17 00:00:00 2001 From: Jun Qiu Date: Wed, 27 Jul 2022 08:00:36 +0000 Subject: [PATCH] gro: trim tail padding bytes [ upstream commit b8a55871d5af6f5b8694b1cb5eacbc629734e403 ] Exclude CRC fields, the minimum Ethernet packet length is 60 bytes. When the actual packet length is less than 60 bytes, padding is added to the tail. When GRO is performed on a packet containing a padding field, mbuf->pkt_len is the one that contains the padding field, which leads to the error of thinking of the padding field as the actual content of the packet. We need to trim away this extra padding field during GRO processing. Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4") Signed-off-by: Jun Qiu Acked-by: Jiayu Hu --- lib/librte_gro/gro_tcp4.c | 7 ++++++- lib/librte_gro/gro_udp4.c | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c index 5f3b3a82ce..9bde7162b1 100644 --- a/lib/librte_gro/gro_tcp4.c +++ b/lib/librte_gro/gro_tcp4.c @@ -199,7 +199,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, struct rte_tcp_hdr *tcp_hdr; uint32_t sent_seq; int32_t tcp_dl; - uint16_t ip_id, hdr_len, frag_off; + uint16_t ip_id, hdr_len, frag_off, ip_tlen; uint8_t is_atomic; struct tcp4_flow_key key; @@ -234,6 +234,11 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, if (tcp_dl <= 0) return -1; + /* trim the tail padding bytes */ + ip_tlen = rte_be_to_cpu_16(ipv4_hdr->total_length); + if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) + rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); + /* * Save IPv4 ID for the packet whose DF bit is 0. For the packet * whose DF bit is 1, IPv4 ID is ignored. diff --git a/lib/librte_gro/gro_udp4.c b/lib/librte_gro/gro_udp4.c index b8301296df..517e12b12b 100644 --- a/lib/librte_gro/gro_udp4.c +++ b/lib/librte_gro/gro_udp4.c @@ -232,6 +232,10 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, if (ip_dl <= pkt->l3_len) return -1; + /* trim the tail padding bytes */ + if (pkt->pkt_len > (uint32_t)(ip_dl + pkt->l2_len)) + rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_dl - pkt->l2_len); + ip_dl -= pkt->l3_len; ip_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); frag_offset = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-11-03 09:27:31.362453630 +0000 +++ 0096-gro-trim-tail-padding-bytes.patch 2022-11-03 09:27:25.565426157 +0000 @@ -1 +1 @@ -From b8a55871d5af6f5b8694b1cb5eacbc629734e403 Mon Sep 17 00:00:00 2001 +From 7d752ff94e93f38e780bb53d7e6a44d423aeca6b Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b8a55871d5af6f5b8694b1cb5eacbc629734e403 ] + @@ -17 +18,0 @@ -Cc: stable@dpdk.org @@ -22,2 +23,2 @@ - lib/gro/gro_tcp4.c | 7 ++++++- - lib/gro/gro_udp4.c | 4 ++++ + lib/librte_gro/gro_tcp4.c | 7 ++++++- + lib/librte_gro/gro_udp4.c | 4 ++++ @@ -26,5 +27,5 @@ -diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c -index 9758e28fd5..8f5e800250 100644 ---- a/lib/gro/gro_tcp4.c -+++ b/lib/gro/gro_tcp4.c -@@ -198,7 +198,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, +diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c +index 5f3b3a82ce..9bde7162b1 100644 +--- a/lib/librte_gro/gro_tcp4.c ++++ b/lib/librte_gro/gro_tcp4.c +@@ -199,7 +199,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, @@ -39 +40 @@ -@@ -233,6 +233,11 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, +@@ -234,6 +234,11 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, @@ -51,5 +52,5 @@ -diff --git a/lib/gro/gro_udp4.c b/lib/gro/gro_udp4.c -index dd71135ada..839f9748b7 100644 ---- a/lib/gro/gro_udp4.c -+++ b/lib/gro/gro_udp4.c -@@ -231,6 +231,10 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, +diff --git a/lib/librte_gro/gro_udp4.c b/lib/librte_gro/gro_udp4.c +index b8301296df..517e12b12b 100644 +--- a/lib/librte_gro/gro_udp4.c ++++ b/lib/librte_gro/gro_udp4.c +@@ -232,6 +232,10 @@ gro_udp4_reassemble(struct rte_mbuf *pkt,