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 9AB34A04FD; Tue, 8 Nov 2022 07:19:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E768400D7; Tue, 8 Nov 2022 07:19:04 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 011DA4003C for ; Tue, 8 Nov 2022 07:19:02 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2A8216ld009445 for ; Mon, 7 Nov 2022 22:19:02 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=sozUKjD5/GdZvFyHwF4kMKNpZoZ3M3XfYrNG/THXx4g=; b=HdS3hGTLGRekdrGg4uqZXMRdwPsusxEY7k9Z14JO7fnMq4kl7wuf5v1z9Jb5M6YRyA6X EBE/ZiQjd+YaKAm8eWC+F7yR8IxQAhdcQSPKRpY+Qh1FCF67p2oO1aXDVJlbywSM+47U AF57yLc7UJsOrGQjRfF3xVXNCbTTBNPHannnQvVBeZIksDc3Rs6z2u6Vb0XJ/XBZ89e2 W/etX4Ii7xGJJ6Bgy/FL0dweSzsUt1PNJOmaRrCtH3eiseQlsQUNQCjq7Fj+ts5TmAPp MpmaoxhsUOUXHHwVM85s8/fuN1G/3r1h+r6H3Q9KgmD+yKBdcevFEc8rngkwmwbymFaB 8w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3kqdy7rq7u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 07 Nov 2022 22:19:02 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 7 Nov 2022 22:19:00 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 7 Nov 2022 22:19:00 -0800 Received: from localhost.localdomain (unknown [10.28.36.142]) by maili.marvell.com (Postfix) with ESMTP id 92FEF3F706D; Mon, 7 Nov 2022 22:18:56 -0800 (PST) From: Ashwin Sekhar T K To: , Ashwin Sekhar T K , Pavan Nikhilesh CC: , , , , , , , , Subject: [PATCH v1] mempool/cnxk: destroy NPA pool only if its created Date: Tue, 8 Nov 2022 11:48:53 +0530 Message-ID: <20221108061853.2091476-1-asekhar@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 21lDq-M6B9kLnceUMoiJVkS_Gw8n-MYS X-Proofpoint-ORIG-GUID: 21lDq-M6B9kLnceUMoiJVkS_Gw8n-MYS 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..e3026136cf 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) == NULL) + return; + rc = roc_npa_pool_destroy(mp->pool_id); if (rc) plt_err("Failed to free pool or aura rc=%d", rc); -- 2.25.1