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
187 env.type = o->map; in test_start_subtest()
188 env.subtest = t->title; in test_start_subtest()
189 env.prepend = o->prepend; in test_start_subtest()
199 int error = env.fail_cnt - env.fail_last; in test_end_subtest()
222 printf(" Usage: %s --cgroup <cgroup_path>\n", argv[0]); in usage()
225 printf(" --%-12s", long_options[i].name); in usage()
230 printf(" -%c\n", long_options[i].val); in usage()
273 return -EINVAL; in sockmap_init_ktls()
278 return -EINVAL; in sockmap_init_ktls()
283 return -EINVAL; in sockmap_init_ktls()
288 return -EINVAL; in sockmap_init_ktls()
293 return -EINVAL; in sockmap_init_ktls()
327 /* Non-blocking sockets */ in sockmap_init_sockets()
401 printf("connected sockets: c1 <-> p1, c2 <-> p2\n"); in sockmap_init_sockets()
402 printf("cgroups binding: c1(%i) <-> s1(%i) - - - c2(%i) <-> s2(%i)\n", in sockmap_init_sockets()
419 bool drop = opt->drop_expected; in msg_loop_sendpage()
436 clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop_sendpage()
451 return -EIO; in msg_loop_sendpage()
455 s->bytes_sent += sent; in msg_loop_sendpage()
457 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop_sendpage()
466 for (i = 0; i < msg->msg_iovlen; i++) in msg_free_iov()
467 free(msg->msg_iov[i].iov_base); in msg_free_iov()
468 free(msg->msg_iov); in msg_free_iov()
469 msg->msg_iov = NULL; in msg_free_iov()
470 msg->msg_iovlen = 0; in msg_free_iov()
503 msg->msg_iov = iov; in msg_alloc_iov()
504 msg->msg_iovlen = iov_count; in msg_alloc_iov()
508 for (i--; i >= 0 ; i--) in msg_alloc_iov()
509 free(msg->msg_iov[i].iov_base); in msg_alloc_iov()
510 return -ENOMEM; in msg_alloc_iov()
518 for (i = 0; i < msg->msg_iovlen; i++) { in msg_verify_data()
519 unsigned char *d = msg->msg_iov[i].iov_base; in msg_verify_data()
523 if (msg->msg_iov[i].iov_len < 4) in msg_verify_data()
524 return -EIO; in msg_verify_data()
529 return -EIO; in msg_verify_data()
534 for (; j < msg->msg_iov[i].iov_len && size; j++) { in msg_verify_data()
538 i, j, d[j], k - 1, d[j+1], k); in msg_verify_data()
539 return -EIO; in msg_verify_data()
546 size--; in msg_verify_data()
553 struct msg_stats *s, bool tx, in msg_loop() argument
558 bool drop = opt->drop_expected; in msg_loop()
559 bool data = opt->data_test; in msg_loop()
562 if (!tx && opt->check_recved_len) in msg_loop()
565 err = msg_alloc_iov(&msg, iov_count, iov_alloc_length, data, tx); in msg_loop()
569 err = msg_alloc_iov(&msg_peek, iov_count, iov_length, data, tx); in msg_loop()
574 if (tx) { in msg_loop()
575 clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop()
583 if (opt->tx_wait_mem && errno == EACCES) { in msg_loop()
593 errno = -EIO; in msg_loop()
597 s->bytes_sent += sent; in msg_loop()
599 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
623 total_bytes -= txmsg_pop_total; in msg_loop()
624 err = clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop()
627 while (s->bytes_recvd < total_bytes) { in msg_loop()
641 if (slct == -1) { in msg_loop()
643 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
646 if (opt->verbose) in msg_loop()
647 …fprintf(stderr, "unexpected timeout: recved %zu/%f pop_total %f\n", s->bytes_recvd, total_bytes, t… in msg_loop()
648 errno = -EIO; in msg_loop()
649 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
653 if (opt->tx_wait_mem) { in msg_loop()
668 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
678 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
685 s->bytes_recvd += recv; in msg_loop()
687 if (opt->check_recved_len && s->bytes_recvd > total_bytes) { in msg_loop()
690 s->bytes_recvd, total_bytes); in msg_loop()
695 int chunk_sz = opt->sendpage ? in msg_loop()
715 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
731 return s.bytes_sent / (s.end.tv_sec - s.start.tv_sec); in sentBps()
736 return s.bytes_recvd / (s.end.tv_sec - s.start.tv_sec); in recvdBps()
744 int iov_count = opt->iov_count; in sendmsg_test()
745 int iov_buf = opt->iov_length; in sendmsg_test()
747 int cnt = opt->rate; in sendmsg_test()
751 if (opt->base) in sendmsg_test()
757 /* Redirecting into non-TLS socket which sends into a TLS in sendmsg_test()
762 err = sockmap_init_ktls(opt->verbose, rx_fd); in sendmsg_test()
766 err = sockmap_init_ktls(opt->verbose, c1); in sendmsg_test()
771 if (opt->tx_wait_mem) { in sendmsg_test()
790 iov_buf -= (txmsg_pop - txmsg_start_pop + 1); in sendmsg_test()
791 if (opt->drop_expected || txmsg_ktls_skb_drop) in sendmsg_test()
797 if (opt->sendpage) in sendmsg_test()
801 if (opt->verbose > 1) in sendmsg_test()
805 if (s.end.tv_sec - s.start.tv_sec) { in sendmsg_test()
809 if (opt->verbose > 1) in sendmsg_test()
811 "rx_sendmsg: TX: %zuB %fB/s %fGB/s RX: %zuB %fB/s %fGB/s %s\n", in sendmsg_test()
818 } else if (rxpid == -1) { in sendmsg_test()
823 if (opt->tx_wait_mem) in sendmsg_test()
828 if (opt->sendpage) in sendmsg_test()
838 if (s.end.tv_sec - s.start.tv_sec) { in sendmsg_test()
842 if (opt->verbose > 1) in sendmsg_test()
844 "tx_sendmsg: TX: %zuB %fB/s %f GB/s RX: %zuB %fB/s %fGB/s\n", in sendmsg_test()
848 } else if (txpid == -1) { in sendmsg_test()
865 fprintf(stderr, "tx thread exited with err %d.\n", err); in sendmsg_test()
880 /* Ping/Pong data from client to server */ in forever_ping_pong()
899 if (s == -1) { in forever_ping_pong()
911 s--; in forever_ping_pong()
936 if (opt->verbose) { in forever_ping_pong()
969 "ERROR: bpf_program__attach_sockmap (sockmap %i->%i): (%s)\n", in run_options()
971 return -1; in run_options()
979 return -1; in run_options()
988 "ERROR: bpf_program__attach_sockmap (TLS sockmap %i->%i): (%s)\n", in run_options()
990 return -1; in run_options()
998 return -1; in run_options()
1011 err = sockmap_init_sockets(options->verbose); in run_options()
1039 err = -1; 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()
1320 size_t avail = dst_cap - strlen(dst); in append_str()
1325 strncat(dst, src, avail - 1); /* strncat() adds + 1 for zero byte */ in append_str()
1380 opt->sendpage = true; in __test_exec()
1382 opt->sendpage = false; in __test_exec()
1385 opt->drop_expected = true; in __test_exec()
1387 opt->drop_expected = false; in __test_exec()
1391 if (opt->verbose) { in __test_exec()
1394 test_cnt, opt->rate, opt->iov_count, opt->iov_length, in __test_exec()
1399 if (opt->verbose) in __test_exec()
1409 int type = strcmp(opt->map, BPF_SOCKMAP_FILENAME); in test_exec()
1427 opt->iov_length = 1; in test_send_one()
1428 opt->iov_count = 1; in test_send_one()
1429 opt->rate = 1; in test_send_one()
1432 opt->iov_length = 1; in test_send_one()
1433 opt->iov_count = 1024; in test_send_one()
1434 opt->rate = 1; in test_send_one()
1437 opt->iov_length = 1024; in test_send_one()
1438 opt->iov_count = 1; in test_send_one()
1439 opt->rate = 1; in test_send_one()
1446 opt->iov_length = 3; in test_send_many()
1447 opt->iov_count = 1; in test_send_many()
1448 opt->rate = 512; in test_send_many()
1451 opt->rate = 100; in test_send_many()
1452 opt->iov_count = 1; in test_send_many()
1453 opt->iov_length = 5; in test_send_many()
1459 opt->iov_length = 256; in test_send_large()
1460 opt->iov_count = 1024; in test_send_large()
1461 opt->rate = 2; in test_send_large()
1489 opt->tx_wait_mem = true; in test_txmsg_redir_wait_sndmem()
1491 opt->tx_wait_mem = false; in test_txmsg_redir_wait_sndmem()
1509 bool data = opt->data_test; in test_txmsg_skb()
1512 opt->data_test = true; in test_txmsg_skb()
1524 opt->iov_length = 100; in test_txmsg_skb()
1525 opt->iov_count = 1; in test_txmsg_skb()
1526 opt->rate = 1; in test_txmsg_skb()
1554 opt->data_test = data; in test_txmsg_skb()
1753 opt->iov_length = 256; in test_txmsg_ingress_parser()
1754 opt->iov_count = 1; in test_txmsg_ingress_parser()
1755 opt->rate = 2; in test_txmsg_ingress_parser()
1764 opt->iov_length = 20; in test_txmsg_ingress_parser2()
1765 opt->iov_count = 1; in test_txmsg_ingress_parser2()
1766 opt->rate = 1; in test_txmsg_ingress_parser2()
1767 opt->check_recved_len = true; in test_txmsg_ingress_parser2()
1769 opt->check_recved_len = false; in test_txmsg_ingress_parser2()
1799 return -1; in populate_progs()
1815 return -1; in populate_progs()
1836 {"txmsg test pull-data", test_txmsg_pull},
1837 {"txmsg test pop-data", test_txmsg_pop},
1847 if (!opt->whitelist) in check_whitelist()
1849 ptr = strdup(opt->whitelist); in check_whitelist()
1851 return -ENOMEM; in check_whitelist()
1854 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_whitelist()
1855 strstr(opt->map, entry) != 0 || in check_whitelist()
1856 strstr(t->title, entry) != 0) { in check_whitelist()
1863 return -EINVAL; in check_whitelist()
1870 if (!opt->blacklist) in check_blacklist()
1871 return -EINVAL; in check_blacklist()
1872 ptr = strdup(opt->blacklist); in check_blacklist()
1874 return -ENOMEM; in check_blacklist()
1877 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_blacklist()
1878 strstr(opt->map, entry) != 0 || in check_blacklist()
1879 strstr(t->title, entry) != 0) { in check_blacklist()
1886 return -EINVAL; in check_blacklist()
1893 err = populate_progs(opt->map); in __test_selftests()
1918 opt->map = BPF_SOCKMAP_FILENAME; in test_selftests_sockmap()
1924 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_sockhash()
1930 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_ktls()
1931 opt->prepend = "ktls"; in test_selftests_ktls()
1956 long_options, &longindex)) != -1) { in main()
2009 if (strcmp(optarg, "ping") == 0) { in main()
2021 return -1; in main()
2027 return -ENOMEM; in main()
2032 return -ENOMEM; in main()
2038 return -1; in main()