mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/3] net: dsa: make a shorter bridge ageing time take effect
@ 2026-11-15 10:59 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
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Oleksij Rempel @ 2026-11-15 10:59 UTC (permalink / raw)
  To: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Arun Ramadoss, Jiri Pirko, Linus Walleij,
	Florian Fainelli, Vivien Didelot
  Cc: netdev, linux-kernel, kernel, Jens Emil Schulz Østergaard,
	Oleksij Rempel

During an STP topology change, the bridge lowers the ageing time so
that stale FDB entries go away quickly. When the change is over, the
bridge sets the configured value again. On DSA switches, both steps
can go wrong:

- On a KSZ9893, ksz9477 does not apply a shorter value at once. Patch 1
  fixes this.
- The DSA core can keep the short value after the bridge has restored
  the long one. Patch 2 fixes this, and patch 3 does the same for a
  port that has left the bridge.

In a lab test on a KSZ9893, I cut one of two redundant paths while a
station sent one-way UDP or raw Ethernet traffic. Without the series,
the traffic stopped for up to 56 s, long after STP had converged. With
it, the traffic came back after 12 to 15 s, about as long as STP
needed to converge.

One case is not fixed. The last port of a bridge in its DSA tree may
leave while the bridge has a shorter ageing time, for example during a
topology change. Then the switch keeps the short value until a bridge
with ports in the same DSA tree sets its ageing time, or a port in that
tree joins a bridge.

The patches carry Fixes tags. They still go to net-next, because
patches 2 and 3 change the DSA core and affect every driver with
.set_ageing_time.

With patch 2, sja1105 reloads its static config once more when the
bridge restores the ageing time.

To check patches 2 and 3 on a KSZ9477-family switch over I2C, read the
ageing register from debugfs (<device> is the I2C device, for example
3-005f):

  dd if=/sys/kernel/debug/regmap/<device>-32/registers bs=15 \
     skip=$((0x310)) count=1 2>/dev/null

The ageing time in seconds is bits 5:3 of the first byte times the last
byte. For example, in "0310: 55450096" bits 5:3 of 0x55 give 2 and 0x96
is 150, so the ageing time is 2 x 150 s = 300 s.

Without STP, after a boot (the comments give the register value):

  ip link add br0 type bridge stp_state 0
  ip link set lan1 master br0
  ip link set lan2 master br0
  ip link set br0 up
  ip link set br0 type bridge ageing_time 1000    # 10 s
  # 0310: 4d45000a (1 x 10 s)
  ip link set lan2 nomaster
  ip link set br0 type bridge ageing_time 30000   # 300 s
  # with the series:      0310: 55450096 (2 x 150 s)
  # without patch 2 or 3: 0310: 4d45000a (1 x 10 s)

With kernel STP, start again with a bridge that runs STP, here with
forward_delay 4 s. lan1 and lan2 need a link to peers that do not run
STP, so that br0 is the root bridge:

  ip link del br0
  ip link add br0 type bridge stp_state 1 forward_delay 400
  ip link set lan1 master br0
  ip link set lan2 master br0
  ip link set lan1 up
  ip link set lan2 up
  ip link set br0 up
  # wait until /sys/class/net/br0/bridge/topology_change reads 1
  # 0310: 55450004 (2 x 4 s)
  ip link set lan2 nomaster
  sleep 30
  # with the series:      0310: 55450096 (2 x 150 s)
  # without patch 2 or 3: 0310: 55450004 (2 x 4 s)

Tested on a KSZ9893.

---
Changes in v2:
- Link to v1: https://lore.kernel.org/r/20261104-ksz-stp-ageing-v1-0-2c2bc7217dea@pengutronix.de

---
Oleksij Rempel (3):
      net: dsa: microchip: ksz9477: apply a shorter ageing time at once
      net: dsa: ignore the old ageing time of the port being changed
      net: dsa: forget the port ageing time when the port leaves the bridge

 drivers/net/dsa/microchip/ksz9477.c | 41 ++++++++++++++++++++++++++++++++-----
 net/dsa/port.c                      | 13 +++++++++---
 net/dsa/switch.c                    | 17 +++++++++++----
 net/dsa/switch.h                    |  1 +
 4 files changed, 60 insertions(+), 12 deletions(-)
---
base-commit: 6964ff21c5d8b75649211a52dbfd92753e605649
change-id: 20261103-ksz-stp-ageing-705aa69829e5

Best regards,
-- 
Oleksij Rempel <o.rempel@pengutronix.de>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-16 11:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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®