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 v3 1/3] net: dsa: microchip: ksz9477: apply a shorter ageing time at once
Date: Thu, 19 Nov 2026 01:03:20 +0000	[thread overview]
Message-ID: <179505020064.3136.4475163541276513628@kernel.org> (raw)
In-Reply-To: <20261117-ksz-stp-ageing-v3-1-135de6b9f8ad@pengutronix.de>

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

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

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 depends on a fixed Fast Aging pulse length
  (KSZ9477_FAST_AGE_PULSE_US = 2 ms, ksz9477.c:1293) that was found by…
- [Low] ksz9477_set_ageing_time()
  (drivers/net/dsa/microchip/ksz9477.c:1359-1371) now pulses the switch-…

--

net: dsa: microchip: ksz9477: apply a shorter ageing time at once

This patch makes ksz9477_set_ageing_time() pulse the switch-wide Fast
Aging bit in REG_SW_LUE_CTRL_1 when the programmed ageing time gets
shorter or the Age Count gets smaller. Without the pulse, stale FDB
entries outlived an STP topology change on a KSZ9893. The bit is held
for a fixed 2 ms and then cleared.

> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index 8d4647e23cda1..972703fe7454f 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -1289,13 +1289,16 @@ static void ksz9477_phylink_get_caps(struct dsa_switch *ds, int port,
>  	ksz_phylink_get_caps(ds, port, config);
>  }
>  
> +/* The datasheet gives no pulse length. A 2 ms pulse worked on a KSZ9893. */
> +#define KSZ9477_FAST_AGE_PULSE_US	(2 * USEC_PER_MSEC)

[Severity: Medium]
Is a fixed 2 ms pulse enough on every chip in this family and for every
stored Age Count?

The value was found by trial on one KSZ9893, where the entries stored Age
Count 4. Each ALU entry holds a 3-bit stored age count
(ALU_V_PRIO_AGE_CNT_M, decoded in ksz9477_convert_alu()). That count is
copied from SW_AGE_CNT_M when the entry is learned or refreshed, so it can
be as high as 7.

The pulse matters most when the old count (mult) was larger, and that is
exactly when entries hold the highest counts. One example: 1785 s
(7 x 255), then an STP topology change to 8 s. That gives data = 1 and
triggers the pulse.

Suppose Fast Aging here speeds up ageing rather than purging the table at
once. Could entries with stored counts 5 to 7 then survive a 2 ms pulse?
The same question applies to the other chips that use ksz9477_switch_ops
(KSZ9477, KSZ9897, KSZ9896, KSZ9567, KSZ9563, KSZ8563, LAN9646 and so on).

ksz9477_set_ageing_time() sets SW_FAST_AGING, sleeps, clears the bit and
returns 0. It never checks that the dynamic entries are gone. If they
survive, the stale FDB after a topology change would still happen, and
nothing would report it.

The KSZ8995XA path in ksz8.c describes an "800 us fast-age cycle", which
hints at sweep behaviour. It doesn't show how the KSZ9477 family behaves.

[ ... ]

> +	old_secs = mult * old_period;
> +	new_secs = data * new_period;
> +	if (new_secs >= old_secs && data >= mult)
> +		return 0;
> +
> +	ret = ksz_rmw8(dev, REG_SW_LUE_CTRL_1, SW_FAST_AGING, SW_FAST_AGING);
> +	if (!ret)
> +		fsleep(KSZ9477_FAST_AGE_PULSE_US);
> +
> +	/* Clear the bit even after an error. */
> +	err = ksz_rmw8(dev, REG_SW_LUE_CTRL_1, SW_FAST_AGING, 0);
> +
> +	return ret ?: err;
>  }

[Severity: Low]
Can an ageing time change in one bridge now flush the dynamic FDB entries
of every other bridge on the same switch?

The value programmed here comes from dsa_switch_fastest_ageing_time(),
which takes the minimum over all ports of the switch. Before this patch,
one bridge could only shorten the ageing timer for the others, and entries
still in use kept being refreshed. With the pulse, entries still in use in
unrelated bridges are removed too. Their unicast traffic floods until the
addresses are learned again.

Nothing limits the flush to one bridge or limits how often it runs. Here
are two ways to trigger it again and again.

With kernel STP, __br_set_topology_change() lowers the ageing time when
received BPDUs or TCNs set TC, and restores it when TC clears:

net/bridge/br_stp.c:__br_set_topology_change() {
    ...
		if (val) {
			t = 2 * br->forward_delay;
    ...
		} else {
			t = br->bridge_ageing_time;
    ...
		err = __set_ageing_time(br->dev, t);
    ...
}

For example, 300 s (4 x 75) -> 30 s pulses. Going back to 300 s
(2 x 150) does not. The next TC (30 s = 2 x 15) pulses again, so every
TC on/off cycle causes one switch-wide flush.

DSA user ports are not netns-immutable. A CAP_NET_ADMIN holder in another
netns that owns a bridged switch port could toggle IFLA_BR_AGEING_TIME.
Each toggle would flush the FDB of bridges owned by the host or by other
tenants. The same happens when a port joins a bridge with a shorter
ageing time, since the attribute is replayed on join.

The commit message says Fast Aging is a control for the whole switch.
Was the effect on other bridges sharing the switch intended?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117-ksz-stp-ageing-v3-0-135de6b9f8ad%40pengutronix.de

  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 [this message]
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

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=179505020064.3136.4475163541276513628@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