[PATCH] net/cnxk: restore MAC address table during port reset

skori at marvell.com skori at marvell.com
Wed Apr 9 08:11:49 CEST 2025


From: Sunil Kumar Kori <skori at 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 at dpdk.org

Signed-off-by: Sunil Kumar Kori <skori at 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



More information about the dev mailing list