[PATCH net-next v2 0/5] selftests/xsk: improve shared-UMEM coverage
From: Tushar Vyavahare <hidden>
Date: 2026-08-13 06:30:24
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 five
steps.
Patch 1 makes UMEM ownership explicit with refcounting and centralizes
socket/UMEM teardown, keeping cleanup behavior consistent across normal
completion and error paths.
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 unaligned path snapshots and restores alignment flags with
NULL-safe UMEM guards.
Patch 5 makes pkt_stream_even_odd_sequence() transactional: it stages
replacement streams until all allocations succeed, avoiding leaked
replacement streams and partially replaced socket stream arrays after
an allocation failure.
Together, these patches strengthen shared-UMEM setup and cleanup and
extend selftest coverage to multi-socket and packet-distribution
scenarios.
v1 -> v2:
- [1/5] Track per-slot UMEM ownership and centralize refcount-based
socket teardown. [sashiko]
- [2/5] Replace the redundant partial-socket rollback with RX failure
publication before the setup barrier and skip TX setup after a failed
RX configuration. [BPF AI]
- [3/5] Trim the length-classifier comment to match nearby BPF style.
[BPF AI]
- [5/5] Clarify the partial stream replacement leak in the commit
message. [BPF AI]
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Tushar Vyavahare <redacted>
Tushar Vyavahare (5):
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/xsk: make pkt_stream_even_odd_sequence rollback-safe
.../selftests/bpf/prog_tests/test_xsk.c | 423 ++++++++++++++++--
.../selftests/bpf/prog_tests/test_xsk.h | 26 +-
.../selftests/bpf/progs/xsk_xdp_progs.c | 15 +-
tools/testing/selftests/bpf/xsk_xdp_common.h | 3 +-
tools/testing/selftests/bpf/xskxceiver.c | 38 +-
5 files changed, 430 insertions(+), 75 deletions(-)
--
2.43.0