[PATCH net-next 3/3] net: dsa: forget the port ageing time when the port leaves the bridge

From: Oleksij Rempel

Date: Wed Nov 04 2026 - 06:57:01 EST


A port that leaves the bridge keeps its cached dp->ageing_time, and it
still counts for dsa_switch_fastest_ageing_time(). A port that leaves
during an STP topology change keeps the switch at the short value until
the port joins a bridge again.

Clear the cached value when the port leaves the bridge. The switch is
not reprogrammed on leave. If the leaving port held the shortest ageing
time, for example during a topology change, the switch keeps that value
until the next ageing time change or bridge join in the DSA tree.

Found by code inspection. On a KSZ9893 with lan1 and lan2 in a bridge,
setting the ageing time to 10 s, removing lan2 and setting 300 s left
the switch at 10 s without this patch and at 300 s with it.

Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
net/dsa/port.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/net/dsa/port.c b/net/dsa/port.c
index 3195d8b7c69c5e0fbc4007421218c2ff1db0ce47..21b237332cc77b9f99520e71dae01c2c9b49d496 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -414,7 +414,10 @@ static void dsa_port_switchdev_unsync_attrs(struct dsa_port *dp,

/* Ageing time may be global to the switch chip, so don't change it
* here because we have no good reason (or value) to change it to.
+ * But forget the port's value, so that the shortest ageing time of
+ * the ports still in a bridge is the one programmed next time.
*/
+ dp->ageing_time = 0;
}

static int dsa_port_bridge_create(struct dsa_port *dp,

--
2.47.3