Lines Matching +full:tx +full:- +full:ping +full:- +full:pong
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2017-2018 Covalent IO, Inc. http://covalent.io
186 env.type = o->map; in test_start_subtest()
187 env.subtest = t->title; in test_start_subtest()
188 env.prepend = o->prepend; in test_start_subtest()
198 int error = env.fail_cnt - env.fail_last; in test_end_subtest()
221 printf(" Usage: %s --cgroup <cgroup_path>\n", argv[0]); in usage()
224 printf(" --%-12s", long_options[i].name); in usage()
229 printf(" -%c\n", long_options[i].val); in usage()
272 return -EINVAL; in sockmap_init_ktls()
277 return -EINVAL; in sockmap_init_ktls()
282 return -EINVAL; in sockmap_init_ktls()
287 return -EINVAL; in sockmap_init_ktls()
292 return -EINVAL; in sockmap_init_ktls()
326 /* Non-blocking sockets */ in sockmap_init_sockets()
400 printf("connected sockets: c1 <-> p1, c2 <-> p2\n"); in sockmap_init_sockets()
401 printf("cgroups binding: c1(%i) <-> s1(%i) - - - c2(%i) <-> s2(%i)\n", in sockmap_init_sockets()
418 bool drop = opt->drop_expected; in msg_loop_sendpage()
435 clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop_sendpage()
450 return -EIO; in msg_loop_sendpage()
454 s->bytes_sent += sent; in msg_loop_sendpage()
456 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop_sendpage()
465 for (i = 0; i < msg->msg_iovlen; i++) in msg_free_iov()
466 free(msg->msg_iov[i].iov_base); in msg_free_iov()
467 free(msg->msg_iov); in msg_free_iov()
468 msg->msg_iov = NULL; in msg_free_iov()
469 msg->msg_iovlen = 0; in msg_free_iov()
502 msg->msg_iov = iov; in msg_alloc_iov()
503 msg->msg_iovlen = iov_count; in msg_alloc_iov()
507 for (i--; i >= 0 ; i--) in msg_alloc_iov()
508 free(msg->msg_iov[i].iov_base); in msg_alloc_iov()
509 return -ENOMEM; in msg_alloc_iov()
517 for (i = 0; i < msg->msg_iovlen; i++) { in msg_verify_data()
518 unsigned char *d = msg->msg_iov[i].iov_base; in msg_verify_data()
522 if (msg->msg_iov[i].iov_len < 4) in msg_verify_data()
523 return -EIO; in msg_verify_data()
528 return -EIO; in msg_verify_data()
533 for (; j < msg->msg_iov[i].iov_len && size; j++) { in msg_verify_data()
537 i, j, d[j], k - 1, d[j+1], k); in msg_verify_data()
538 return -EIO; in msg_verify_data()
545 size--; in msg_verify_data()
552 struct msg_stats *s, bool tx, in msg_loop() argument
557 bool drop = opt->drop_expected; in msg_loop()
558 bool data = opt->data_test; in msg_loop()
561 if (!tx && opt->check_recved_len) in msg_loop()
564 err = msg_alloc_iov(&msg, iov_count, iov_alloc_length, data, tx); in msg_loop()
568 err = msg_alloc_iov(&msg_peek, iov_count, iov_length, data, tx); in msg_loop()
573 if (tx) { in msg_loop()
574 clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop()
582 if (opt->tx_wait_mem && errno == EACCES) { in msg_loop()
592 errno = -EIO; in msg_loop()
596 s->bytes_sent += sent; in msg_loop()
598 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
622 total_bytes -= txmsg_pop_total; in msg_loop()
623 err = clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop()
626 while (s->bytes_recvd < total_bytes) { in msg_loop()
640 if (slct == -1) { in msg_loop()
642 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
645 if (opt->verbose) in msg_loop()
646 …fprintf(stderr, "unexpected timeout: recved %zu/%f pop_total %f\n", s->bytes_recvd, total_bytes, t… in msg_loop()
647 errno = -EIO; in msg_loop()
648 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
652 if (opt->tx_wait_mem) { in msg_loop()
667 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
677 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
683 s->bytes_recvd += recv; in msg_loop()
685 if (opt->check_recved_len && s->bytes_recvd > total_bytes) { in msg_loop()
688 s->bytes_recvd, total_bytes); in msg_loop()
693 int chunk_sz = opt->sendpage ? in msg_loop()
713 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
729 return s.bytes_sent / (s.end.tv_sec - s.start.tv_sec); in sentBps()
734 return s.bytes_recvd / (s.end.tv_sec - s.start.tv_sec); in recvdBps()
742 int iov_count = opt->iov_count; in sendmsg_test()
743 int iov_buf = opt->iov_length; in sendmsg_test()
745 int cnt = opt->rate; in sendmsg_test()
749 if (opt->base) in sendmsg_test()
755 /* Redirecting into non-TLS socket which sends into a TLS in sendmsg_test()
760 err = sockmap_init_ktls(opt->verbose, rx_fd); in sendmsg_test()
764 err = sockmap_init_ktls(opt->verbose, c1); in sendmsg_test()
769 if (opt->tx_wait_mem) { in sendmsg_test()
788 iov_buf -= (txmsg_pop - txmsg_start_pop + 1); in sendmsg_test()
789 if (opt->drop_expected || txmsg_ktls_skb_drop) in sendmsg_test()
795 if (opt->sendpage) in sendmsg_test()
799 if (opt->verbose > 1) in sendmsg_test()
803 if (s.end.tv_sec - s.start.tv_sec) { in sendmsg_test()
807 if (opt->verbose > 1) in sendmsg_test()
809 "rx_sendmsg: TX: %zuB %fB/s %fGB/s RX: %zuB %fB/s %fGB/s %s\n", in sendmsg_test()
816 } else if (rxpid == -1) { in sendmsg_test()
821 if (opt->tx_wait_mem) in sendmsg_test()
826 if (opt->sendpage) in sendmsg_test()
836 if (s.end.tv_sec - s.start.tv_sec) { in sendmsg_test()
840 if (opt->verbose > 1) in sendmsg_test()
842 "tx_sendmsg: TX: %zuB %fB/s %f GB/s RX: %zuB %fB/s %fGB/s\n", in sendmsg_test()
846 } else if (txpid == -1) { in sendmsg_test()
863 fprintf(stderr, "tx thread exited with err %d.\n", err); in sendmsg_test()
878 /* Ping/Pong data from client to server */ in forever_ping_pong()
897 if (s == -1) { in forever_ping_pong()
909 s--; in forever_ping_pong()
934 if (opt->verbose) { in forever_ping_pong()
955 int i, key, next_key, err, tx_prog_fd = -1, zero = 0; in run_options()
967 "ERROR: bpf_prog_attach (sockmap %i->%i): %d (%s)\n", in run_options()
988 "ERROR: bpf_prog_attach (TLS sockmap %i->%i): %d (%s)\n", in run_options()
1012 err = sockmap_init_sockets(options->verbose); in run_options()
1258 options->drop_expected = true; in run_options()
1261 err = forever_ping_pong(options->rate, options); in run_options()
1263 options->base = false; in run_options()
1264 options->sendpage = false; in run_options()
1267 options->base = false; in run_options()
1268 options->sendpage = true; in run_options()
1271 options->base = true; in run_options()
1272 options->sendpage = false; in run_options()
1275 options->base = true; in run_options()
1276 options->sendpage = true; in run_options()
1322 size_t avail = dst_cap - strlen(dst); in append_str()
1327 strncat(dst, src, avail - 1); /* strncat() adds + 1 for zero byte */ in append_str()
1382 opt->sendpage = true; in __test_exec()
1384 opt->sendpage = false; in __test_exec()
1387 opt->drop_expected = true; in __test_exec()
1389 opt->drop_expected = false; in __test_exec()
1393 if (opt->verbose) { in __test_exec()
1396 test_cnt, opt->rate, opt->iov_count, opt->iov_length, in __test_exec()
1401 if (opt->verbose) in __test_exec()
1411 int type = strcmp(opt->map, BPF_SOCKMAP_FILENAME); in test_exec()
1429 opt->iov_length = 1; in test_send_one()
1430 opt->iov_count = 1; in test_send_one()
1431 opt->rate = 1; in test_send_one()
1434 opt->iov_length = 1; in test_send_one()
1435 opt->iov_count = 1024; in test_send_one()
1436 opt->rate = 1; in test_send_one()
1439 opt->iov_length = 1024; in test_send_one()
1440 opt->iov_count = 1; in test_send_one()
1441 opt->rate = 1; in test_send_one()
1448 opt->iov_length = 3; in test_send_many()
1449 opt->iov_count = 1; in test_send_many()
1450 opt->rate = 512; in test_send_many()
1453 opt->rate = 100; in test_send_many()
1454 opt->iov_count = 1; in test_send_many()
1455 opt->iov_length = 5; in test_send_many()
1461 opt->iov_length = 256; in test_send_large()
1462 opt->iov_count = 1024; in test_send_large()
1463 opt->rate = 2; in test_send_large()
1491 opt->tx_wait_mem = true; in test_txmsg_redir_wait_sndmem()
1493 opt->tx_wait_mem = false; in test_txmsg_redir_wait_sndmem()
1511 bool data = opt->data_test; in test_txmsg_skb()
1514 opt->data_test = true; in test_txmsg_skb()
1526 opt->iov_length = 100; in test_txmsg_skb()
1527 opt->iov_count = 1; in test_txmsg_skb()
1528 opt->rate = 1; in test_txmsg_skb()
1556 opt->data_test = data; in test_txmsg_skb()
1737 opt->iov_length = 256; in test_txmsg_ingress_parser()
1738 opt->iov_count = 1; in test_txmsg_ingress_parser()
1739 opt->rate = 2; in test_txmsg_ingress_parser()
1748 opt->iov_length = 20; in test_txmsg_ingress_parser2()
1749 opt->iov_count = 1; in test_txmsg_ingress_parser2()
1750 opt->rate = 1; in test_txmsg_ingress_parser2()
1751 opt->check_recved_len = true; in test_txmsg_ingress_parser2()
1753 opt->check_recved_len = false; in test_txmsg_ingress_parser2()
1811 return -1; in populate_progs()
1834 return -1; in populate_progs()
1852 {"txmsg test pull-data", test_txmsg_pull},
1853 {"txmsg test pop-data", test_txmsg_pop},
1863 if (!opt->whitelist) in check_whitelist()
1865 ptr = strdup(opt->whitelist); in check_whitelist()
1867 return -ENOMEM; in check_whitelist()
1870 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_whitelist()
1871 strstr(opt->map, entry) != 0 || in check_whitelist()
1872 strstr(t->title, entry) != 0) in check_whitelist()
1876 return -EINVAL; in check_whitelist()
1883 if (!opt->blacklist) in check_blacklist()
1884 return -EINVAL; in check_blacklist()
1885 ptr = strdup(opt->blacklist); in check_blacklist()
1887 return -ENOMEM; in check_blacklist()
1890 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_blacklist()
1891 strstr(opt->map, entry) != 0 || in check_blacklist()
1892 strstr(t->title, entry) != 0) in check_blacklist()
1896 return -EINVAL; in check_blacklist()
1903 err = populate_progs(opt->map); in __test_selftests()
1928 opt->map = BPF_SOCKMAP_FILENAME; in test_selftests_sockmap()
1934 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_sockhash()
1940 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_ktls()
1941 opt->prepend = "ktls"; in test_selftests_ktls()
1967 long_options, &longindex)) != -1) { in main()
2020 if (strcmp(optarg, "ping") == 0) { in main()
2032 return -1; in main()
2038 return -ENOMEM; in main()
2043 return -ENOMEM; in main()
2049 return -1; in main()