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 0656D41D4F for ; Thu, 23 Feb 2023 10:39:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0292C43164; Thu, 23 Feb 2023 10:39:17 +0100 (CET) Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by mails.dpdk.org (Postfix) with ESMTP id ACDE143150 for ; Thu, 23 Feb 2023 10:39:14 +0100 (CET) Received: by mail-wr1-f49.google.com with SMTP id l25so9737311wrb.3 for ; Thu, 23 Feb 2023 01:39:14 -0800 (PST) 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=WmocApThRjfuKd/nS6zh7Zr42n4HKea6oo/sK6mcUnE=; b=fN0YmRuVHKj7cFLs9CXRFPRKIHmCoIxxOneb/KoLT2g+BKnGnRimDDZBv6UX2ig084 qfw46LKMjVnwq8xJt7FBAhiRkruq48rsUJfEvjXoRfFMKO9X8XnTdvyklkt2LHq4kH9+ j/RVC5F/C6O0ut1ZLWs+hDMwVDUsdUMKoKfU75Kg3GT9IfgNcsrAAAhXYH3qeG54wc9H GxifBfGdtLEXTPdzu8cNIiNoq2ZJkthKyTnzjCa+YFsLZu/Ik9HxZqzftt2cjO836T7F Gt9GoDIBeHPpbpwqdzsSt8n9+ETuQ8jCx3StJtIPCRb1AhSla6K3fnD+2zAbyZ+gWfhF eHGg== 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=WmocApThRjfuKd/nS6zh7Zr42n4HKea6oo/sK6mcUnE=; b=ZnAjtRB1/NIjRhHOFO3XNdEn2gamSAC+A7oFSBmUaED3fKm97QAk7ThClpMraBkH98 9IDNxbDUgydWkR0FUXHuknHwiN8sHswmeLrZLOeTn+WliLE84uNKbs3JbTsze+ltPUvX r6WtgoK3m+arV4p9G0nr+2JXaJkHWljIwTwhTl9NUNzn90f3YDlmjgYg4JGeCa0eNP5d xks7R9Xwy57AnDV1IP9w53ZEMiwIsM+d5o66K6Lm7UnJp5tAjF06s91nknjSueTGppzN i1A0Eva542tNAijt/G9P7rNwgows0AxEVgbNDCvscxdMYPGIdYVrGUOls4wcbYETz00R yseQ== X-Gm-Message-State: AO0yUKVfzicwRlaOE+5jJkFMrff7WJiooXXFV4j0jzTWDmjmgRwhm5wu gYRI/c0oT4emBn6+w+/XIBiHSB+prf4zUg== X-Google-Smtp-Source: AK7set8cxZ3GPfRifJcpwbqqebLETyDB/uP1Gijl05fRTtAl00bKmADKHAwP7J6ToPLEm0N/lNdbVA== X-Received: by 2002:a5d:53c7:0:b0:2c5:99df:f12 with SMTP id a7-20020a5d53c7000000b002c599df0f12mr10833972wrw.30.1677145154414; Thu, 23 Feb 2023 01:39:14 -0800 (PST) Received: from localhost ([137.220.119.58]) by smtp.gmail.com with ESMTPSA id z14-20020a5d654e000000b002c5801aa9b0sm10056661wrv.40.2023.02.23.01.39.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 01:39:14 -0800 (PST) From: luca.boccassi@gmail.com To: Jiawen Wu Cc: dpdk stable Subject: patch 'net/txgbe: fix packet type to parse from offload flags' has been queued to stable release 20.11.8 Date: Thu, 23 Feb 2023 09:36:41 +0000 Message-Id: <20230223093715.3926893-37-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230223093715.3926893-1-luca.boccassi@gmail.com> References: <20230223093715.3926893-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.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/25/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/1c060c633e390268f4508ea6962c65e294325dfe Thanks. Luca Boccassi --- >From 1c060c633e390268f4508ea6962c65e294325dfe Mon Sep 17 00:00:00 2001 From: Jiawen Wu Date: Thu, 2 Feb 2023 17:21:26 +0800 Subject: [PATCH] net/txgbe: fix packet type to parse from offload flags [ upstream commit 0e32d6edd47914d38857c34d97416b9c91929020 ] Context descriptors which contains the length of each packet layer and the packet type are needed when Tx checksum offload or TSO is on. If the packet type and length do not strictly match, it will cause Tx ring hang. In some external applications, developers may fill in wrong packet_type in rte_mbuf for Tx path. For example, they encap/decap the packets but did not refill the packet_type. To prevent this, change it to parse from ol_flags. Fixes: ca46fcd753b1 ("net/txgbe: support Tx with hardware offload") Signed-off-by: Jiawen Wu --- drivers/net/txgbe/txgbe_rxtx.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c index 82dde509a0..1196b95367 100644 --- a/drivers/net/txgbe/txgbe_rxtx.c +++ b/drivers/net/txgbe/txgbe_rxtx.c @@ -495,20 +495,21 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) return cmdtype; } -static inline uint8_t -tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) +static inline uint32_t +tx_desc_ol_flags_to_ptype(uint64_t oflags) { + uint32_t ptype; bool tun; - if (ptype) - return txgbe_encode_ptype(ptype); - /* Only support flags in TXGBE_TX_OFFLOAD_MASK */ tun = !!(oflags & PKT_TX_TUNNEL_MASK); /* L2 level */ ptype = RTE_PTYPE_L2_ETHER; if (oflags & PKT_TX_VLAN) + ptype |= (tun ? RTE_PTYPE_INNER_L2_ETHER_VLAN : RTE_PTYPE_L2_ETHER_VLAN); + + if (oflags & PKT_TX_QINQ) /* tunnel + QINQ is not supported */ ptype |= RTE_PTYPE_L2_ETHER_VLAN; /* L3 level */ @@ -572,6 +573,16 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) break; } + return ptype; +} + +static inline uint8_t +tx_desc_ol_flags_to_ptid(uint64_t oflags) +{ + uint32_t ptype; + + ptype = tx_desc_ol_flags_to_ptype(oflags); + return txgbe_encode_ptype(ptype); } @@ -731,8 +742,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, /* If hardware offload required */ tx_ol_req = ol_flags & TXGBE_TX_OFFLOAD_MASK; if (tx_ol_req) { - tx_offload.ptid = tx_desc_ol_flags_to_ptid(tx_ol_req, - tx_pkt->packet_type); + tx_offload.ptid = tx_desc_ol_flags_to_ptid(tx_ol_req); tx_offload.l2_len = tx_pkt->l2_len; tx_offload.l3_len = tx_pkt->l3_len; tx_offload.l4_len = tx_pkt->l4_len; -- 2.39.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-23 09:36:29.720632695 +0000 +++ 0037-net-txgbe-fix-packet-type-to-parse-from-offload-flag.patch 2023-02-23 09:36:28.246170308 +0000 @@ -1 +1 @@ -From 0e32d6edd47914d38857c34d97416b9c91929020 Mon Sep 17 00:00:00 2001 +From 1c060c633e390268f4508ea6962c65e294325dfe Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0e32d6edd47914d38857c34d97416b9c91929020 ] + @@ -16 +17,0 @@ -Cc: stable@dpdk.org @@ -24 +25 @@ -index ac1bba08a3..021f281fbb 100644 +index 82dde509a0..1196b95367 100644 @@ -27 +28 @@ -@@ -516,20 +516,21 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) +@@ -495,20 +495,21 @@ tx_desc_ol_flags_to_cmdtype(uint64_t ol_flags) @@ -43 +44 @@ - tun = !!(oflags & RTE_MBUF_F_TX_TUNNEL_MASK); + tun = !!(oflags & PKT_TX_TUNNEL_MASK); @@ -47 +48 @@ - if (oflags & RTE_MBUF_F_TX_VLAN) + if (oflags & PKT_TX_VLAN) @@ -50 +51 @@ -+ if (oflags & RTE_MBUF_F_TX_QINQ) /* tunnel + QINQ is not supported */ ++ if (oflags & PKT_TX_QINQ) /* tunnel + QINQ is not supported */ @@ -54 +55 @@ -@@ -587,6 +588,16 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) +@@ -572,6 +573,16 @@ tx_desc_ol_flags_to_ptid(uint64_t oflags, uint32_t ptype) @@ -71 +72 @@ -@@ -776,8 +787,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, +@@ -731,8 +742,7 @@ txgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, @@ -78,2 +78,0 @@ - if (tx_offload.ptid & TXGBE_PTID_PKT_TUN) - tx_offload.ptid |= txgbe_parse_tun_ptid(tx_pkt); @@ -80,0 +80,2 @@ + tx_offload.l3_len = tx_pkt->l3_len; + tx_offload.l4_len = tx_pkt->l4_len;