From eb51d41b129cac3cd83ed3c4349d84dd44bb6842 Mon Sep 17 00:00:00 2001 From: Gennaro Cimmino Date: Sat, 10 Oct 2026 18:04:52 +0200 Subject: [PATCH] realtek: dsa: let the FDB dump walk reschedule rtldsa_port_fdb_dump() calls cond_resched() every 64 rows, but at the end of the loop, after the "continue" that skips each row that is not a valid unicast entry. So it only reschedules when such a 64th row happens to hold a valid unicast entry. DSA calls the function once per port. On the 52-port HPE 1920-48G (RTL8393) a full "bridge fdb show" walks the 16384 rows 52 times: 96 ms per port, 5.0 s in all. With PREEMPT_NONE no other task runs on that CPU meanwhile. When the kernel's watchdog worker, which toggles the board's external PT7A7514, waits on that CPU, it misses its pings and the board resets during the dump, without any console output. Move cond_resched() to the top of the loop, as the L3 debugfs dumps already do, so it runs every 64 rows whatever the row holds. Tested on the HPE 1920-48G under ping load, with full dumps. Without this change and the dump pinned to CPU0, 20 of 20 dumps completed with the watchdog worker on CPU1; moved to CPU0 in the same boot, the board reset on the first dump. With this change, 20 of 20 completed with both on CPU0, 20 of 20 with CPU1 kept busy and 20 of 20 with nothing pinned. Across those 60 dumps no two toggles of the watchdog GPIO were more than 0.51 s apart. Not tested on other families. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Gennaro Cimmino Link: https://github.com/openwrt/openwrt/pull/25787 Signed-off-by: Markus Stockhausen --- .../linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/dsa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/dsa.c index 2780f776d03..6663a059e8e 100644 --- a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/dsa.c @@ -1049,6 +1049,9 @@ static int rtldsa_port_fdb_dump(struct dsa_switch *ds, int port, for (int i = 0; i < uc_rows; i++) { struct rtl838x_l2_entry e = {}; + if (!((i + 1) % 64)) + cond_resched(); + priv->r->read_l2_entry_using_hash(i >> 2, i & 0x3, &e); if (!e.valid || e.type != L2_UNICAST || e.is_trunk) @@ -1056,9 +1059,6 @@ static int rtldsa_port_fdb_dump(struct dsa_switch *ds, int port, if (e.port == port || e.port == RTL930X_PORT_IGNORE) cb(e.mac, e.rvid, e.is_static, data); - - if (!((i + 1) % 64)) - cond_resched(); } for (int i = 0; i < cam_rows; i++) {