From patchwork Tue Nov 8 06:41:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Sekhar T K X-Patchwork-Id: 119543 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8557BA04FD; Tue, 8 Nov 2022 07:41:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 93555400D7; Tue, 8 Nov 2022 07:41:24 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 665F84003C for ; Tue, 8 Nov 2022 07:41:23 +0100 (CET) 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 2A86TcZR012280 for ; Mon, 7 Nov 2022 22:41:22 -0800 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=Yyy9ms4z0j7QRae2GzS82PEA9uS7BSqqEOJJnINgGeA=; b=PS2NF9Ul+q1n3vUxtzITx5qb5/WMe1GT9uk2QOVnK1Df9IbxFQjXPdJtABw/A32UDgNc UTNw3vZz57jLjivRpZ3pEUDdqdqGeiyKqoUbuYVULSUuPh7y/Py8q+Jh/33fyY69kbjS DQPncm6Z3NMSiGomoHHTPJqHlP2/86TaXH3IbPC7WyAs1/jHWbyPBIVNBCPo9NIqG+yH hXGu7TuoniM48hlOtVQ7F3Egfv4NR16UhNE3v+NmRsDQlDZ+sB0BJsH2uBpAAHbeI3b+ fEfpthwBkdEq1LOcmymG0xdTqbVi7xYcnd+cnWKliNqlw/lg1aB2+ZhmdpbsfsJ9wDp8 Mg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3kqhw2g16g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 07 Nov 2022 22:41:22 -0800 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.2; Mon, 7 Nov 2022 22:41:20 -0800 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.2 via Frontend Transport; Mon, 7 Nov 2022 22:41:20 -0800 Received: from localhost.localdomain (unknown [10.28.36.142]) by maili.marvell.com (Postfix) with ESMTP id 69D063F70B9; Mon, 7 Nov 2022 22:41:16 -0800 (PST) From: Ashwin Sekhar T K To: , Ashwin Sekhar T K , Pavan Nikhilesh CC: , , , , , , , , Subject: [PATCH v2] mempool/cnxk: destroy NPA pool only if its created Date: Tue, 8 Nov 2022 12:11:13 +0530 Message-ID: <20221108064113.2091862-1-asekhar@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221108061853.2091476-1-asekhar@marvell.com> References: <20221108061853.2091476-1-asekhar@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: EBc4-E_cjt3rDBCekMdE1ifipR1Zotpj X-Proofpoint-GUID: EBc4-E_cjt3rDBCekMdE1ifipR1Zotpj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-07_11,2022-11-07_02,2022-06-22_01 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 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(). Signed-off-by: Ashwin Sekhar T K --- 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);