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 31D55459C6; Wed, 18 Sep 2024 09:51:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2CAF442EBA; Wed, 18 Sep 2024 09:51:03 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id B908C42EAB for ; Wed, 18 Sep 2024 09:50:58 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 92658200238; Wed, 18 Sep 2024 09:50:58 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 57D91201344; Wed, 18 Sep 2024 09:50:58 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 62E42183C480; Wed, 18 Sep 2024 15:50:57 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena , Anatoly Burakov Cc: Jun Yang Subject: [v2 01/43] net/dpaa2: enhance Tx scatter-gather mempool Date: Wed, 18 Sep 2024 13:20:14 +0530 Message-Id: <20240918075056.1838654-2-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240918075056.1838654-1-vanshika.shukla@nxp.com> References: <20240913055959.3246917-1-vanshika.shukla@nxp.com> <20240918075056.1838654-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP 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 From: Jun Yang Create TX SG pool only for primary process and lookup this pool in secondary process. Signed-off-by: Jun Yang --- drivers/net/dpaa2/dpaa2_ethdev.c | 46 +++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 449bbda7ca..238533f439 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2867,6 +2867,35 @@ int dpaa2_dev_is_dpaa2(struct rte_eth_dev *dev) return dev->device->driver == &rte_dpaa2_pmd.driver; } +static int dpaa2_tx_sg_pool_init(void) +{ + char name[RTE_MEMZONE_NAMESIZE]; + + if (dpaa2_tx_sg_pool) + return 0; + + sprintf(name, "dpaa2_mbuf_tx_sg_pool"); + if (rte_eal_process_type() == RTE_PROC_PRIMARY) { + dpaa2_tx_sg_pool = rte_pktmbuf_pool_create(name, + DPAA2_POOL_SIZE, + DPAA2_POOL_CACHE_SIZE, 0, + DPAA2_MAX_SGS * sizeof(struct qbman_sge), + rte_socket_id()); + if (!dpaa2_tx_sg_pool) { + DPAA2_PMD_ERR("SG pool creation failed\n"); + return -ENOMEM; + } + } else { + dpaa2_tx_sg_pool = rte_mempool_lookup(name); + if (!dpaa2_tx_sg_pool) { + DPAA2_PMD_ERR("SG pool lookup failed\n"); + return -ENOMEM; + } + } + + return 0; +} + static int rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv, struct rte_dpaa2_device *dpaa2_dev) @@ -2921,19 +2950,10 @@ rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv, /* Invoke PMD device initialization function */ diag = dpaa2_dev_init(eth_dev); - if (diag == 0) { - if (!dpaa2_tx_sg_pool) { - dpaa2_tx_sg_pool = - rte_pktmbuf_pool_create("dpaa2_mbuf_tx_sg_pool", - DPAA2_POOL_SIZE, - DPAA2_POOL_CACHE_SIZE, 0, - DPAA2_MAX_SGS * sizeof(struct qbman_sge), - rte_socket_id()); - if (dpaa2_tx_sg_pool == NULL) { - DPAA2_PMD_ERR("SG pool creation failed\n"); - return -ENOMEM; - } - } + if (!diag) { + diag = dpaa2_tx_sg_pool_init(); + if (diag) + return diag; rte_eth_dev_probing_finish(eth_dev); dpaa2_valid_dev++; return 0; -- 2.25.1