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 v3 3/3] net: dsa: forget the port ageing time when the port leaves the bridge
Date: Thu, 19 Nov 2026 01:03:22 +0000 [thread overview]
Message-ID: <179505020217.3136.6917391809574658393@kernel.org> (raw)
In-Reply-To: <20261117-ksz-stp-ageing-v3-3-135de6b9f8ad@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] The fix is incomplete because nothing reprograms the switch
when the port leaves.
--
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 when it computes the minimum. The aim is to keep the switch from
staying at a short ageing time (for example one set during an STP
topology change) after the port that requested it has left.
> 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]
Can the switch still stay at the departed port's short ageing time after
this change?
This only clears the cache. Nothing on the leave path reprograms the
hardware. dsa_port_bridge_leave() ends right after
dsa_port_switchdev_unsync_attrs(). The only code that writes the ageing
register is dsa_switch_ageing_time() in net/dsa/switch.c:
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 function runs only for DSA_NOTIFIER_AGEING_TIME. The only sender is
dsa_port_ageing_time(). It is called from the sync_attrs path at bridge
join, and from the SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME handler, which
needs a port that still offloads the bridge.
Here is a sequence on a single chip, with br0={lan1} at 300 s and
br1={lan2} with STP enabled:
topology change on br1
__set_ageing_time(br1, 2 * fwd_delay)
dsa_port_ageing_time(lan2, 8 s)
programs min(8, lan1=300) = 8 s for the whole chip
ip link set lan2 nomaster
dsa_port_bridge_leave()
dsa_port_switchdev_unsync_attrs()
dp->ageing_time = 0; /* no reprogram */
end of the topology change on br1
br1 restores 300 s, but br1 has no DSA lower port left,
so no notifier is sent
lan1 in br0 would keep ageing at 8 s until br0's ageing time changes or
some port joins a bridge again. Would it make sense to recompute the
minimum of the remaining non-zero dp->ageing_time values on dp->ds and
program it here when the port leaves?
The existing comment just above the new code says there is "no good
reason (or value) to change it to". Once the cache is cleared, the
minimum of the remaining cached values is a usable value, so that
comment no longer seems accurate. The new comment also doesn't mention
that the hardware value stays unchanged until the next notification.
The commit message does cover part of this:
"The switch gets the restored value only if another port of the same
bridge is still in this DSA tree."
However, the problem the commit message describes, a switch stuck at the
departed port's short ageing time, can still happen through this leave
path when ports of a different bridge remain on the same chip.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117-ksz-stp-ageing-v3-0-135de6b9f8ad%40pengutronix.de
prev parent reply other threads:[~2026-11-19 1:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 13:02 [PATCH net-next v3 0/3] net: dsa: make a shorter bridge ageing time take effect Oleksij Rempel
2026-11-17 13:02 ` [PATCH net-next v3 1/3] net: dsa: microchip: ksz9477: apply a shorter ageing time at once Oleksij Rempel
2026-11-19 1:03 ` netdev-bot+sashiko
2026-11-17 13:02 ` [PATCH net-next v3 2/3] net: dsa: ignore the old ageing time of the port being changed Oleksij Rempel
2026-11-17 21:37 ` Linus Walleij
2026-11-17 13:02 ` [PATCH net-next v3 3/3] net: dsa: forget the port ageing time when the port leaves the bridge Oleksij Rempel
2026-11-19 1:03 ` 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=179505020217.3136.6917391809574658393@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
all inboxes | Powered by JetHome®