summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/xdpxceiver.h
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2021-08-25 11:37:20 +0200
committerAlexei Starovoitov <ast@kernel.org>2021-08-25 12:23:11 -0700
commit29f128b38b346a16dc6749b66f20fca29430d271 (patch)
tree8a943d490c3ac155663999c1942592c1c20d15c1 /tools/testing/selftests/bpf/xdpxceiver.h
parent960b6e0153fb383bd634313fbd41bd4813dd73fc (diff)
selftests: xsk: Generate packets from specification
Generate packets from a specification instead of something hard coded. The idea is that a test generates one or more packet specifications and provides it/them to both Tx and Rx. The Tx thread will generate from this specification and Rx will validate that it receives what is in the specification. The specification can be the same on both ends, meaning that everything that was sent should be received, or different which means that Rx will only receive part of the sent packets. Currently, the packet specification is the same for both Rx and Tx and the same for each test. This will change in later work as features and tests are added. The data path functions are also renamed to better reflect what actions they are performing after introducing this feature. Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20210825093722.10219-15-magnus.karlsson@gmail.com
Diffstat (limited to 'tools/testing/selftests/bpf/xdpxceiver.h')
-rw-r--r--tools/testing/selftests/bpf/xdpxceiver.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/testing/selftests/bpf/xdpxceiver.h b/tools/testing/selftests/bpf/xdpxceiver.h
index 7670df7e7746..3e5394295ac1 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.h
+++ b/tools/testing/selftests/bpf/xdpxceiver.h
@@ -40,6 +40,7 @@
#define POLL_TMOUT 1000
#define DEFAULT_PKT_CNT (4 * 1024)
#define RX_FULL_RXQSIZE 32
+#define XSK_UMEM__INVALID_FRAME_SIZE (XSK_UMEM__DEFAULT_FRAME_SIZE + 1)
#define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } while (0)
@@ -74,13 +75,10 @@ static u32 num_frames = DEFAULT_PKT_CNT / 4;
static bool second_step;
static int test_type;
-static u32 opt_pkt_count = DEFAULT_PKT_CNT;
static u8 opt_verbose;
static u32 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
static u32 xdp_bind_flags = XDP_USE_NEED_WAKEUP | XDP_COPY;
-static u32 pkt_counter;
-static int sigvar;
static int stat_test_type;
static u32 rxqsize;
static u32 frame_headroom;
@@ -107,6 +105,17 @@ struct flow_vector {
} vector;
};
+struct pkt {
+ u64 addr;
+ u32 len;
+ u32 payload;
+};
+
+struct pkt_stream {
+ u32 nb_pkts;
+ struct pkt *pkts;
+};
+
struct ifobject {
char ifname[MAX_INTERFACE_NAME_CHARS];
char nsname[MAX_INTERFACES_NAMESPACE_CHARS];
@@ -116,6 +125,7 @@ struct ifobject {
struct xsk_umem_info *umem;
void *(*func_ptr)(void *arg);
struct flow_vector fv;
+ struct pkt_stream *pkt_stream;
int ns_fd;
u32 dst_ip;
u32 src_ip;