[PATCH v3 4/8] net: dsa: enable promiscuous mode for switch master edev
Oleksij Rempel
o.rempel at pengutronix.de
Mon Nov 7 03:16:57 PST 2022
Typical use case for DSA framework on barebox is 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 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c
index 040ba897e2..124059ee3c 100644
--- a/drivers/net/dsa.c
+++ b/drivers/net/dsa.c
@@ -129,6 +129,11 @@ static int dsa_port_start(struct eth_device *edev)
return ret;
}
+ ret = eth_set_promisc(ds->edev_master, true);
+ if (ret)
+ dev_warn(ds->dev, "Failed to set promisc mode. Using different eth addresses may not work. %pe\n",
+ ERR_PTR(ret));
+
eth_open(ds->edev_master);
}
@@ -160,6 +165,7 @@ static void dsa_port_stop(struct eth_device *edev)
ops->port_disable(dpc, ds->cpu_port,
ds->cpu_port_fixed_phy);
+ eth_set_promisc(ds->edev_master, false);
eth_close(ds->edev_master);
}
}
--
2.30.2
More information about the barebox
mailing list