patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: stable@dpdk.org
Cc: luca.boccassi@gmail.com, ajit.khaparde@broadcom.com
Subject: [dpdk-stable] [19.11] [PATCH 2/3] net/bnxt: restore VLAN filters during reset recovery
Date: Tue, 18 Feb 2020 09:29:39 +0530	[thread overview]
Message-ID: <20200218035940.8629-3-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20200218035940.8629-1-kalesh-anakkur.purayil@broadcom.com>

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

[ upstream commit 151c8240ac6ad32269a04b5012cabceea0843abb ]

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 <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 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 62cfa1c..5e05930 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3807,6 +3807,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;
@@ -3860,6 +3883,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


  parent reply	other threads:[~2020-02-18  3:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18  3:59 [dpdk-stable] [19.11] [PATCH 0/3] bnxt fixes Kalesh A P
2020-02-18  3:59 ` [dpdk-stable] [19.11] [PATCH 1/3] net/bnxt: restore MAC filters during reset recovery Kalesh A P
2020-02-18  3:59 ` Kalesh A P [this message]
2020-02-18  3:59 ` [dpdk-stable] [19.11] [PATCH 3/3] net/bnxt: fix VLAN strip Kalesh A P
2020-02-18  9:19 ` [dpdk-stable] [19.11] [PATCH 0/3] bnxt fixes Luca Boccassi

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=20200218035940.8629-3-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=luca.boccassi@gmail.com \
    --cc=stable@dpdk.org \
    /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).