Skip to content

Commit 42e41b2

Browse files
walking-machineAlexei Starovoitov
authored andcommitted
selftests/xsk: properly handle batch ending in the middle of a packet
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: 8913e65 ("selftests/xsk: Iterate over all the sockets in the receive pkts function") Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com> Link: https://lore.kernel.org/r/20260203155103.2305816-2-larysa.zaremba@intel.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 1ace9ba commit 42e41b2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tools/testing/selftests/bpf/prog_tests/test_xsk.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,8 @@ static int __receive_pkts(struct test_spec *test, struct xsk_socket_info *xsk)
10901090
xsk_ring_prod__cancel(&umem->fq, nb_frags);
10911091
}
10921092
frags_processed -= nb_frags;
1093+
pkt_stream_cancel(pkt_stream);
1094+
pkts_sent--;
10931095
}
10941096

10951097
if (ifobj->use_fill_ring)

0 commit comments

Comments
 (0)