aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>2018-05-31 00:42:38 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-06-02 00:13:56 -0400
commita009f1f396d04a700971586ce8a142ea606cbb61 (patch)
tree789c1813757218f053d02835801b875ba85b5c01
parent035b37ff2c6e3577b8ad7d5c3cc4619ab74559bb (diff)
selftests/bpf: test_sockmap, timing improvements
Currently 10us delay is too low for many tests to succeed. It needs to be increased. Also, many corked tests are expected to hit rx timeout irrespective of timeout value. - This patch sets 1000usec timeout value for corked tests because less than that causes broken-pipe error in tx thread. Also sets 1 second timeout for all other tests because less than that results in RX timeout - tests with apply=1 and higher number of iterations were taking lot of time. This patch reduces test run time by reducing iterations. real 0m12.968s user 0m0.219s sys 0m14.337s Fixes: a18fda1a62c3 ("bpf: reduce runtime of test_sockmap tests") Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp> Acked-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--tools/testing/selftests/bpf/test_sockmap.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
index 7f9ca79aadbc..5cd0550af595 100644
--- a/tools/testing/selftests/bpf/test_sockmap.c
+++ b/tools/testing/selftests/bpf/test_sockmap.c
@@ -345,8 +345,13 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
345 if (err < 0) 345 if (err < 0)
346 perror("recv start time: "); 346 perror("recv start time: ");
347 while (s->bytes_recvd < total_bytes) { 347 while (s->bytes_recvd < total_bytes) {
348 timeout.tv_sec = 0; 348 if (txmsg_cork) {
349 timeout.tv_usec = 10; 349 timeout.tv_sec = 0;
350 timeout.tv_usec = 1000;
351 } else {
352 timeout.tv_sec = 1;
353 timeout.tv_usec = 0;
354 }
350 355
351 /* FD sets */ 356 /* FD sets */
352 FD_ZERO(&w); 357 FD_ZERO(&w);
@@ -1025,14 +1030,14 @@ static int test_send(struct sockmap_options *opt, int cgrp)
1025 1030
1026 opt->iov_length = 1; 1031 opt->iov_length = 1;
1027 opt->iov_count = 1; 1032 opt->iov_count = 1;
1028 opt->rate = 1024; 1033 opt->rate = 512;
1029 err = test_exec(cgrp, opt); 1034 err = test_exec(cgrp, opt);
1030 if (err) 1035 if (err)
1031 goto out; 1036 goto out;
1032 1037
1033 opt->iov_length = 256; 1038 opt->iov_length = 256;
1034 opt->iov_count = 1024; 1039 opt->iov_count = 1024;
1035 opt->rate = 10; 1040 opt->rate = 2;
1036 err = test_exec(cgrp, opt); 1041 err = test_exec(cgrp, opt);
1037 if (err) 1042 if (err)
1038 goto out; 1043 goto out;