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
193 env.type = o->map; in test_start_subtest()
194 env.subtest = t->title; in test_start_subtest()
195 env.prepend = o->prepend; in test_start_subtest()
205 int error = env.fail_cnt - env.fail_last; in test_end_subtest()
228 printf(" Usage: %s --cgroup <cgroup_path>\n", argv[0]); in usage()
231 printf(" --%-12s", long_options[i].name); in usage()
236 printf(" -%c\n", long_options[i].val); in usage()
279 return -EINVAL; in sockmap_init_ktls()
284 return -EINVAL; in sockmap_init_ktls()
289 return -EINVAL; in sockmap_init_ktls()
294 return -EINVAL; in sockmap_init_ktls()
299 return -EINVAL; in sockmap_init_ktls()
333 /* Non-blocking sockets */ in sockmap_init_sockets()
407 printf("connected sockets: c1 <-> p1, c2 <-> p2\n"); in sockmap_init_sockets()
408 printf("cgroups binding: c1(%i) <-> s1(%i) - - - c2(%i) <-> s2(%i)\n", in sockmap_init_sockets()
425 bool drop = opt->drop_expected; in msg_loop_sendpage()
444 clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop_sendpage()
459 return -EIO; in msg_loop_sendpage()
463 s->bytes_sent += sent; in msg_loop_sendpage()
465 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop_sendpage()
474 for (i = 0; i < msg->msg_iovlen; i++) in msg_free_iov()
475 free(msg->msg_iov[i].iov_base); in msg_free_iov()
476 free(msg->msg_iov); in msg_free_iov()
477 msg->msg_iov = NULL; in msg_free_iov()
478 msg->msg_iovlen = 0; in msg_free_iov()
511 msg->msg_iov = iov; in msg_alloc_iov()
512 msg->msg_iovlen = iov_count; in msg_alloc_iov()
516 for (i--; i >= 0 ; i--) in msg_alloc_iov()
517 free(msg->msg_iov[i].iov_base); in msg_alloc_iov()
518 return -ENOMEM; in msg_alloc_iov()
524 int push_range_end = txmsg_start_push + txmsg_end_push - 1; in msg_verify_date_prep()
525 int pop_range_end = txmsg_start_pop + txmsg_pop - 1; in msg_verify_date_prep()
535 overlap_len = min(push_range_end - txmsg_start_pop + 1, txmsg_pop); in msg_verify_date_prep()
537 overlap_len = min(pop_range_end - txmsg_start_push + 1, txmsg_end_push); in msg_verify_date_prep()
538 verify_push_len = max(txmsg_end_push - overlap_len, 0); in msg_verify_date_prep()
539 verify_pop_len = max(txmsg_pop - overlap_len, 0); in msg_verify_date_prep()
557 for (i = 0, j = 0; i < msg->msg_iovlen && size; i++, j = 0) { in msg_verify_data()
558 unsigned char *d = msg->msg_iov[i].iov_base; in msg_verify_data()
562 if (msg->msg_iov[i].iov_len < 4) in msg_verify_data()
563 return -EDATAINTEGRITY; in msg_verify_data()
568 return -EDATAINTEGRITY; in msg_verify_data()
573 for (; j < msg->msg_iov[i].iov_len && size; j++) { in msg_verify_data()
575 check_cnt == verify_push_start + verify_push_len - push) { in msg_verify_data()
579 if (j + push >= msg->msg_iov[i].iov_len) in msg_verify_data()
580 skipped = msg->msg_iov[i].iov_len - j; in msg_verify_data()
581 push -= skipped; in msg_verify_data()
582 size -= skipped; in msg_verify_data()
583 j += skipped - 1; in msg_verify_data()
601 check_cnt == verify_push_start + verify_push_len - push) in msg_verify_data()
608 i, j, d[j], k - 1, d[j+1], k); in msg_verify_data()
609 return -EDATAINTEGRITY; in msg_verify_data()
619 size--; in msg_verify_data()
635 bool drop = opt->drop_expected; in msg_loop()
636 bool data = opt->data_test; in msg_loop()
639 if (!tx && opt->check_recved_len) in msg_loop()
652 clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop()
660 if (opt->tx_wait_mem && errno == EACCES) { in msg_loop()
670 errno = -EIO; in msg_loop()
674 s->bytes_sent += sent; in msg_loop()
676 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
700 if (!opt->sendpage) in msg_loop()
710 total_bytes -= txmsg_pop_total; in msg_loop()
715 err = clock_gettime(CLOCK_MONOTONIC, &s->start); in msg_loop()
718 while (s->bytes_recvd < total_bytes) { in msg_loop()
732 if (slct == -1) { in msg_loop()
734 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
737 if (opt->verbose) in msg_loop()
738 …fprintf(stderr, "unexpected timeout: recved %zu/%f pop_total %f\n", s->bytes_recvd, total_bytes, t… in msg_loop()
739 errno = -EIO; in msg_loop()
740 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
744 if (opt->tx_wait_mem) { in msg_loop()
759 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
769 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
776 s->bytes_recvd += recv; in msg_loop()
778 if (opt->check_recved_len && s->bytes_recvd > total_bytes) { in msg_loop()
781 s->bytes_recvd, total_bytes); in msg_loop()
786 int chunk_sz = opt->sendpage ? in msg_loop()
811 clock_gettime(CLOCK_MONOTONIC, &s->end); in msg_loop()
827 return s.bytes_sent / (s.end.tv_sec - s.start.tv_sec); in sentBps()
832 return s.bytes_recvd / (s.end.tv_sec - s.start.tv_sec); in recvdBps()
840 int iov_count = opt->iov_count; in sendmsg_test()
841 int iov_buf = opt->iov_length; in sendmsg_test()
843 int cnt = opt->rate; in sendmsg_test()
847 if (opt->base) in sendmsg_test()
853 /* Redirecting into non-TLS socket which sends into a TLS in sendmsg_test()
858 err = sockmap_init_ktls(opt->verbose, rx_fd); in sendmsg_test()
862 err = sockmap_init_ktls(opt->verbose, c1); in sendmsg_test()
867 if (opt->tx_wait_mem) { in sendmsg_test()
885 if (opt->drop_expected || txmsg_ktls_skb_drop) in sendmsg_test()
891 if (opt->sendpage) in sendmsg_test()
895 if (opt->verbose > 1) in sendmsg_test()
899 if (s.end.tv_sec - s.start.tv_sec) { in sendmsg_test()
903 if (opt->verbose > 1) in sendmsg_test()
905 "rx_sendmsg: TX: %zuB %fB/s %fGB/s RX: %zuB %fB/s %fGB/s %s\n", in sendmsg_test()
909 if (err && err != -EDATAINTEGRITY && txmsg_cork) in sendmsg_test()
912 } else if (rxpid == -1) { in sendmsg_test()
917 if (opt->tx_wait_mem) in sendmsg_test()
922 if (opt->sendpage) in sendmsg_test()
932 if (s.end.tv_sec - s.start.tv_sec) { in sendmsg_test()
936 if (opt->verbose > 1) in sendmsg_test()
938 "tx_sendmsg: TX: %zuB %fB/s %f GB/s RX: %zuB %fB/s %fGB/s\n", in sendmsg_test()
942 } else if (txpid == -1) { in sendmsg_test()
952 fprintf(stderr, "rx thread exited with err %d.\n", err); in sendmsg_test()
974 /* Ping/Pong data from client to server */ in forever_ping_pong()
993 if (s == -1) { in forever_ping_pong()
1005 s--; in forever_ping_pong()
1030 if (opt->verbose) { in forever_ping_pong()
1063 "ERROR: bpf_program__attach_sockmap (sockmap %i->%i): (%s)\n", in run_options()
1065 return -1; in run_options()
1073 return -1; in run_options()
1082 "ERROR: bpf_program__attach_sockmap (TLS sockmap %i->%i): (%s)\n", in run_options()
1084 return -1; in run_options()
1092 return -1; in run_options()
1105 err = sockmap_init_sockets(options->verbose); in run_options()
1133 err = -1; in run_options()
1352 options->drop_expected = true; in run_options()
1355 err = forever_ping_pong(options->rate, options); in run_options()
1357 options->base = false; in run_options()
1358 options->sendpage = false; in run_options()
1361 options->base = false; in run_options()
1362 options->sendpage = true; in run_options()
1365 options->base = true; in run_options()
1366 options->sendpage = false; in run_options()
1369 options->base = true; in run_options()
1370 options->sendpage = true; in run_options()
1414 size_t avail = dst_cap - strlen(dst); in append_str()
1419 strncat(dst, src, avail - 1); /* strncat() adds + 1 for zero byte */ in append_str()
1474 opt->sendpage = true; in __test_exec()
1476 opt->sendpage = false; in __test_exec()
1479 opt->drop_expected = true; in __test_exec()
1481 opt->drop_expected = false; in __test_exec()
1485 if (opt->verbose) { in __test_exec()
1488 test_cnt, opt->rate, opt->iov_count, opt->iov_length, in __test_exec()
1493 if (opt->verbose) in __test_exec()
1503 int type = strcmp(opt->map, BPF_SOCKMAP_FILENAME); in test_exec()
1521 opt->iov_length = 1; in test_send_one()
1522 opt->iov_count = 1; in test_send_one()
1523 opt->rate = 1; in test_send_one()
1526 opt->iov_length = 1; in test_send_one()
1527 opt->iov_count = 1024; in test_send_one()
1528 opt->rate = 1; in test_send_one()
1531 opt->iov_length = 1024; in test_send_one()
1532 opt->iov_count = 1; in test_send_one()
1533 opt->rate = 1; in test_send_one()
1540 opt->iov_length = 3; in test_send_many()
1541 opt->iov_count = 1; in test_send_many()
1542 opt->rate = 512; in test_send_many()
1545 opt->rate = 100; in test_send_many()
1546 opt->iov_count = 1; in test_send_many()
1547 opt->iov_length = 5; in test_send_many()
1553 opt->iov_length = 8192; in test_send_large()
1554 opt->iov_count = 32; in test_send_large()
1555 opt->rate = 2; in test_send_large()
1582 opt->tx_wait_mem = true; in test_txmsg_redir_wait_sndmem()
1589 opt->tx_wait_mem = false; in test_txmsg_redir_wait_sndmem()
1607 bool data = opt->data_test; in test_txmsg_skb()
1610 opt->data_test = true; in test_txmsg_skb()
1622 opt->iov_length = 100; in test_txmsg_skb()
1623 opt->iov_count = 1; in test_txmsg_skb()
1624 opt->rate = 1; in test_txmsg_skb()
1652 opt->data_test = data; in test_txmsg_skb()
1721 bool data = opt->data_test; in test_txmsg_pop()
1742 * - It makes the layout of the received data difficult in test_txmsg_pop()
1743 * - It makes it hard to calculate the total_bytes in the recvmsg in test_txmsg_pop()
1746 opt->data_test = false; in test_txmsg_pop()
1760 opt->data_test = data; in test_txmsg_pop()
1765 bool data = opt->data_test; in test_txmsg_push()
1786 * - It makes the layout of the received data difficult in test_txmsg_push()
1787 * - It makes it hard to calculate the total_bytes in the recvmsg in test_txmsg_push()
1790 opt->data_test = false; in test_txmsg_push()
1797 opt->data_test = data; in test_txmsg_push()
1831 /* Test push/pop range non-overlapping */ in test_txmsg_push_pop()
1913 opt->iov_length = 256; in test_txmsg_ingress_parser()
1914 opt->iov_count = 1; in test_txmsg_ingress_parser()
1915 opt->rate = 2; in test_txmsg_ingress_parser()
1924 opt->iov_length = 20; in test_txmsg_ingress_parser2()
1925 opt->iov_count = 1; in test_txmsg_ingress_parser2()
1926 opt->rate = 1; in test_txmsg_ingress_parser2()
1927 opt->check_recved_len = true; in test_txmsg_ingress_parser2()
1929 opt->check_recved_len = false; in test_txmsg_ingress_parser2()
1959 return -1; in populate_progs()
1975 return -1; in populate_progs()
1996 {"txmsg test pull-data", test_txmsg_pull},
1997 {"txmsg test pop-data", test_txmsg_pop},
2007 if (!opt->whitelist) in check_whitelist()
2009 ptr = strdup(opt->whitelist); in check_whitelist()
2011 return -ENOMEM; in check_whitelist()
2014 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_whitelist()
2015 strstr(opt->map, entry) != 0 || in check_whitelist()
2016 strstr(t->title, entry) != 0) { in check_whitelist()
2023 return -EINVAL; in check_whitelist()
2030 if (!opt->blacklist) in check_blacklist()
2031 return -EINVAL; in check_blacklist()
2032 ptr = strdup(opt->blacklist); in check_blacklist()
2034 return -ENOMEM; in check_blacklist()
2037 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_blacklist()
2038 strstr(opt->map, entry) != 0 || in check_blacklist()
2039 strstr(t->title, entry) != 0) { in check_blacklist()
2046 return -EINVAL; in check_blacklist()
2053 err = populate_progs(opt->map); in __test_selftests()
2078 opt->map = BPF_SOCKMAP_FILENAME; in test_selftests_sockmap()
2084 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_sockhash()
2090 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_ktls()
2091 opt->prepend = "ktls"; in test_selftests_ktls()
2116 long_options, &longindex)) != -1) { in main()
2169 if (strcmp(optarg, "ping") == 0) { in main()
2181 return -1; in main()
2187 return -ENOMEM; in main()
2192 return -ENOMEM; in main()
2198 return -1; in main()