DPDK patches and discussions
 help / color / mirror / Atom feed
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 2/2] mempool/cnxk: fix alloc from non-EAL pthreads
Date: Mon, 31 Jul 2023 11:25:14 +0530	[thread overview]
Message-ID: <20230731055514.1708500-2-asekhar@marvell.com> (raw)
In-Reply-To: <20230731055514.1708500-1-asekhar@marvell.com>

For non-EAL pthreads, rte_lcore_id() will not be valid.
So, batch allocation cannot be used as we won't have a
dedicated alloc buffer for the thread. So, fallback to
bulk alloc in such cases.

Fixes: 91531e63f43b ("mempool/cnxk: add cn10k batch dequeue")

Signed-off-by: Ashwin Sekhar T K <asekhar@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..9594370ecd 100644
--- a/drivers/mempool/cnxk/cn10k_mempool_ops.c
+++ b/drivers/mempool/cnxk/cn10k_mempool_ops.c
@@ -326,6 +326,12 @@ cn10k_mempool_deq(struct rte_mempool *mp, void **obj_table, unsigned int n)
 	struct batch_op_data *op_data;
 	unsigned int count = 0;
 
+	/* 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_deq(mp, obj_table, n);
+
 	op_data = batch_op_data_get(mp->pool_id);
 	if (op_data->max_async_batch)
 		count = mempool_deq_batch_async(mp, obj_table, n);
-- 
2.25.1


  reply	other threads:[~2023-07-31  5:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31  5:55 [PATCH 1/2] mempool/cnxk: limit usage of async allocs Ashwin Sekhar T K
2023-07-31  5:55 ` Ashwin Sekhar T K [this message]
2023-08-18  9:21   ` [PATCH 2/2] mempool/cnxk: fix alloc from non-EAL pthreads Jerin Jacob
2023-08-22 17:01 ` [PATCH 1/3] mempool/cnxk: limit usage of async allocs Ashwin Sekhar T K
2023-08-22 17:01   ` [PATCH 2/3] mempool/cnxk: fix free from non-EAL pthreads Ashwin Sekhar T K
2023-08-22 17:01   ` [PATCH 3/3] mempool/cnxk: fix alloc " Ashwin Sekhar T K
2023-08-24  4:57   ` [PATCH 1/3] mempool/cnxk: limit usage of async allocs Jerin Jacob

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=20230731055514.1708500-2-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).