[v2] net/mlx5: fix multi segment packet wraparound

Message ID 20211123135741.178491-1-dsosnowski@nvidia.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series [v2] net/mlx5: fix multi segment packet wraparound |

Checks

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

Commit Message

Dariusz Sosnowski Nov. 23, 2021, 1:57 p.m. UTC
  This patch fixes the assertion failure triggered when the user
configured minimum inline length requirements and the application
transmitted multi segment packets. Failure was triggered when space left
in TX queue was not enough to cover this requirement.

This patch limits the length of data to be copied to the available space
in TX queue.

Fixes: cacb44a09962 ("net/mlx5: add no-inline Tx flag")
Cc: viacheslavo@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_tx.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Comments

Raslan Darawsheh Nov. 23, 2021, 8:34 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: Dariusz Sosnowski <dsosnowski@nvidia.com>
> Sent: Tuesday, November 23, 2021 3:58 PM
> To: Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasland@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/mlx5: fix multi segment packet wraparound
> 
> This patch fixes the assertion failure triggered when the user
> configured minimum inline length requirements and the application
> transmitted multi segment packets. Failure was triggered when space left
> in TX queue was not enough to cover this requirement.
> 
> This patch limits the length of data to be copied to the available space
> in TX queue.
> 
> Fixes: cacb44a09962 ("net/mlx5: add no-inline Tx flag")
> Cc: viacheslavo@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h
index bc629983fa..099e72935a 100644
--- a/drivers/net/mlx5/mlx5_tx.h
+++ b/drivers/net/mlx5/mlx5_tx.h
@@ -1071,7 +1071,6 @@  mlx5_tx_mseg_memcpy(uint8_t *pdst,
 	uint8_t *psrc;
 
 	MLX5_ASSERT(len);
-	MLX5_ASSERT(must <= len);
 	do {
 		/* Allow zero length packets, must check first. */
 		dlen = rte_pktmbuf_data_len(loc->mbuf);
@@ -1098,9 +1097,11 @@  mlx5_tx_mseg_memcpy(uint8_t *pdst,
 				if (diff <= rte_pktmbuf_data_len(loc->mbuf)) {
 					/*
 					 * Copy only the minimal required
-					 * part of the data buffer.
+					 * part of the data buffer. Limit amount
+					 * of data to be copied to the length of
+					 * available space.
 					 */
-					len = diff;
+					len = RTE_MIN(len, diff);
 				}
 			}
 			continue;