[dpdk-dev] [PATCH 4/5] net/mlx5: fix memory registration cache last index

Shahaf Shuler shahafs at mellanox.com
Tue Jan 23 18:08:22 CET 2018


In case memory registration cache is full the new mempool will be
inserted in the last index of the array.

Update the last entry being hit to reflect it.

Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86")
Cc: stable at dpdk.org
Cc: yskoh at mellanox.com

Signed-off-by: Shahaf Shuler <shahafs at mellanox.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 2934f9fb3..4bedfb89b 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -572,7 +572,6 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 			return txq->mp2mr[i]->lkey;
 		}
 	}
-	txq->mr_cache_idx = 0;
 	mp = mlx5_tx_mb2mp(mb);
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
 		WARN("Using unregistered mempool 0x%p(%s) in secondary process,"
@@ -588,6 +587,7 @@ mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
 	 */
 	if (mr) {
 		rte_atomic32_inc(&mr->refcnt);
+		txq->mr_cache_idx = i >= RTE_DIM(txq->mp2mr) ? i - 1 : i;
 		return mr->lkey;
 	} else {
 		WARN("Failed to register mempool 0x%p(%s)",
-- 
2.12.0



More information about the dev mailing list