diff mbox series

[bpf-next,v3,11/16] selftests: xsk: decrease sending speed

Message ID 20210825093722.10219-12-magnus.karlsson@gmail.com
State New
Headers show
Series selftests: xsk: various simplifications | expand

Commit Message

Magnus Karlsson Aug. 25, 2021, 9:37 a.m. UTC
From: Magnus Karlsson <magnus.karlsson@intel.com>

Decrease sending speed to avoid potentially overflowing some buffers
in the skb case that leads to dropped packets we cannot control (and
thus the tests may generate false negatives). Decrease batch size and
introduce a usleep in the transmit thread to not overflow the
receiver.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
---
 tools/testing/selftests/bpf/xdpxceiver.c | 1 +
 tools/testing/selftests/bpf/xdpxceiver.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index 8ff24472ef1e..bc7d6bbbb867 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -637,6 +637,7 @@  static void tx_only_all(struct ifobject *ifobject)
 
 		tx_only(ifobject->xsk, &frame_nb, batch_size);
 		pkt_cnt += batch_size;
+		usleep(10);
 	}
 
 	complete_tx_only_all(ifobject);
diff --git a/tools/testing/selftests/bpf/xdpxceiver.h b/tools/testing/selftests/bpf/xdpxceiver.h
index 0fb657b505ae..1c5457e9f1d6 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.h
+++ b/tools/testing/selftests/bpf/xdpxceiver.h
@@ -36,7 +36,7 @@ 
 #define UDP_PKT_DATA_SIZE (UDP_PKT_SIZE - sizeof(struct udphdr))
 #define USLEEP_MAX 10000
 #define SOCK_RECONF_CTR 10
-#define BATCH_SIZE 64
+#define BATCH_SIZE 8
 #define POLL_TMOUT 1000
 #define DEFAULT_PKT_CNT (4 * 1024)
 #define RX_FULL_RXQSIZE 32