mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "Woojung Huh" <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@pengutronix.de,
	"Jens Emil Schulz Østergaard"
	<jensemil.schulzostergaard@microchip.com>
Subject: Re: [PATCH net-next 2/3] net: dsa: store the port ageing time before programming it
Date: Fri, 6 Nov 2026 14:23:54 +0100	[thread overview]
Message-ID: <719eb448-580a-413a-be49-253243533518@lunn.ch> (raw)
In-Reply-To: <20261104-ksz-stp-ageing-v1-2-2c2bc7217dea@pengutronix.de>

On Wed, Nov 04, 2026 at 12:48:29PM +0100, Oleksij Rempel wrote:
> 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);

This appears to make the info.ageing_time parameter pointless?

Either remove it, or pass the port it is to be applied to, so the
correct switch wide ageing time can be calculated?

	Andrew

  reply	other threads:[~2026-11-06 13:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 11:48 [PATCH net-next 0/3] net: dsa: make a shorter bridge ageing time take effect Oleksij Rempel
2026-11-04 11:48 ` [PATCH net-next 1/3] net: dsa: microchip: ksz9477: apply a shorter ageing time at once Oleksij Rempel
2026-11-06 13:16   ` Andrew Lunn
2026-11-04 11:48 ` [PATCH net-next 2/3] net: dsa: store the port ageing time before programming it Oleksij Rempel
2026-11-06 13:23   ` Andrew Lunn [this message]
2026-11-04 11:48 ` [PATCH net-next 3/3] net: dsa: forget the port ageing time when the port leaves the bridge Oleksij Rempel
2026-11-06 13:30   ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=719eb448-580a-413a-be49-253243533518@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®