Skip to content

net: hsr: fix super-packet forwarding

Xin Xie linux-doc linux-kselftest lkml netdev stable 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest4 patches 4 repliesIn review
  2. v94 patches 4 repliesSuperseded
  3. v84 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v74 patches11 repliesSuperseded

Changes in v10 from the cover letter

- Added Sebastian's Reviewed-by.
- Patch 1: the role clear in hsr_del_port() and the hsr_port bit moved, so that the series applies with the pending fix [6] and with the XDP series now in net-next [7]. Comment and message updated after the AI review [8].
- Patch 3: the segment loop uses skb_list_walk_safe(), as Sebastian suggested.
- Patch 4: three test checks tightened after the AI review [8].
- AI review [8], not changed: a tunnel routed back through its own HSR master (patch 2) is the existing deadlock described above, and the socket close order in the test helper is harmless.

[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/anXnxn-PBv8qH6VB@fedora/
[4] https://lore.kernel.org/netdev/[email protected]/
[5] https://lore.kernel.org/netdev/[email protected]/
[6] https://lore.kernel.org/netdev/[email protected]/
[7] https://lore.kernel.org/netdev/[email protected]/
[8] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/[email protected]

Patches in v10 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4net: hsr: keep GRO disabled on HSR/PRP portsDocumentation/networking/net_cachelines/net_device.rst include/linux/netdevice.h net/core/dev.c +1 more+78 -01 reply
2/4net: hsr: refuse forwarding devices as HSR/PRP portsnet/hsr/hsr_device.c net/hsr/hsr_slave.c net/hsr/hsr_slave.h+86 -21 reply
3/4net: hsr: segment GSO before per-frame forwardingnet/hsr/hsr_device.c net/hsr/hsr_forward.c net/hsr/hsr_forward.h +1 more+163 -121 reply
4/4selftests: net: hsr: verify GRO policy and ordered forwardingtools/testing/selftests/net/hsr/Makefile tools/testing/selftests/net/hsr/config tools/testing/selftests/net/hsr/hsr_gro_superpacket.py +2 more+1502 -11 reply

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchSebastian Andrzej Siewior
1/4R-b
2/4R-b
3/4R-b
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v10 thread

Cover letter [PATCH net v10 0/4] net: hsr: fix super-packet forwarding

HSR and PRP tag, number and de-duplicate each frame on the wire. GRO and GSO can hand them one skb holding several frames, which the lower device then drops or which goes out with a single tag or RCT and sequence number.

Patch 1 keeps software GRO off on HSR/PRP ports. GRO_HW that the driver keeps on is left alone.

Patch 2 refuses bridge, bond, team and OVS masters as ports, a macvlan or MACsec device on top of a bridge, bond, team or HSR/PRP master, and devices that already have a master or cannot take an RX handler. This fixes the syzbot recursive seqnr_lock report, as Sebastian suggested [1].

A port check cannot catch every path back into an HSR master, such as a tc/BPF redirect or a tunnel; those still nest the lock and can deadlock on the same device. Fixing them without dropping traffic needs seqnr_lock released before the port transmit, which can reorder frames for receivers without aae9d6b616b5 ("hsr: Implement more robust duplicate discard for HSR"). That is left to net-next, where Hangbin's patch [2] fits. He dropped it in favor of this series [3]; as this series no longer narrows seqnr_lock, it can go ahead there.

Patch 3 segments GSO skbs before per-frame processing, outside seqnr_lock. GSO reaches an HSR/PRP port even with GRO off, typically from a container attached to a PRP RedBox interlink through veth:

  container/netns                  host PRP RedBox
  prp0-peer ---- veth ---- prp0-int (interlink RX)
                                  |
                           split GSO into frames
                                  |
                           sequence number + RCT
                              /          \
                           LAN A        LAN B

Some old Linux PRP senders put one RCT on a whole GSO skb; patch 3 drops such aggregates when it can detect them. With GRO_HW off on virtio-net, the host may segment them first and the RCT arrives as payload; upgrade the sender or disable GSO and TSO on its HSR/PRP master.

Patch 4 adds selftests.

Tested on a lockdep kernel: the new selftests (also with Python 3.9) and the existing hsr selftests pass, and the syzbot reproducer no longer reports recursive locking. No new W=1 warnings.

No stable backport is requested. The remaining HSR dev->stats races are left to a separate series, as Paolo suggested [4].

Based on net aa40afa831eb; also applies to net-next. Patch 3 conflicts with Sebastian's pending net-next series [5]; its notes give the resolution.

Changes since v9:
- Added Sebastian's Reviewed-by.
- Patch 1: the role clear in hsr_del_port() and the hsr_port bit moved, so that the series applies with the pending fix [6] and with the XDP series now in net-next [7]. Comment and message updated after the AI review [8].
- Patch 3: the segment loop uses skb_list_walk_safe(), as Sebastian suggested.
- Patch 4: three test checks tightened after the AI review [8].
- AI review [8], not changed: a tunnel routed back through its own HSR master (patch 2) is the existing deadlock described above, and the socket close order in the test helper is harmless.

[1] https://lore.kernel.org/netdev/[email protected]/
[2] https://lore.kernel.org/netdev/[email protected]/
[3] https://lore.kernel.org/netdev/anXnxn-PBv8qH6VB@fedora/
[4] https://lore.kernel.org/netdev/[email protected]/
[5] https://lore.kernel.org/netdev/[email protected]/
[6] https://lore.kernel.org/netdev/[email protected]/
[7] https://lore.kernel.org/netdev/[email protected]/
[8] https://netdev-ai.bots.linux.dev/sashiko/#/patchset/[email protected]

v9: https://lore.kernel.org/netdev/[email protected]/
v8: https://lore.kernel.org/netdev/[email protected]/
v7: https://lore.kernel.org/netdev/[email protected]/
v6: https://lore.kernel.org/netdev/[email protected]/
v5: https://lore.kernel.org/netdev/[email protected]/
v4: https://lore.kernel.org/netdev/[email protected]/
v3: https://lore.kernel.org/netdev/[email protected]/
v2: https://lore.kernel.org/netdev/[email protected]/
v1: https://lore.kernel.org/netdev/[email protected]/

Xin Xie (4):
net: hsr: keep GRO disabled on HSR/PRP ports
net: hsr: refuse forwarding devices as HSR/PRP ports
net: hsr: segment GSO before per-frame forwarding
selftests: net: hsr: verify GRO policy and ordered forwarding

 .../networking/net_cachelines/net_device.rst  |    1 +
 include/linux/netdevice.h                     |    8 +
 net/core/dev.c                                |   15 +
 net/hsr/hsr_device.c                          |   13 +-
 net/hsr/hsr_forward.c                         |  156 ++
 net/hsr/hsr_forward.h                         |    1 +
 net/hsr/hsr_slave.c                           |  145 +-
 net/hsr/hsr_slave.h                           |    2 +
 tools/testing/selftests/net/hsr/Makefile      |    7 +-
 tools/testing/selftests/net/hsr/config        |   10 +
 .../selftests/net/hsr/hsr_gro_superpacket.py  | 1468 +++++++++++++++++
 .../selftests/net/hsr/hsr_gro_superpacket.sh  |    9 +
 .../net/hsr/hsr_ordered_forwarding.sh         |    9 +
 13 files changed, 1829 insertions(+), 15 deletions(-)
 create mode 100755 tools/testing/selftests/net/hsr/hsr_gro_superpacket.py
 create mode 100755 tools/testing/selftests/net/hsr/hsr_gro_superpacket.sh
 create mode 100755 tools/testing/selftests/net/hsr/hsr_ordered_forwarding.sh

base-commit: aa40afa831ebfe45e40a23721711059f2ac584d4

Signature · 1 line
2.53.0