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 08461A04F0; Tue, 10 Dec 2019 15:48:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CF5C61BE3D; Tue, 10 Dec 2019 15:48:07 +0100 (CET) Received: from relay.smtp.broadcom.com (unknown [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 9886C1B13C for ; Tue, 10 Dec 2019 15:48:04 +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 5131A1BD7AC; Tue, 10 Dec 2019 06:48:02 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 5131A1BD7AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1575989283; bh=+Gf56qi0LDV8IB434iXnaDkaT5OomXoqNqt2lcCDeow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q8xn9fVHvH1e6x5xh7PeaLHgzTOislW+b9E9A7gr7U2hbMkQaDLTw6DBDVlcSN+wH ZHFcGVPR/ysxbrQSGq9MoNuC2qOJeWr92pEhh5K+YKPY9ni2GgUTNertIYJQ8bq91a k2bbeZhjVOUjaQFvXlG8HwMAfUoD/1oRJzP5nr48= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com Date: Tue, 10 Dec 2019 20:35:24 +0530 Message-Id: <20191210150529.27922-2-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 1/6] net/bnxt: restore mac 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 mac addresses prior to hot FW upgrade or FW error. Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt_ethdev.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index c70b072..addc850 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -3796,6 +3796,48 @@ static void bnxt_dev_cleanup(struct bnxt *bp) bnxt_uninit_resources(bp, true); } +static int bnxt_restore_mac_filters(struct bnxt *bp) +{ + struct rte_eth_dev *dev = bp->eth_dev; + struct rte_eth_dev_info dev_info; + struct rte_ether_addr *addr; + uint64_t pool_mask; + uint32_t pool = 0; + uint16_t i; + int rc; + + if (BNXT_VF(bp) & !BNXT_VF_IS_TRUSTED(bp)) + return 0; + + rc = bnxt_dev_info_get_op(dev, &dev_info); + if (rc) + return rc; + + /* replay MAC address configuration */ + for (i = 1; i < dev_info.max_mac_addrs; i++) { + addr = &dev->data->mac_addrs[i]; + + /* skip zero address */ + if (rte_is_zero_ether_addr(addr)) + continue; + + pool = 0; + pool_mask = dev->data->mac_pool_sel[i]; + + do { + if (pool_mask & 1ULL) { + rc = bnxt_mac_addr_add_op(dev, addr, i, pool); + if (rc) + return rc; + } + pool_mask >>= 1; + pool++; + } while (pool_mask); + } + + return 0; +} + static int bnxt_restore_filters(struct bnxt *bp) { struct rte_eth_dev *dev = bp->eth_dev; @@ -3806,6 +3848,7 @@ static int bnxt_restore_filters(struct bnxt *bp) if (dev->data->promiscuous) ret = bnxt_promiscuous_enable_op(dev); + ret = bnxt_restore_mac_filters(bp); /* TODO restore other filters as well */ return ret; } -- 2.10.1