Lines Matching refs:opt
160 void (*tester)(int cg_fd, struct sockmap_options *opt);
423 struct sockmap_options *opt) in msg_loop_sendpage() argument
425 bool drop = opt->drop_expected; in msg_loop_sendpage()
631 struct sockmap_options *opt) in msg_loop() argument
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()
660 if (opt->tx_wait_mem && errno == EACCES) { in msg_loop()
700 if (!opt->sendpage) in msg_loop()
737 if (opt->verbose) in msg_loop()
744 if (opt->tx_wait_mem) { in msg_loop()
778 if (opt->check_recved_len && s->bytes_recvd > total_bytes) { in msg_loop()
786 int chunk_sz = opt->sendpage ? in msg_loop()
835 static int sendmsg_test(struct sockmap_options *opt) in sendmsg_test() argument
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()
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()
894 cnt, &s, false, opt); in sendmsg_test()
895 if (opt->verbose > 1) in sendmsg_test()
903 if (opt->verbose > 1) in sendmsg_test()
917 if (opt->tx_wait_mem) in sendmsg_test()
922 if (opt->sendpage) in sendmsg_test()
923 err = msg_loop_sendpage(c1, iov_buf, cnt, &s, opt); in sendmsg_test()
926 cnt, &s, true, opt); in sendmsg_test()
936 if (opt->verbose > 1) in sendmsg_test()
965 static int forever_ping_pong(int rate, struct sockmap_options *opt) in forever_ping_pong() argument
1030 if (opt->verbose) { in forever_ping_pong()
1468 static int __test_exec(int cgrp, int test, struct sockmap_options *opt) in __test_exec() argument
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()
1492 err = run_options(opt, cgrp, test); in __test_exec()
1493 if (opt->verbose) in __test_exec()
1501 static void test_exec(int cgrp, struct sockmap_options *opt) in test_exec() argument
1503 int type = strcmp(opt->map, BPF_SOCKMAP_FILENAME); in test_exec()
1508 err = __test_exec(cgrp, SENDMSG, opt); in test_exec()
1513 err = __test_exec(cgrp, SENDPAGE, opt); in test_exec()
1519 static void test_send_one(struct sockmap_options *opt, int cgrp) in test_send_one() argument
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()
1524 test_exec(cgrp, opt); 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()
1529 test_exec(cgrp, opt); 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()
1534 test_exec(cgrp, opt); in test_send_one()
1538 static void test_send_many(struct sockmap_options *opt, int cgrp) in test_send_many() argument
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()
1543 test_exec(cgrp, opt); 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()
1548 test_exec(cgrp, opt); in test_send_many()
1551 static void test_send_large(struct sockmap_options *opt, int cgrp) in test_send_large() argument
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()
1556 test_exec(cgrp, opt); in test_send_large()
1559 static void test_send(struct sockmap_options *opt, int cgrp) in test_send() argument
1561 test_send_one(opt, cgrp); in test_send()
1562 test_send_many(opt, cgrp); in test_send()
1563 test_send_large(opt, cgrp); in test_send()
1567 static void test_txmsg_pass(int cgrp, struct sockmap_options *opt) in test_txmsg_pass() argument
1571 test_send(opt, cgrp); in test_txmsg_pass()
1574 static void test_txmsg_redir(int cgrp, struct sockmap_options *opt) in test_txmsg_redir() argument
1577 test_send(opt, cgrp); in test_txmsg_redir()
1580 static void test_txmsg_redir_wait_sndmem(int cgrp, struct sockmap_options *opt) in test_txmsg_redir_wait_sndmem() argument
1582 opt->tx_wait_mem = true; in test_txmsg_redir_wait_sndmem()
1584 test_send_large(opt, cgrp); in test_txmsg_redir_wait_sndmem()
1588 test_send_large(opt, cgrp); in test_txmsg_redir_wait_sndmem()
1589 opt->tx_wait_mem = false; in test_txmsg_redir_wait_sndmem()
1592 static void test_txmsg_drop(int cgrp, struct sockmap_options *opt) in test_txmsg_drop() argument
1595 test_send(opt, cgrp); in test_txmsg_drop()
1598 static void test_txmsg_ingress_redir(int cgrp, struct sockmap_options *opt) in test_txmsg_ingress_redir() argument
1602 test_send(opt, cgrp); in test_txmsg_ingress_redir()
1605 static void test_txmsg_skb(int cgrp, struct sockmap_options *opt) in test_txmsg_skb() argument
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()
1625 test_exec(cgrp, opt); in test_txmsg_skb()
1628 test_exec(cgrp, opt); in test_txmsg_skb()
1632 test_exec(cgrp, opt); in test_txmsg_skb()
1639 test_exec(cgrp, opt); in test_txmsg_skb()
1642 test_exec(cgrp, opt); in test_txmsg_skb()
1646 test_exec(cgrp, opt); in test_txmsg_skb()
1649 test_exec(cgrp, opt); in test_txmsg_skb()
1652 opt->data_test = data; in test_txmsg_skb()
1663 static void test_txmsg_cork_hangs(int cgrp, struct sockmap_options *opt) in test_txmsg_cork_hangs() argument
1669 test_send_large(opt, cgrp); in test_txmsg_cork_hangs()
1675 test_send_large(opt, cgrp); in test_txmsg_cork_hangs()
1681 test_send_large(opt, cgrp); in test_txmsg_cork_hangs()
1684 static void test_txmsg_pull(int cgrp, struct sockmap_options *opt) in test_txmsg_pull() argument
1690 test_send(opt, cgrp); in test_txmsg_pull()
1696 test_send_large(opt, cgrp); in test_txmsg_pull()
1702 test_send(opt, cgrp); in test_txmsg_pull()
1709 test_send_many(opt, cgrp); in test_txmsg_pull()
1716 test_send_many(opt, cgrp); in test_txmsg_pull()
1719 static void test_txmsg_pop(int cgrp, struct sockmap_options *opt) in test_txmsg_pop() argument
1721 bool data = opt->data_test; in test_txmsg_pop()
1727 test_send_many(opt, cgrp); in test_txmsg_pop()
1733 test_send_large(opt, cgrp); in test_txmsg_pop()
1739 test_send_many(opt, cgrp); in test_txmsg_pop()
1746 opt->data_test = false; in test_txmsg_pop()
1752 test_send_many(opt, cgrp); in test_txmsg_pop()
1759 test_send_many(opt, cgrp); in test_txmsg_pop()
1760 opt->data_test = data; in test_txmsg_pop()
1763 static void test_txmsg_push(int cgrp, struct sockmap_options *opt) in test_txmsg_push() argument
1765 bool data = opt->data_test; in test_txmsg_push()
1771 test_send(opt, cgrp); in test_txmsg_push()
1777 test_send_large(opt, cgrp); in test_txmsg_push()
1783 test_send_many(opt, cgrp); in test_txmsg_push()
1790 opt->data_test = false; in test_txmsg_push()
1796 test_send_many(opt, cgrp); in test_txmsg_push()
1797 opt->data_test = data; in test_txmsg_push()
1800 static void test_txmsg_push_pop(int cgrp, struct sockmap_options *opt) in test_txmsg_push_pop() argument
1808 test_send_large(opt, cgrp); in test_txmsg_push_pop()
1815 test_send_large(opt, cgrp); in test_txmsg_push_pop()
1822 test_send_large(opt, cgrp); in test_txmsg_push_pop()
1829 test_send_large(opt, cgrp); in test_txmsg_push_pop()
1837 test_send_large(opt, cgrp); in test_txmsg_push_pop()
1844 test_send_large(opt, cgrp); in test_txmsg_push_pop()
1847 static void test_txmsg_apply(int cgrp, struct sockmap_options *opt) in test_txmsg_apply() argument
1854 test_send_one(opt, cgrp); in test_txmsg_apply()
1861 test_send_one(opt, cgrp); in test_txmsg_apply()
1868 test_send_one(opt, cgrp); in test_txmsg_apply()
1875 test_send_large(opt, cgrp); in test_txmsg_apply()
1882 test_send_large(opt, cgrp); in test_txmsg_apply()
1889 test_send_large(opt, cgrp); in test_txmsg_apply()
1892 static void test_txmsg_cork(int cgrp, struct sockmap_options *opt) in test_txmsg_cork() argument
1898 test_send(opt, cgrp); in test_txmsg_cork()
1904 test_send(opt, cgrp); in test_txmsg_cork()
1907 static void test_txmsg_ingress_parser(int cgrp, struct sockmap_options *opt) in test_txmsg_ingress_parser() argument
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()
1916 test_exec(cgrp, opt); in test_txmsg_ingress_parser()
1919 static void test_txmsg_ingress_parser2(int cgrp, struct sockmap_options *opt) in test_txmsg_ingress_parser2() argument
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()
1928 test_exec(cgrp, opt); in test_txmsg_ingress_parser2()
1929 opt->check_recved_len = false; in test_txmsg_ingress_parser2()
2003 static int check_whitelist(struct _test *t, struct sockmap_options *opt) in check_whitelist() argument
2007 if (!opt->whitelist) in check_whitelist()
2009 ptr = strdup(opt->whitelist); in check_whitelist()
2014 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_whitelist()
2015 strstr(opt->map, entry) != 0 || in check_whitelist()
2026 static int check_blacklist(struct _test *t, struct sockmap_options *opt) in check_blacklist() argument
2030 if (!opt->blacklist) in check_blacklist()
2032 ptr = strdup(opt->blacklist); in check_blacklist()
2037 if ((opt->prepend && strstr(opt->prepend, entry) != 0) || in check_blacklist()
2038 strstr(opt->map, entry) != 0 || in check_blacklist()
2049 static int __test_selftests(int cg_fd, struct sockmap_options *opt) in __test_selftests() argument
2053 err = populate_progs(opt->map); in __test_selftests()
2063 if (check_whitelist(&t, opt) != 0) in __test_selftests()
2065 if (check_blacklist(&t, opt) == 0) in __test_selftests()
2068 test_start_subtest(&t, opt); in __test_selftests()
2069 t.tester(cg_fd, opt); in __test_selftests()
2076 static void test_selftests_sockmap(int cg_fd, struct sockmap_options *opt) in test_selftests_sockmap() argument
2078 opt->map = BPF_SOCKMAP_FILENAME; in test_selftests_sockmap()
2079 __test_selftests(cg_fd, opt); in test_selftests_sockmap()
2082 static void test_selftests_sockhash(int cg_fd, struct sockmap_options *opt) in test_selftests_sockhash() argument
2084 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_sockhash()
2085 __test_selftests(cg_fd, opt); in test_selftests_sockhash()
2088 static void test_selftests_ktls(int cg_fd, struct sockmap_options *opt) in test_selftests_ktls() argument
2090 opt->map = BPF_SOCKHASH_FILENAME; in test_selftests_ktls()
2091 opt->prepend = "ktls"; in test_selftests_ktls()
2093 __test_selftests(cg_fd, opt); in test_selftests_ktls()
2097 static int test_selftest(int cg_fd, struct sockmap_options *opt) in test_selftest() argument
2099 test_selftests_sockmap(cg_fd, opt); in test_selftest()
2100 test_selftests_sockhash(cg_fd, opt); in test_selftest()
2101 test_selftests_ktls(cg_fd, opt); in test_selftest()
2110 int opt, longindex, err, cg_fd = 0; in main() local
2115 while ((opt = getopt_long(argc, argv, ":dhv:c:r:i:l:t:p:q:n:b:", in main()
2117 switch (opt) { in main()