* [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; 5+ 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] 5+ 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
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, 1 reply; 5+ 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] 5+ 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-03 8:05 ` [PATCH net-next 3/3] net: ethernet: ti: cpsw: don't untag frames on DSA conduit A. Sverdlin
2 siblings, 0 replies; 5+ 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] 5+ 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; 5+ 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] 5+ 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
0 siblings, 0 replies; 5+ 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] 5+ messages in thread
end of thread, other threads:[~2026-12-03 9:13 UTC | newest]
Thread overview: 5+ 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 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox