[PATCH v2 2/6] net: dsa: enable promiscuous mode for switch master edev
Sascha Hauer
sha at pengutronix.de
Fri Nov 4 01:26:53 PDT 2022
On Thu, Nov 03, 2022 at 02:13:47PM +0100, Oleksij Rempel wrote:
> Typical use case for DSA framework on barebox a port multiplexer. This
> means, we mostly have different MAC addresses on each port. To make this
> work, we need to enable promiscuous mode on the master Ethernet
> controller.
>
> With this patch, promiscuous mode will be enabled automatically, as soon
> as at least one switch port is enabled and this mode will be disabled
> after all switch ports are disabled as well.
>
> Signed-off-by: Oleksij Rempel <o.rempel at pengutronix.de>
> ---
> drivers/net/dsa.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
> index 040ba897e2..14ef8f4c4f 100644
> --- a/drivers/net/dsa.c
> +++ b/drivers/net/dsa.c
> @@ -129,6 +129,7 @@ static int dsa_port_start(struct eth_device *edev)
> return ret;
> }
>
> + eth_set_promiscuous_mode(ds->edev_master, true);
> eth_open(ds->edev_master);
> }
>
> @@ -160,6 +161,7 @@ static void dsa_port_stop(struct eth_device *edev)
> ops->port_disable(dpc, ds->cpu_port,
> ds->cpu_port_fixed_phy);
>
> + eth_set_promiscuous_mode(ds->edev_master, false);
Please check the error code. When eth_set_promiscuous_mode() is not
implemented for the current ethernet device we should notice the user.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list