selftests: xsk: Add test for unaligned mode
authorMagnus Karlsson <magnus.karlsson@intel.com>
Tue, 7 Sep 2021 07:19:25 +0000 (09:19 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 10 Sep 2021 19:15:31 +0000 (21:15 +0200)
commita4ba98dd0c693e4f0f4aa93ef210a77a72d32025
treeefea1e21006d37792aca5193bb5cf8a622b7980e
parent605091c5100ddc1ae0d67a74b688d8755658d3c9
selftests: xsk: Add test for unaligned mode

Add a test for unaligned mode in which packet buffers can be placed
anywhere within the umem. Some packets are made to straddle page
boundaries in order to check for correctness. On the Tx side, buffers
are now allocated according to the addresses found in the packet
stream. Thus, the placement of buffers can be controlled with the
boolean use_addr_for_fill in the packet stream.

One new pkt_stream interface is introduced: pkt_stream_replace_half()
that replaces every other packet in the default packet stream with the
specified new packet. The constant DEFAULT_OFFSET is also
introduced. It specifies at what offset from the start of a chunk a Tx
packet is placed by the sending thread. This is just to be able to
test that it is possible to send packets at an offset not equal to
zero.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/bpf/20210907071928.9750-18-magnus.karlsson@gmail.com
tools/testing/selftests/bpf/xdpxceiver.c
tools/testing/selftests/bpf/xdpxceiver.h