DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1] mempool/cnxk: destroy NPA pool only if its created
@ 2022-11-08  6:18 Ashwin Sekhar T K
  2022-11-08  6:41 ` [PATCH v2] " Ashwin Sekhar T K
  2022-11-08  6:55 ` [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools Ashwin Sekhar T K
  0 siblings, 2 replies; 4+ messages in thread
From: Ashwin Sekhar T K @ 2022-11-08  6:18 UTC (permalink / raw)
  To: dev, Ashwin Sekhar T K, Pavan Nikhilesh
  Cc: jerinj, skori, skoteshwar, kirankumark, psatheesh, anoobj,
	gakhil, hkalra, ndabilpuram

In scenarios where rte_mempool_free() is called immediately
after rte_mempool_create_empty(), the NPA pool will not be
created. In such cases the free path should not call
roc_npa_pool_destroy().

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
---
 drivers/mempool/cnxk/cnxk_mempool_ops.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mempool/cnxk/cnxk_mempool_ops.c b/drivers/mempool/cnxk/cnxk_mempool_ops.c
index a0b94bb95c..e3026136cf 100644
--- a/drivers/mempool/cnxk/cnxk_mempool_ops.c
+++ b/drivers/mempool/cnxk/cnxk_mempool_ops.c
@@ -126,6 +126,14 @@ cnxk_mempool_free(struct rte_mempool *mp)
 	int rc = 0;
 
 	plt_npa_dbg("aura_handle=0x%" PRIx64, mp->pool_id);
+
+	/* It can happen that rte_mempool_free() is called immediately after
+	 * rte_mempool_create_empty(). In such cases the NPA pool will not be
+	 * allocated.
+	 */
+	if (roc_npa_aura_handle_to_base(mp->pool_id) == NULL)
+		return;
+
 	rc = roc_npa_pool_destroy(mp->pool_id);
 	if (rc)
 		plt_err("Failed to free pool or aura rc=%d", rc);
-- 
2.25.1


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

end of thread, other threads:[~2022-11-15  3:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08  6:18 [PATCH v1] mempool/cnxk: destroy NPA pool only if its created Ashwin Sekhar T K
2022-11-08  6:41 ` [PATCH v2] " Ashwin Sekhar T K
2022-11-08  6:55 ` [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools Ashwin Sekhar T K
2022-11-15  3:24   ` Thomas Monjalon

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