[Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet
Eva Kurchatova
eva.kurchatova at virtuozzo.com
Fri Nov 6 17:54:56 MSK 2026
From: Larysa Zaremba <larysa.zaremba at intel.com>
Referenced commit reduced the scope of the variable pkt, so now it has to
be reinitialized via pkt_stream_get_next_rx_pkt(), which also increments
some counters. When the packet is interrupted by the batch ending, pkt
stream therefore proceeds to the next packet, while xsk ring still contains
the previous one, this results in a pkt_nb mismatch.
Decrement the affected counters when packet is interrupted.
Fixes: 8913e653e9b8 ("selftests/xsk: Iterate over all the sockets in the receive pkts function")
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov at intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba at intel.com>
Link: https://lore.kernel.org/r/20260203155103.2305816-2-larysa.zaremba@intel.com
Signed-off-by: Alexei Starovoitov <ast at kernel.org>
(cherry picked from commit 42e41b2a0afa04ca49ee2725aadf90ccb058ed28)
Rebase note: applied to xskxceiver.c, which mainline split into
prog_tests/test_xsk.c in commit 3ab77f35a75e ("selftests/bpf:
test_xsk: Split xskxceiver"), missing here. The code is the same.
https://virtuozzo.atlassian.net/browse/VSTOR-153754
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
tools/testing/selftests/bpf/xskxceiver.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index a4a0b4e2516c..04fda63b6350 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1260,6 +1260,8 @@ static int __receive_pkts(struct test_spec *test, struct xsk_socket_info *xsk)
xsk_ring_prod__cancel(&umem->fq, nb_frags);
}
frags_processed -= nb_frags;
+ pkt_stream_cancel(pkt_stream);
+ pkts_sent--;
}
if (ifobj->use_fill_ring)
--
2.56.0
More information about the Devel
mailing list