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 5B5E5A04F0; Tue, 10 Dec 2019 15:48:54 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AE6221BF7B; Tue, 10 Dec 2019 15:48:14 +0100 (CET) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 1F4D81BEDE for ; Tue, 10 Dec 2019 15:48:10 +0100 (CET) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp.broadcom.com (Postfix) with ESMTP id B71AD1BD7CE; Tue, 10 Dec 2019 06:48:08 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com B71AD1BD7CE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1575989289; bh=B/aKql08vICQd72fPZG5afrhepCKmhYJAMMIYQfpoog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ov+E3xuWyvYGCQFrUv3usYYIZ2EXh0b5gP76Isj3/vNBBW0ov9DS31vlysRBkTd49 oCy0j1cIrQ0pbAhp6+b8jM22T21jgSFbh2xk06QcHZLlH9Pe7cH2yPZcWA2RAkBVc0 IMW+Svfvvi7f7NI+9nktME00vxc8CPsY4O0pty+Q= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com Date: Tue, 10 Dec 2019 20:35:28 +0530 Message-Id: <20191210150529.27922-6-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20191210150529.27922-1-kalesh-anakkur.purayil@broadcom.com> References: <20191210150529.27922-1-kalesh-anakkur.purayil@broadcom.com> Subject: [dpdk-dev] [PATCH 5/6] net/bnxt: reset filter indices on free 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: Kalesh AP Fix bnxt_free_filter() to ensure that the filter indices are reset correctly when a filter is freed. This change helps in avoiding few duplicate code as well. Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 10 ---------- drivers/net/bnxt/bnxt_filter.c | 5 +++++ drivers/net/bnxt/bnxt_flow.c | 1 - 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 2f84794..146f04b 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -1007,8 +1007,6 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev, STAILQ_REMOVE(&vnic->filter, filter, bnxt_filter_info, next); bnxt_hwrm_clear_l2_filter(bp, filter); - filter->mac_index = INVALID_MAC_INDEX; - memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN); bnxt_free_filter(bp, filter); } filter = temp_filter; @@ -1055,7 +1053,6 @@ static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic, else STAILQ_INSERT_TAIL(&vnic->filter, filter, next); } else { - memset(&filter->l2_addr, 0, RTE_ETHER_ADDR_LEN); bnxt_free_filter(bp, filter); } @@ -1781,7 +1778,6 @@ static int bnxt_add_vlan_filter(struct bnxt *bp, uint16_t vlan_id) /* Free the newly allocated filter as we were * not able to create the filter in hardware. */ - filter->fw_l2_filter_id = UINT64_MAX; bnxt_free_filter(bp, filter); return rc; } @@ -1831,7 +1827,6 @@ static int bnxt_del_dflt_mac_filter(struct bnxt *bp, STAILQ_REMOVE(&vnic->filter, filter, bnxt_filter_info, next); bnxt_free_filter(bp, filter); - filter->fw_l2_filter_id = UINT64_MAX; } return rc; } @@ -2705,14 +2700,11 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp, STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info, next); bnxt_free_filter(bp, mfilter); - mfilter->fw_l2_filter_id = -1; bnxt_free_filter(bp, bfilter); - bfilter->fw_l2_filter_id = -1; } return 0; free_filter: - bfilter->fw_l2_filter_id = -1; bnxt_free_filter(bp, bfilter); return ret; } @@ -3110,7 +3102,6 @@ bnxt_fdir_filter(struct rte_eth_dev *dev, STAILQ_REMOVE(&vnic->filter, match, bnxt_filter_info, next); bnxt_free_filter(bp, match); - filter->fw_l2_filter_id = -1; bnxt_free_filter(bp, filter); } break; @@ -3143,7 +3134,6 @@ bnxt_fdir_filter(struct rte_eth_dev *dev, return ret; free_filter: - filter->fw_l2_filter_id = -1; bnxt_free_filter(bp, filter); return ret; } diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c index da1a6c2..0c410f8 100644 --- a/drivers/net/bnxt/bnxt_filter.c +++ b/drivers/net/bnxt/bnxt_filter.c @@ -192,5 +192,10 @@ struct bnxt_filter_info *bnxt_get_unused_filter(struct bnxt *bp) void bnxt_free_filter(struct bnxt *bp, struct bnxt_filter_info *filter) { + memset(filter, 0, sizeof(*filter)); + filter->mac_index = INVALID_MAC_INDEX; + filter->fw_l2_filter_id = UINT64_MAX; + filter->fw_ntuple_filter_id = UINT64_MAX; + filter->fw_em_filter_id = UINT64_MAX; STAILQ_INSERT_TAIL(&bp->free_filter_list, filter, next); } diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 447a51b..7bd6811 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -1521,7 +1521,6 @@ bnxt_flow_validate(struct rte_eth_dev *dev, exit: /* No need to hold on to this filter if we are just validating flow */ - filter->fw_l2_filter_id = UINT64_MAX; bnxt_free_filter(bp, filter); bnxt_release_flow_lock(bp); -- 2.10.1