[PATCH net v3] net: dsa: motorcomm: Isolate all ports during chip setup

From: David Yang

Date: Mon Oct 26 2026 - 19:03:29 EST


The chip setup only blocked unknown unicast and unknown multicast
frames, known multicast and broadcast were left open (though the former
cannot appear while the FDB is still empty). Broadcast frames received
on a port may flood out of the other ports before port_setup() runs.

Close the window by fully isolating every port right after the hardware
reset.

Fixes: 186623f4aa72 ("net: dsa: yt921x: Add support for Motorcomm YT921x")
Signed-off-by: David Yang <mmyangfl@xxxxxxxxx>
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
---
v3:
- typo
v2: https://lore.kernel.org/r/20261025144834.2810828-1-mmyangfl@xxxxxxxxx
- reword and reduce code changes
v1: https://lore.kernel.org/r/20261024144023.1010237-1-mmyangfl@xxxxxxxxx
drivers/net/dsa/motorcomm/chip.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/net/dsa/motorcomm/chip.c b/drivers/net/dsa/motorcomm/chip.c
index d4fc20c52a58..f71160eefe48 100644
--- a/drivers/net/dsa/motorcomm/chip.c
+++ b/drivers/net/dsa/motorcomm/chip.c
@@ -2221,6 +2221,7 @@ static int yt921x_chip_reset(struct yt921x_priv *priv)
{
struct device *dev = yt921x_priv_to_device(priv);
u16 eth_p_tag;
+ u32 ctrl;
u32 val;
int res;

@@ -2258,6 +2259,17 @@ static int yt921x_chip_reset(struct yt921x_priv *priv)
return -EINVAL;
}

+ /* Block all traffic as soon as we reset the hardware since it now acts
+ * as a dumb switch.
+ */
+ for (int port = 0; port < YT921X_PORT_NUM; port++) {
+ ctrl = ~(u32)0;
+ res = yt921x_reg_write(priv, YT921X_PORTn_ISOLATION(port),
+ ctrl);
+ if (res)
+ return res;
+ }
+
return 0;
}

--
2.53.0