From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 364FD42F9D; Mon, 31 Jul 2023 07:55:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F3DD43253; Mon, 31 Jul 2023 07:55:34 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 1482643251 for ; Mon, 31 Jul 2023 07:55:32 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36UNIcX7012062 for ; Sun, 30 Jul 2023 22:55:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=jt8tAc8vA1FdvxdoJOdSnJkAixndtTyQxBzXwVLe0e0=; b=Yuv7qikrOPv1CBNBrP1woatFeVLcMCE5LA1ii8bS9DDa+TNYH54Ic9+MnLoYL2q71P0W mNJ3iiJQWaAdrUdcwrQGpOuQ6rTrQSKv0ifVZJcEkBW1PsVko7Dfy5mZbvs3rynnD/Lu UHHZimvoWViqiK+GTjjE4fRdPaGP7BY3T/HVUuU+xX4FvM6PdQ8UVS8lR1ZlxExFe3j9 yqrllYjtGeTiXIZwlbQjpNLPa+KvC6vXYfnicpvPWfKwWZriJjIJJ5B32qMHNnr4820h AR3hjxnu1JgLUcGX7xSDCQMUyWrRTsT4qONqYOvTXSFU0oxoUaqr5++1wwMWk+jV7fkE ag== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3s529k3vr0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 30 Jul 2023 22:55:32 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 30 Jul 2023 22:55:30 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 30 Jul 2023 22:55:30 -0700 Received: from localhost.localdomain (unknown [10.28.36.142]) by maili.marvell.com (Postfix) with ESMTP id 6F4CA3F7040; Sun, 30 Jul 2023 22:55:26 -0700 (PDT) From: Ashwin Sekhar T K To: , Ashwin Sekhar T K , Pavan Nikhilesh CC: , , , , , , , , Subject: [PATCH 2/2] mempool/cnxk: fix alloc from non-EAL pthreads Date: Mon, 31 Jul 2023 11:25:14 +0530 Message-ID: <20230731055514.1708500-2-asekhar@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230731055514.1708500-1-asekhar@marvell.com> References: <20230731055514.1708500-1-asekhar@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: TxXMnUwyf15wmmNt-RISiM2nxxFNZE39 X-Proofpoint-ORIG-GUID: TxXMnUwyf15wmmNt-RISiM2nxxFNZE39 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-27_10,2023-07-26_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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