summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2021-09-22 10:56:07 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2021-09-28 01:18:35 +0300
commit5b132056123dfe25b0a8c96d1420e9c31cb8edf8 (patch)
treeda4db89ab4e94d46bdd594de9e1ae0df0d9ed48d /tools
parent94033cd8e73b8632bab7c8b7bb54caa4f5616db7 (diff)
downloadlinux-5b132056123dfe25b0a8c96d1420e9c31cb8edf8.tar.xz
selftests: xsk: Fix missing initialization
Fix missing initialization of the member rx_pkt_nb in the packet stream. This leads to some tests declaring success too early as the test thought all packets had already been received. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20210922075613.12186-8-magnus.karlsson@gmail.com
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/xdpxceiver.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 127bcde06c86..97591e2a69f7 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -445,6 +445,12 @@ static void test_spec_set_name(struct test_spec *test, const char *name)
strncpy(test->name, name, MAX_TEST_NAME_SIZE);
}
+static void pkt_stream_reset(struct pkt_stream *pkt_stream)
+{
+ if (pkt_stream)
+ pkt_stream->rx_pkt_nb = 0;
+}
+
static struct pkt *pkt_stream_get_pkt(struct pkt_stream *pkt_stream, u32 pkt_nb)
{
if (pkt_nb >= pkt_stream->nb_pkts)
@@ -1032,6 +1038,7 @@ static void testapp_validate_traffic(struct test_spec *test)
exit_with_error(errno);
test->current_step++;
+ pkt_stream_reset(ifobj_rx->pkt_stream);
/*Spawn RX thread */
pthread_create(&t0, NULL, ifobj_rx->func_ptr, test);