path: root/drivers/net/mlx5/mlx5_mr.c
diff options
authorYongseok Koh <>2018-01-18 23:52:55 -0800
committerFerruh Yigit <>2018-01-21 15:51:52 +0100
commitf81ec748434bfef078be57fc880313e832765ad1 (patch)
tree48220ad0c756de15a74514703d93473b4d819f11 /drivers/net/mlx5/mlx5_mr.c
parentc95e8597034a9c7b2236c9a22694f33ef7bbc9e1 (diff)
net/mlx5: fix memory region lookup
This patch reverts: commit 3a6f2eb8c5c5 ("net/mlx5: fix Memory Region registration") Although 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. It is because buffer address is compared against aligned addresses for Memory Region. Saving original addresses of mempool for comparison doesn't create any overlap. Fixes: b0b093845793 ("net/mlx5: use buffer address for LKEY search") Fixes: 3a6f2eb8c5c5 ("net/mlx5: fix Memory Region registration") Cc: Reported-by: Xueming Li <> Signed-off-by: Xueming Li <> Signed-off-by: Yongseok Koh <> Acked-by: Nelio Laranjeiro <>
Diffstat (limited to 'drivers/net/mlx5/mlx5_mr.c')
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 6b29eed..2776dc7 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -291,6 +291,9 @@ priv_mr_new(struct priv *priv, struct rte_mempool *mp)
DEBUG("mempool %p area start=%p end=%p size=%zu",
(void *)mp, (void *)start, (void *)end,
(size_t)(end - start));
+ /* Save original addresses for exact MR lookup. */
+ mr->start = start;
+ mr->end = end;
/* Round start and end to page boundary if found in memory segments. */
for (i = 0; (i < RTE_MAX_MEMSEG) && (ms[i].addr != NULL); ++i) {
uintptr_t addr = (uintptr_t)ms[i].addr;
@@ -309,8 +312,6 @@ priv_mr_new(struct priv *priv, struct rte_mempool *mp)
mr->mp = mp;
mr->lkey = rte_cpu_to_be_32(mr->mr->lkey);
- mr->start = start;
- mr->end = (uintptr_t)mr->mr->addr + mr->mr->length;
DEBUG("%p: new Memory Region %p refcnt: %d", (void *)priv,
(void *)mr, rte_atomic32_read(&mr->refcnt));