Commit 42e41b2a authored by Larysa Zaremba's avatar Larysa Zaremba Committed by Alexei Starovoitov
Browse files

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: 8913e653 ("selftests/xsk: Iterate over all the sockets in the receive pkts function")
Reviewed-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
Link: https://lore.kernel.org/r/20260203155103.2305816-2-larysa.zaremba@intel.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 1ace9bac
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1090,6 +1090,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)