Netdev List
 help / color / mirror / Atom feed
From: "A. Sverdlin" <alexander.sverdlin@siemens.com>
To: netdev@vger.kernel.org
Cc: Alexander Sverdlin <alexander.sverdlin@siemens.com>,
	Siddharth Vadapalli <s-vadapalli@ti.com>,
	Roger Quadros <rogerq@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Karl Mehltretter <kmehltretter@gmail.com>,
	Kevin Hao <haokexin@gmail.com>,
	Guangshuo Li <lgs201920130244@gmail.com>,
	Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Murali Karicheri <m-karicheri2@ti.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Mugunthan V N <mugunthanvnm@ti.com>,
	linux-omap@vger.kernel.org,
	Lukas Stockmann <lukas.stockmann@siemens.com>
Subject: [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
Date: Thu,  3 Dec 2026 09:05:09 +0100	[thread overview]
Message-ID: <20261203080514.577407-2-alexander.sverdlin@siemens.com> (raw)
In-Reply-To: <20261203080514.577407-1-alexander.sverdlin@siemens.com>

From: Alexander Sverdlin <alexander.sverdlin@siemens.com>

In dual-MAC mode the ALE is VLAN-aware and the Unknown VLAN register is
left at its reset value, so frames tagged with a VID the ALE doesn't know
are dropped even if the interface is promiscuous. ALE_P0_UNI_FLOOD only
helps with unknown unicast in known VLANs.

This breaks DSA switches with VLAN-based tagging protocols, like LAN9303,
which encodes the source port in the VID: DSA puts the conduit into
promiscuous mode, but the ALE drops the frames coming from the switch.

Bypass the ALE in promiscuous mode, as the legacy cpsw driver does in
dual_emac mode. In dual-MAC mode the ALE never forwards between external
ports and bypass delivers all received frames to the host port only, so
the port separation is preserved. When leaving promiscuous mode restore
the bypass setting configured via devlink.

Switch mode changes reset ALE_BYPASS, re-apply the rx mode of the running
ports afterwards so that the promiscuous state isn't lost.

Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
Tested-by: Lukas Stockmann <lukas.stockmann@siemens.com>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
 drivers/net/ethernet/ti/cpsw_new.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
index 9ea7b6ffc992b..5f0fe96814f0c 100644
--- a/drivers/net/ethernet/ti/cpsw_new.c
+++ b/drivers/net/ethernet/ti/cpsw_new.c
@@ -100,15 +100,13 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
 	}
 
 	if (enable) {
-		/* Enable unknown unicast, reg/unreg mcast */
-		cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM,
-				     ALE_P0_UNI_FLOOD, 1);
+		/* Bypass also delivers frames of VLANs unknown to the ALE */
+		cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM, ALE_BYPASS, 1);
 
 		dev_dbg(cpsw->dev, "promiscuity enabled\n");
 	} else {
-		/* Disable unknown unicast */
-		cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM,
-				     ALE_P0_UNI_FLOOD, 0);
+		cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM, ALE_BYPASS,
+				     cpsw->ale_bypass);
 		dev_dbg(cpsw->dev, "promiscuity disabled\n");
 	}
 }
@@ -1769,6 +1767,14 @@ static int cpsw_dl_switch_mode_set(struct devlink *dl, u32 id,
 		cpsw_ale_control_set(cpsw->ale, 0, ALE_BYPASS, 0);
 		cpsw->data.dual_emac = true;
 	}
+
+	/* ALE_BYPASS has been reset above, re-apply promiscuity */
+	for (i = 0; i < cpsw->data.slaves; i++) {
+		struct net_device *sl_ndev = cpsw->slaves[i].ndev;
+
+		if (sl_ndev && netif_running(sl_ndev))
+			cpsw_ndo_set_rx_mode(sl_ndev);
+	}
 exit:
 	rtnl_unlock();
 
-- 
2.56.1


  reply	other threads:[~2026-12-03  8:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  8:05 [PATCH net-next 0/3] net: ethernet: ti: cpsw: Support cascaded switches A. Sverdlin
2026-12-03  8:05 ` A. Sverdlin [this message]
2026-12-03  8:05 ` [PATCH net-next 2/3] net: ethernet: ti: cpsw: forward unknown VLANs in promiscuous switch mode A. Sverdlin
2026-12-03  8:05 ` [PATCH net-next 3/3] net: ethernet: ti: cpsw: don't untag frames on DSA conduit A. Sverdlin

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20261203080514.577407-2-alexander.sverdlin@siemens.com \
    --to=alexander.sverdlin@siemens.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=grygorii.strashko@ti.com \
    --cc=haokexin@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kmehltretter@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=lukas.stockmann@siemens.com \
    --cc=m-karicheri2@ti.com \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rogerq@kernel.org \
    --cc=s-vadapalli@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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