Skip to contentSkip to conversation

net/cnxk: fix promiscuous state after MAC change

PATCH Applied Rahul Bhansali 2 participants 2 messages May 28, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/cnxk: fix promiscuous state after MAC change

If promiscuous mode is enabled and default MAC address is set again then promiscuous mode gets disabled in hardware.

This change will restore promiscuous behavior after configuring default MAC address.

Fixes 5fe86db2a0dd ("net/cnxk: support MAC address set")
---
 drivers/net/cnxk/cnxk_ethdev_ops.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/cnxk/cnxk_ethdev_ops.c +7 -0
index c8260fcb9c..b1093dd584 100644
@@ -451,6 +451,13 @@ cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
 			roc_nix_npc_mac_addr_set(nix, dev->mac_addr);
 			goto exit;
 		}
+
+		if (eth_dev->data->promiscuous) {
+			rc = roc_nix_mac_promisc_mode_enable(nix, true);
+			if (rc)
+				plt_err("Failed to setup promisc mode in mac, rc=%d(%s)", rc,
+					roc_error_msg_get(rc));
+		}
 	}
 
 	/* Update mac address to cnxk ethernet device */
Signature · 1 line
2.25.1
Applied
#1 lore raw
Quoted 11 lines · Rahul Bhansali

If promiscuous mode is enabled and default MAC address is set again then promiscuous mode gets disabled in hardware.

This change will restore promiscuous behavior after configuring default MAC address.

Fixes 5fe86db2a0dd ("net/cnxk: support MAC address set")

Applied to dpdk-next-net-mrvl/for-main. Thanks

Quoted 25 lines
---
 drivers/net/cnxk/cnxk_ethdev_ops.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/net/cnxk/cnxk_ethdev_ops.c +7 -1
index c8260fcb9c..b1093dd584 100644
@@ -451,6 +451,13 @@ cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr)
                        roc_nix_npc_mac_addr_set(nix, dev->mac_addr);
                        goto exit;
                }
+
+               if (eth_dev->data->promiscuous) {
+                       rc = roc_nix_mac_promisc_mode_enable(nix, true);
+                       if (rc)
+                               plt_err("Failed to setup promisc mode in mac, rc=%d(%s)", rc,
+                                       roc_error_msg_get(rc));
+               }
        }
 
        /* Update mac address to cnxk ethernet device */
--

2.25.1