[PATCH net v2 0/2] xsk: fix multi-buffer TX software checksum

From: Rongzheng Wang

Date: Sat Oct 24 2026 - 10:13:45 EST


This is v2 of the AF_XDP multi-buffer TX software checksum fix.

v1 was a single patch containing both the kernel fix and a standalone
selftest. Review feedback asked to split it into a 2-patch series and to
reuse the existing xdp_metadata selftest infrastructure. v2 does that.

Patch 1 moves the software checksum calculation from xsk_skb_metadata() to
the point where the last descriptor has been added to the skb. The old
code calculated the checksum after the first descriptor, so multi-buffer
packets only included the first fragment in the checksum.

On a checksum failure the packet is now dropped after the descriptors have
been consumed. Metadata validation makes this path unreachable in the
current copy-mode implementation; keeping the defensive drop avoids a
retry path for an skb that is no longer complete.

Patch 2 extends test_xdp_metadata instead of adding another test harness.
It reuses the existing AF_XDP setup, packet generation, completion, and
verification helpers, and sends the same UDP packet both as one descriptor
and as two descriptors.

Testing:
- final exact-else patched kernel: xdp_metadata 1/0 PASSED
- same-config unpatched kernel: checksum mismatch, xdp_metadata FAILED
- checkpatch --strict: 0 errors / 0 warnings for both patches

Changes in v2:
- split the kernel fix and selftest into 1/2 and 2/2
- reuse test_xdp_metadata helpers and reduce the selftest patch to
86 insertions
- use literal else and unlikely in the checksum error path
- document the drop decision and test it on patched and unpatched kernels


Rongzheng Wang (2):
xsk: defer software checksum until the skb is complete
selftests/bpf: cover AF_XDP multi-buffer TX software checksum

net/xdp/xsk.c | 22 +--
.../selftests/bpf/prog_tests/xdp_metadata.c | 126 ++++++++++++------
2 files changed, 100 insertions(+), 48 deletions(-)

--
2.39.5 (Apple Git-154)