DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com
Subject: [dpdk-dev] [PATCH 1/6] net/bnxt: restore mac filters during reset recovery
Date: Tue, 10 Dec 2019 20:35:24 +0530	[thread overview]
Message-ID: <20191210150529.27922-2-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20191210150529.27922-1-kalesh-anakkur.purayil@broadcom.com>

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

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 <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 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


  reply	other threads:[~2019-12-10 14:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 15:05 [dpdk-dev] [PATCH 0/6] bnxt patchset Kalesh A P
2019-12-10 15:05 ` Kalesh A P [this message]
2019-12-10 15:05 ` [dpdk-dev] [PATCH 2/6] net/bnxt: restore vlan filters during reset recovery Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 3/6] net/bnxt: fix request for hot reset support Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 4/6] net/bnxt: remove unnecessary macro for unused variables Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 5/6] net/bnxt: reset filter indices on free Kalesh A P
2019-12-10 15:05 ` [dpdk-dev] [PATCH 6/6] net/bnxt: add a field for fw capabilities Kalesh A P
2019-12-13 22:41 ` [dpdk-dev] [PATCH 0/6] bnxt patchset Ajit Khaparde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210150529.27922-2-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).