]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: integrate test_tc_edt into test_progs
authorAlexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Fri, 28 Nov 2025 22:27:19 +0000 (23:27 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 29 Nov 2025 17:37:41 +0000 (09:37 -0800)
commitb0f82e7ab6fb2f8501ef87ae928cbf7358d7845e
treeb349f81a8b8e95c9b5241b8e771c14e774222e36
parent4b4833acc63e9c8ea9d5897ee84b694f30b23882
selftests/bpf: integrate test_tc_edt into test_progs

test_tc_edt.sh uses a pair of veth and a BPF program attached to the TX
veth to shape the traffic to 5MBps. It then checks that the amount of
received bytes (at interface level), compared to the TX duration, indeed
matches 5Mbps.

Convert this test script to the test_progs framework:
- keep the double veth setup, isolated in two veths
- run a small tcp server, and connect client to server
- push a pre-configured amount of bytes, and measure how much time has
  been needed to push those
- ensure that this rate is in a 2% error margin around the target rate

This two percent value, while being tight, is hopefully large enough to
not make the test too flaky in CI, while also turning it into a small
example of BPF-based shaping.

Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20251128-tc_edt-v2-2-26db48373e73@bootlin.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_tc_edt.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_tc_edt.c