Skip to content

Commit

Permalink
selftests: xsk: Fix missing initialization
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Magnus Karlsson authored and Daniel Borkmann committed Sep 27, 2021
1 parent 94033cd commit 5b13205
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/testing/selftests/bpf/xdpxceiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5b13205

Please sign in to comment.