🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #10933

[PATCH net-next 2/3] net: dsa: store the port ageing time before programming it

#10933
From: Oleksij Rempel
Date: Wed, 04 Nov 2026 11:48
57 lines
12097 bytes
dsa_switch_fastest_ageing_time() takes the minimum of the cached
dp->ageing_time of all ports, but dsa_port_ageing_time() updates the
cached value only after the notifier. Raising the ageing time programs
the old, shorter value again, so after an STP topology change the switch
stays at 2 x forward_delay.

Store the new value before the notifier and restore it on error. This
affects all DSA drivers with .set_ageing_time: sja1105, which reloads
its static config on a change, will reload again when the bridge
restores the ageing time.

Reported in an automated review of the lan9645x bridge series (Link:
below).

Tested on a KSZ9893.

Link: https://lore.kernel.org/netdev/179180428624.434549.14425623884223795761@kernel.org/
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 net/dsa/port.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/dsa/port.c b/net/dsa/port.c
index 1f5536c0dffc2311db24015697e0c8f5c014ac74..3195d8b7c69c5e0fbc4007421218c2ff1db0ce47 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -876,18 +876,22 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock)
 {
 	unsigned long ageing_jiffies = clock_t_to_jiffies(ageing_clock);
 	unsigned int ageing_time = jiffies_to_msecs(ageing_jiffies);
+	unsigned int old_ageing_time = dp->ageing_time;
 	struct dsa_notifier_ageing_time_info info;
 	int err;
 
 	info.ageing_time = ageing_time;
 
+	/* dsa_switch_fastest_ageing_time() takes the minimum over the cached
+	 * values of all ports, so update this port's value first.
+	 */
+	dp->ageing_time = ageing_time;
+
 	err = dsa_port_notify(dp, DSA_NOTIFIER_AGEING_TIME, &info);
 	if (err)
-		return err;
+		dp->ageing_time = old_ageing_time;
 
-	dp->ageing_time = ageing_time;
-
-	return 0;
+	return err;
 }
 
 int dsa_port_mst_enable(struct dsa_port *dp, bool on,

-- 
2.47.3
Technical Details
Message-ID: <20261104-ksz-stp-ageing-v1-2-2c2bc7217dea@pengutronix.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356392-linux-kernel-netdev=dewy.ru
References: <20261104-ksz-stp-ageing-v1-0-2c2bc7217dea@pengutronix.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-356392-linux-kernel-netdev=dewy.ru
From: o.rempel@pengutronix.de (Oleksij Rempel)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 2/3] net: dsa: store the port ageing time before
 programming it
Date: Wed, 04 Nov 2026 12:48:29 +0100
Organization: Usenet Network
Message-ID: <20261104-ksz-stp-ageing-v1-2-2c2bc7217dea@pengutronix.de>
References: <20261104-ksz-stp-ageing-v1-0-2c2bc7217dea@pengutronix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="3382757"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Dl1dzpk6sz9AW4J43DsVH1hyCL0= sha256:G9EIuAv7HtQFVTb1sULkO8IJDMgOIrUBJRVqtXCnKWo=
	sha1:wTwrlGY2yYw9oQbWFYC1Zw9kgv8= sha256:P97pquIhX/+T0MOrp0njOvjJqlxM4ZqVaUYFJoHhAFk=
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 48871112B9D; Wed,  4 Nov 2026 14:49:56 +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 lPFGnrtvQWHz;
	Wed,  4 Nov 2026 14:49:52 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-356392-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 1132F112B95; Wed,  4 Nov 2026 14:49:44 +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 3F5A72D7F2; Wed,  4 Nov 2026 11:48:51 +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=1793792927;
	b=MOl5QqEdeRRqmD5dmX+AHT6Uu6jJtfzNCbHy3+fEJ54FhkMfNdEPJJZi+d7lROwhSxAO
	 q1BoNatxjDALf2A/bOQ8gWhz+iiWC6WgRpUje6KabHXIrdiBLv1bmQ9+UoSDSAFGXxyXA
	 BTCZwvFa0Z1laC+SJ6RwFVi/DjN6XX43YASuROKtN8/xlDh7Nor6ORQZxO50JG+L0djjF
	 n5Q8l8cFv4vnFXjl1ljZk77kd/V+YvBtYPUlCl20D+cMxN0gU3k9jHKtE9bXzdu3BIdyr
	 Z8Zv0muZFtqlkO1LTGsIYGX4mkqvrDWOX73+BybyvpVKxlsNPr96gcrtiuH4sYnvltA==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793792927;
	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=yK4khsS2ba65Eeulo4Vcf+S64wQVrE4OGyCa1KBxEG4=;
	b=ZfF8PgU9l8ygkmL6iOOpkZAbUzBuVxCdo1kf+j6Wlc3Tux2fgBz1bvcqAmyDVDOaAylT
	 swGodlt41vL/fAn2Tov4FweuQkv74sm083uOuEISzec4382PE45gjxLrbFDJ2JMRGNqPm
	 u+kGaAqOYHlwveS/tuRcVgBBEYne/cdqifZIZzNhnAtfFOptQuFMUnxCjyqyCG+0MlzTm
	 A7wTG7FEsnUUScDTL5A2cpLE/cDmbJkJtjop5lD3vjDm4j9Byn2GkWAe9QGPiy12uGXgs
	 WSvTR80eoEFheEqswZbv9K38dv2gXc4VTqu2os3CZ/Q74zoIN9ekFMflJ1yF8cuymXw==
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=L78rvXvn;
	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 1F3E8606D80C;
	Wed,  4 Nov 2026 11:48:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=L78rvXvn
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=1793792926;
	b=NzkV2l/A0VHwFuB2HDZJ5mEIetRQdfX6qn397EfEiM8nQqN8etkHFBPEaWn0RDiYSNDQ
	 d8p1d81wZ4a1HR8rW6VpvkuqiGuXksrbNw3WaTZnu/oit/Xkv2c03REWNRplfmoix5E5F
	 KdbWS6mFZq3XV+29qpaiyFbo9q6fhDrjbjyWTxW833kCZCPbY5szU2KxoOEr9Tad1ORtD
	 8qbDk4keNgx/4D/5AK9H8GIguTfkyvwcGy+60R6wlVhaMlFsJA3+OjIQ5Sb/8ZKLwukCS
	 f5cWnc0afmYFwftBloTisPacQNksuyHqXM1evMeOJRC3RmdyngFo72AymH1coktROpg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793792926;
	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=yK4khsS2ba65Eeulo4Vcf+S64wQVrE4OGyCa1KBxEG4=;
	b=V4SQnIpIOgcHZc0rU2raAqrDAd6+y8EH28R5Q2T20AJCEgsMT22VHjodaDeoFVcAqdXe
	 xK6Iqc6gmqgW3E8RmVDfUbtvgkymXASHJ8XhnbP/ETrnJ8wGHIMdYMxuVC1YO5XuD94fD
	 vloiyef625HlAMfyWHPg6cjUKSyRDjh/BCSjSIeMClu8NCTYUpYZzxrJFJqKClQltDSzl
	 6NPT9OVWjoiJlppMy2b3lalVz5My0xhPhwtFPLObYk4AVsantMpcHHeAqoO1Sv3+sWodE
	 N3kTp7smBTntbHB0mRBLZGVFQFAr+GsQwIGf0rEDtNRFMjAluRtEkwtk5dljatN6egQ==
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=L78rvXvn;
	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))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C221606A32E;
	Wed,  4 Nov 2026 11:48:44 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4C221606A32E
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.pengutronix.de [IPv6:2a0a:edc0:0:1101:1d::ac])
	(Authenticated sender: relay-from-dude04.red.stw.pengutronix.de)
	by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 85904202013;
	Wed, 04 Nov 2026 12:48:42 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de;
	s=20260414; t=1793792922;
	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=yK4khsS2ba65Eeulo4Vcf+S64wQVrE4OGyCa1KBxEG4=;
	b=L78rvXvnm5GPF+6OTZ+u7+iQT7sFmjB05D1CU8N6usrlw644a8N8aper7OWGSEmJvju4Wy
	EWujslRGTQZalbZiNP6fopkaTY04lvkPrsHpnWxPvpz/ucz5PQfumVb4SaLTY4OvzA4iQF
	56wEnYDNGJZrhX1O7hSsd98k6cXW8dxOLxQoSQpLm4QPMbfZCaDdc4DxschYk81xaSMRxQ
	JLPyRNUNfj1r7g0ih85DXJuymcKauSyJX2zMc09g2l+LbbIwBIHpBiUeX1IgS+NRKyKA02
	C30oGzZpnRETq0EuvMp1S66oA0372hwc36Z9nuy6tZ1G+fZM7eQnxevsjk4vKw==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de;
	s=20260414; t=1793792922;
	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=yK4khsS2ba65Eeulo4Vcf+S64wQVrE4OGyCa1KBxEG4=;
	b=ElMJP4b1PH6jBALJ02KIlbZhp7XRQPzdrt9N/1LFYEknS5WjJ+Tlycs5ZTSAkSmqEN1S6b
	jwn5+VlC2p+HegRQ3R35VthAA7A18TbOWf5CRXFl9wDDxobfA/jzpwDXCn9ga8Zq26gTka
	lfVa/KDyNZs+CspuFywyipzEK8A0eB/jOvsjKpe32ysh8diViNrS32luPEQ9PROk6UIDbY
	/QG+18hv6aWNAHOoVNuNBqVatOi3QZOtGbR2TnHaFpcOUJ2M6CFjeUh8HUhGPKInsR58WU
	eCLD2Kem4yemv0pI6hrwMIKFsfZ3gJ2OwgvEzbIn6k7QE2J+rVfjc+X/fjLBxA==
X-ARC-Authentication-Results: i=1;
	ORIGINATING;
	auth=pass smtp.auth=relay-from-dude04.red.stw.pengutronix.de smtp.mailfrom=ore@pengutronix.de
X-ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1793792922; a=rsa-sha256;
	cv=none;
	b=G2VjOQXF7ZMblA+viA02j/bnT/TavF5wGhdli3pPyHBRPpYLHmAD+cu0bjQfn4roGEIlF/
	MV1wnR04BZZwN5LPGim6/Jpo/0zfm1By79JNLKoHbyj8VdwwmJWy3siiVozpkVIDlKay8H
	wCGkY9qoHxWCi2DiAQ6t8szZoH7MIdqqcldH1u5nieinD8A2KH7JPMn5XJgXKHHw9Udloy
	pZ0bW2/2K5jq4gSV5O0C67GhgYappoK/AoH073uTSrOR388sgpuAx5txVwcZnDEmhnaHv2
	LL+08HLFQFLplQz2eaO7Pes19fGGTSAslDPh26TOgy64f5lz9rydSakUNh9tMw==
X-Received: by dude04.red.stw.pengutronix.de (Postfix, from userid 1058)
	id 6031F380AE9; Wed, 04 Nov 2026 12:48:42 +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: <20261104-ksz-stp-ageing-v1-0-2c2bc7217dea@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