selftests, xsk: Fix rx_full stats test

Fix the rx_full stats test so that it correctly reports pass even when
the fill ring is not full of buffers.

Fixes: 872a1184db ("selftests: xsk: Put the same buffer only once in the fill ring")
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/bpf/20220121123508.12759-1-magnus.karlsson@gmail.com
This commit is contained in:
Magnus Karlsson 2022-01-21 13:35:08 +01:00 коммит произвёл Daniel Borkmann
Родитель ed8bb03222
Коммит b4ec6a1923
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -906,7 +906,10 @@ static bool rx_stats_are_valid(struct ifobject *ifobject)
return true;
case STAT_TEST_RX_FULL:
xsk_stat = stats.rx_ring_full;
expected_stat -= RX_FULL_RXQSIZE;
if (ifobject->umem->num_frames < XSK_RING_PROD__DEFAULT_NUM_DESCS)
expected_stat = ifobject->umem->num_frames - RX_FULL_RXQSIZE;
else
expected_stat = XSK_RING_PROD__DEFAULT_NUM_DESCS - RX_FULL_RXQSIZE;
break;
case STAT_TEST_RX_FILL_EMPTY:
xsk_stat = stats.rx_fill_ring_empty_descs;