From 886975d856c77f1fd9ba8bfb88699b6e331d2759 Mon Sep 17 00:00:00 2001 From: d00f Date: Tue, 4 Aug 2026 03:20:07 +0200 Subject: [PATCH] stp: stop forcing the SFP port to forwarding in the CPU-port mask The "do not block the CPU port" mask 0x0f covers bits 3:0 of MSTP_STATES byte 1, which is ports 8 AND 9 - so stp_setup unconditionally forced port 8 (a real front port, the SFP uplink on SWTGW218AS) into forwarding and it could never be blocked. The CPU port alone is bits 3:2 = 0x0c. --- rtl837x_stp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtl837x_stp.c b/rtl837x_stp.c index 3266041..8d2e3fd 100644 --- a/rtl837x_stp.c +++ b/rtl837x_stp.c @@ -271,8 +271,8 @@ void stp_setup(void) __banked port_hello[i] = TIME_HELLO; port_timers[i] = 0x280; // 10 s in blocking state (at the ~64 Hz stp_timers rate) } - sfr_data[1] |= 0x0f; // Do not block CPU-Port - reg_write_m(RTL837X_MSTP_STATES); // R5310-000d555f + sfr_data[1] |= 0x0c; // Do not block the CPU port (bits 3:2 of byte 1 = port 9) + reg_write_m(RTL837X_MSTP_STATES); print_reg(RTL837X_MSTP_STATES); write_char('\n'); @@ -294,7 +294,7 @@ void stp_off(void) __banked uint8_t bit_mask = 0b11 << ( (i << 1) & 0x7); sfr_data[3 - (i >> 2)] |= bit_mask; } - sfr_data[1] |= 0x0f; // Do not block CPU-Port + sfr_data[1] |= 0x0c; // Do not block the CPU port (bits 3:2 of byte 1 = port 9) reg_write_m(RTL837X_MSTP_STATES); /* Restore BPDU transparency: flood them again like an unmanaged switch. */