patch 'net/nfp: fix Tx packet drop for large data length' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Mon Feb 27 07:58:53 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=a87a84560cf4b5825c85dcdb7d8e1cad0931cce6

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From a87a84560cf4b5825c85dcdb7d8e1cad0931cce6 Mon Sep 17 00:00:00 2001
From: Long Wu <long.wu at corigine.com>
Date: Tue, 29 Nov 2022 09:21:22 +0800
Subject: [PATCH] net/nfp: fix Tx packet drop for large data length
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit b108863e40bacf20cdb461b50b88c4ec0bb5e143 ]

If dma_len is larger than NFDK_DESC_TX_DMA_LEN_HEAD, the value of
"dma_len & NFDK_DESC_TX_DMA_LEN_HEAD" maybe less than packet head length
and the packet will be dropped.

Fill maximum dma_len in first Tx descriptor to make sure the whole head
is included in the first descriptor.

In addition, add comments to better explain the code flow.

Fixes: c73dced48c8c ("net/nfp: add NFDk Tx")

Signed-off-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at corigine.com>
---
 drivers/net/nfp/nfp_rxtx.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 01cffdfde0..e2cdb9e27e 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -1063,6 +1063,7 @@ nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, struct rte_mbuf *pkt)
 	if (unlikely(n_descs > NFDK_TX_DESC_GATHER_MAX))
 		return -EINVAL;

+	/* Under count by 1 (don't count meta) for the round down to work out */
 	n_descs += !!(pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG);

 	if (round_down(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) !=
@@ -1219,8 +1220,19 @@ nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 		} else {
 			type = NFDK_DESC_TX_TYPE_GATHER;
 		}
+
+		/* Implicitly truncates to chunk in below logic */
 		dma_len -= 1;
-		dlen_type = (NFDK_DESC_TX_DMA_LEN_HEAD & dma_len) |
+
+		/*
+		 * We will do our best to pass as much data as we can in descriptor
+		 * and we need to make sure the first descriptor includes whole
+		 * head since there is limitation in firmware side. Sometimes the
+		 * value of 'dma_len & NFDK_DESC_TX_DMA_LEN_HEAD' will be less
+		 * than packet head len.
+		 */
+		dlen_type = (dma_len > NFDK_DESC_TX_DMA_LEN_HEAD ?
+				NFDK_DESC_TX_DMA_LEN_HEAD : dma_len) |
 			(NFDK_DESC_TX_TYPE_HEAD & (type << 12));
 		ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
 		dma_addr = rte_mbuf_data_iova(pkt);
@@ -1230,10 +1242,18 @@ nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 		ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
 		ktxds++;

+		/*
+		 * Preserve the original dlen_type, this way below the EOP logic
+		 * can use dlen_type.
+		 */
 		tmp_dlen = dlen_type & NFDK_DESC_TX_DMA_LEN_HEAD;
 		dma_len -= tmp_dlen;
 		dma_addr += tmp_dlen + 1;

+		/*
+		 * The rest of the data (if any) will be in larger DMA descriptors
+		 * and is handled with the dma_len loop.
+		 */
 		while (pkt) {
 			if (*lmbuf)
 				rte_pktmbuf_free_seg(*lmbuf);
--
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-02-27 14:08:41.782981000 +0800
+++ 0026-net-nfp-fix-Tx-packet-drop-for-large-data-length.patch	2023-02-27 14:08:40.739237000 +0800
@@ -1 +1 @@
-From b108863e40bacf20cdb461b50b88c4ec0bb5e143 Mon Sep 17 00:00:00 2001
+From a87a84560cf4b5825c85dcdb7d8e1cad0931cce6 Mon Sep 17 00:00:00 2001
@@ -7,0 +8,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit b108863e40bacf20cdb461b50b88c4ec0bb5e143 ]
@@ -19 +21,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list