Lines Matching refs:opt

153 	void (*tester)(int cg_fd, struct sockmap_options *opt);
416 struct sockmap_options *opt)
418 bool drop = opt->drop_expected;
553 struct sockmap_options *opt)
557 bool drop = opt->drop_expected;
558 bool data = opt->data_test;
561 if (!tx && opt->check_recved_len)
582 if (opt->tx_wait_mem && errno == EACCES) {
645 if (opt->verbose)
652 if (opt->tx_wait_mem) {
685 if (opt->check_recved_len && s->bytes_recvd > total_bytes) {
693 int chunk_sz = opt->sendpage ?
737 static int sendmsg_test(struct sockmap_options *opt)
742 int iov_count = opt->iov_count;
743 int iov_buf = opt->iov_length;
745 int cnt = opt->rate;
749 if (opt->base)
760 err = sockmap_init_ktls(opt->verbose, rx_fd);
764 err = sockmap_init_ktls(opt->verbose, c1);
769 if (opt->tx_wait_mem) {
789 if (opt->drop_expected || txmsg_ktls_skb_drop)
795 if (opt->sendpage)
798 cnt, &s, false, opt);
799 if (opt->verbose > 1)
807 if (opt->verbose > 1)
821 if (opt->tx_wait_mem)
826 if (opt->sendpage)
827 err = msg_loop_sendpage(c1, iov_buf, cnt, &s, opt);
830 cnt, &s, true, opt);
840 if (opt->verbose > 1)
869 static int forever_ping_pong(int rate, struct sockmap_options *opt)
934 if (opt->verbose) {
1376 static int __test_exec(int cgrp, int test, struct sockmap_options *opt)
1382 opt->sendpage = true;
1384 opt->sendpage = false;
1387 opt->drop_expected = true;
1389 opt->drop_expected = false;
1393 if (opt->verbose) {
1396 test_cnt, opt->rate, opt->iov_count, opt->iov_length,
1400 err = run_options(opt, cgrp, test);
1401 if (opt->verbose)
1409 static void test_exec(int cgrp, struct sockmap_options *opt)
1411 int type = strcmp(opt->map, BPF_SOCKMAP_FILENAME);
1416 err = __test_exec(cgrp, SENDMSG, opt);
1421 err = __test_exec(cgrp, SENDPAGE, opt);
1427 static void test_send_one(struct sockmap_options *opt, int cgrp)
1429 opt->iov_length = 1;
1430 opt->iov_count = 1;
1431 opt->rate = 1;
1432 test_exec(cgrp, opt);
1434 opt->iov_length = 1;
1435 opt->iov_count = 1024;
1436 opt->rate = 1;
1437 test_exec(cgrp, opt);
1439 opt->iov_length = 1024;
1440 opt->iov_count = 1;
1441 opt->rate = 1;
1442 test_exec(cgrp, opt);
1446 static void test_send_many(struct sockmap_options *opt, int cgrp)
1448 opt->iov_length = 3;
1449 opt->iov_count = 1;
1450 opt->rate = 512;
1451 test_exec(cgrp, opt);
1453 opt->rate = 100;
1454 opt->iov_count = 1;
1455 opt->iov_length = 5;
1456 test_exec(cgrp, opt);
1459 static void test_send_large(struct sockmap_options *opt, int cgrp)
1461 opt->iov_length = 256;
1462 opt->iov_count = 1024;
1463 opt->rate = 2;
1464 test_exec(cgrp, opt);
1467 static void test_send(struct sockmap_options *opt, int cgrp)
1469 test_send_one(opt, cgrp);
1470 test_send_many(opt, cgrp);
1471 test_send_large(opt, cgrp);
1475 static void test_txmsg_pass(int cgrp, struct sockmap_options *opt)
1479 test_send(opt, cgrp);
1482 static void test_txmsg_redir(int cgrp, struct sockmap_options *opt)
1485 test_send(opt, cgrp);
1488 static void test_txmsg_redir_wait_sndmem(int cgrp, struct sockmap_options *opt)
1491 opt->tx_wait_mem = true;
1492 test_send_large(opt, cgrp);
1493 opt->tx_wait_mem = false;
1496 static void test_txmsg_drop(int cgrp, struct sockmap_options *opt)
1499 test_send(opt, cgrp);
1502 static void test_txmsg_ingress_redir(int cgrp, struct sockmap_options *opt)
1506 test_send(opt, cgrp);
1509 static void test_txmsg_skb(int cgrp, struct sockmap_options *opt)
1511 bool data = opt->data_test;
1514 opt->data_test = true;
1526 opt->iov_length = 100;
1527 opt->iov_count = 1;
1528 opt->rate = 1;
1529 test_exec(cgrp, opt);
1532 test_exec(cgrp, opt);
1536 test_exec(cgrp, opt);
1543 test_exec(cgrp, opt);
1546 test_exec(cgrp, opt);
1550 test_exec(cgrp, opt);
1553 test_exec(cgrp, opt);
1556 opt->data_test = data;
1567 static void test_txmsg_cork_hangs(int cgrp, struct sockmap_options *opt)
1573 test_send_large(opt, cgrp);
1579 test_send_large(opt, cgrp);
1585 test_send_large(opt, cgrp);
1588 static void test_txmsg_pull(int cgrp, struct sockmap_options *opt)
1593 test_send(opt, cgrp);
1598 test_send_large(opt, cgrp);
1604 test_send(opt, cgrp);
1611 test_send_many(opt, cgrp);
1618 test_send_many(opt, cgrp);
1621 static void test_txmsg_pop(int cgrp, struct sockmap_options *opt)
1626 test_send_many(opt, cgrp);
1631 test_send_large(opt, cgrp);
1637 test_send_many(opt, cgrp);
1644 test_send_many(opt, cgrp);
1651 test_send_many(opt, cgrp);
1654 static void test_txmsg_push(int cgrp, struct sockmap_options *opt)
1659 test_send(opt, cgrp);
1664 test_send_large(opt, cgrp);
1670 test_send_many(opt, cgrp);
1677 test_send_many(opt, cgrp);
1680 static void test_txmsg_push_pop(int cgrp, struct sockmap_options *opt)
1686 test_send_large(opt, cgrp);
1689 static void test_txmsg_apply(int cgrp, struct sockmap_options *opt)
1696 test_send_one(opt, cgrp);
1703 test_send_one(opt, cgrp);
1710 test_send_one(opt, cgrp);
1717 test_send_large(opt, cgrp);
1724 test_send_large(opt, cgrp);
1731 test_send_large(opt, cgrp);
1734 static void test_txmsg_cork(int cgrp, struct sockmap_options *opt)
1740 test_send(opt, cgrp);
1746 test_send(opt, cgrp);
1749 static void test_txmsg_ingress_parser(int cgrp, struct sockmap_options *opt)
1755 opt->iov_length = 256;
1756 opt->iov_count = 1;
1757 opt->rate = 2;
1758 test_exec(cgrp, opt);
1761 static void test_txmsg_ingress_parser2(int cgrp, struct sockmap_options *opt)
1766 opt->iov_length = 20;
1767 opt->iov_count = 1;
1768 opt->rate = 1;
1769 opt->check_recved_len = true;
1770 test_exec(cgrp, opt);
1771 opt->check_recved_len = false;
1877 static int check_whitelist(struct _test *t, struct sockmap_options *opt)
1881 if (!opt->whitelist)
1883 ptr = strdup(opt->whitelist);
1888 if ((opt->prepend && strstr(opt->prepend, entry) != 0) ||
1889 strstr(opt->map, entry) != 0 ||
1897 static int check_blacklist(struct _test *t, struct sockmap_options *opt)
1901 if (!opt->blacklist)
1903 ptr = strdup(opt->blacklist);
1908 if ((opt->prepend && strstr(opt->prepend, entry) != 0) ||
1909 strstr(opt->map, entry) != 0 ||
1917 static int __test_selftests(int cg_fd, struct sockmap_options *opt)
1921 err = populate_progs(opt->map);
1931 if (check_whitelist(&t, opt) != 0)
1933 if (check_blacklist(&t, opt) == 0)
1936 test_start_subtest(&t, opt);
1937 t.tester(cg_fd, opt);
1944 static void test_selftests_sockmap(int cg_fd, struct sockmap_options *opt)
1946 opt->map = BPF_SOCKMAP_FILENAME;
1947 __test_selftests(cg_fd, opt);
1950 static void test_selftests_sockhash(int cg_fd, struct sockmap_options *opt)
1952 opt->map = BPF_SOCKHASH_FILENAME;
1953 __test_selftests(cg_fd, opt);
1956 static void test_selftests_ktls(int cg_fd, struct sockmap_options *opt)
1958 opt->map = BPF_SOCKHASH_FILENAME;
1959 opt->prepend = "ktls";
1961 __test_selftests(cg_fd, opt);
1965 static int test_selftest(int cg_fd, struct sockmap_options *opt)
1968 test_selftests_sockmap(cg_fd, opt);
1969 test_selftests_sockhash(cg_fd, opt);
1970 test_selftests_ktls(cg_fd, opt);
1979 int opt, longindex, err, cg_fd = 0;
1984 while ((opt = getopt_long(argc, argv, ":dhv:c:r:i:l:t:p:q:n:b:",
1986 switch (opt) {