* [PATCH net-next 0/3] net: ethernet: ti: cpsw: Support cascaded switches
@ 2026-12-03 8:05 A. Sverdlin
2026-12-03 8:05 ` [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode A. Sverdlin
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: A. Sverdlin @ 2026-12-03 8:05 UTC (permalink / raw)
To: netdev
Cc: Alexander Sverdlin, Siddharth Vadapalli, Roger Quadros,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Karl Mehltretter, Kevin Hao, Guangshuo Li,
Aleksandr Loktionov, Ilias Apalodimas, Murali Karicheri,
Grygorii Strashko, Mugunthan V N, linux-omap, Lukas Stockmann
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
A LAN9303 DSA switch connected to one CPSW port doesn't work: its
tagging protocol encodes the source port in the VLAN tag, but the
VLAN-aware ALE drops frames with VIDs it doesn't know even on a
promiscuous interface, and the host port's untagged-egress handling
strips the tag before DSA can decode it.
Make promiscuous mode deliver all frames unmodified to the host in
both cpsw drivers (patches 1 and 2) and keep the VLAN tag intact on a
DSA conduit (patch 3), so VLAN-tagging DSA switches work behind CPSW.
Tested on AM335x with a LAN9303 behind one CPSW port in dual-MAC mode.
Alexander Sverdlin (3):
net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
net: ethernet: ti: cpsw: forward unknown VLANs in promiscuous switch
mode
net: ethernet: ti: cpsw: don't untag frames on DSA conduit
drivers/net/ethernet/ti/cpsw.c | 16 ++++++++++++++++
drivers/net/ethernet/ti/cpsw_new.c | 18 ++++++++++++------
drivers/net/ethernet/ti/cpsw_priv.c | 5 +++++
3 files changed, 33 insertions(+), 6 deletions(-)
--
2.56.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
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
2026-12-03 9:13 ` Siddharth Vadapalli
` (2 more replies)
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
2 siblings, 3 replies; 10+ messages in thread
From: A. Sverdlin @ 2026-12-03 8:05 UTC (permalink / raw)
To: netdev
Cc: Alexander Sverdlin, Siddharth Vadapalli, Roger Quadros,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Karl Mehltretter, Kevin Hao, Guangshuo Li,
Aleksandr Loktionov, Ilias Apalodimas, Murali Karicheri,
Grygorii Strashko, Mugunthan V N, linux-omap, Lukas Stockmann
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 2/3] net: ethernet: ti: cpsw: forward unknown VLANs in promiscuous switch mode
2026-12-03 8:05 [PATCH net-next 0/3] net: ethernet: ti: cpsw: Support cascaded switches A. Sverdlin
2026-12-03 8:05 ` [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode A. Sverdlin
@ 2026-12-03 8:05 ` A. Sverdlin
2026-12-04 8:53 ` netdev-bot+sashiko
2026-12-03 8:05 ` [PATCH net-next 3/3] net: ethernet: ti: cpsw: don't untag frames on DSA conduit A. Sverdlin
2 siblings, 1 reply; 10+ messages in thread
From: A. Sverdlin @ 2026-12-03 8:05 UTC (permalink / raw)
To: netdev
Cc: Alexander Sverdlin, Siddharth Vadapalli, Roger Quadros,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Karl Mehltretter, Kevin Hao, Guangshuo Li,
Aleksandr Loktionov, Ilias Apalodimas, Murali Karicheri,
Grygorii Strashko, Mugunthan V N, linux-omap
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
In switch 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.
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.
dual_emac mode already bypasses the ALE in promiscuous mode. In switch
mode program the unknown VLAN member list and flood masks to all ports
while promiscuous. The unknown VLAN force untagged egress mask stays 0,
so the tags are preserved.
Fixes: 0cd8f9cc0654 ("drivers: net: cpsw: enable promiscuous mode support")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
drivers/net/ethernet/ti/cpsw.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 14350ec5b7d0c..1390bf5ecba8c 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -150,11 +150,27 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
/* Flood All Unicast Packets to Host port */
cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1);
+
+ /* Forward packets of VLANs unknown to the ALE */
+ cpsw_ale_control_set(ale, 0, ALE_PORT_UNKNOWN_VLAN_MEMBER,
+ ALE_ALL_PORTS);
+ cpsw_ale_control_set(ale, 0, ALE_PORT_UNKNOWN_MCAST_FLOOD,
+ ALE_ALL_PORTS);
+ cpsw_ale_control_set(ale, 0,
+ ALE_PORT_UNKNOWN_REG_MCAST_FLOOD,
+ ALE_ALL_PORTS);
dev_dbg(&ndev->dev, "promiscuity enabled\n");
} else {
/* Don't Flood All Unicast Packets to Host port */
cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0);
+ cpsw_ale_control_set(ale, 0, ALE_PORT_UNKNOWN_VLAN_MEMBER,
+ 0);
+ cpsw_ale_control_set(ale, 0, ALE_PORT_UNKNOWN_MCAST_FLOOD,
+ 0);
+ cpsw_ale_control_set(ale, 0,
+ ALE_PORT_UNKNOWN_REG_MCAST_FLOOD, 0);
+
/* Enable Learn for all ports (host is port 0 and slaves are port 1 and up */
for (i = 0; i <= cpsw->data.slaves; i++) {
cpsw_ale_control_set(ale, i,
--
2.56.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 3/3] net: ethernet: ti: cpsw: don't untag frames on DSA conduit
2026-12-03 8:05 [PATCH net-next 0/3] net: ethernet: ti: cpsw: Support cascaded switches A. Sverdlin
2026-12-03 8:05 ` [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode A. Sverdlin
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 ` A. Sverdlin
2 siblings, 0 replies; 10+ messages in thread
From: A. Sverdlin @ 2026-12-03 8:05 UTC (permalink / raw)
To: netdev
Cc: Alexander Sverdlin, Siddharth Vadapalli, Roger Quadros,
Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Karl Mehltretter, Kevin Hao, Guangshuo Li,
Aleksandr Loktionov, Ilias Apalodimas, Murali Karicheri,
Grygorii Strashko, Mugunthan V N, linux-omap, Lukas Stockmann
From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
cpsw_rx_vlan_encap() strips the VLAN tag of received frames and passes it
as hwaccel tag, unless the host port is in the force untagged egress mask
of the VLAN. In the latter case the tag is lost. In dual-MAC mode this is
the case for the port VLANs, which default to VID 1 and 2 if not
configured in DT.
DSA tagging protocols which carry information in the VLAN tag, like
LAN9303, which encodes the source port in the VID, then interpret the
payload as the tag. Frames from LAN9303 port 1 are dropped with "Dropping
packet due to invalid source port".
Hand the frames to DSA as received if the netdev is a DSA conduit.
Fixes: 4b41d3436796 ("net: ethernet: ti: cpsw: allow untagged traffic on host port")
Tested-by: Lukas Stockmann <lukas.stockmann@siemens.com>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
---
drivers/net/ethernet/ti/cpsw_priv.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c
index 0580a7885d339..60f9db93ba735 100644
--- a/drivers/net/ethernet/ti/cpsw_priv.c
+++ b/drivers/net/ethernet/ti/cpsw_priv.c
@@ -18,6 +18,7 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/skbuff.h>
+#include <net/dsa.h>
#include <net/page_pool/helpers.h>
#include <net/pkt_cls.h>
#include <net/pkt_sched.h>
@@ -248,6 +249,10 @@ void cpsw_rx_vlan_encap(struct sk_buff *skb)
/* Remove VLAN header encapsulation word */
skb_pull(skb, CPSW_RX_VLAN_ENCAP_HDR_SIZE);
+ /* VLAN tag may carry DSA tagging information, keep it intact */
+ if (netdev_uses_dsa(skb->dev))
+ return;
+
pkt_type = (rx_vlan_encap_hdr >>
CPSW_RX_VLAN_ENCAP_HDR_PKT_TYPE_SHIFT) &
CPSW_RX_VLAN_ENCAP_HDR_PKT_TYPE_MSK;
--
2.56.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
2026-12-03 8:05 ` [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode A. Sverdlin
@ 2026-12-03 9:13 ` Siddharth Vadapalli
2026-12-03 13:06 ` Andrew Lunn
2026-12-04 8:53 ` netdev-bot+sashiko
2 siblings, 0 replies; 10+ messages in thread
From: Siddharth Vadapalli @ 2026-12-03 9:13 UTC (permalink / raw)
To: A. Sverdlin
Cc: netdev, Roger Quadros, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Karl Mehltretter, Kevin Hao,
Guangshuo Li, Aleksandr Loktionov, Ilias Apalodimas,
Murali Karicheri, Grygorii Strashko, Mugunthan V N, linux-omap,
Lukas Stockmann, s-vadapalli
On 12/3/26 1:35 PM, A. Sverdlin wrote:
> 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.
Would just the following diff also work? (given that the issue seems to be
with dropping packets of unknown VLANs)
diff --git a/drivers/net/ethernet/ti/cpsw_new.c
b/drivers/net/ethernet/ti/cpsw_new.c
index 9ea7b6ffc992..af38711770f7 100644
--- a/drivers/net/ethernet/ti/cpsw_new.c
+++ b/drivers/net/ethernet/ti/cpsw_new.c
@@ -79,6 +79,7 @@ static bool cpsw_is_switch_en(struct cpsw_common *cpsw)
static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
{
struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
+ struct cpsw_priv *priv = netdev_priv(ndev);
bool enable_uni = false;
int i;
@@ -100,12 +101,16 @@ static void cpsw_set_promiscious(struct net_device
*ndev, bool enable)
}
if (enable) {
+ cpsw_ale_control_set(cpsw->ale, priv->emac_port,
+ ALE_PORT_DROP_UNKNOWN_VLAN, 0);
/* Enable unknown unicast, reg/unreg mcast */
cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM,
ALE_P0_UNI_FLOOD, 1);
dev_dbg(cpsw->dev, "promiscuity enabled\n");
} else {
+ cpsw_ale_control_set(cpsw->ale, priv->emac_port,
+ ALE_PORT_DROP_UNKNOWN_VLAN, 1);
/* Disable unknown unicast */
cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM,
ALE_P0_UNI_FLOOD, 0);
Regards,
Siddharth.
>
> 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();
>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
2026-12-03 8:05 ` [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode A. Sverdlin
2026-12-03 9:13 ` Siddharth Vadapalli
@ 2026-12-03 13:06 ` Andrew Lunn
2026-12-03 13:11 ` Sverdlin, Alexander
2026-12-04 8:53 ` netdev-bot+sashiko
2 siblings, 1 reply; 10+ messages in thread
From: Andrew Lunn @ 2026-12-03 13:06 UTC (permalink / raw)
To: A. Sverdlin
Cc: netdev, Siddharth Vadapalli, Roger Quadros, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Karl Mehltretter, Kevin Hao, Guangshuo Li, Aleksandr Loktionov,
Ilias Apalodimas, Murali Karicheri, Grygorii Strashko,
Mugunthan V N, linux-omap, Lukas Stockmann
On Thu, Dec 03, 2026 at 09:05:09AM +0100, A. Sverdlin wrote:
> 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")
Is this a regression? Did it ever work?
I think this is net-next material.
Andrew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
2026-12-03 13:06 ` Andrew Lunn
@ 2026-12-03 13:11 ` Sverdlin, Alexander
2026-12-03 13:13 ` Andrew Lunn
0 siblings, 1 reply; 10+ messages in thread
From: Sverdlin, Alexander @ 2026-12-03 13:11 UTC (permalink / raw)
To: andrew@lunn.ch
Cc: Stockmann, Lukas, andrew+netdev@lunn.ch,
lgs201920130244@gmail.com, davem@davemloft.net,
edumazet@kernel.org, pabeni@redhat.com, s-vadapalli@ti.com,
kmehltretter@gmail.com, haokexin@gmail.com, kuba@kernel.org,
ilias.apalodimas@linaro.org, m-karicheri2@ti.com,
netdev@vger.kernel.org, aleksandr.loktionov@intel.com,
mugunthanvnm@ti.com, grygorii.strashko@ti.com, rogerq@kernel.org,
linux-omap@vger.kernel.org
Hi Andrew!
On Thu, 2026-12-03 at 14:06 +0100, Andrew Lunn wrote:
> > 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")
>
> Is this a regression? Did it ever work?
I would not be able to tell, how it should worked before.
No, I don't consider it a regression.
And I dropped Cc: stable@ right before submitting.
> I think this is net-next material.
Which I tagged correctly, I believe.
Do you mean I shall drop Fixes: tag in v2+?
--
Alexander Sverdlin
Siemens AG
www.siemens.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
2026-12-03 13:11 ` Sverdlin, Alexander
@ 2026-12-03 13:13 ` Andrew Lunn
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2026-12-03 13:13 UTC (permalink / raw)
To: Sverdlin, Alexander
Cc: Stockmann, Lukas, andrew+netdev@lunn.ch,
lgs201920130244@gmail.com, davem@davemloft.net,
edumazet@kernel.org, pabeni@redhat.com, s-vadapalli@ti.com,
kmehltretter@gmail.com, haokexin@gmail.com, kuba@kernel.org,
ilias.apalodimas@linaro.org, m-karicheri2@ti.com,
netdev@vger.kernel.org, aleksandr.loktionov@intel.com,
mugunthanvnm@ti.com, grygorii.strashko@ti.com, rogerq@kernel.org,
linux-omap@vger.kernel.org
> > > Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> >
> > Is this a regression? Did it ever work?
>
> I would not be able to tell, how it should worked before.
> No, I don't consider it a regression.
> And I dropped Cc: stable@ right before submitting.
>
> > I think this is net-next material.
>
> Which I tagged correctly, I believe.
> Do you mean I shall drop Fixes: tag in v2+?
Yes. That can trigger the backport, even without Cc: stable.
Andrew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
2026-12-03 8:05 ` [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode A. Sverdlin
2026-12-03 9:13 ` Siddharth Vadapalli
2026-12-03 13:06 ` Andrew Lunn
@ 2026-12-04 8:53 ` netdev-bot+sashiko
2 siblings, 0 replies; 10+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04 8:53 UTC (permalink / raw)
To: alexander.sverdlin
Cc: netdev, s-vadapalli, rogerq, andrew+netdev, davem, edumazet, kuba,
pabeni, kmehltretter, haokexin, lgs201920130244,
aleksandr.loktionov, ilias.apalodimas, m-karicheri2,
grygorii.strashko, mugunthanvnm, linux-omap, lukas.stockmann
Thank you for your contribution! Sashiko AI review found 6 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 4 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch leaves two owners of the global ALE_BYPASS bit and
only handles one direction of the conflict.
- [Medium] ALE_BYPASS is a global ALE_CONTROL bit
(ale_controls[ALE_BYPASS] has port_offset=0 and port_shift=0, so the…
- [Medium] Promiscuous-originated ALE_BYPASS can survive a switch-mode
transition made while all interfaces are down.
- [Medium] After this patch, two paths read and write the ALE_BYPASS bit
and its shadow cpsw->ale_bypass, and no common lock serializes them.
- [Low] The commit message's root cause is incomplete.
- [Low]…
--
net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
This commit changes cpsw_set_promiscious() in the cpsw_new driver so that
a promiscuous dual-MAC port enables ALE_BYPASS instead of
ALE_P0_UNI_FLOOD. With that, frames tagged with VIDs the ALE doesn't know
reach the host. On leaving promiscuous mode the devlink-configured bypass
value is restored, and cpsw_dl_switch_mode_set() re-applies rx mode after
a switch mode change.
> 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.
[Severity: Low]
Is this root cause description complete? In dual-MAC mode
cpsw_port_add_dual_emac_def_ale_entries() also sets the per-port
drop-unknown-VLAN bit explicitly:
drivers/net/ethernet/ti/cpsw_new.c:cpsw_port_add_dual_emac_def_ale_entries() {
...
cpsw_ale_control_set(cpsw->ale, priv->emac_port,
ALE_PORT_DROP_UNKNOWN_VLAN, 1);
...
}
So programming the Unknown VLAN register alone would not be enough in
dual-MAC mode. In switch mode, cpsw_port_add_switch_def_ale_entries()
clears this bit.
Could the commit message mention this as well?
> 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);
[Severity: Medium]
ALE_BYPASS is a global ALE_CONTROL bit, and the port argument is ignored:
drivers/net/ethernet/ti/cpsw_ale.c:
[ALE_BYPASS] = {
.name = "bypass",
.offset = ALE_CONTROL,
.port_offset = 0,
.shift = 4,
.port_shift = 0,
.bits = 1,
},
If one dual-MAC port becomes promiscuous, does this also switch off
hardware filtering for the other, non-promiscuous port? Unicast
destination, multicast and VLAN membership filtering would all be
bypassed.
For example, with the DSA conduit on port 1 in promiscuous mode, the port
2 netdev would receive every frame on its wire and have to drop them in
software. Before this patch, the only setting shared between the ports
was P0_UNI_FLOOD.
The commit message says port separation is preserved. That holds for
forwarding. Should it also say that the sibling port loses its hardware
filtering?
[Severity: Low]
The documentation now contradicts this. The Dual mac mode section of
Documentation/networking/device_drivers/ethernet/ti/cpsw_switchdev.rst
still says:
- optimized promiscuous mode: The P0_UNI_FLOOD (both ports) is enabled in
addition to ALLMULTI (current port) instead of ALE_BYPASS.
So, Ports in promiscuous mode will keep possibility of mcast and vlan
filtering, ...
Should that text be updated together with this change?
>
> 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);
[Severity: Medium]
This restores the devlink value when leaving promiscuous mode. What about
the other direction? cpsw_dl_ale_ctrl_set() still writes the register
directly:
drivers/net/ethernet/ti/cpsw_new.c:cpsw_dl_ale_ctrl_set() {
...
case CPSW_DL_PARAM_ALE_BYPASS:
ret = cpsw_ale_control_set(cpsw->ale, 0, ALE_BYPASS,
ctx->val.vbool);
if (!ret) {
cpsw->ale_bypass = ctx->val.vbool;
cpsw_port_offload_fwd_mark_update(cpsw);
}
...
}
Suppose ale_bypass is set to false through devlink while a dual-MAC port,
such as the DSA conduit, is promiscuous. Wouldn't that clear ALE_BYPASS
while IFF_PROMISC stays set? Frames with unknown VIDs would then be
dropped again until a later rx_mode event re-runs
cpsw_set_promiscious().
cpsw_dl_ale_ctrl_get() also reports the hardware bit, not
cpsw->ale_bypass:
ctx->val.vbool = cpsw_ale_control_get(cpsw->ale, 0, ALE_BYPASS);
Would devlink param show now report ale_bypass as true whenever a
dual-MAC port is promiscuous, even though it was never enabled through
devlink? Documentation/networking/devlink/ti-cpsw-switch.rst describes
this parameter as a bypass mode that the user enables for debugging.
The patch already re-applies rx mode after the switch_mode writer of
ALE_BYPASS. Could cpsw_dl_ale_ctrl_set() do the same, or write the
effective value (cpsw->ale_bypass or any promiscuous dual-MAC slave)?
The getter could then return cpsw->ale_bypass.
The later patches in this series don't appear to touch cpsw_new.c, so
this would remain in the final state.
[Severity: Medium]
Is anything serializing this read of cpsw->ale_bypass with
cpsw_dl_ale_ctrl_set()?
cpsw_ndo_set_rx_mode_work() holds rtnl_lock and netif_addr_lock_bh.
devlink_param_set() calls param->set() under the devlink instance lock
only, and cpsw_dl_ale_ctrl_set() doesn't take rtnl, unlike
cpsw_dl_switch_mode_set().
One possible interleaving:
rx_mode work (leaving promisc) devlink set ale_bypass=false
cpsw_set_promiscious(ndev, false)
reads cpsw->ale_bypass == true
cpsw_dl_ale_ctrl_set()
ALE_BYPASS = 0
cpsw->ale_bypass = false
cpsw_ale_control_set(..., ALE_BYPASS, 1)
Wouldn't the hardware then stay in bypass while cpsw->ale_bypass is
false? The getter would also report true right after the parameter was
set to false.
The unlocked read-modify-write of ALE_CONTROL already existed through
ALE_P0_UNI_FLOOD. What's new is that both paths now share the same bit
and the same shadow variable. Taking rtnl_lock in cpsw_dl_ale_ctrl_set()
and re-applying rx mode there might address both this and the issue
above.
[ ... ]
> @@ -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();
[Severity: Medium]
What happens if the switch mode is changed while all interfaces are
down? The !if_running path jumps straight to exit:
if (!if_running) {
/* all ndevs are down */
cpsw->data.dual_emac = !switch_en;
...
goto exit;
}
That skips both the ALE_BYPASS reset and this new loop.
The sequence would be:
1. A dual-MAC port is promiscuous, so ALE_BYPASS is 1.
2. All ports are brought down. cpsw_ndo_stop()->cpsw_ale_stop() only
sets ALE_CLEAR and clears ALE_ENABLE.
3. devlink switch_mode is set to true, which takes the !if_running path.
4. A port is opened. cpsw_ale_start() and cpsw_init_host_port_switch()
don't write ALE_BYPASS. cpsw_set_promiscious() returns early because
cpsw_is_switch_en() is true.
If ALE_CONTROL survives the soft reset or runtime PM idle, could the
switch end up running with ALE bypass on while cpsw->ale_bypass is
false?
Once both ports are bridged, cpsw_port_offload_fwd_mark_update() decides
from the software flag:
if (!cpsw->ale_bypass &&
(cpsw->br_members == (ALE_PORT_1 | ALE_PORT_2)))
set_val = 1;
With offload_fwd_mark set, the software bridge would not forward, and the
hardware would not forward either. Before this patch the leftover state
was only P0_UNI_FLOOD, and cpsw_init_host_port_switch() sets that anyway.
I haven't confirmed whether the hardware resets ALE_CONTROL here.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203080514.577407-1-alexander.sverdlin%40siemens.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 2/3] net: ethernet: ti: cpsw: forward unknown VLANs in promiscuous switch mode
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-04 8:53 ` netdev-bot+sashiko
0 siblings, 0 replies; 10+ messages in thread
From: netdev-bot+sashiko @ 2026-12-04 8:53 UTC (permalink / raw)
To: alexander.sverdlin
Cc: netdev, s-vadapalli, rogerq, andrew+netdev, davem, edumazet, kuba,
pabeni, kmehltretter, haokexin, lgs201920130244,
aleksandr.loktionov, ilias.apalodimas, m-karicheri2,
grygorii.strashko, mugunthanvnm, linux-omap, lukas.stockmann
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch may not fix what it says it fixes.
- [Medium] Suppose the Unknown VLAN register does control forwarding of
unknown VIDs, as the commit message assumes.
--
net: ethernet: ti: cpsw: forward unknown VLANs in promiscuous switch mode
In legacy cpsw switch mode, this commit sets the ALE unknown VLAN member
list and the unknown and registered multicast flood masks to all ports
while the interface is promiscuous. It clears them again when promiscuity
is turned off. The goal is to let frames from VLAN-tagging DSA switches
such as LAN9303 reach the host.
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index 14350ec5b7d0c..1390bf5ecba8c 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -150,11 +150,27 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
>
> /* Flood All Unicast Packets to Host port */
> cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1);
> +
> + /* Forward packets of VLANs unknown to the ALE */
> + cpsw_ale_control_set(ale, 0, ALE_PORT_UNKNOWN_VLAN_MEMBER,
> + ALE_ALL_PORTS);
> + cpsw_ale_control_set(ale, 0, ALE_PORT_UNKNOWN_MCAST_FLOOD,
> + ALE_ALL_PORTS);
> + cpsw_ale_control_set(ale, 0,
> + ALE_PORT_UNKNOWN_REG_MCAST_FLOOD,
> + ALE_ALL_PORTS);
[Severity: Medium]
Are these writes enough on their own while the ALE is still VLAN-aware?
In switch mode, cpsw_init_host_port() does this:
drivers/net/ethernet/ti/cpsw.c:cpsw_init_host_port() {
...
cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM, ALE_VLAN_AWARE,
CPSW_ALE_VLAN_AWARE);
...
}
CPSW_ALE_VLAN_AWARE is 1, and this patch does not change ALE_CONTROL
bit 2.
As I recall, the CPSW TRM describes ALE_VLAN_AWARE as "0 = flood if VLAN
not found, 1 = drop packet if VLAN not found". I have not been able to
re-check that against the TRM. If the hardware works that way, the
unknown VLAN masks only apply in the VLAN-unaware case.
The LAN9303 source port VIDs would then still be dropped while the
conduit is promiscuous. cpsw.c never sets default_vlan, so the ALE only
knows VID 0 and the VIDs the host adds.
Two other things point the same way:
- gbe_init_host_port() in netcp_ethss.c is the only other in-tree user of
these masks. It sets ALE_PORT_UNKNOWN_VLAN_MEMBER and never sets
ALE_VLAN_AWARE.
- The sibling commit "net: ethernet: ti: cpsw_new: bypass ALE in
promiscuous mode" fixes the same symptom with ALE_BYPASS, which works
whatever VLAN_AWARE is set to. That commit has a Tested-by. This one
does not, and the rest of the series seems to have been tested in
dual_emac mode, which never reaches this branch.
Has legacy cpsw switch mode with only this patch been shown on hardware
to receive LAN9303-tagged frames? If not, the fix may need to clear
ALE_VLAN_AWARE or enable ALE_BYPASS while promiscuous.
If so, this part of the commit message would also need updating:
"In switch 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."
[Severity: Medium]
If these masks do take effect, does writing ALE_ALL_PORTS here also
forward unknown-VID frames between the two external slave ports, and not
just to the host?
ALE_ALL_PORTS is 0x7, which covers the host, port 1 and port 2. The
ALE_UNKNOWNVLAN fields are global (port_offset and port_shift are 0 in
ale_controls[]), so they apply to every ingress port.
This branch also sets ALE_PORT_NOLEARN and ALE_PORT_NO_SA_UPDATE on all
ports, so unknown-VID unicast is always flooded to every port in the
member list.
With LAN9303 on slave port 1, this seems to have three effects:
- Every frame LAN9303 sends to the CPU with a source-port VID is also
flooded out slave port 2. DSA keeps the conduit promiscuous, so in
practice this happens all the time.
- Host TX in switch mode is non-directed and goes through the ALE
lookup, so DSA-tagged frames from the host also go out port 2.
- A device on slave port 2 can send frames with LAN9303 management VIDs.
Those now reach the LAN9303 CPU port; before this patch they were
dropped.
Some context makes this less of a change. Switch mode already gives known
VLANs ALE_ALL_PORTS membership through cpsw_add_vlan_ale_entry() and
cpsw_add_default_vlan(). Promiscuous mode already floods known-VLAN
unicast to both ports. So this extends an existing design choice.
Is it intended that VLAN filtering between the external ports stops
whenever the host is promiscuous, for example under tcpdump or DSA? If
so, could the commit message mention this side effect?
> dev_dbg(&ndev->dev, "promiscuity enabled\n");
> } else {
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261203080514.577407-1-alexander.sverdlin%40siemens.com
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-12-04 8:53 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 8:05 [PATCH net-next 0/3] net: ethernet: ti: cpsw: Support cascaded switches A. Sverdlin
2026-12-03 8:05 ` [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode A. Sverdlin
2026-12-03 9:13 ` Siddharth Vadapalli
2026-12-03 13:06 ` Andrew Lunn
2026-12-03 13:11 ` Sverdlin, Alexander
2026-12-03 13:13 ` Andrew Lunn
2026-12-04 8:53 ` netdev-bot+sashiko
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-04 8:53 ` netdev-bot+sashiko
2026-12-03 8:05 ` [PATCH net-next 3/3] net: ethernet: ti: cpsw: don't untag frames on DSA conduit A. Sverdlin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox