patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix multi segment packet wraparound
@ 2021-11-19 18:11 Dariusz Sosnowski
  2021-11-23 13:57 ` [PATCH v2] " Dariusz Sosnowski
  0 siblings, 1 reply; 3+ messages in thread
From: Dariusz Sosnowski @ 2021-11-19 18:11 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev, stable

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>
---
 drivers/net/mlx5/mlx5_tx.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h
index bc629983fa..f3727351ca 100644
--- a/drivers/net/mlx5/mlx5_tx.h
+++ b/drivers/net/mlx5/mlx5_tx.h
@@ -1222,6 +1222,11 @@ mlx5_tx_eseg_mdat(struct mlx5_txq_data *__rte_restrict txq,
 		 */
 		copy = tso ? inlen : txq->inlen_mode;
 		copy = tlen >= copy ? 0 : (copy - tlen);
+		/*
+		 * Limit amount of data to be copied to the length of available
+		 * WQE ring buffer space or packet data left to be copied.
+		 */
+		copy = RTE_MIN(part, copy);
 		copy = mlx5_tx_mseg_memcpy(pdst, loc, part, copy, olx);
 		tlen += copy;
 		if (likely(inlen <= tlen) || copy < part) {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] net/mlx5: fix multi segment packet wraparound
  2021-11-19 18:11 [PATCH] net/mlx5: fix multi segment packet wraparound Dariusz Sosnowski
@ 2021-11-23 13:57 ` Dariusz Sosnowski
  2021-11-23 20:34   ` Raslan Darawsheh
  0 siblings, 1 reply; 3+ messages in thread
From: Dariusz Sosnowski @ 2021-11-23 13:57 UTC (permalink / raw)
  To: Matan Azrad, Viacheslav Ovsiienko; +Cc: dev, Raslan Darawsheh, stable

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(-)

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;
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] net/mlx5: fix multi segment packet wraparound
  2021-11-23 13:57 ` [PATCH v2] " Dariusz Sosnowski
@ 2021-11-23 20:34   ` Raslan Darawsheh
  0 siblings, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2021-11-23 20:34 UTC (permalink / raw)
  To: Dariusz Sosnowski, Matan Azrad, Slava Ovsiienko; +Cc: dev, stable

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-23 20:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 18:11 [PATCH] net/mlx5: fix multi segment packet wraparound Dariusz Sosnowski
2021-11-23 13:57 ` [PATCH v2] " Dariusz Sosnowski
2021-11-23 20:34   ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).