mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
selftests: xsk: Deflakify STATS_RX_DROPPED test
[ Upstream commit68e7322142
] Fix flaky STATS_RX_DROPPED test. The receiver calls getsockopt after receiving the last (valid) packet which is not the final packet sent in the test (valid and invalid packets are sent in alternating fashion with the final packet being invalid). Since the last packet may or may not have been dropped already, both outcomes must be allowed. This issue could also be fixed by making sure the last packet sent is valid. This alternative is left as an exercise to the reader (or the benevolent maintainers of this file). This problem was quite visible on certain setups. On one machine this failure was observed 50% of the time. Also, remove a redundant assignment of pkt_stream->nb_pkts. This field is already initialized by __pkt_stream_alloc. Fixes:27e934bec3
("selftests: xsk: make stat tests not spin on getsockopt") Signed-off-by: Kal Conley <kal.conley@dectris.com> Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> Link: https://lore.kernel.org/r/20230403120400.31018-1-kal.conley@dectris.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
0ea59567d0
commit
751168d0d2
1 changed files with 8 additions and 2 deletions
|
@ -649,7 +649,6 @@ static struct pkt_stream *pkt_stream_generate(struct xsk_umem_info *umem, u32 nb
|
|||
if (!pkt_stream)
|
||||
exit_with_error(ENOMEM);
|
||||
|
||||
pkt_stream->nb_pkts = nb_pkts;
|
||||
for (i = 0; i < nb_pkts; i++) {
|
||||
pkt_set(umem, &pkt_stream->pkts[i], (i % umem->num_frames) * umem->frame_size,
|
||||
pkt_len);
|
||||
|
@ -1141,7 +1140,14 @@ static int validate_rx_dropped(struct ifobject *ifobject)
|
|||
if (err)
|
||||
return TEST_FAILURE;
|
||||
|
||||
if (stats.rx_dropped == ifobject->pkt_stream->nb_pkts / 2)
|
||||
/* The receiver calls getsockopt after receiving the last (valid)
|
||||
* packet which is not the final packet sent in this test (valid and
|
||||
* invalid packets are sent in alternating fashion with the final
|
||||
* packet being invalid). Since the last packet may or may not have
|
||||
* been dropped already, both outcomes must be allowed.
|
||||
*/
|
||||
if (stats.rx_dropped == ifobject->pkt_stream->nb_pkts / 2 ||
|
||||
stats.rx_dropped == ifobject->pkt_stream->nb_pkts / 2 - 1)
|
||||
return TEST_PASS;
|
||||
|
||||
return TEST_FAILURE;
|
||||
|
|
Loading…
Reference in a new issue