Thread (36 messages) 36 messages, 4 authors, 6d ago

Re: [PATCH v2 net-next 05/14] selftests: xsk: move the AF_XDP test suite to selftests/net

flat view

From: Björn Töpel <bjorn@kernel.org>
Date: 2026-10-09 11:18:13
Also in: bpf

Maciej Fijalkowski [off-list ref] writes:
Move the xskxceiver engine, the AF_XDP userspace library, the test
definitions and the XDP program to net/lib/xsk, and the veth launcher
test_xsk.sh with its prerequisites script to selftests/net. A later
patch drives the same engine against real NICs from drivers/net/hw, and
net/lib is where both suites already take shared helpers from, so the
binary does not need a second copy.

net/lib builds xskxceiver together with its XDP program and skeleton,
using the bpftool in PATH, and skips it with a warning when bpftool is
missing or does not run, so the rest of net/lib still builds.
selftests/net installs test_xsk.sh, which runs lib/xskxceiver.

Like the rest of net/lib, xskxceiver builds against the installed uapi
headers rather than the tools/include/uapi copies that the bpf selftests
use. xskxceiver.c got min_t() only because the tools copy of
linux/netlink.h includes linux/kernel.h, so include linux/kernel.h
directly.

Move the two ethtool ring helpers from network_helpers into xsk.c so the
engine no longer depends on network_helpers, and point the kselftest.h
include of test_xsk.h at the net/lib include path. The XDP program moves
unchanged. Its Ethernet header bound check compares pointers of distinct
types, so net/lib builds it with -Wno-compare-distinct-pointer-types, as
the bpf selftests do.

xdp_hw_metadata and the test_progs xdp_metadata test keep using xsk.c
and xsk.h from their new location.

Point the AF_XDP entry in MAINTAINERS at the new paths.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 Documentation/networking/af_xdp.rst           |  6 +--
 MAINTAINERS                                   |  3 +-
 tools/testing/selftests/bpf/.gitignore        |  1 -
 tools/testing/selftests/bpf/Makefile          | 29 +++++------
 tools/testing/selftests/bpf/network_helpers.c | 48 ------------------
 tools/testing/selftests/bpf/network_helpers.h |  2 -
 tools/testing/selftests/net/Makefile          |  2 +
 tools/testing/selftests/net/config            |  1 +
 tools/testing/selftests/net/lib/.gitignore    |  2 +
 tools/testing/selftests/net/lib/Makefile      | 34 +++++++++++++
 .../prog_tests => net/lib/xsk}/test_xsk.c     |  2 +-
 .../prog_tests => net/lib/xsk}/test_xsk.h     |  2 +-
 .../selftests/{bpf => net/lib/xsk}/xsk.c      | 49 ++++++++++++++++++-
 .../selftests/{bpf => net/lib/xsk}/xsk.h      |  4 ++
 .../{bpf => net/lib/xsk}/xsk_xdp_common.h     |  0
 .../lib/xsk/xsk_xdp_progs.bpf.c}              |  0
 .../{bpf => net/lib/xsk}/xskxceiver.c         |  7 +--
 .../{bpf => net/lib/xsk}/xskxceiver.h         |  0
 .../selftests/{bpf => net}/test_xsk.sh        |  0
I would not carry the test_xsk.sh over. Just do a Python variant, like
the drivers/net/hw/xsk.py, but for net instead. Look at the the
nk_lease.py pair for inspiration.

It's just a cogitive load switch between Python and bash. We're starting
out fresh(ish) here.

The Python ksft world gives us a lot for free.


Björn
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help