From f3743850bf6a560fbc265b8b6da5a389ad405dbd Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Sun, 22 Feb 2026 17:40:00 +0100 Subject: [PATCH] realtek: dsa: switch RTL93xx to new fast_age() The driver has a generic fast_age() function. Use it in the dsa specific callback port_fast_age() for RTL93xx. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/22145 Signed-off-by: Robert Marko --- .../files-6.12/drivers/net/dsa/rtl83xx/dsa.c | 50 ++++--------------- 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c index 74c5b5cfc5..9952e39b23 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c @@ -1936,44 +1936,6 @@ void rtldsa_83xx_fast_age(struct dsa_switch *ds, int port) mutex_unlock(&priv->reg_mutex); } -static void rtldsa_931x_fast_age_old(struct dsa_switch *ds, int port) -{ - struct rtl838x_switch_priv *priv = ds->priv; - u32 val; - - mutex_lock(&priv->reg_mutex); - - sw_w32(0, RTL931X_L2_TBL_FLUSH_CTRL + 4); - - val = 0; - val |= port << 11; - val |= BIT(24); /* compare port id */ - val |= BIT(28); /* status - trigger flush */ - sw_w32(val, RTL931X_L2_TBL_FLUSH_CTRL); - - do { } while (sw_r32(RTL931X_L2_TBL_FLUSH_CTRL) & BIT(28)); - - mutex_unlock(&priv->reg_mutex); -} - -static void rtldsa_930x_fast_age_old(struct dsa_switch *ds, int port) -{ - struct rtl838x_switch_priv *priv = ds->priv; - - if (priv->family_id == RTL9310_FAMILY_ID) - return rtldsa_931x_fast_age_old(ds, port); - - pr_debug("FAST AGE port %d\n", port); - mutex_lock(&priv->reg_mutex); - sw_w32(port << 11, RTL930X_L2_TBL_FLUSH_CTRL + 4); - - sw_w32(BIT(26) | BIT(30), RTL930X_L2_TBL_FLUSH_CTRL); - - do { } while (sw_r32(priv->r->l2_tbl_flush_ctrl) & BIT(30)); - - mutex_unlock(&priv->reg_mutex); -} - static int rtldsa_port_mst_state_set(struct dsa_switch *ds, int port, const struct switchdev_mst_state *st) { @@ -2185,6 +2147,16 @@ static int rtldsa_vlan_del(struct dsa_switch *ds, int port, return 0; } +static void rtldsa_port_fast_age(struct dsa_switch *ds, int port) +{ + struct rtl838x_switch_priv *priv = ds->priv; + + mutex_lock(&priv->reg_mutex); + if (!priv->r->fast_age) + priv->r->fast_age(priv, port, -1); + mutex_unlock(&priv->reg_mutex); +} + static int rtldsa_port_vlan_fast_age(struct dsa_switch *ds, int port, u16 vid) { struct rtl838x_switch_priv *priv = ds->priv; @@ -3076,7 +3048,7 @@ const struct dsa_switch_ops rtldsa_93xx_switch_ops = { .port_bridge_join = rtldsa_port_bridge_join, .port_bridge_leave = rtldsa_port_bridge_leave, .port_stp_state_set = rtldsa_port_stp_state_set, - .port_fast_age = rtldsa_930x_fast_age_old, + .port_fast_age = rtldsa_port_fast_age, .port_mst_state_set = rtldsa_port_mst_state_set, .port_vlan_filtering = rtldsa_vlan_filtering,