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

With kernel STP, the bridge sets a shorter ageing time during a
topology change. When the topology change ends, the bridge restores
the configured ageing time. Without this series, two things go wrong:

- On a KSZ9893, a shorter ageing time does not take effect at once.
  The new Age Period starts only after the running period ends.
  Entries already in the table keep their old Age Count (patch 1).
- On any DSA switch with .set_ageing_time, the restore has no effect.
  DSA writes the short value to the switch instead of the configured
  value (patch 2).

A port can also leave the bridge during the topology change (patch 3):

- Before this series, DSA kept the short ageing time of that port. DSA
  uses the smallest ageing time of all ports. While the port stayed out
  of the bridge, later changes to a longer ageing time still wrote the
  short value to the switch.
- With this series, DSA clears the ageing time of the port when the
  port leaves. As before this series, DSA does not write the ageing
  time to the switch at that moment. The switch keeps its current value
  until the next write. The next write comes with the next ageing time
  change, or when a port in the same DSA tree joins a bridge. Usually,
  the next ageing time change is the restore at the end of the topology
  change.

In a lab test on a KSZ9893 with a redundant path, I cut one path while
one station sent one-way traffic to another. I ran six setups. With the
series, the traffic stopped for 12 to 15 s in all six. That is about
the time STP needed to converge. Without the series, the traffic
stopped for 24 to 56 s in three setups. The other three failed before
the cut (see below).

Without the series, the switch kept the old FDB entry of the receiver.
The entry pointed to the port on which the traffic came in, so the
switch dropped the traffic. During the topology change, the switch still
ran its old, long Age Period. The entry therefore did not age out in
time (patch 1). The outage ends when the entry ages out or when the
receiver sends a frame. In one of the three measured setups, the sender
used normal ARP, so the receiver could answer ARP requests. There, the
outage was 24 to 46 s. Where the receiver sent no frame that the switch
could learn from, it was 51 to 56 s. Stations that receive much and send
little are affected most, for example receivers of a UDP stream or of
telemetry. I did not test traffic in both directions, such as TCP.

Without the series, the switch also stayed at the short ageing time
after a topology change ended (patch 2). In this test, the topology
change when the bridge came up already left the switch at 8 s instead
of 300 s, before the cut. The short value is twice the forward delay,
which was 4 s. Entries of stations that send little then
aged out after a few seconds. In three setups, the switch lost the
entry of the receiver this way before the cut.

Patches 2 and 3 change the DSA core. They affect every driver that
implements .set_ageing_time. For this reason, the series targets
net-next and has no Fixes tags.

To reproduce the restore case (patch 2):

  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
  ip link set br0 type bridge ageing_time 30000

ip link takes centiseconds, so 1000 is 10 s and 30000 is 300 s. Then
read the ageing time from the switch, for example from the 32-bit
regmap in debugfs:

  grep -E '^0*310:' /sys/kernel/debug/regmap/<device>-32/registers

The line shows the bytes of registers 0x0310 to 0x0313. Bits 5:3 of
the first byte are the Age Count. The last byte is the Age Period in
seconds. The ageing time is Age Count times Age Period. Without the
series, it is 1 x 10 s = 10 s. With the series, it is 2 x 150 s =
300 s, so the last byte reads 96.

To test a port that leaves the bridge (patch 3), run "ip link set lan2
nomaster" between the two ageing_time commands. Without the series,
and with only patches 1 and 2, the register readback shows 10 s. With
the whole series, it shows 300 s.

To test patch 1 on a fresh bridge, set the ageing time to 300 s and let
the switch learn an address on lan1. Then set the ageing time to 10 s
and watch the "self" entry of that address in "bridge fdb show dev
lan1". Without the series, the entry stayed in the table for 57 s to
more than 120 s in my tests on a KSZ9893. With patch 1, the switch
removes the dynamic entries at once. The switch learns the address
again from new traffic.

Tested on a KSZ9893. I did not run the forwarding selftests.

---
Oleksij Rempel (3):
      net: dsa: microchip: ksz9477: apply a shorter ageing time at once
      net: dsa: store the port ageing time before programming it
      net: dsa: forget the port ageing time when the port leaves the bridge

 drivers/net/dsa/microchip/ksz9477.c | 36 ++++++++++++++++++++++++++++++++----
 net/dsa/port.c                      | 15 +++++++++++----
 2 files changed, 43 insertions(+), 8 deletions(-)
---
base-commit: 4dd16e31135ea8437a720222df34e8745f385d6d
change-id: 20261103-ksz-stp-ageing-705aa69829e5

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


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

end of thread, other threads:[~2026-11-06 13:30 UTC | newest]

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

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®