DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix vectorized Rx burst error handling
@ 2019-09-22  7:47 Dekel Peled
  2019-09-22  7:53 ` Matan Azrad
  2019-09-29  8:45 ` Raslan Darawsheh
  0 siblings, 2 replies; 3+ messages in thread
From: Dekel Peled @ 2019-09-22  7:47 UTC (permalink / raw)
  To: matan, viacheslavo, shahafs; +Cc: orika, dev, stable

In the process of recovery from error CQE, when using vectorized Rx
burst, the initialization of data length in mbufs was not done.
As a result the wrong length was left written in mbuf, causing
memory overwrite or wrong error report.

This patch fixes the initialization of mbuf data length during
recovery from error CQE, when using vectorized Rx burst,

Fixes: 88c0733535d6 ("net/mlx5: extend Rx completion with error handling")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/mlx5_rxtx.c | 19 +++++++++++++++----
 drivers/net/mlx5/mlx5_rxtx.h |  3 +--
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index f540977..10d0ca1 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -940,14 +940,15 @@ enum mlx5_txcmp_code {
  *
  * @param[in] rxq
  *   Pointer to RX queue structure.
- * @param[in] mbuf_prepare
- *   Whether to prepare mbufs for the RQ.
+ * @param[in] vec
+ *   1 when called from vectorized Rx burst, need to prepare mbufs for the RQ.
+ *   0 when called from non-vectorized Rx burst.
  *
  * @return
  *   -1 in case of recovery error, otherwise the CQE status.
  */
 int
-mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t mbuf_prepare)
+mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec)
 {
 	const uint16_t cqe_n = 1 << rxq->cqe_n;
 	const uint16_t cqe_mask = cqe_n - 1;
@@ -1014,7 +1015,7 @@ enum mlx5_txcmp_code {
 			if (mlx5_queue_state_modify(ETH_DEV(rxq_ctrl->priv),
 						    &sm))
 				return -1;
-			if (mbuf_prepare) {
+			if (vec) {
 				const uint16_t q_mask = wqe_n - 1;
 				uint16_t elt_idx;
 				struct rte_mbuf **elt;
@@ -1038,6 +1039,16 @@ enum mlx5_txcmp_code {
 						return -1;
 					}
 				}
+				for (i = 0; i < (int)wqe_n; ++i) {
+					elt = &(*rxq->elts)[i];
+					DATA_LEN(*elt) =
+						(uint16_t)((*elt)->buf_len -
+						rte_pktmbuf_headroom(*elt));
+				}
+				/* Padding with a fake mbuf for vec Rx. */
+				for (i = 0; i < MLX5_VPMD_DESCS_PER_LOOP; ++i)
+					(*rxq->elts)[wqe_n + i] =
+								&rxq->fake_mbuf;
 			}
 			mlx5_rxq_initialize(rxq);
 			rxq->err_state = MLX5_RXQ_ERR_STATE_NO_ERROR;
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 4f73d91..4bb28a4 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -406,8 +406,7 @@ struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx,
 				 volatile struct mlx5_err_cqe *err_cqe);
 uint16_t mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n);
 void mlx5_rxq_initialize(struct mlx5_rxq_data *rxq);
-__rte_noinline int mlx5_rx_err_handle(struct mlx5_rxq_data *rxq,
-				      uint8_t mbuf_prepare);
+__rte_noinline int mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec);
 void mlx5_mprq_buf_free_cb(void *addr, void *opaque);
 void mlx5_mprq_buf_free(struct mlx5_mprq_buf *buf);
 uint16_t mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts,
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix vectorized Rx burst error handling
  2019-09-22  7:47 [dpdk-dev] [PATCH] net/mlx5: fix vectorized Rx burst error handling Dekel Peled
@ 2019-09-22  7:53 ` Matan Azrad
  2019-09-29  8:45 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Matan Azrad @ 2019-09-22  7:53 UTC (permalink / raw)
  To: Dekel Peled, Slava Ovsiienko, Shahaf Shuler; +Cc: Ori Kam, dev, stable



From: Dekel Peled
> In the process of recovery from error CQE, when using vectorized Rx burst,
> the initialization of data length in mbufs was not done.
> As a result the wrong length was left written in mbuf, causing memory
> overwrite or wrong error report.
> 
> This patch fixes the initialization of mbuf data length during recovery from
> error CQE, when using vectorized Rx burst,
> 
> Fixes: 88c0733535d6 ("net/mlx5: extend Rx completion with error handling")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix vectorized Rx burst error handling
  2019-09-22  7:47 [dpdk-dev] [PATCH] net/mlx5: fix vectorized Rx burst error handling Dekel Peled
  2019-09-22  7:53 ` Matan Azrad
@ 2019-09-29  8:45 ` Raslan Darawsheh
  1 sibling, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2019-09-29  8:45 UTC (permalink / raw)
  To: Dekel Peled, Matan Azrad, Slava Ovsiienko, Shahaf Shuler
  Cc: Ori Kam, dev, stable

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Dekel Peled
> Sent: Sunday, September 22, 2019 10:47 AM
> To: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Shahaf Shuler <shahafs@mellanox.com>
> Cc: Ori Kam <orika@mellanox.com>; dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix vectorized Rx burst error handling
> 
> In the process of recovery from error CQE, when using vectorized Rx
> burst, the initialization of data length in mbufs was not done.
> As a result the wrong length was left written in mbuf, causing
> memory overwrite or wrong error report.
> 
> This patch fixes the initialization of mbuf data length during
> recovery from error CQE, when using vectorized Rx burst,
> 
> Fixes: 88c0733535d6 ("net/mlx5: extend Rx completion with error handling")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.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:[~2019-09-29  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-22  7:47 [dpdk-dev] [PATCH] net/mlx5: fix vectorized Rx burst error handling Dekel Peled
2019-09-22  7:53 ` Matan Azrad
2019-09-29  8:45 ` 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).