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 AC00FA04B3; Tue, 28 Jan 2020 22:02:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4ED4F1D5B8; Tue, 28 Jan 2020 22:02:11 +0100 (CET) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id A8D981D5A6; Tue, 28 Jan 2020 22:02:05 +0100 (CET) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 0E6BD30C1FC; Tue, 28 Jan 2020 12:55:11 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 0E6BD30C1FC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1580244911; bh=lAzBv0uXPQE2oJis0tTVCXMqzdLFcsjemh/Yz2x7glI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZESDcALI9HXyfnk7QNyRdFtbgl1n7Q0N6vm5qh+jy7/Apn+m/h2fQMNg1XJxkGMo 8lM1jGmy/ZtHgP3SLWKWs26WMhCJxzroeh4ryaTGGVibx6NI6l8HZOdJt8qWo+aKCv t9SDzrC7I3Q9/E2m1lowJUvUe8wGCi8sjCNzYXC4= Received: from C02VPB22HTD6.wifi.broadcom.net (c02vpb22htd6.wifi.broadcom.net [10.69.74.102]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 9199F14008C; Tue, 28 Jan 2020 13:02:04 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Somnath Kotur , stable@dpdk.org, Kalesh Anakkur Purayil Date: Tue, 28 Jan 2020 13:01:52 -0800 Message-Id: <20200128210159.6972-3-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122.2) In-Reply-To: <20200128210159.6972-1-ajit.khaparde@broadcom.com> References: <20200128072923.9912-1-somnath.kotur@broadcom.com> <20200128210159.6972-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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" From: Somnath Kotur 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: 5c1171c97216 ("net/bnxt: refactor filter/flow") Cc: stable@dpdk.org Reviewed-by: Kalesh Anakkur Purayil Signed-off-by: Somnath Kotur Signed-off-by: Ajit Khaparde --- 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 e2184334f..a1463a0e2 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 5564c5363..4b3b59795 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -867,7 +867,6 @@ bnxt_create_l2_filter(struct bnxt *bp, struct bnxt_filter_info *nf, 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 3b013396b..460cc4894 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; } -- 2.21.0 (Apple Git-122.2)