[PATCH 2/3] mempool/cnxk: fix free from non-EAL pthreads

Ashwin Sekhar T K asekhar at marvell.com
Tue Aug 22 19:01:56 CEST 2023


From: Harman Kalra <hkalra at marvell.com>

For non-EAL pthreads, rte_lcore_id() will not be valid.
So, batch free cannot be used as those threads won't have
dedicated lmtlines. So, fallback to bulk alloc in such cases.

Fixes: ecbc731a2286 ("mempool/cnxk: add cn10k batch enqueue")

Signed-off-by: Harman Kalra <hkalra at marvell.com>
Signed-off-by: Ashwin Sekhar T K <asekhar at marvell.com>
---
 drivers/mempool/cnxk/cn10k_mempool_ops.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mempool/cnxk/cn10k_mempool_ops.c b/drivers/mempool/cnxk/cn10k_mempool_ops.c
index 41b755b52b..2e46204c8d 100644
--- a/drivers/mempool/cnxk/cn10k_mempool_ops.c
+++ b/drivers/mempool/cnxk/cn10k_mempool_ops.c
@@ -162,6 +162,12 @@ cn10k_mempool_enq(struct rte_mempool *mp, void *const *obj_table,
 	 */
 	rte_io_wmb();
 
+	/* For non-EAL threads, rte_lcore_id() will not be valid. Hence
+	 * fallback to bulk alloc
+	 */
+	if (unlikely(rte_lcore_id() == LCORE_ID_ANY))
+		return cnxk_mempool_enq(mp, obj_table, n);
+
 	if (n == 1) {
 		roc_npa_aura_op_free(mp->pool_id, 1, ptr[0]);
 		return 0;
-- 
2.25.1



More information about the dev mailing list