From: Ashwin Sekhar T K <asekhar@marvell.com>
To: <dev@dpdk.org>, Ashwin Sekhar T K <asekhar@marvell.com>,
Pavan Nikhilesh <pbhagavatula@marvell.com>
Cc: <jerinj@marvell.com>, <skori@marvell.com>,
<skoteshwar@marvell.com>, <kirankumark@marvell.com>,
<psatheesh@marvell.com>, <anoobj@marvell.com>,
<gakhil@marvell.com>, <hkalra@marvell.com>,
<ndabilpuram@marvell.com>
Subject: [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools
Date: Tue, 8 Nov 2022 12:25:58 +0530 [thread overview]
Message-ID: <20221108065558.2092290-1-asekhar@marvell.com> (raw)
In-Reply-To: <20221108061853.2091476-1-asekhar@marvell.com>
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().
Fixes: bbf19e89b87c ("mempool/cnxk: add generic operations")
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..3769afd3d1 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) == 0)
+ 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
next prev parent reply other threads:[~2022-11-08 6:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Ashwin Sekhar T K [this message]
2022-11-15 3:24 ` [PATCH v3] mempool/cnxk: fix mempool destroy for empty pools Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221108065558.2092290-1-asekhar@marvell.com \
--to=asekhar@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=hkalra@marvell.com \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=pbhagavatula@marvell.com \
--cc=psatheesh@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).