[PATCH net-next v3 0/4] selftests/xsk: improve shared-UMEM coverage
From: Tushar Vyavahare <hidden>
Date: 2026-08-19 02:47:17
Also in:
bpf
AF_XDP shared-UMEM support in the existing XSK selftests is limited to
a small set of scenarios, while the supporting setup and cleanup paths
become fragile as coverage expands.
This series improves shared-UMEM testing and infrastructure in four
steps.
Patch 1 makes UMEM ownership explicit with refcounting and centralizes
socket and UMEM teardown, keeping cleanup behavior consistent across
normal completion and error paths. A UMEM that survives teardown now
fails the test instead of leaking silently.
Patch 2 prevents TX setup when RX socket configuration has already
failed. This avoids shared-UMEM TX setup relying on incomplete RX-side
socket and UMEM state.
Patch 3 expands XSKMAP and test capacity to four sockets and adds a
length-based XDP steering program. The classifier uses total
XDP-visible packet length (data_end - data) and SHARED_UMEM_LEN_SPLIT.
Patch 4 adds the shared-UMEM callback runner and initial 4-socket,
length-based steering, uneven-distribution, and unaligned-chunk test
cases. The three packet-stream sequences share one transactional helper
that stages replacement streams and publishes them into the socket
arrays only after every allocation has succeeded.
Together, these patches strengthen shared-UMEM setup and cleanup and
extend selftest coverage to multi-socket and packet-distribution
scenarios.
v1 -> v2:
- [1/4] Track per-slot UMEM ownership and centralize refcount-based
teardown. [sashiko]
- [2/4] Publish RX failure before the setup barrier and skip TX setup
after a failed RX configuration. [BPF AI]
- [3/4] Trim the length-classifier comment to match nearby BPF style.
[BPF AI]
- [4/4] Clarify the partial stream replacement leak in the commit
message. [BPF AI]
v2 -> v3:
- [1/4] Keep one xsk_umem_info for shared-UMEM TX setup instead of
copying it; initialize only the non-owning TX buffer view. [sashiko]
- [1/4] Propagate xsk_umem__delete() errors so the stack-allocated
zero-copy probe cannot lose deferred cleanup. [sashiko]
- [1/4] Record UMEM deletion failures in test->fail; in-test teardown
cannot retry them. [sashiko]
- [1/4] Collapse the redundant teardown helpers into a single loop.
[sashiko]
- [4/4] Fold the previous 5/5 rollback-safe stream replacement into
this patch. [BPF AI]
- [4/4] Factor the three stream sequences into pkt_stream_replace_seq(),
driven by a pkt_stream_dims_fn callback. [BPF AI]
- [4/4] Drop the stream-readiness check and the uneven-distribution
hook; neither could fail. [sashiko]
- [4/4] Drop the unreachable NULL-safe UMEM guards from the unaligned
test. [co-pilot]
Co-developed-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Tushar Vyavahare <redacted>
Tushar Vyavahare (4):
selftests/xsk: add UMEM users refcount and centralize socket teardown
selftests/xsk: skip TX setup after RX configuration failure
selftests/xsk: expand XSKMAP capacity and add length-based XDP program
selftests/xsk: add shared-UMEM callback framework and initial test
cases
.../selftests/bpf/prog_tests/test_xsk.c | 340 +++++++++++++++---
.../selftests/bpf/prog_tests/test_xsk.h | 27 +-
.../selftests/bpf/progs/xsk_xdp_progs.c | 15 +-
tools/testing/selftests/bpf/xsk_xdp_common.h | 3 +-
tools/testing/selftests/bpf/xskxceiver.c | 40 +--
5 files changed, 344 insertions(+), 81 deletions(-)
--
2.43.0