[net-next PATCH 02/10] net: dsa: realtek: rtl8365mb: set STP state to disabled early

From: Luiz Angelo Daros de Luca

Date: Tue Mar 31 2026 - 19:03:14 EST


From: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>

Since we are going around and manipulating a number of port settings
during setup, it's safer to assume that the port is disabled to begin
with. This is purely defensive.

Co-developed-by: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>
Signed-off-by: Alvin Šipraga <alsi@xxxxxxxxxxxxxxx>
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@xxxxxxxxx>
---
drivers/net/dsa/realtek/rtl8365mb.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/dsa/realtek/rtl8365mb.c b/drivers/net/dsa/realtek/rtl8365mb.c
index 31fa94dac627..530ff5503543 100644
--- a/drivers/net/dsa/realtek/rtl8365mb.c
+++ b/drivers/net/dsa/realtek/rtl8365mb.c
@@ -1989,6 +1989,12 @@ static int rtl8365mb_setup(struct dsa_switch *ds)
if (dsa_is_unused_port(ds, i))
continue;

+ /* Set the initial STP state of all ports to DISABLED, otherwise
+ * ports will still forward frames to the CPU despite being
+ * administratively down by default.
+ */
+ rtl8365mb_port_stp_state_set(ds, i, BR_STATE_DISABLED);
+
/* Forward only to the CPU */
ret = rtl8365mb_port_set_isolation(priv, i, cpu->mask);
if (ret)
@@ -1999,12 +2005,6 @@ static int rtl8365mb_setup(struct dsa_switch *ds)
if (ret)
goto out_teardown_irq;

- /* Set the initial STP state of all ports to DISABLED, otherwise
- * ports will still forward frames to the CPU despite being
- * administratively down by default.
- */
- rtl8365mb_port_stp_state_set(ds, i, BR_STATE_DISABLED);
-
/* Set up per-port private data */
p->priv = priv;
p->index = i;

--
2.53.0