[2/3] mempool/cnxk: fix free from non-EAL pthreads
Checks
Commit Message
From: Harman Kalra <hkalra@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@marvell.com>
Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
---
drivers/mempool/cnxk/cn10k_mempool_ops.c | 6 ++++++
1 file changed, 6 insertions(+)
@@ -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;