net/cnxk: fix promiscuous state after MAC change
Checks
Commit Message
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")
Cc: stable@dpdk.org
Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
---
drivers/net/cnxk/cnxk_ethdev_ops.c | 7 +++++++
1 file changed, 7 insertions(+)
Comments
On Tue, May 28, 2024 at 2:18 PM Rahul Bhansali <rbhansali@marvell.com> wrote:
>
> 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")
> Cc: stable@dpdk.org
>
> Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
Applied to dpdk-next-net-mrvl/for-main. Thanks
> ---
> drivers/net/cnxk/cnxk_ethdev_ops.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c
> index c8260fcb9c..b1093dd584 100644
> --- a/drivers/net/cnxk/cnxk_ethdev_ops.c
> +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c
> @@ -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
>
@@ -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 */