net/nfp: fix length comparison for max DMA length

Message ID 20230203022328.15674-1-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/nfp: fix length comparison for max DMA length |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Chaoyong He Feb. 3, 2023, 2:23 a.m. UTC
  From: Richard Donkin <richard.donkin@corigine.com>

The DMA transfer length is allowed to be as large as
NFDK_TX_MAX_DATA_PER_HEAD. The existing check would not allow a simple-
type descriptor to be created for a packet of size
NFDK_TX_MAX_DATA_PER_HEAD, but it would also not enable gather-type
descriptors to be created correctly later.

Change the limit of simple-type descriptors to include packets of size
NFDK_TX_MAX_DATA_PER_HEAD.

In practice this fixes traffic with packets of size 4096. Previously
such packets would not be transmitted correctly.

Fixes: c73dced48c8c ("net/nfp: add NFDk Tx")
Cc: stable@dpdk.org

Signed-off-by: Richard Donkin <richard.donkin@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Feb. 11, 2023, 12:53 a.m. UTC | #1
On 2/3/2023 2:23 AM, Chaoyong He wrote:
> From: Richard Donkin <richard.donkin@corigine.com>
> 
> The DMA transfer length is allowed to be as large as
> NFDK_TX_MAX_DATA_PER_HEAD. The existing check would not allow a simple-
> type descriptor to be created for a packet of size
> NFDK_TX_MAX_DATA_PER_HEAD, but it would also not enable gather-type
> descriptors to be created correctly later.
> 
> Change the limit of simple-type descriptors to include packets of size
> NFDK_TX_MAX_DATA_PER_HEAD.
> 
> In practice this fixes traffic with packets of size 4096. Previously
> such packets would not be transmitted correctly.
> 
> Fixes: c73dced48c8c ("net/nfp: add NFDk Tx")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Richard Donkin <richard.donkin@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 01cffdfde0..fa4cc94a43 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -1214,7 +1214,7 @@  nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
 		if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
 				(pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
 			type = NFDK_DESC_TX_TYPE_TSO;
-		} else if (!pkt->next && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
+		} else if (!pkt->next && dma_len <= NFDK_TX_MAX_DATA_PER_HEAD) {
 			type = NFDK_DESC_TX_TYPE_SIMPLE;
 		} else {
 			type = NFDK_DESC_TX_TYPE_GATHER;