]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests/xsk: account reclaimed invalid Tx descriptors
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Sun, 19 Jul 2026 13:56:09 +0000 (15:56 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 24 Jul 2026 22:12:15 +0000 (15:12 -0700)
commitf49d99eaee7c32badc7ddfaecbb01ce4d037d695
tree0b3c51ae3f3ba0101e9a5dd7e4c91184b6d27feb
parentc5b1ca6a02886f00170ed91b757e244f23259e91
selftests/xsk: account reclaimed invalid Tx descriptors

Invalid Tx descriptors are now returned through the completion ring,
regardless of whether they form a standalone packet or belong to an
invalid multi-buffer packet.

The selftests previously counted only descriptors belonging to valid
packets, with a special exception for some invalid multi-buffer packets
in verbatim streams. This undercounts completion entries when a
standalone invalid descriptor or another invalid packet is reclaimed by
the kernel.

Keep valid_pkts as the number of packets expected on the Rx side, but
count every descriptor submitted to the Tx ring in valid_frags, as every
such descriptor is now expected to be returned through the completion
ring.

Make fragment counting in verbatim mode follow the packet boundary
instead of stopping at the first invalid fragment. Update custom stream
generation so an invalid middle fragment terminates the generated Rx
packet while Tx completion accounting still covers the complete invalid
packet.

Also add explicit end fragments after invalid middle descriptors. This
exercises the kernel drain logic and verifies that subsequent valid
packets are not interpreted as continuations of the invalid packet.

Reviewed-by: Jason Xing <kernelxing@tencent.com>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20260719135609.147823-7-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_xsk.c