patch 'net/txgbe: fix packet type to parse from offload flags' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Mon Feb 27 08:00:00 CET 2023


Hi,

FYI, your patch has been queued to stable release 22.11.2

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/01/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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=c96c4e1b9e4058e655db4b3d5849ffbcfe6f249a

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From c96c4e1b9e4058e655db4b3d5849ffbcfe6f249a Mon Sep 17 00:00:00 2001
From: Jiawen Wu <jiawenwu at trustnetic.com>
Date: Thu, 2 Feb 2023 17:21:26 +0800
Subject: [PATCH] net/txgbe: fix packet type to parse from offload flags
Cc: Xueming Li <xuemingl at nvidia.com>

[ 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 <jiawenwu at trustnetic.com>
---
 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 ac1bba08a3..021f281fbb 100644
--- a/drivers/net/txgbe/txgbe_rxtx.c
+++ b/drivers/net/txgbe/txgbe_rxtx.c
@@ -516,20 +516,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 & RTE_MBUF_F_TX_TUNNEL_MASK);

 	/* L2 level */
 	ptype = RTE_PTYPE_L2_ETHER;
 	if (oflags & RTE_MBUF_F_TX_VLAN)
+		ptype |= (tun ? RTE_PTYPE_INNER_L2_ETHER_VLAN : RTE_PTYPE_L2_ETHER_VLAN);
+
+	if (oflags & RTE_MBUF_F_TX_QINQ) /* tunnel + QINQ is not supported */
 		ptype |= RTE_PTYPE_L2_ETHER_VLAN;

 	/* L3 level */
@@ -587,6 +588,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);
 }

@@ -776,8 +787,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);
 			if (tx_offload.ptid & TXGBE_PTID_PKT_TUN)
 				tx_offload.ptid |= txgbe_parse_tun_ptid(tx_pkt);
 			tx_offload.l2_len = tx_pkt->l2_len;
--
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-02-27 14:08:43.865873500 +0800
+++ 0093-net-txgbe-fix-packet-type-to-parse-from-offload-flag.patch	2023-02-27 14:08:40.819237000 +0800
@@ -1 +1 @@
-From 0e32d6edd47914d38857c34d97416b9c91929020 Mon Sep 17 00:00:00 2001
+From c96c4e1b9e4058e655db4b3d5849ffbcfe6f249a Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 0e32d6edd47914d38857c34d97416b9c91929020 ]
@@ -16 +18,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list