From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5004DA04B3; Tue, 28 Jan 2020 08:31:10 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8BA141C0DD; Tue, 28 Jan 2020 08:30:53 +0100 (CET) Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com [192.19.211.62]) by dpdk.org (Postfix) with ESMTP id 183E51C0CA for ; Tue, 28 Jan 2020 08:30:48 +0100 (CET) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (bgccx-dev-host-lnx35.bec.broadcom.net [10.123.153.55]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 50B2229051B; Mon, 27 Jan 2020 23:30:47 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 50B2229051B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1580196647; bh=i2Pg6T6ESlCpma+7iFvqT2y1wPPpwiX9kovHgd8SNRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aLOPcuBFKcG3bX5NFTiZlRZ5Hwf8+/GH0HMlAwKyHE7UqA9oa5MtPscYoCbY1Arjz xJEjIoGaXU3r+7y+lCjZzoHZKq1khA52pPYdyTxrreFifTmQnrcsXII3buFnzALcaP 9nFJCz52HTtOgaxf2Vrms0yRs5oAteimwDNbN01U= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Tue, 28 Jan 2020 12:59:16 +0530 Message-Id: <20200128072923.9912-3-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.10.1.613.g2cc2e70 In-Reply-To: <20200128072923.9912-1-somnath.kotur@broadcom.com> References: <20200128072923.9912-1-somnath.kotur@broadcom.com> Subject: [dpdk-dev] [PATCH 2/9] net/bnxt: fix bumping of L2 filter reference count X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Now that the L2 filter reference count is bumped up in all cases including bnxt_alloc_filter() which is issued in init, just move this ref count bump inside the routine issuing the HWRM cmd so that it is bumped up only if the cmd is successful. Fixes: f0f6b5e6cf94 ("fix reusing L2 filter") Reviewed-by: Kalesh Anakkur Purayil Signed-off-by: Somnath Kotur --- drivers/net/bnxt/bnxt_filter.c | 3 +-- drivers/net/bnxt/bnxt_flow.c | 1 - drivers/net/bnxt/bnxt_hwrm.c | 2 ++ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index e218433..a1463a0 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -39,8 +39,7 @@ struct bnxt_filter_info *bnxt_alloc_filter(struct bnxt *bp) HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_L2_ADDR_MASK; memcpy(filter->l2_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN); memset(filter->l2_addr_mask, 0xff, RTE_ETHER_ADDR_LEN); - /* bump up the reference count of filter */ - filter->l2_ref_cnt++; + return filter; } diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 5564c53..4b3b597 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -867,7 +867,6 @@ bnxt_free_filter(bp, filter1); return NULL; } - filter1->l2_ref_cnt++; return filter1; } diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 3b01339..460cc48 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -488,6 +488,8 @@ int bnxt_hwrm_set_l2_filter(struct bnxt *bp, filter->flow_id = rte_le_to_cpu_32(resp->flow_id); HWRM_UNLOCK(); + filter->l2_ref_cnt++; + return rc; } -- 1.8.3.1