mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <>
Cc: Oleksij Rempel <>
Subject: [PATCH v4 4/8] net: dsa: enable promiscuous mode for switch master edev
Date: Tue,  8 Nov 2022 07:10:05 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

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

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 <>
 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));
@@ -160,6 +165,7 @@ static void dsa_port_stop(struct eth_device *edev)
 			ops->port_disable(dpc, ds->cpu_port,
+		eth_set_promisc(ds->edev_master, false);

  parent reply	other threads:[~2022-11-08  6:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  6:10 [PATCH v4 1/8] net: add promiscuous mode configuration support Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 2/8] net: usb: asix: add promisc mode support Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 3/8] ethlog: option to enable/disable promisc mode Oleksij Rempel
2022-11-08  6:57   ` Johannes Zink
2022-11-08  6:10 ` Oleksij Rempel [this message]
2022-11-08  6:10 ` [PATCH v4 5/8] drivers: net: fec_imx: add promiscuous mode configuration support Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 6/8] net: dsa: fix of_device_ensure_probed*() for switch ports Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 7/8] ARM: boards: skov-imx6: convert all pr_ to dev_ prints Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 8/8] ARM: boards: skov-imx6: assigned separate MAC address to LAN2 Oleksij Rempel
2022-11-08 10:13 ` [PATCH v4 1/8] net: add promiscuous mode configuration support Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox