This series follows the discussion of my earlier [PATCH net] "amt: do not offer software GSO on the amt device", which I withdrew. Eric Dumazet pointed out that tx checksum offload is off by default on amt, so that case does not trigger by default, and that the better fix is to call udp_tunnel_handle_offloads() in amt_send_multicast_data() like the other UDP tunnels do. Patch 1 does that, and patch 2 adds the selftest that I said I would send with it.
The earlier thread: https://lore.kernel.org/all/[email protected]/ The trigger needs a non-default setting (ethtool -K <amt dev> tx on) and a GSO source, such as a UDP_SEGMENT sender on the relay. The problem was found by an LLM-assisted code review of drivers/net/amt.c, while developing an IPv6 outer transport for amt. Results, from the selftest in patch 2 in a KVM guest on net-next commit eb0c18404c89 ("amt: pull the AMT header behind the transport header in amt_parse_type()") with CONFIG_DEBUG_NET=y, eleven runs per kernel: without patch 1 the UDP_SEGMENT burst with tx on is dropped (0 of 900 datagrams arrive, tx_dropped of the relay's egress device +100 per run, a trace shows __udp_gso_segment() returning -EINVAL during the segmentation on that device); with patch 1 all 900 arrive intact and tx_dropped does not move. With tx off, and with plain datagrams, both kernels pass. The existing amt.sh passes with patch 1 (it was not run on the unpatched kernel). Not tested: hardware with UDP tunnel segmentation offload, hardware checksumming on the egress device (the selftest turns it off there, so the non-GSO CHECKSUM_PARTIAL packet that now leaves with skb->encapsulation set is only checked through the software path), KASAN, sparse, the udp_csum=false variant, and NETIF_F_GSO_FRAGLIST. The selftest is a small sample so far: an earlier version of it failed intermittently in about 3 of 25 full runs (listener counters rose but the receiver got nothing, which I think was its idle timer expiring before the sender started, inferred and not confirmed). The final version passed or failed as expected in all 22 runs, but those were in one 4-vCPU KVM guest, so it may still be flaky elsewhere. Known and not touched here: amt advertises NETIF_F_GSO_FRAGLIST, and skb_copy_expand() refuses a SKB_GSO_FRAGLIST skb with a WARN_ON_ONCE(). That is independent of this series, I have not reproduced it, and if it is real it would be a separate fix for the net tree. Assisted-by: LLM Omar Ramadan (2): amt: mark relay data as a UDP tunnel packet before sending it selftests: net: add an amt test for UDP_SEGMENT through the relay drivers/net/amt.c | 11 + tools/testing/selftests/net/.gitignore | 1 + tools/testing/selftests/net/Makefile | 2 + tools/testing/selftests/net/amt_gso.c | 473 +++++++++++++++++++++++++ tools/testing/selftests/net/amt_gso.sh | 269 ++++++++++++++ 5 files changed, 756 insertions(+) create mode 100644 tools/testing/selftests/net/amt_gso.c create mode 100755 tools/testing/selftests/net/amt_gso.sh -- 2.43.0

