[PATCH v2 2/6] net: dsa: enable promiscuous mode for switch master edev

Oleksij Rempel o.rempel at pengutronix.de
Thu Nov 3 06:13:47 PDT 2022


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);
 		eth_close(ds->edev_master);
 	}
 }
-- 
2.30.2




More information about the barebox mailing list