summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2022-01-21 13:35:08 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2022-01-24 17:29:22 +0100
commitb4ec6a19231224f6b08dc54ea07da4c4090e8ee3 (patch)
tree618fa40d4f646da1a90f828c48c9f5e0d71b3fa7
parented8bb03222c965290026c8ead5a902f4140f5440 (diff)
downloadlinux-stable-b4ec6a19231224f6b08dc54ea07da4c4090e8ee3.tar.gz
linux-stable-b4ec6a19231224f6b08dc54ea07da4c4090e8ee3.tar.bz2
linux-stable-b4ec6a19231224f6b08dc54ea07da4c4090e8ee3.zip
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: 872a1184dbf2 ("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
-rw-r--r--tools/testing/selftests/bpf/xdpxceiver.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 0a5d23da486d..ffa5502ad95e 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -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;