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 BBFCAA04F0; Tue, 10 Dec 2019 15:48:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8BF011BE9E; Tue, 10 Dec 2019 15:48:09 +0100 (CET) Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 7002E1F5 for ; Tue, 10 Dec 2019 15:48:05 +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 E51101BD78E; Tue, 10 Dec 2019 06:48:03 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com E51101BD78E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1575989285; bh=exJ6n14RkIBhnz4PVcid7z3yH4QUEAeupdCBZgQ+sYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=asM6Nme1fG+1ZbQAVy5DIgtqCPfMLeQlNa29Mf9LSSeuARUvC7VS5YErTSWvSc9To TVtFPpM/CXjVm0DkwpIlQl9k79oao6yaycelxCeXY2gM5i84MR26Wvyqz2z/u93t+i vp7gMOHcNjA0tG0e+xq/5YzE9SOnSCm4+Qf5cxDw= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com Date: Tue, 10 Dec 2019 20:35:25 +0530 Message-Id: <20191210150529.27922-3-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 2/6] net/bnxt: restore vlan filters during reset recovery 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 Older Firmware could have state information such as MAC Filters, VLAN settings etc configured by user. But new Firmware is unaware of this state information and as a result driver should restore these settings during reset recovery. This patch restores the user configured vlan settings prior to hot FW upgrade or FW error. Signed-off-by: Kalesh AP Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index addc850..d72a756 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3796,6 +3796,29 @@ static void bnxt_dev_cleanup(struct bnxt *bp) bnxt_uninit_resources(bp, true); } +static int bnxt_restore_vlan_filters(struct bnxt *bp) +{ + struct rte_eth_dev *dev = bp->eth_dev; + struct rte_vlan_filter_conf *vfc; + int vidx, vbit, rc; + uint16_t vlan_id; + + for (vlan_id = 1; vlan_id <= RTE_ETHER_MAX_VLAN_ID; vlan_id++) { + vfc = &dev->data->vlan_filter_conf; + vidx = vlan_id / 64; + vbit = vlan_id % 64; + + /* Each bit corresponds to a VLAN id */ + if (vfc->ids[vidx] & (UINT64_C(1) << vbit)) { + rc = bnxt_add_vlan_filter(bp, vlan_id); + if (rc) + return rc; + } + } + + return 0; +} + static int bnxt_restore_mac_filters(struct bnxt *bp) { struct rte_eth_dev *dev = bp->eth_dev; @@ -3849,6 +3872,10 @@ static int bnxt_restore_filters(struct bnxt *bp) ret = bnxt_promiscuous_enable_op(dev); ret = bnxt_restore_mac_filters(bp); + if (ret) + return ret; + + ret = bnxt_restore_vlan_filters(bp); /* TODO restore other filters as well */ return ret; } -- 2.10.1