net/cnxk: fix promiscuous state after MAC change

Message ID 20240528083246.4016677-1-rbhansali@marvell.com (mailing list archive)
State Accepted
Delegated to: Jerin Jacob
Headers
Series net/cnxk: fix promiscuous state after MAC change |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Rahul Bhansali May 28, 2024, 8:32 a.m. UTC
  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

Jerin Jacob May 28, 2024, 5:43 p.m. UTC | #1
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
>
  

Patch

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 */