DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] net/mlx5: fix Memory Region registration
@ 2017-12-15  1:59 Yongseok Koh
  2017-12-15  1:59 ` [dpdk-dev] [PATCH 2/2] net/mlx5: fix overflow of Memory Region cache Yongseok Koh
  2017-12-21 15:26 ` [dpdk-dev] [dpdk-stable] [PATCH 1/2] net/mlx5: fix Memory Region registration Shahaf Shuler
  0 siblings, 2 replies; 3+ messages in thread
From: Yongseok Koh @ 2017-12-15  1:59 UTC (permalink / raw)
  To: adrien.mazarguil, nelio.laranjeiro; +Cc: dev, hhaim, Yongseok Koh, stable

Althought granularity of chunks in a mempool is a cacheline, addresses are
extended to align to page boundary for performance reason in device when
registering a MR (Memory Region). This could make some regions overlap,
then can cause Tx completion error due to incorrect LKEY search. If the
error occurs, the Tx queue will get stuck. To avoid it, end address of a
packet segment is used in LKEY search.

Fixes: b0b093845793 ("net/mlx5: use buffer address for LKEY search")
Cc: stable@dpdk.org

Reported-by: Hanoch Haim <hhaim@cisco.com>
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_rxtx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index b8c7925a3..b783ca203 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -543,7 +543,7 @@ static __rte_always_inline uint32_t
 mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 {
 	uint16_t i = txq->mr_cache_idx;
-	uintptr_t addr = rte_pktmbuf_mtod(mb, uintptr_t);
+	uintptr_t addr = rte_pktmbuf_mtod_offset(mb, uintptr_t, DATA_LEN(mb));
 	struct mlx5_mr *mr;
 
 	assert(i < RTE_DIM(txq->mp2mr));
-- 
2.11.0

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

* [dpdk-dev] [PATCH 2/2] net/mlx5: fix overflow of Memory Region cache
  2017-12-15  1:59 [dpdk-dev] [PATCH 1/2] net/mlx5: fix Memory Region registration Yongseok Koh
@ 2017-12-15  1:59 ` Yongseok Koh
  2017-12-21 15:26 ` [dpdk-dev] [dpdk-stable] [PATCH 1/2] net/mlx5: fix Memory Region registration Shahaf Shuler
  1 sibling, 0 replies; 3+ messages in thread
From: Yongseok Koh @ 2017-12-15  1:59 UTC (permalink / raw)
  To: adrien.mazarguil, nelio.laranjeiro; +Cc: dev, hhaim, Yongseok Koh, stable

If there're more MR(Memroy Region)'s than the size of per-queue cache, the
cache can be overflowed and corrupt the following data structure in
mlx5_txq_data.

Fixes: 6e78005a9b30 ("net/mlx5: add reference counter on DPDK Tx queues")
Cc: stable@dpdk.org

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_trigger.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index ed80a6bee..88f60a01d 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -64,8 +64,11 @@ priv_txq_start(struct priv *priv)
 
 		if (!txq_ctrl)
 			continue;
-		LIST_FOREACH(mr, &priv->mr, next)
+		LIST_FOREACH(mr, &priv->mr, next) {
 			priv_txq_mp2mr_reg(priv, &txq_ctrl->txq, mr->mp, idx++);
+			if (idx == MLX5_PMD_TX_MP_CACHE)
+				break;
+		}
 		txq_alloc_elts(txq_ctrl);
 		txq_ctrl->ibv = mlx5_priv_txq_ibv_new(priv, i);
 		if (!txq_ctrl->ibv) {
-- 
2.11.0

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

* Re: [dpdk-dev] [dpdk-stable] [PATCH 1/2] net/mlx5: fix Memory Region registration
  2017-12-15  1:59 [dpdk-dev] [PATCH 1/2] net/mlx5: fix Memory Region registration Yongseok Koh
  2017-12-15  1:59 ` [dpdk-dev] [PATCH 2/2] net/mlx5: fix overflow of Memory Region cache Yongseok Koh
@ 2017-12-21 15:26 ` Shahaf Shuler
  1 sibling, 0 replies; 3+ messages in thread
From: Shahaf Shuler @ 2017-12-21 15:26 UTC (permalink / raw)
  To: Yongseok Koh, Adrien Mazarguil, Nélio Laranjeiro
  Cc: dev, hhaim, Yongseok Koh, stable

Friday, December 15, 2017 3:59 AM, Yongseok Koh:
> Althought granularity of chunks in a mempool is a cacheline, addresses are
> extended to align to page boundary for performance reason in device when
> registering a MR (Memory Region). This could make some regions overlap,
> then can cause Tx completion error due to incorrect LKEY search. If the error
> occurs, the Tx queue will get stuck. To avoid it, end address of a packet
> segment is used in LKEY search.
> 
> Fixes: b0b093845793 ("net/mlx5: use buffer address for LKEY search")
> Cc: stable@dpdk.org
> 
> Reported-by: Hanoch Haim <hhaim@cisco.com>
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Series applied to next-net-mlx, thanks.

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

end of thread, other threads:[~2017-12-21 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-15  1:59 [dpdk-dev] [PATCH 1/2] net/mlx5: fix Memory Region registration Yongseok Koh
2017-12-15  1:59 ` [dpdk-dev] [PATCH 2/2] net/mlx5: fix overflow of Memory Region cache Yongseok Koh
2017-12-21 15:26 ` [dpdk-dev] [dpdk-stable] [PATCH 1/2] net/mlx5: fix Memory Region registration Shahaf Shuler

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