DPDK patches and discussions
 help / color / mirror / Atom feed
From: <skori@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
	Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	Satha Rao <skoteshwar@marvell.com>,
	Harman Kalra <hkalra@marvell.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>
Subject: [PATCH] net/cnxk: restore MAC address table during port reset
Date: Wed, 9 Apr 2025 11:41:49 +0530	[thread overview]
Message-ID: <20250409061152.1096849-1-skori@marvell.com> (raw)

From: Sunil Kumar Kori <skori@marvell.com>

When user requests to configure a device which is already in
configured state then first device gets resets to default and
then reconfigured with latest parameters.

While resetting the device, MAC address table is left stale which
causes entry update in later state.

Hence same is restoring during reset operation to avoid any error
due to further operation on MAC table.

Fixes: b75e0aca84b0 ("net/cnxk: add device configuration operation")
Cc: stable@dpdk.org

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
 drivers/net/cnxk/cnxk_ethdev.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c
index 289ae96afa..7e77fcba45 100644
--- a/drivers/net/cnxk/cnxk_ethdev.c
+++ b/drivers/net/cnxk/cnxk_ethdev.c
@@ -1209,6 +1209,26 @@ nix_lso_fmt_setup(struct cnxk_eth_dev *dev)
 	return nix_lso_tun_fmt_update(dev);
 }
 
+static int
+nix_restore_mac_table(struct rte_eth_dev *eth_dev)
+{
+	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+	struct rte_ether_addr *macs = NULL;
+	struct roc_nix *nix = &dev->nix;
+	int i, rc;
+
+	macs = eth_dev->data->mac_addrs;
+	for (i = 1; i < dev->dmac_filter_count; i++) {
+		rc = roc_nix_mac_addr_add(nix, macs[i].addr_bytes);
+		if (rc < 0) {
+			plt_err("Failed to restore mac addr table, rc=%d", rc);
+			return rc;
+		}
+	}
+
+	return 0;
+}
+
 int
 cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 {
@@ -1507,6 +1527,10 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev)
 		rc = nix_restore_queue_cfg(eth_dev);
 		if (rc)
 			goto sec_release;
+
+		rc = nix_restore_mac_table(eth_dev);
+		if (rc)
+			goto sec_release;
 	}
 
 	/* Update the mac address */
-- 
2.43.0


                 reply	other threads:[~2025-04-09  6:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250409061152.1096849-1-skori@marvell.com \
    --to=skori@marvell.com \
    --cc=dev@dpdk.org \
    --cc=hkalra@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skoteshwar@marvell.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).