From: Alexander Sverdlin 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 --- 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