summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/xdpxceiver.h
diff options
context:
space:
mode:
authorMagnus Karlsson <magnus.karlsson@intel.com>2021-09-22 09:56:10 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2021-09-28 00:18:35 +0200
commit1bf3649688c103f80690a7088a105924f9d5a6e4 (patch)
tree2779af6a76a183962d124a5477352dfac69cd4f9 /tools/testing/selftests/bpf/xdpxceiver.h
parentselftests: xsk: Fix socket creation retry (diff)
downloadlinux-1bf3649688c103f80690a7088a105924f9d5a6e4.tar.xz
linux-1bf3649688c103f80690a7088a105924f9d5a6e4.zip
selftests: xsk: Introduce pacing of traffic
Introduce pacing of traffic so that the Tx thread can never send more packets than the receiver has processed plus the number of packets it can have in its umem. So at any point in time, the number of in flight packets (not processed by the Rx thread) are less than or equal to the number of packets that can be held in the Rx thread's umem. The batch size is also increased to improve running time. 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-11-magnus.karlsson@gmail.com
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/bpf/xdpxceiver.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/xdpxceiver.h b/tools/testing/selftests/bpf/xdpxceiver.h
index 5ac4a5e64744..00790c976f4f 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.h
+++ b/tools/testing/selftests/bpf/xdpxceiver.h
@@ -35,7 +35,7 @@
#define UDP_PKT_DATA_SIZE (UDP_PKT_SIZE - sizeof(struct udphdr))
#define USLEEP_MAX 10000
#define SOCK_RECONF_CTR 10
-#define BATCH_SIZE 8
+#define BATCH_SIZE 64
#define POLL_TMOUT 1000
#define DEFAULT_PKT_CNT (4 * 1024)
#define DEFAULT_UMEM_BUFFERS (DEFAULT_PKT_CNT / 4)
@@ -136,6 +136,7 @@ struct ifobject {
bool tx_on;
bool rx_on;
bool use_poll;
+ bool pacing_on;
u8 dst_mac[ETH_ALEN];
u8 src_mac[ETH_ALEN];
};
@@ -151,5 +152,9 @@ struct test_spec {
};
pthread_barrier_t barr;
+pthread_mutex_t pacing_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t pacing_cond = PTHREAD_COND_INITIALIZER;
+
+u32 pkts_in_flight;
#endif /* XDPXCEIVER_H */