Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: o.rempel@pengutronix.de
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
	andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, arun.ramadoss@microchip.com, jiri@resnulli.us,
	linusw@kernel.org, f.fainelli@gmail.com,
	vivien.didelot@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de,
	jensemil.schulzostergaard@microchip.com
Subject: Re: [PATCH net-next v2 3/3] net: dsa: forget the port ageing time when the port leaves the bridge
Date: Mon, 16 Nov 2026 11:00:36 +0000	[thread overview]
Message-ID: <179482683686.3136.4297608809022872177@kernel.org> (raw)
In-Reply-To: <20261115-ksz-stp-ageing-v2-3-7af27320033e@pengutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] In net/dsa/port.c, dsa_port_switchdev_unsync_attrs() now
  clears the cached dp->ageing_time, but nothing on the bridge-leave…

--

net: dsa: forget the port ageing time when the port leaves the bridge

This patch clears the cached dp->ageing_time in
dsa_port_switchdev_unsync_attrs() when a port leaves a bridge. After that,
dsa_switch_fastest_ageing_time() no longer counts the departed port's
value. The switch can then return to the bridge's long ageing time when
another port of the same bridge gets a restore.

> diff --git a/net/dsa/port.c b/net/dsa/port.c
> index 15e7da20b0e2f..54c9709840952 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;

[Severity: Medium]
This clears the cache, but the leave path never writes the switch's ageing
register again. Can the chip still stay at the departed port's short
ageing time?

The hardware is only programmed in dsa_switch_ageing_time(), which runs
on DSA_NOTIFIER_AGEING_TIME:

net/dsa/switch.c:dsa_switch_ageing_time() {
    ...
	ageing_time = dsa_switch_fastest_ageing_time(ds, info);

	if (ds->ops->set_ageing_time)
		return ds->ops->set_ageing_time(ds, ageing_time);
    ...
}

That notifier is only sent by dsa_port_ageing_time(). It is reached from
dsa_port_switchdev_sync_attrs() when a port joins, and from
dsa_user_port_attr_set(), which is gated on the port still offloading the
bridge:

net/dsa/user.c:dsa_user_port_attr_set() {
    ...
	case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
		if (!dsa_port_offloads_bridge_dev(dp, attr->orig_dev))
			return -EOPNOTSUPP;

		ret = dsa_port_ageing_time(dp, attr->u.ageing_time);
    ...
}

Take one switch with br0 holding lan1 and lan2 at 300 s, and br1 holding
only lan3 at 10 s (or 2 x forward_delay during an STP topology change on
br1). The chip runs at 10 s.

When lan3 leaves br1, the call chain is:

dsa_port_bridge_leave()
  dsa_port_switchdev_unsync_attrs()
    dp->ageing_time = 0;

br1 has no ports left in this tree to send a restore, and br0 has no
reason to send one. The chip stays at 10 s. br0's FDB entries then age
out early, which causes extra unknown-unicast flooding. This lasts until
br0's ageing time changes, a port joins a bridge, or br0 has its own
topology change.

At that point dsa_switch_fastest_ageing_time() would return the minimum
of the remaining cached values (300 s), but the hardware is never set to
it.

The comment kept just above the new code says there is "no good reason
(or value)" to change the ageing time here. In this case there is a
usable value: the minimum over the remaining bridged ports.

Could the leave path recompute the fastest ageing time over the switch's
remaining bridged ports after clearing the cache, and program it? The
register could be left alone when no bridged ports remain.

The commit message notes that "The switch gets the restored value only
if another port of the same bridge is still in this DSA tree", and the
v2 changelog moves the last-port case to the cover letter. The
multi-bridge case above would still leave the switch at the short value
this patch is meant to fix.

>  }
>  
>  static int dsa_port_bridge_create(struct dsa_port *dp,

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261115-ksz-stp-ageing-v2-0-7af27320033e%40pengutronix.de

      parent reply	other threads:[~2026-11-16 11:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 10:59 [PATCH net-next v2 0/3] net: dsa: make a shorter bridge ageing time take effect Oleksij Rempel
2026-11-15 10:59 ` [PATCH net-next v2 1/3] net: dsa: microchip: ksz9477: apply a shorter ageing time at once Oleksij Rempel
2026-11-15 15:38   ` Andrew Lunn
2026-11-16 11:00   ` netdev-bot+sashiko
2026-11-15 10:59 ` [PATCH net-next v2 2/3] net: dsa: ignore the old ageing time of the port being changed Oleksij Rempel
2026-11-15 15:40   ` Andrew Lunn
2026-11-15 10:59 ` [PATCH net-next v2 3/3] net: dsa: forget the port ageing time when the port leaves the bridge Oleksij Rempel
2026-11-15 15:40   ` Andrew Lunn
2026-11-16 11:00   ` netdev-bot+sashiko [this message]

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=179482683686.3136.4297608809022872177@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=arun.ramadoss@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=horms@kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=jiri@resnulli.us \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linusw@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=vivien.didelot@gmail.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