From patchwork Fri Sep 17 04:37:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Satheesh Paul Antonysamy X-Patchwork-Id: 99059 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 15D38A0C46; Fri, 17 Sep 2021 06:38:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE785406B4; Fri, 17 Sep 2021 06:38:00 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id AFFDE40689 for ; Fri, 17 Sep 2021 06:37:58 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18GNENLQ030259 for ; Thu, 16 Sep 2021 21:37:57 -0700 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=Zps3BkOh1WEoa/q+xOZ9e7v28t9xjn9XiWGwEGok2zI=; b=IKJBa2IJ0yO9MQWa7KCiDO/8oind8RZOD+Vl7BzfWeedEm114PqHtmWmbROsP06RaFnh cAx7ZmiP6GqzZdIzFR/DuVBD0icYUG6Xv4afDGuoKTsjZmj7Cw/ciNM/0GccfgYlFErN zeStzBRSJriaUm5gwMbyaG87pkSzHq4tFBe2D/ltVNhhDhW+vvJhkpapoH3jbQ3AQnD7 JLKRyc1dHvUZ/hTJgtd9FRUhFkI7V9LI7YLnuKagT4itGIUNPhuPGxgvMCwYsDTjJQmO gwCPZf/00aVocVQM9brf2XvPb6EvNcnh9HHRJOzQMxpbwlGAVcv5ZEzKy4xZtWBzUTK1 /Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3b4fe1rrrc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 16 Sep 2021 21:37:57 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 16 Sep 2021 21:37:56 -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.18 via Frontend Transport; Thu, 16 Sep 2021 21:37:56 -0700 Received: from localhost.localdomain (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 27DAE3F7063; Thu, 16 Sep 2021 21:37:53 -0700 (PDT) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Satheesh Paul Date: Fri, 17 Sep 2021 10:07:46 +0530 Message-ID: <20210917043746.3652748-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Proofpoint-GUID: 76w3zEtxBmiTRQT3PjgywQfaQr1P2bWe X-Proofpoint-ORIG-GUID: 76w3zEtxBmiTRQT3PjgywQfaQr1P2bWe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-17_02,2021-09-16_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH] common/cnxk: fix incorrect free of MCAM counter 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 Sender: "dev" From: Satheesh Paul Upon MCAM allocation failure, free counters only if counters were allocated earlier for the flow rule. Fixes: f9af9080746 ("common/cnxk: add mcam utility API") Signed-off-by: Satheesh Paul Acked-by: Jerin Jacob --- drivers/common/cnxk/roc_npc_mcam.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c index 8ccaaad0af..7d9b0ed3e3 100644 --- a/drivers/common/cnxk/roc_npc_mcam.c +++ b/drivers/common/cnxk/roc_npc_mcam.c @@ -519,7 +519,8 @@ npc_mcam_alloc_and_write(struct npc *npc, struct roc_npc_flow *flow, entry = npc_check_preallocated_entry_cache(mbox, flow, npc); if (entry < 0) { - npc_mcam_free_counter(npc, ctr); + if (use_ctr) + npc_mcam_free_counter(npc, ctr); return NPC_ERR_MCAM_ALLOC; }