[Devel] [PATCH hci-8.1 v4 0/3] selftests/bpf: run the xsk veth tests in a network namespace of their own

Konstantin Khorenko khorenko at virtuozzo.com
Tue Oct 27 21:15:18 MSK 2026


Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-150731

test_xsk.sh makes its veth pair in the host's namespace. The host's own
traffic on the pair reaches the AF_XDP sockets under test, so the tests
fail on a configured host and pass on a bare one. The series moves the
veth part into a namespace of its own, after two fixes it relies on:

- Patch 1: test_exit() exits 1 for a skip, so the runner counts every
  "skip all tests" as a failure.
- Patch 2: xskxceiver takes the fragment limit from the max_skb_frags
  sysctl, which AF_XDP does not check and which exists in the initial
  namespace only. Take MAX_SKB_FRAGS from the kernel's BTF.
- Patch 3: the namespace itself.

Assisted-by: LLM
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
Changes in v4:
- Split v3 into three patches. The test_exit() fix gets a Fixes: tag;
  mainline gets the same fix (VSTOR-151679), and a commit of its own
  here can later be replaced by the ms/ one.
- Patch 3: drop "mount --make-rprivate /", unshare --mount already
  makes the new mount namespace private.
- Messages: the sysctl fallback serves kernels without BTF only, it
  cannot work inside the namespace; the "as before" claim is gone.
- Link to v3: http://lore.virtuozzo.com/20261026012309.458048-1-eva.kurchatova@virtuozzo.com

Changes in v3:
- The namespace is unnamed, so it goes with its last process however
  the run ends, Ctrl-C, a timeout or a kill, and no outer run is left
  to delete host interfaces.
- Obtain max_skb_frags from the kernel BTF, removing -f option.
- Fix test_exit() exit status for skipped runs.
- With -d, the namespace is kept.
- Rebased.
- Link to v2: http://lore.virtuozzo.com/kernel/20261022024816.2435565-1-eva.kurchatova@virtuozzo.com/T/#t

Changes in v2:
- -f is checked as the sysctl is, 1 to 45 and digits only, so a value
  that would wrap the fragment count or the packet array is refused.
- -f goes into the namespace only when the host's sysctl file could be
  read; a bare -f made getopts complain.
- No network namespace skips the tests, as no veth support does, rather
  than failing them.
- The -f description says the option tells the tests the kernel's limit
  and changes nothing in the kernel.
- The -d hint names the namespace in a usable form.
- test_exit() exits 1 for a skip as it does for the veth one; as the
  script has it.
- Link to v1: http://lore.virtuozzo.com/kernel/20261020041218.1659392-1-eva.kurchatova@virtuozzo.com/T/#t

---
Eva Kurchatova (3):
      selftests/bpf: xsk: exit with the status test_exit() is given
      selftests/bpf: xsk: take the fragment limit from the kernel's BTF
      selftests/bpf: run the xsk veth tests in a network namespace of their own

 tools/testing/selftests/bpf/test_xsk.sh    | 30 +++++++++++++++++++++--
 tools/testing/selftests/bpf/xsk_prereqs.sh |  2 +-
 tools/testing/selftests/bpf/xskxceiver.c   | 39 +++++++++++++++++++++++++++++-
 3 files changed, 67 insertions(+), 4 deletions(-)
---
base-commit: 02401c5e378f282fbf11bdc65996253ff65dad9b
change-id: 20261027-b4-prep-khorenko-vstor-150731-xsk-veth-netns-d97e81caa801

Best regards,
--  
Konstantin Khorenko,
Virtuozzo Linux Kernel Team



More information about the Devel mailing list