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 3699045B37; Mon, 14 Oct 2024 14:01:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 65A7D4065D; Mon, 14 Oct 2024 14:01:31 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id 3E405402D7 for ; Mon, 14 Oct 2024 14:01:29 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 131781A08E3; Mon, 14 Oct 2024 14:01:29 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C71691A08C8; Mon, 14 Oct 2024 14:01:28 +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 CA67B183DC04; Mon, 14 Oct 2024 20:01:27 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena , Anatoly Burakov Cc: Jun Yang Subject: [v3 01/43] net/dpaa2: enhance Tx scatter-gather mempool Date: Mon, 14 Oct 2024 17:30:44 +0530 Message-Id: <20241014120126.170790-2-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241014120126.170790-1-vanshika.shukla@nxp.com> References: <20240918075056.1838654-2-vanshika.shukla@nxp.com> <20241014120126.170790-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 7b3e587a8d..4b93606de1 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2870,6 +2870,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"); + return -ENOMEM; + } + } else { + dpaa2_tx_sg_pool = rte_mempool_lookup(name); + if (!dpaa2_tx_sg_pool) { + DPAA2_PMD_ERR("SG pool lookup failed"); + return -ENOMEM; + } + } + + return 0; +} + static int rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv, struct rte_dpaa2_device *dpaa2_dev) @@ -2924,19 +2953,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"); - 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