Lines Matching refs:opt

160 	void (*tester)(int cg_fd, struct sockmap_options *opt);
423 struct sockmap_options *opt)
425 bool drop = opt->drop_expected;
631 struct sockmap_options *opt)
635 bool drop = opt->drop_expected;
636 bool data = opt->data_test;
639 if (!tx && opt->check_recved_len)
660 if (opt->tx_wait_mem && errno == EACCES) {
700 if (!opt->sendpage)
737 if (opt->verbose)
744 if (opt->tx_wait_mem) {
778 if (opt->check_recved_len && s->bytes_recvd > total_bytes) {
786 int chunk_sz = opt->sendpage ?
835 static int sendmsg_test(struct sockmap_options *opt)
840 int iov_count = opt->iov_count;
841 int iov_buf = opt->iov_length;
843 int cnt = opt->rate;
847 if (opt->base)
858 err = sockmap_init_ktls(opt->verbose, rx_fd);
862 err = sockmap_init_ktls(opt->verbose, c1);
867 if (opt->tx_wait_mem) {
885 if (opt->drop_expected || txmsg_ktls_skb_drop)
891 if (opt->sendpage)
894 cnt, &s, false, opt);
895 if (opt->verbose > 1)
903 if (opt->verbose > 1)
917 if (opt->tx_wait_mem)
922 if (opt->sendpage)
923 err = msg_loop_sendpage(c1, iov_buf, cnt, &s, opt);
926 cnt, &s, true, opt);
936 if (opt->verbose > 1)
965 static int forever_ping_pong(int rate, struct sockmap_options *opt)
1030 if (opt->verbose) {
1468 static int __test_exec(int cgrp, int test, struct sockmap_options *opt)
1474 opt->sendpage = true;
1476 opt->sendpage = false;
1479 opt->drop_expected = true;
1481 opt->drop_expected = false;
1485 if (opt->verbose) {
1488 test_cnt, opt->rate, opt->iov_count, opt->iov_length,
1492 err = run_options(opt, cgrp, test);
1493 if (opt->verbose)
1501 static void test_exec(int cgrp, struct sockmap_options *opt)
1503 int type = strcmp(opt->map, BPF_SOCKMAP_FILENAME);
1508 err = __test_exec(cgrp, SENDMSG, opt);
1513 err = __test_exec(cgrp, SENDPAGE, opt);
1519 static void test_send_one(struct sockmap_options *opt, int cgrp)
1521 opt->iov_length = 1;
1522 opt->iov_count = 1;
1523 opt->rate = 1;
1524 test_exec(cgrp, opt);
1526 opt->iov_length = 1;
1527 opt->iov_count = 1024;
1528 opt->rate = 1;
1529 test_exec(cgrp, opt);
1531 opt->iov_length = 1024;
1532 opt->iov_count = 1;
1533 opt->rate = 1;
1534 test_exec(cgrp, opt);
1538 static void test_send_many(struct sockmap_options *opt, int cgrp)
1540 opt->iov_length = 3;
1541 opt->iov_count = 1;
1542 opt->rate = 512;
1543 test_exec(cgrp, opt);
1545 opt->rate = 100;
1546 opt->iov_count = 1;
1547 opt->iov_length = 5;
1548 test_exec(cgrp, opt);
1551 static void test_send_large(struct sockmap_options *opt, int cgrp)
1553 opt->iov_length = 8192;
1554 opt->iov_count = 32;
1555 opt->rate = 2;
1556 test_exec(cgrp, opt);
1559 static void test_send(struct sockmap_options *opt, int cgrp)
1561 test_send_one(opt, cgrp);
1562 test_send_many(opt, cgrp);
1563 test_send_large(opt, cgrp);
1567 static void test_txmsg_pass(int cgrp, struct sockmap_options *opt)
1571 test_send(opt, cgrp);
1574 static void test_txmsg_redir(int cgrp, struct sockmap_options *opt)
1577 test_send(opt, cgrp);
1580 static void test_txmsg_redir_wait_sndmem(int cgrp, struct sockmap_options *opt)
1582 opt->tx_wait_mem = true;
1584 test_send_large(opt, cgrp);
1588 test_send_large(opt, cgrp);
1589 opt->tx_wait_mem = false;
1592 static void test_txmsg_drop(int cgrp, struct sockmap_options *opt)
1595 test_send(opt, cgrp);
1598 static void test_txmsg_ingress_redir(int cgrp, struct sockmap_options *opt)
1602 test_send(opt, cgrp);
1605 static void test_txmsg_skb(int cgrp, struct sockmap_options *opt)
1607 bool data = opt->data_test;
1610 opt->data_test = true;
1622 opt->iov_length = 100;
1623 opt->iov_count = 1;
1624 opt->rate = 1;
1625 test_exec(cgrp, opt);
1628 test_exec(cgrp, opt);
1632 test_exec(cgrp, opt);
1639 test_exec(cgrp, opt);
1642 test_exec(cgrp, opt);
1646 test_exec(cgrp, opt);
1649 test_exec(cgrp, opt);
1652 opt->data_test = data;
1663 static void test_txmsg_cork_hangs(int cgrp, struct sockmap_options *opt)
1669 test_send_large(opt, cgrp);
1675 test_send_large(opt, cgrp);
1681 test_send_large(opt, cgrp);
1684 static void test_txmsg_pull(int cgrp, struct sockmap_options *opt)
1690 test_send(opt, cgrp);
1696 test_send_large(opt, cgrp);
1702 test_send(opt, cgrp);
1709 test_send_many(opt, cgrp);
1716 test_send_many(opt, cgrp);
1719 static void test_txmsg_pop(int cgrp, struct sockmap_options *opt)
1721 bool data = opt->data_test;
1727 test_send_many(opt, cgrp);
1733 test_send_large(opt, cgrp);
1739 test_send_many(opt, cgrp);
1746 opt->data_test = false;
1752 test_send_many(opt, cgrp);
1759 test_send_many(opt, cgrp);
1760 opt->data_test = data;
1763 static void test_txmsg_push(int cgrp, struct sockmap_options *opt)
1765 bool data = opt->data_test;
1771 test_send(opt, cgrp);
1777 test_send_large(opt, cgrp);
1783 test_send_many(opt, cgrp);
1790 opt->data_test = false;
1796 test_send_many(opt, cgrp);
1797 opt->data_test = data;
1800 static void test_txmsg_push_pop(int cgrp, struct sockmap_options *opt)
1808 test_send_large(opt, cgrp);
1815 test_send_large(opt, cgrp);
1822 test_send_large(opt, cgrp);
1829 test_send_large(opt, cgrp);
1837 test_send_large(opt, cgrp);
1844 test_send_large(opt, cgrp);
1847 static void test_txmsg_apply(int cgrp, struct sockmap_options *opt)
1854 test_send_one(opt, cgrp);
1861 test_send_one(opt, cgrp);
1868 test_send_one(opt, cgrp);
1875 test_send_large(opt, cgrp);
1882 test_send_large(opt, cgrp);
1889 test_send_large(opt, cgrp);
1892 static void test_txmsg_cork(int cgrp, struct sockmap_options *opt)
1898 test_send(opt, cgrp);
1904 test_send(opt, cgrp);
1907 static void test_txmsg_ingress_parser(int cgrp, struct sockmap_options *opt)
1913 opt->iov_length = 256;
1914 opt->iov_count = 1;
1915 opt->rate = 2;
1916 test_exec(cgrp, opt);
1919 static void test_txmsg_ingress_parser2(int cgrp, struct sockmap_options *opt)
1924 opt->iov_length = 20;
1925 opt->iov_count = 1;
1926 opt->rate = 1;
1927 opt->check_recved_len = true;
1928 test_exec(cgrp, opt);
1929 opt->check_recved_len = false;
2003 static int check_whitelist(struct _test *t, struct sockmap_options *opt)
2007 if (!opt->whitelist)
2009 ptr = strdup(opt->whitelist);
2014 if ((opt->prepend && strstr(opt->prepend, entry) != 0) ||
2015 strstr(opt->map, entry) != 0 ||
2026 static int check_blacklist(struct _test *t, struct sockmap_options *opt)
2030 if (!opt->blacklist)
2032 ptr = strdup(opt->blacklist);
2037 if ((opt->prepend && strstr(opt->prepend, entry) != 0) ||
2038 strstr(opt->map, entry) != 0 ||
2049 static int __test_selftests(int cg_fd, struct sockmap_options *opt)
2053 err = populate_progs(opt->map);
2063 if (check_whitelist(&t, opt) != 0)
2065 if (check_blacklist(&t, opt) == 0)
2068 test_start_subtest(&t, opt);
2069 t.tester(cg_fd, opt);
2076 static void test_selftests_sockmap(int cg_fd, struct sockmap_options *opt)
2078 opt->map = BPF_SOCKMAP_FILENAME;
2079 __test_selftests(cg_fd, opt);
2082 static void test_selftests_sockhash(int cg_fd, struct sockmap_options *opt)
2084 opt->map = BPF_SOCKHASH_FILENAME;
2085 __test_selftests(cg_fd, opt);
2088 static void test_selftests_ktls(int cg_fd, struct sockmap_options *opt)
2090 opt->map = BPF_SOCKHASH_FILENAME;
2091 opt->prepend = "ktls";
2093 __test_selftests(cg_fd, opt);
2097 static int test_selftest(int cg_fd, struct sockmap_options *opt)
2099 test_selftests_sockmap(cg_fd, opt);
2100 test_selftests_sockhash(cg_fd, opt);
2101 test_selftests_ktls(cg_fd, opt);
2110 int opt, longindex, err, cg_fd = 0;
2115 while ((opt = getopt_long(argc, argv, ":dhv:c:r:i:l:t:p:q:n:b:",
2117 switch (opt) {