🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17876

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

#17876
From: Oleksij Rempel
Date: Tue, 17 Nov 2026 13:02
55 lines
12424 bytes
Clear the cached dp->ageing_time when the port leaves the bridge.
Otherwise dsa_switch_fastest_ageing_time() still uses the ageing time
of the port that left. If the port leaves with a shorter ageing time,
for example during an STP topology change, the switch stays at the
short value until that port joins a bridge again. With this change the
switch goes back to the long value when the bridge restores it at the
end of the topology change. The switch gets the restored value only if
another port of the same bridge is still in this DSA tree.

Found by code inspection. Tested on a KSZ9893 with lan1 and lan2 in a
bridge, ageing time 300 s:
- kernel STP, forward delay 4 s, lan2 removed during a topology change:
  without this patch the switch stayed at 8 s (2 x 4 s). With it, the
  switch went back to 300 s at the end of the topology change.
- no STP: I set the ageing time to 10 s, removed lan2, then set 300 s.
  The switch stayed at 10 s without this patch and went to 300 s with
  it.

Fixes: 34a79f63bbe4 ("net: dsa: support switchdev ageing time attr")
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
Changes in v3:
- No changes.

Changes in v2:
- Say how long the short ageing time stays, with an STP test (Andrew)
- Rephrase the commit message and the comment
- Move the case of the last bridge port leaving to the cover letter
- Add a Fixes tag
---
 net/dsa/port.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/dsa/port.c b/net/dsa/port.c
index 15e7da20b0e2f470a0ce5b763fa73b9b66b4c6f2..54c9709840952210ecd1abdfde31f751d07ef2b6 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -415,6 +415,12 @@ 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.
 	 */
+
+	/* Forget the ageing time cached for this port.
+	 * dsa_switch_fastest_ageing_time() skips 0, so this port no longer
+	 * counts towards the minimum.
+	 */
+	dp->ageing_time = 0;
 }
 
 static int dsa_port_bridge_create(struct dsa_port *dp,

-- 
2.47.3
Technical Details
Message-ID: <20261117-ksz-stp-ageing-v3-3-135de6b9f8ad@pengutronix.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365275-linux-kernel-netdev=dewy.ru
References: <20261117-ksz-stp-ageing-v3-0-135de6b9f8ad@pengutronix.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365275-linux-kernel-netdev=dewy.ru
From: o.rempel@pengutronix.de (Oleksij Rempel)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v3 3/3] net: dsa: forget the port ageing time when
 the port leaves the bridge
Date: Tue, 17 Nov 2026 14:02:13 +0100
Organization: Usenet Network
Message-ID: <20261117-ksz-stp-ageing-v3-3-135de6b9f8ad@pengutronix.de>
References: <20261117-ksz-stp-ageing-v3-0-135de6b9f8ad@pengutronix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2332964"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:YVd99XPcSTMpID0Qp4p8DwavaLE= sha256:wOTIYrVubaVRS/KGDXdapdK8dQGrSpn+Qsb5Ue1JJc4=
	sha1:vF03p4IEmUCaNzLJT25M3B0ZEWc= sha256:/ZFjuVqgMtSm9VZiLDQLKMlUUTEXAefTyWc52T+dxts=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 7BEAB114F70; Tue, 17 Nov 2026 16:03:27 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=pengutronix.de
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id LkJW4z5eg7JK;
	Tue, 17 Nov 2026 16:03:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365275-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=pengutronix.de
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 3C4D2114F4F; Tue, 17 Nov 2026 16:03:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 92B2E2FFC1; Tue, 17 Nov 2026 13:02:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794920554;
	b=0mepHMTEQ/VC1+GsINNuPUzR+1guIdXbQvPYw+4OPS20N2pvczePVMMeXApxAI3M7WhZ
	 YbhByf28Twis9dawIlleuJp7ScZcaOngxSzQzHn5+hu6LZNuxthn/V8nuTh7lIjmA9LwC
	 Il2uOkPkxabeSWOwLeDrlIecuhvooT2lh4wlTiJElL8H+v1dbsAXt1XcZPTJaD56tIN5O
	 iPAJ/TAXs2uKLoGLYjdXzk6VmA0enZHzeiECt8BN6Jxp6V80GN6fpTPBXjE7urjcLJqEb
	 7fvsJHzwG7BYOsH+/H7CgTw/h8PPFg81C0/vNawkikSkmkwJ+jkxnRLTwryhOUH81QA==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794920554;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
	 From:Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer;
	bh=bB+QIZL4TfOJJ6oLWxrz5vX9khwt59svjLxkzj7XuZA=;
	b=FwypVQZIw8bdAsdwkxzHHhxvLpbBdxkaP9qE9P/bsTR5ObqzSnw4sOv3lZoSA9Yk/gO3
	 Ts55i/y44CPrCwxWJqVIXk8XxL3NDqDVe+4QuOis/UCjSEfLB7wP69uhhGT6XT6BkJSIL
	 I8tMHMKHUm2eTSYo+gHw4E/q33RGCouTQOPT5S8tDEhDlKEmzVGHxym6z8dpreT6Enwti
	 4my20mSDzvgISSaP5rDMOqZsTckOfbOCOw/GdlkIhNeIPqra3AWuPuUMzX/rA2Ht3q9+C
	 20eUutN8algKZqNNGKJqqKGu4izl3ZTGZqKtdfy0eSbfMmCTkDMYwWUl/Dp7BWxCpeg==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b="WLS/FlwA";
	dmarc=none header.from=pengutronix.de;
	spf=pass smtp.mailfrom=pengutronix.de;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F90A606A895;
	Tue, 17 Nov 2026 13:02:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=WLS/FlwA
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794920543;
	b=3NGqyNQz6WDIuv/vvrWmswo5wNC+DyaDer9ab4Mha7jlPNyvw3prss9LwSgWwUicro25
	 Aqq1ATYNChSqBKDwUaNpmfJDq6UdUjPQZBr9BR+YBfs0YfAJ2LOVbnMJbGPYzJdllQUrO
	 NYxjEdx22HRkCwB4P3c8sGc/R0Px30tlBIe8S5qslxU8xiAqDf+W2SVTfoRv9f1QmAobr
	 quU0jafMm51nEwu99gQTmGHJnop1LLQQXl6ZhWRfudfrWDsQONr+gxYh7unc/La5BDi/n
	 AGVp8tnv7/RPfKOO1iSndYWmDPQvEqp3l6rKnMZEx0tkdszEMkPaQx39QIWiGfCB1NQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794920543;
	h=DMARC-Filter:Received:DKIM-Signature:Received:From:Date:Subject:
	 MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:
	 References:In-Reply-To:To:Cc:X-Mailer;
	bh=bB+QIZL4TfOJJ6oLWxrz5vX9khwt59svjLxkzj7XuZA=;
	b=ZWPgpHFzgLQfhBAo2ZBi6q08f7SEvavmCHN1yvuvad3LiNR53DgMDY67cW4CLeJUzcqL
	 G3shY2lZ3PaSNDErn3piTd0nL0Y2tloo4yWmXhMJFCJefxUUakcww4dIXR5tkmG0jVdSE
	 emER/O+3eTGQL6asHMvn2lmFiuqNVXs24OnkjhQDmPwM3iw+h93qcirBaw7QRE6VBRTwt
	 +9vKyGoKLvIP3GTA4WuploqKniz0wZd0k12Xrn99yO98wkQ7HRNEdPSY1eoeySgXPoDdq
	 FmPNSlEQy+2Y4jdWYBGjfNlc3YzxB2FkcODwOgueUilA0bnTT5LBJ5OhJSWd+XtGIaA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=pengutronix.de;
	spf=pass smtp.mailfrom=pengutronix.de;
	dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b="WLS/FlwA";
	arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13
X-Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 814E8606A32C;
	Tue, 17 Nov 2026 13:02:22 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 814E8606A32C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de
X-Received: from dude04.red.stw.pengutronix.de (dude04.red.stw.4.pengutronix.de [10.17.1.12])
	(Authenticated sender: relay-from-dude04.red.stw.pengutronix.de)
	by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 932AA205A24;
	Tue, 17 Nov 2026 14:02:19 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de;
	s=20260414; t=1794920539;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=bB+QIZL4TfOJJ6oLWxrz5vX9khwt59svjLxkzj7XuZA=;
	b=WLS/FlwAuoN2idLSKbTxas2zl6/r0C+dBRo6SteclF+0U3UVNsU8Ca+mKEb41hv5pBKEr1
	8cjLbw4/R4SYFqemw006djrzuZkHKBOMSBmGVN1ht5oSU1pnDVORv9X9y9ZxgzQ5koKvWb
	0nQSaLW2KeyVD3gfjrf7fx5a3sUo2ZzhMR1IHI6dCnJJIMCvHMzTQMeV+6mhQ6L+OnP/2e
	xUGl+pb28pMcFpsXRkM0296qg4Qan0MV2M8EghXT3ZwqEEHNJiKkv3WawIldn085uQWtJD
	XCbmwKkCx2CVhG/8haQCXJo/6oys7LXHIPudYVxgYCnEVbKAXvH53tYOc19tsA==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de;
	s=20260414; t=1794920539;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=bB+QIZL4TfOJJ6oLWxrz5vX9khwt59svjLxkzj7XuZA=;
	b=T+BuoZQgfQFeIg+k1qQS6vOSsLnz5YBYLM3en7KS/+UTMzURrhww6rP0A6itXRCc5MyRa6
	Xg+gqwPDp+juLo1j/kJ9aPShkKfkHnD69qFVUa3+LYp9BOih+nQdIOtDzm3voYvx8kUJHy
	YbLzfC3dZjJYWjdjaWDtlQaIWZfWbCc1EUfybN6W6MB+J9mMR6ooilkNpr427hQUPAJHuU
	QSlE0VPL5yj3i4o/QFPD6wusGzgJ1B2MWp/GwfdvAzr4a/4CJkfhibJ4AF5gl31wIqIZAd
	xzHmSmlPQG8wWx5tOue5k3jXu556WtHw9Wfm+rVD47o++EZECOtsNWuKMPsMvg==
X-ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1794920539; a=rsa-sha256;
	cv=none;
	b=KUsEbVtcJ+gyJnx9wl9mcW3Mxihmp4soSt9rkcw/9NA6NGU5izf+QjxqVjdSp/h2WbvcnJ
	Jag9OitYfJKZKUZyMW3xpu+H/pg2hclNudxoTrSz5LsCoXnNiLX8ZElKKyoK/OHpl71+wm
	F2y/S4mDGAOpU4z54VsrpicnrXq3MhijgHsN9NU4Co0hRxuAcoX2bV8hDct5fU9x8hLzbG
	EhidBQLqjge7flXMGOcOLeVJi7yLz3GILNlNJ7SqUqlzBlFJK8yVflq5A+WMQupuF8zY4X
	hpTpysWOmAgKuztl7kAgODQupt2Us7HqUj3ifMcyF9ifi6cPsmLr43QPQkbkYw==
X-ARC-Authentication-Results: i=1;
	ORIGINATING;
	auth=pass smtp.auth=relay-from-dude04.red.stw.pengutronix.de smtp.mailfrom=ore@pengutronix.de
X-Received: by dude04.red.stw.pengutronix.de (Postfix, from userid 1058)
	id 7382C381A95; Tue, 17 Nov 2026 14:02:19 +0100 (CET)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261117-ksz-stp-ageing-v3-0-135de6b9f8ad@pengutronix.de>
X-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 
 kernel@pengutronix.de, 
 Jens Emil Schulz Østergaard <jensemil.schulzostergaard@microchip.com>, 
 Oleksij Rempel <o.rempel@pengutronix.de>
X-Mailer: b4 0.14.2