selftests: drv-net: add BIG TCP test cases
Subsystems (3)
PATCH 1/1 selftests: drv-net: add BIG TCP test cases
Add four new test cases that validate coalescing
under increased size limits (BIG TCP):
big_tcp_data_same
- validates that equal-sized segments coalesce past
the legacy IP_MAXPACKET limit.big_tcp_data_lrg_sml
- validates that a smaller final segment coalesces into the previous chain of large-sized segments while crossing the IP_MAXPACKET limit.big_tcp_tcp_seq
- validates that a packet with a wrong sequence number doesn't coalesce. The test uses a sequence number for which the low 16 bits correspond to the correct sequence number to validate against truncation bugs, since total aggregate length crosses over the legacy size limit for BIG TCP.big_tcp_large_max
- validates that coalescing stops at the configured BIG TCP limit.
--- .../testing/selftests/drivers/net/gro_lib.py | 50 ++++++- tools/testing/selftests/net/lib/gro.c | 133 +++++++++++++++++- 2 files changed, 180 insertions(+), 3 deletions(-)
tools/testing/selftests/drivers/net/gro_lib.py +48 -2
@@ -40,13 +40,17 @@ Test cases: - ip_v6ext_diff: (IPv6) IPv6 ext header with different payload doesn't coalesce - large_max: Packets exceeding GRO_MAX_SIZE don't coalesce - large_rem: Large packet remainder handling + - big_tcp_data_same: Same size packets coalesce past IP_MAXPACKET + - big_tcp_data_lrg_sml: Smaller last packet coalesces past IP_MAXPACKET + - big_tcp_tcp_seq: Packets with 16-bit truncated seqno don't coalesce + - big_tcp_large_max: Packets exceeding the BIG TCP limit don't coalesce """ import glob import os import re -from lib.py import ksft_run, ksft_exit, ksft_pr -from lib.py import NetDrvEpEnv, KsftFailEx, KsftXfailEx +from lib.py import ksft_run, ksft_exit, ksft_pr, ksft_eq +from lib.py import NetDrvEpEnv, KsftFailEx, KsftSkipEx, KsftXfailEx from lib.py import NetdevFamily, EthtoolFamily from lib.py import bkg, cmd, ctl_file_write, defer, ethtool, ip from lib.py import ksft_variants, KsftNamedVariant
@@ -55,6 +59,8 @@ from lib.py import ksft_variants, KsftNamedVariant # gro.c uses hardcoded DPORT=8000 GRO_DPORT = 8000 +BIG_TCP_GRO_MAX_SIZE = 128000 + def _resolve_dmac(cfg, ipver): """
@@ -91,6 +97,34 @@ def _set_mtu_restore(dev, mtu, host): defer(ip, f"link set dev {dev['ifname']} mtu {dev['mtu']}", host=host) +def _set_gro_size_restore(cfg, size): + """ + Set the local device's GRO size limits, then confirm they stuck. + """ + + _set_mtu_restore(cfg.dev, 4096, None) + _set_mtu_restore(cfg.remote_dev, 4096, cfg.remote) + + if "gro_max_size" not in cfg.dev or "gro_ipv4_max_size" not in cfg.dev: + raise KsftSkipEx("iproute2 does not report the GRO size limits") + + if (cfg.dev["gro_max_size"] == size and + cfg.dev["gro_ipv4_max_size"] == size): + return + + old = (f"gro_max_size {cfg.dev['gro_max_size']} " + f"gro_ipv4_max_size {cfg.dev['gro_ipv4_max_size']}") + new = f"gro_max_size {size} gro_ipv4_max_size {size}" + + ip(f"link set dev {cfg.ifname} {new}") + defer(ip, f"link set dev {cfg.ifname} {old}") + + dev = ip("-d link show dev " + cfg.ifname, json=True)[0] + ksft_eq(dev["gro_max_size"], size, comment="gro_max_size not applied") + ksft_eq(dev["gro_ipv4_max_size"], size, + comment="gro_ipv4_max_size not applied") + + def _set_ethtool_feat(dev, current, feats, host=None): s2n = {True: "on", False: "off"}
@@ -289,6 +323,9 @@ def _setup(cfg, mode, test_name): except KsftXfailEx: pass + if test_name.startswith("big_tcp_"): + _set_gro_size_restore(cfg, BIG_TCP_GRO_MAX_SIZE) + def _gro_variants(): """Generator that yields all combinations of protocol and test types."""
@@ -304,6 +341,11 @@ def _gro_variants(): "large_max", "large_rem", ] + big_tcp_tests = [ + "big_tcp_data_same", "big_tcp_data_lrg_sml", + "big_tcp_tcp_seq", "big_tcp_large_max", + ] + # Tests specific to IPv4 ipv4_tests = [ "ip_csum",
@@ -322,6 +364,10 @@ def _gro_variants(): for test_name in common_tests: yield protocol, test_name + if protocol in ["ipv4", "ipv6"]: + for test_name in big_tcp_tests: + yield protocol, test_name + if protocol in ["ipv4", "ipip"]: for test_name in ipv4_tests: yield protocol, test_name
tools/testing/selftests/net/lib/gro.c +132 -1
175 lines not on this page · raw message
Signature · 1 line
2.53.0-Meta
Jakub Kicinski
maintainerQuoted 18 lines · On Thu, 10 Sep 2026 22:06:59 -0700 Narcisa Vasile wrote:
Add four new test cases that validate coalescing
under increased size limits (BIG TCP):
big_tcp_data_same
- validates that equal-sized segments coalesce past
the legacyIP_MAXPACKETlimit.big_tcp_data_lrg_sml
- validates that a smaller final segment coalesces into the previous chain of large-sized segments while crossing theIP_MAXPACKETlimit.big_tcp_tcp_seq
- validates that a packet with a wrong sequence number doesn't coalesce. The test uses a sequence number for which the low 16 bits correspond to the correct sequence number to validate against truncation bugs, since total aggregate length crosses over the legacy size limit for BIG TCP.big_tcp_large_max
- validates that coalescing stops at the configured BIG TCP limit.
Looks like SW is struggling to aggregate enough. Do we need longer timeouts perhaps? Note that the debug kernel build includes kernel/configs/debug.config
AI says:
Thanks for adding the BIG TCP coalescing coverage to gro_sw.py. CI is flagging the new subtests as failing on our debug-kernel executor (vmksft-net-drv-dbg, gro-sw-py):
not ok gro_sw.test.ipv4_big_tcp_data_same
not ok gro_sw.test.ipv4_big_tcp_data_lrg_sml
not ok gro_sw.test.ipv4_big_tcp_tcp_seq
not ok gro_sw.test.ipv4_big_tcp_large_max
(and the ipv6 equivalents)
The rx side never fully coalesces the injected segments before the background receiver gives up and the test's retry loop (6 attempts) is exhausted, e.g.:
Expected {68952 }, Total 1 packets
Received {20280 [!=68952]40560 [!=0]8112 [!=0]}, Total 3 packets.
Quoted 20 lines · Jakub Kicinski
Quoted 2 lines · On Thu, 10 Sep 2026 22:06:59 -0700 Narcisa Vasile wrote:
Add four new test cases that validate coalescing
under increased size limits (BIG TCP):Looks like SW is struggling to aggregate enough. Do we need longer timeouts perhaps? Note that the debug kernel build includes
kernel/configs/debug.configAI says:
Thanks for adding the BIG TCP coalescing coverage to
gro_sw.py. CI is flagging the new subtests as failing on our debug-kernel executor (vmksft-net-drv-dbg, gro-sw-py):not ok gro_sw.test.ipv4_big_tcp_data_same
not ok gro_sw.test.ipv4_big_tcp_data_lrg_sml
not ok gro_sw.test.ipv4_big_tcp_tcp_seq
not ok gro_sw.test.ipv4_big_tcp_large_max
(and the ipv6 equivalents)
Quoted 6 lines
The rx side never fully coalesces the injected segments before the background receiver gives up and the test's retry loop (6 attempts) is exhausted, e.g.:
Expected {68952 }, Total 1 packets
Received {20280 [!=68952]40560 [!=0]8112 [!=0]}, Total 3 packets.
I've run the tests in a loop on a slower system running a debug kernel using 10x the previous flush timeout and I still noticed retries every 10-20 iterations, so I've settled on 15x higher timeout to account for variability across different systems.
1..4
ok 1 gro_sw.test.ipv4_big_tcp_data_same
ok 2 gro_sw.test.ipv4_big_tcp_data_lrg_sml
ok 3 gro_sw.test.ipv4_big_tcp_tcp_seq
ok 4 gro_sw.test.ipv4_big_tcp_large_max
# Totals: pass:4 fail:0 xfail:0 xpass:0 skip:0 error:0
1..4
ok 1 gro_sw.test.ipv6_big_tcp_data_same
ok 2 gro_sw.test.ipv6_big_tcp_data_lrg_sml
ok 3 gro_sw.test.ipv6_big_tcp_tcp_seq
ok 4 gro_sw.test.ipv6_big_tcp_large_max
# Totals: pass:4 fail:0 xfail:0 xpass:0 skip:0 error:0