Lines Matching +full:rx +full:- +full:ping +full:- +full:pong

1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2017-2018 Covalent IO, Inc. http://covalent.io
192 env.type = o->map; in test_start_subtest()
193 env.subtest = t->title; in test_start_subtest()
194 env.prepend = o->prepend; in test_start_subtest()
204 int error = env.fail_cnt - env.fail_last; in test_end_subtest()
227 printf(" Usage: %s --cgroup <cgroup_path>\n", argv[0]); in usage()
230 printf(" --%-12s", long_options[i].name); in usage()
235 printf(" -%c\n", long_options[i].val); in usage()
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()
298 return -EINVAL; in sockmap_init_ktls()
332 /* Non-blocking sockets */ in sockmap_init_sockets()
406 printf("connected sockets: c1 <-> p1, c2 <-> p2\n"); in sockmap_init_sockets()
407 printf("cgroups binding: c1(%i) <-> s1(%i) - - - c2(%i) <-> s2(%i)\n", in sockmap_init_sockets()
424 bool drop = opt->drop_expected; in msg_loop_sendpage()
443 clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop_sendpage()
458 return -EIO; in msg_loop_sendpage()
462 s->bytes_sent += sent; in msg_loop_sendpage()
464 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop_sendpage()
473 for (i = 0; i < msg->msg_iovlen; i++) in msg_free_iov()
474 free(msg->msg_iov[i].iov_base); in msg_free_iov()
475 free(msg->msg_iov); in msg_free_iov()
476 msg->msg_iov = NULL; in msg_free_iov()
477 msg->msg_iovlen = 0; in msg_free_iov()
510 msg->msg_iov = iov; in msg_alloc_iov()
511 msg->msg_iovlen = iov_count; in msg_alloc_iov()
515 for (i--; i >= 0 ; i--) in msg_alloc_iov()
516 free(msg->msg_iov[i].iov_base); in msg_alloc_iov()
517 return -ENOMEM; in msg_alloc_iov()
523 int push_range_end = txmsg_start_push + txmsg_end_push - 1; in msg_verify_date_prep()
524 int pop_range_end = txmsg_start_pop + txmsg_pop - 1; in msg_verify_date_prep()
534 overlap_len = min(push_range_end - txmsg_start_pop + 1, txmsg_pop); in msg_verify_date_prep()
536 overlap_len = min(pop_range_end - txmsg_start_push + 1, txmsg_end_push); in msg_verify_date_prep()
537 verify_push_len = max(txmsg_end_push - overlap_len, 0); in msg_verify_date_prep()
538 verify_pop_len = max(txmsg_pop - overlap_len, 0); in msg_verify_date_prep()
556 for (i = 0, j = 0; i < msg->msg_iovlen && size; i++, j = 0) { in msg_verify_data()
557 unsigned char *d = msg->msg_iov[i].iov_base; in msg_verify_data()
561 if (msg->msg_iov[i].iov_len < 4) in msg_verify_data()
562 return -EDATAINTEGRITY; in msg_verify_data()
567 return -EDATAINTEGRITY; in msg_verify_data()
572 for (; j < msg->msg_iov[i].iov_len && size; j++) { in msg_verify_data()
574 check_cnt == verify_push_start + verify_push_len - push) { in msg_verify_data()
578 if (j + push >= msg->msg_iov[i].iov_len) in msg_verify_data()
579 skipped = msg->msg_iov[i].iov_len - j; in msg_verify_data()
580 push -= skipped; in msg_verify_data()
581 size -= skipped; in msg_verify_data()
582 j += skipped - 1; in msg_verify_data()
600 check_cnt == verify_push_start + verify_push_len - push) in msg_verify_data()
607 i, j, d[j], k - 1, d[j+1], k); in msg_verify_data()
608 return -EDATAINTEGRITY; in msg_verify_data()
618 size--; in msg_verify_data()
634 bool drop = opt->drop_expected; in msg_loop()
635 bool data = opt->data_test; in msg_loop()
638 if (!tx && opt->check_recved_len) in msg_loop()
651 clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop()
659 if (opt->tx_wait_mem && errno == EACCES) { in msg_loop()
669 errno = -EIO; in msg_loop()
673 s->bytes_sent += sent; in msg_loop()
675 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
699 if (!opt->sendpage) in msg_loop()
709 total_bytes -= txmsg_pop_total; in msg_loop()
714 err = clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop()
717 while (s->bytes_recvd < total_bytes) { in msg_loop()
731 if (slct == -1) { in msg_loop()
733 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
736 if (opt->verbose) in msg_loop()
737 …fprintf(stderr, "unexpected timeout: recved %zu/%f pop_total %f\n", s->bytes_recvd, total_bytes, t… in msg_loop()
738 errno = -EIO; in msg_loop()
739 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
743 if (opt->tx_wait_mem) { in msg_loop()
758 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
768 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
775 s->bytes_recvd += recv; in msg_loop()
777 if (opt->check_recved_len && s->bytes_recvd > total_bytes) { in msg_loop()
780 s->bytes_recvd, total_bytes); in msg_loop()
785 int chunk_sz = opt->sendpage ? in msg_loop()
810 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
826 return s.bytes_sent / (s.end.tv_sec - s.start.tv_sec); in sentBps()
831 return s.bytes_recvd / (s.end.tv_sec - s.start.tv_sec); in recvdBps()
839 int iov_count = opt->iov_count; in sendmsg_test()
840 int iov_buf = opt->iov_length; in sendmsg_test()
842 int cnt = opt->rate; in sendmsg_test()
846 if (opt->base) in sendmsg_test()
852 /* Redirecting into non-TLS socket which sends into a TLS in sendmsg_test()
857 err = sockmap_init_ktls(opt->verbose, rx_fd); in sendmsg_test()
861 err = sockmap_init_ktls(opt->verbose, c1); in sendmsg_test()
866 if (opt->tx_wait_mem) { in sendmsg_test()
884 if (opt->drop_expected || txmsg_ktls_skb_drop) in sendmsg_test()
890 if (opt->sendpage) in sendmsg_test()
894 if (opt->verbose > 1) in sendmsg_test()
898 if (s.end.tv_sec - s.start.tv_sec) { in sendmsg_test()
902 if (opt->verbose > 1) in sendmsg_test()
904 "rx_sendmsg: TX: %zuB %fB/s %fGB/s RX: %zuB %fB/s %fGB/s %s\n", in sendmsg_test()
908 if (err && err != -EDATAINTEGRITY && txmsg_cork) in sendmsg_test()
911 } else if (rxpid == -1) { in sendmsg_test()
916 if (opt->tx_wait_mem) in sendmsg_test()
921 if (opt->sendpage) in sendmsg_test()
931 if (s.end.tv_sec - s.start.tv_sec) { in sendmsg_test()
935 if (opt->verbose > 1) in sendmsg_test()
937 "tx_sendmsg: TX: %zuB %fB/s %f GB/s RX: %zuB %fB/s %fGB/s\n", in sendmsg_test()
941 } else if (txpid == -1) { in sendmsg_test()
951 fprintf(stderr, "rx thread exited with err %d.\n", err); in sendmsg_test()
973 /* Ping/Pong data from client to server */ in forever_ping_pong()
992 if (s == -1) { in forever_ping_pong()
1004 s--; in forever_ping_pong()
1029 if (opt->verbose) { in forever_ping_pong()
1050 int i, key, next_key, err, tx_prog_fd = -1, zero = 0; in run_options()
1062 "ERROR: bpf_prog_attach (sockmap %i->%i): %d (%s)\n", in run_options()
1083 "ERROR: bpf_prog_attach (TLS sockmap %i->%i): %d (%s)\n", in run_options()
1107 err = sockmap_init_sockets(options->verbose); in run_options()
1353 options->drop_expected = true; in run_options()
1356 err = forever_ping_pong(options->rate, options); in run_options()
1358 options->base = false; in run_options()
1359 options->sendpage = false; in run_options()
1362 options->base = false; in run_options()
1363 options->sendpage = true; in run_options()
1366 options->base = true; in run_options()
1367 options->sendpage = false; in run_options()
1370 options->base = true; in run_options()
1371 options->sendpage = true; in run_options()
1417 size_t avail = dst_cap - strlen(dst); in append_str()
1422 strncat(dst, src, avail - 1); /* strncat() adds + 1 for zero byte */ in append_str()
1477 opt->sendpage = true; in __test_exec()
1479 opt->sendpage = false; in __test_exec()
1482 opt->drop_expected = true; in __test_exec()
1484 opt->drop_expected = false; in __test_exec()
1488 if (opt->verbose) { in __test_exec()
1491 test_cnt, opt->rate, opt->iov_count, opt->iov_length, in __test_exec()
1496 if (opt->verbose) in __test_exec()
1506 int type = strcmp(opt->map, BPF_SOCKMAP_FILENAME); in test_exec()
1524 opt->iov_length = 1; in test_send_one()
1525 opt->iov_count = 1; in test_send_one()
1526 opt->rate = 1; in test_send_one()
1529 opt->iov_length = 1; in test_send_one()
1530 opt->iov_count = 1024; in test_send_one()
1531 opt->rate = 1; in test_send_one()
1534 opt->iov_length = 1024; in test_send_one()
1535 opt->iov_count = 1; in test_send_one()
1536 opt->rate = 1; in test_send_one()
1543 opt->iov_length = 3; in test_send_many()
1544 opt->iov_count = 1; in test_send_many()
1545 opt->rate = 512; in test_send_many()
1548 opt->rate = 100; in test_send_many()
1549 opt->iov_count = 1; in test_send_many()
1550 opt->iov_length = 5; in test_send_many()
1556 opt->iov_length = 8192; in test_send_large()
1557 opt->iov_count = 32; in test_send_large()
1558 opt->rate = 2; in test_send_large()
1586 opt->tx_wait_mem = true; in test_txmsg_redir_wait_sndmem()
1588 opt->tx_wait_mem = false; in test_txmsg_redir_wait_sndmem()
1606 bool data = opt->data_test; in test_txmsg_skb()
1609 opt->data_test = true; in test_txmsg_skb()
1621 opt->iov_length = 100; in test_txmsg_skb()
1622 opt->iov_count = 1; in test_txmsg_skb()
1623 opt->rate = 1; in test_txmsg_skb()
1651 opt->data_test = data; in test_txmsg_skb()
1720 bool data = opt->data_test; in test_txmsg_pop()
1741 * - It makes the layout of the received data difficult in test_txmsg_pop()
1742 * - It makes it hard to calculate the total_bytes in the recvmsg in test_txmsg_pop()
1745 opt->data_test = false; in test_txmsg_pop()
1759 opt->data_test = data; in test_txmsg_pop()
1764 bool data = opt->data_test; in test_txmsg_push()
1785 * - It makes the layout of the received data difficult in test_txmsg_push()
1786 * - It makes it hard to calculate the total_bytes in the recvmsg in test_txmsg_push()
1789 opt->data_test = false; in test_txmsg_push()
1796 opt->data_test = data; in test_txmsg_push()
1875 opt->iov_length = 256; in test_txmsg_ingress_parser()
1876 opt->iov_count = 1; in test_txmsg_ingress_parser()
1877 opt->rate = 2; in test_txmsg_ingress_parser()
1886 opt->iov_length = 20; in test_txmsg_ingress_parser2()
1887 opt->iov_count = 1; in test_txmsg_ingress_parser2()
1888 opt->rate = 1; in test_txmsg_ingress_parser2()
1889 opt->check_recved_len = true; in test_txmsg_ingress_parser2()
1891 opt->check_recved_len = false; in test_txmsg_ingress_parser2()
1945 return -1; in populate_progs()
1968 return -1; in populate_progs()
1986 {"txmsg test pull-data", test_txmsg_pull},
1987 {"txmsg test pop-data", test_txmsg_pop},
1997 if (!opt->whitelist) in check_whitelist()
1999 ptr = strdup(opt->whitelist); in check_whitelist()
2001 return -ENOMEM; in check_whitelist()
2004 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_whitelist()
2005 strstr(opt->map, entry) != 0 || in check_whitelist()
2006 strstr(t->title, entry) != 0) in check_whitelist()
2010 return -EINVAL; in check_whitelist()
2017 if (!opt->blacklist) in check_blacklist()
2018 return -EINVAL; in check_blacklist()
2019 ptr = strdup(opt->blacklist); in check_blacklist()
2021 return -ENOMEM; in check_blacklist()
2024 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_blacklist()
2025 strstr(opt->map, entry) != 0 || in check_blacklist()
2026 strstr(t->title, entry) != 0) in check_blacklist()
2030 return -EINVAL; in check_blacklist()
2037 err = populate_progs(opt->map); in __test_selftests()
2062 opt->map = BPF_SOCKMAP_FILENAME; in test_selftests_sockmap()
2068 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_sockhash()
2074 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_ktls()
2075 opt->prepend = "ktls"; in test_selftests_ktls()
2101 long_options, &longindex)) != -1) { in main()
2154 if (strcmp(optarg, "ping") == 0) { in main()
2166 return -1; in main()
2172 return -ENOMEM; in main()
2177 return -ENOMEM; in main()
2183 return -1; in main()