/external/linux-kselftest/tools/testing/selftests/bpf/prog_tests/ |
D | test_strncmp.c | 6 static int trigger_strncmp(const struct strncmp_test *skel) in trigger_strncmp() argument 12 cmp = skel->bss->cmp_ret; in trigger_strncmp() 24 static void strncmp_full_str_cmp(struct strncmp_test *skel, const char *name, in strncmp_full_str_cmp() argument 27 size_t nr = sizeof(skel->bss->str); in strncmp_full_str_cmp() 28 char *str = skel->bss->str; in strncmp_full_str_cmp() 33 memcpy(str, skel->rodata->target, nr); in strncmp_full_str_cmp() 37 got = trigger_strncmp(skel); in strncmp_full_str_cmp() 46 struct strncmp_test *skel; in test_strncmp_ret() local 50 skel = strncmp_test__open(); in test_strncmp_ret() 51 if (!ASSERT_OK_PTR(skel, "strncmp_test open")) in test_strncmp_ret() [all …]
|
D | atomics.c | 7 static void test_add(struct atomics_lskel *skel) in test_add() argument 13 link_fd = atomics_lskel__add__attach(skel); in test_add() 17 prog_fd = skel->progs.add.prog_fd; in test_add() 24 ASSERT_EQ(skel->data->add64_value, 3, "add64_value"); in test_add() 25 ASSERT_EQ(skel->bss->add64_result, 1, "add64_result"); in test_add() 27 ASSERT_EQ(skel->data->add32_value, 3, "add32_value"); in test_add() 28 ASSERT_EQ(skel->bss->add32_result, 1, "add32_result"); in test_add() 30 ASSERT_EQ(skel->bss->add_stack_value_copy, 3, "add_stack_value"); in test_add() 31 ASSERT_EQ(skel->bss->add_stack_result, 1, "add_stack_result"); in test_add() 33 ASSERT_EQ(skel->data->add_noreturn_value, 3, "add_noreturn_value"); in test_add() [all …]
|
D | bpf_loop.c | 8 static void check_nr_loops(struct bpf_loop *skel) in check_nr_loops() argument 12 link = bpf_program__attach(skel->progs.test_prog); in check_nr_loops() 17 skel->bss->nr_loops = 0; in check_nr_loops() 21 ASSERT_EQ(skel->bss->nr_loops_returned, skel->bss->nr_loops, in check_nr_loops() 25 skel->bss->nr_loops = 500; in check_nr_loops() 29 ASSERT_EQ(skel->bss->nr_loops_returned, skel->bss->nr_loops, in check_nr_loops() 31 ASSERT_EQ(skel->bss->g_output, (500 * 499) / 2, "g_output"); in check_nr_loops() 34 skel->bss->nr_loops = -1; in check_nr_loops() 38 ASSERT_EQ(skel->bss->err, -E2BIG, "over max limit"); in check_nr_loops() 43 static void check_callback_fn_stop(struct bpf_loop *skel) in check_callback_fn_stop() argument [all …]
|
D | bpf_iter.c | 34 struct bpf_iter_test_kern3 *skel; in test_btf_id_or_null() local 36 skel = bpf_iter_test_kern3__open_and_load(); in test_btf_id_or_null() 37 if (CHECK(skel, "bpf_iter_test_kern3__open_and_load", in test_btf_id_or_null() 39 bpf_iter_test_kern3__destroy(skel); in test_btf_id_or_null() 87 struct bpf_iter_ipv6_route *skel; in test_ipv6_route() local 89 skel = bpf_iter_ipv6_route__open_and_load(); in test_ipv6_route() 90 if (CHECK(!skel, "bpf_iter_ipv6_route__open_and_load", in test_ipv6_route() 94 do_dummy_read(skel->progs.dump_ipv6_route); in test_ipv6_route() 96 bpf_iter_ipv6_route__destroy(skel); in test_ipv6_route() 101 struct bpf_iter_netlink *skel; in test_netlink() local [all …]
|
D | find_vma.c | 10 static void test_and_reset_skel(struct find_vma *skel, int expected_find_zero_ret) in test_and_reset_skel() argument 12 ASSERT_EQ(skel->bss->found_vm_exec, 1, "found_vm_exec"); in test_and_reset_skel() 13 ASSERT_EQ(skel->data->find_addr_ret, 0, "find_addr_ret"); in test_and_reset_skel() 14 ASSERT_EQ(skel->data->find_zero_ret, expected_find_zero_ret, "find_zero_ret"); in test_and_reset_skel() 15 ASSERT_OK_PTR(strstr(skel->bss->d_iname, "test_progs"), "find_test_progs"); in test_and_reset_skel() 17 skel->bss->found_vm_exec = 0; in test_and_reset_skel() 18 skel->data->find_addr_ret = -1; in test_and_reset_skel() 19 skel->data->find_zero_ret = -1; in test_and_reset_skel() 20 skel->bss->d_iname[0] = 0; in test_and_reset_skel() 39 static void test_find_vma_pe(struct find_vma *skel) in test_find_vma_pe() argument [all …]
|
D | check_mtu.c | 43 struct test_check_mtu *skel; in test_check_mtu_xdp_attach() local 49 skel = test_check_mtu__open_and_load(); in test_check_mtu_xdp_attach() 50 if (CHECK(!skel, "open and load skel", "failed")) in test_check_mtu_xdp_attach() 53 prog = skel->progs.xdp_use_helper_basic; in test_check_mtu_xdp_attach() 58 skel->links.xdp_use_helper_basic = link; in test_check_mtu_xdp_attach() 75 test_check_mtu__destroy(skel); in test_check_mtu_xdp_attach() 78 static void test_check_mtu_run_xdp(struct test_check_mtu *skel, in test_check_mtu_run_xdp() argument 106 mtu_result = skel->bss->global_bpf_mtu_xdp; in test_check_mtu_run_xdp() 113 struct test_check_mtu *skel; in test_check_mtu_xdp() local 116 skel = test_check_mtu__open(); in test_check_mtu_xdp() [all …]
|
D | ringbuf.c | 61 static struct test_ringbuf_lskel *skel; variable 66 skel->bss->dropped = 0; in trigger_samples() 67 skel->bss->total = 0; in trigger_samples() 68 skel->bss->discarded = 0; in trigger_samples() 71 skel->bss->value = 333; in trigger_samples() 73 skel->bss->value = 777; in trigger_samples() 93 skel = test_ringbuf_lskel__open(); in test_ringbuf() 94 if (CHECK(!skel, "skel_open", "skeleton open failed\n")) in test_ringbuf() 97 skel->maps.ringbuf.max_entries = page_size; in test_ringbuf() 99 err = test_ringbuf_lskel__load(skel); in test_ringbuf() [all …]
|
D | snprintf.c | 40 struct test_snprintf *skel; in test_snprintf_positive() local 42 skel = test_snprintf__open_and_load(); in test_snprintf_positive() 43 if (!ASSERT_OK_PTR(skel, "skel_open")) in test_snprintf_positive() 46 skel->bss->pid = getpid(); in test_snprintf_positive() 48 if (!ASSERT_OK(test_snprintf__attach(skel), "skel_attach")) in test_snprintf_positive() 54 ASSERT_STREQ(skel->bss->num_out, EXP_NUM_OUT, "num_out"); in test_snprintf_positive() 55 ASSERT_EQ(skel->bss->num_ret, EXP_NUM_RET, "num_ret"); in test_snprintf_positive() 57 ASSERT_STREQ(skel->bss->ip_out, EXP_IP_OUT, "ip_out"); in test_snprintf_positive() 58 ASSERT_EQ(skel->bss->ip_ret, EXP_IP_RET, "ip_ret"); in test_snprintf_positive() 60 ASSERT_OK(memcmp(skel->bss->sym_out, exp_sym_out, in test_snprintf_positive() [all …]
|
D | btf_skc_cls_ingress.c | 19 static struct test_btf_skc_cls_ingress *skel; variable 77 memset(&skel->bss->srv_sa6, 0, sizeof(skel->bss->srv_sa6)); in reset_test() 78 skel->bss->listen_tp_sport = 0; in reset_test() 79 skel->bss->req_sk_sport = 0; in reset_test() 80 skel->bss->recv_cookie = 0; in reset_test() 81 skel->bss->gen_cookie = 0; in reset_test() 82 skel->bss->linum = 0; in reset_test() 87 if (skel->bss->linum) in print_err_line() 88 printf("bpf prog error at line %u\n", skel->bss->linum); in print_err_line() 108 memcpy(&skel->bss->srv_sa6, &srv_sa6, sizeof(srv_sa6)); in test_conn() [all …]
|
D | task_local_storage.c | 15 struct task_local_storage *skel; in test_sys_enter_exit() local 18 skel = task_local_storage__open_and_load(); in test_sys_enter_exit() 19 if (!ASSERT_OK_PTR(skel, "skel_open_and_load")) in test_sys_enter_exit() 22 skel->bss->target_pid = syscall(SYS_gettid); in test_sys_enter_exit() 24 err = task_local_storage__attach(skel); in test_sys_enter_exit() 32 ASSERT_EQ(skel->bss->enter_cnt, 3, "enter_cnt"); in test_sys_enter_exit() 33 ASSERT_EQ(skel->bss->exit_cnt, 3, "exit_cnt"); in test_sys_enter_exit() 34 ASSERT_EQ(skel->bss->mismatch_cnt, 0, "mismatch_cnt"); in test_sys_enter_exit() 36 task_local_storage__destroy(skel); in test_sys_enter_exit() 41 struct task_local_storage_exit_creds *skel; in test_exit_creds() local [all …]
|
D | bpf_cookie.c | 11 static void kprobe_subtest(struct test_bpf_cookie *skel) in kprobe_subtest() argument 20 link1 = bpf_program__attach_kprobe_opts(skel->progs.handle_kprobe, in kprobe_subtest() 27 link2 = bpf_program__attach_kprobe_opts(skel->progs.handle_kprobe, in kprobe_subtest() 35 retlink1 = bpf_program__attach_kprobe_opts(skel->progs.handle_kretprobe, in kprobe_subtest() 42 retlink2 = bpf_program__attach_kprobe_opts(skel->progs.handle_kretprobe, in kprobe_subtest() 50 ASSERT_EQ(skel->bss->kprobe_res, 0x1 | 0x2, "kprobe_res"); in kprobe_subtest() 51 ASSERT_EQ(skel->bss->kretprobe_res, 0x10 | 0x20, "kretprobe_res"); in kprobe_subtest() 60 static void uprobe_subtest(struct test_bpf_cookie *skel) in uprobe_subtest() argument 74 link1 = bpf_program__attach_uprobe_opts(skel->progs.handle_uprobe, 0 /* self pid */, in uprobe_subtest() 81 link2 = bpf_program__attach_uprobe_opts(skel->progs.handle_uprobe, -1 /* any pid */, in uprobe_subtest() [all …]
|
D | ksyms_btf.c | 20 struct test_ksyms_btf *skel = NULL; in test_basic() local 36 skel = test_ksyms_btf__open_and_load(); in test_basic() 37 if (CHECK(!skel, "skel_open", "failed to open and load skeleton\n")) in test_basic() 40 err = test_ksyms_btf__attach(skel); in test_basic() 47 data = skel->data; in test_basic() 74 test_ksyms_btf__destroy(skel); in test_basic() 79 struct test_ksyms_btf_null_check *skel; in test_null_check() local 81 skel = test_ksyms_btf_null_check__open_and_load(); in test_null_check() 82 CHECK(skel, "skel_open", "unexpected load of a prog missing null check\n"); in test_null_check() 84 test_ksyms_btf_null_check__destroy(skel); in test_null_check() [all …]
|
D | ringbuf_multi.c | 43 struct test_ringbuf_multi *skel; in test_ringbuf_multi() local 49 skel = test_ringbuf_multi__open(); in test_ringbuf_multi() 50 if (CHECK(!skel, "skel_open", "skeleton open failed\n")) in test_ringbuf_multi() 53 err = bpf_map__set_max_entries(skel->maps.ringbuf1, page_size); in test_ringbuf_multi() 57 err = bpf_map__set_max_entries(skel->maps.ringbuf2, page_size); in test_ringbuf_multi() 61 err = bpf_map__set_max_entries(bpf_map__inner_map(skel->maps.ringbuf_arr), page_size); in test_ringbuf_multi() 69 err = bpf_map__set_inner_map_fd(skel->maps.ringbuf_hash, proto_fd); in test_ringbuf_multi() 73 err = test_ringbuf_multi__load(skel); in test_ringbuf_multi() 81 skel->bss->pid = getpid(); in test_ringbuf_multi() 83 ringbuf = ring_buffer__new(bpf_map__fd(skel->maps.ringbuf1), in test_ringbuf_multi() [all …]
|
D | for_each.c | 13 struct for_each_hash_map_elem *skel; in test_hash_map() local 18 skel = for_each_hash_map_elem__open_and_load(); in test_hash_map() 19 if (!ASSERT_OK_PTR(skel, "for_each_hash_map_elem__open_and_load")) in test_hash_map() 22 hashmap_fd = bpf_map__fd(skel->maps.hashmap); in test_hash_map() 23 max_entries = bpf_map__max_entries(skel->maps.hashmap); in test_hash_map() 33 percpu_map_fd = bpf_map__fd(skel->maps.percpu_map); in test_hash_map() 45 err = bpf_prog_test_run(bpf_program__fd(skel->progs.test_pkt_access), in test_hash_map() 52 ASSERT_EQ(skel->bss->hashmap_output, 4, "hashmap_output"); in test_hash_map() 53 ASSERT_EQ(skel->bss->hashmap_elems, max_entries, "hashmap_elems"); in test_hash_map() 59 ASSERT_EQ(skel->bss->percpu_called, 1, "percpu_called"); in test_hash_map() [all …]
|
D | sk_lookup.c | 515 static void query_lookup_prog(struct test_sk_lookup *skel) in query_lookup_prog() argument 532 link[0] = attach_lookup_prog(skel->progs.lookup_pass); in query_lookup_prog() 535 link[1] = attach_lookup_prog(skel->progs.lookup_pass); in query_lookup_prog() 538 link[2] = attach_lookup_prog(skel->progs.lookup_drop); in query_lookup_prog() 671 static void test_redirect_lookup(struct test_sk_lookup *skel) in test_redirect_lookup() argument 676 .lookup_prog = skel->progs.redir_port, in test_redirect_lookup() 677 .sock_map = skel->maps.redir_map, in test_redirect_lookup() 684 .lookup_prog = skel->progs.redir_ip4, in test_redirect_lookup() 685 .sock_map = skel->maps.redir_map, in test_redirect_lookup() 692 .lookup_prog = skel->progs.select_sock_a, in test_redirect_lookup() [all …]
|
D | lookup_and_delete.c | 47 struct test_lookup_and_delete *skel; in setup_prog() local 50 skel = test_lookup_and_delete__open(); in setup_prog() 51 if (!ASSERT_OK_PTR(skel, "test_lookup_and_delete__open")) in setup_prog() 54 err = bpf_map__set_type(skel->maps.hash_map, map_type); in setup_prog() 58 err = bpf_map__set_max_entries(skel->maps.hash_map, MAX_ENTRIES); in setup_prog() 62 err = test_lookup_and_delete__load(skel); in setup_prog() 66 *map_fd = bpf_map__fd(skel->maps.hash_map); in setup_prog() 70 return skel; in setup_prog() 73 test_lookup_and_delete__destroy(skel); in setup_prog() 78 static int trigger_tp(struct test_lookup_and_delete *skel, __u64 key, in trigger_tp() argument [all …]
|
D | btf_map_in_map.c | 27 struct test_btf_map_in_map *skel; in test_lookup_update() local 30 skel = test_btf_map_in_map__open_and_load(); in test_lookup_update() 31 if (CHECK(!skel, "skel_open", "failed to open&load skeleton\n")) in test_lookup_update() 34 err = test_btf_map_in_map__attach(skel); in test_lookup_update() 38 map1_fd = bpf_map__fd(skel->maps.inner_map1); in test_lookup_update() 39 map2_fd = bpf_map__fd(skel->maps.inner_map2); in test_lookup_update() 40 map3_fd = bpf_map__fd(skel->maps.inner_map3); in test_lookup_update() 41 map4_fd = bpf_map__fd(skel->maps.inner_map4); in test_lookup_update() 42 map5_fd = bpf_map__fd(skel->maps.inner_map5); in test_lookup_update() 43 outer_arr_dyn_fd = bpf_map__fd(skel->maps.outer_arr_dyn); in test_lookup_update() [all …]
|
D | dummy_st_ops.c | 13 struct dummy_st_ops *skel; in test_dummy_st_ops_attach() local 16 skel = dummy_st_ops__open_and_load(); in test_dummy_st_ops_attach() 17 if (!ASSERT_OK_PTR(skel, "dummy_st_ops_load")) in test_dummy_st_ops_attach() 20 link = bpf_map__attach_struct_ops(skel->maps.dummy_1); in test_dummy_st_ops_attach() 23 dummy_st_ops__destroy(skel); in test_dummy_st_ops_attach() 33 struct dummy_st_ops *skel; in test_dummy_init_ret_value() local 36 skel = dummy_st_ops__open_and_load(); in test_dummy_init_ret_value() 37 if (!ASSERT_OK_PTR(skel, "dummy_st_ops_load")) in test_dummy_init_ret_value() 40 fd = bpf_program__fd(skel->progs.test_1); in test_dummy_init_ret_value() 46 dummy_st_ops__destroy(skel); in test_dummy_init_ret_value() [all …]
|
D | attach_probe.c | 19 struct test_attach_probe* skel; in test_attach_probe() local 47 skel = test_attach_probe__open_and_load(); in test_attach_probe() 48 if (CHECK(!skel, "skel_open", "failed to open skeleton\n")) in test_attach_probe() 50 if (CHECK(!skel->bss, "check_bss", ".bss wasn't mmap()-ed\n")) in test_attach_probe() 53 kprobe_link = bpf_program__attach_kprobe(skel->progs.handle_kprobe, in test_attach_probe() 58 skel->links.handle_kprobe = kprobe_link; in test_attach_probe() 60 kretprobe_link = bpf_program__attach_kprobe(skel->progs.handle_kretprobe, in test_attach_probe() 65 skel->links.handle_kretprobe = kretprobe_link; in test_attach_probe() 72 uprobe_link = bpf_program__attach_uprobe_opts(skel->progs.handle_uprobe, in test_attach_probe() 79 skel->links.handle_uprobe = uprobe_link; in test_attach_probe() [all …]
|
D | kfunc_call.c | 11 struct kfunc_call_test_lskel *skel; in test_main() local 14 skel = kfunc_call_test_lskel__open_and_load(); in test_main() 15 if (!ASSERT_OK_PTR(skel, "skel")) in test_main() 18 prog_fd = skel->progs.kfunc_call_test1.prog_fd; in test_main() 24 prog_fd = skel->progs.kfunc_call_test2.prog_fd; in test_main() 30 kfunc_call_test_lskel__destroy(skel); in test_main() 35 struct kfunc_call_test_subprog *skel; in test_subprog() local 38 skel = kfunc_call_test_subprog__open_and_load(); in test_subprog() 39 if (!ASSERT_OK_PTR(skel, "skel")) in test_subprog() 42 prog_fd = bpf_program__fd(skel->progs.kfunc_call_test1); in test_subprog() [all …]
|
D | get_func_ip_test.c | 7 struct get_func_ip_test *skel = NULL; in test_get_func_ip_test() local 11 skel = get_func_ip_test__open(); in test_get_func_ip_test() 12 if (!ASSERT_OK_PTR(skel, "get_func_ip_test__open")) in test_get_func_ip_test() 19 bpf_program__set_autoload(skel->progs.test6, false); in test_get_func_ip_test() 20 bpf_program__set_autoload(skel->progs.test7, false); in test_get_func_ip_test() 23 err = get_func_ip_test__load(skel); in test_get_func_ip_test() 27 err = get_func_ip_test__attach(skel); in test_get_func_ip_test() 31 prog_fd = bpf_program__fd(skel->progs.test1); in test_get_func_ip_test() 37 prog_fd = bpf_program__fd(skel->progs.test5); in test_get_func_ip_test() 43 ASSERT_EQ(skel->bss->test1_result, 1, "test1_result"); in test_get_func_ip_test() [all …]
|
D | linked_vars.c | 11 struct linked_vars *skel; in test_linked_vars() local 13 skel = linked_vars__open(); in test_linked_vars() 14 if (!ASSERT_OK_PTR(skel, "skel_open")) in test_linked_vars() 17 skel->bss->input_bss1 = 1000; in test_linked_vars() 18 skel->bss->input_bss2 = 2000; in test_linked_vars() 19 skel->bss->input_bss_weak = 3000; in test_linked_vars() 21 err = linked_vars__load(skel); in test_linked_vars() 25 err = linked_vars__attach(skel); in test_linked_vars() 32 ASSERT_EQ(skel->bss->output_bss1, 1000 + 2000 + 3000, "output_bss1"); in test_linked_vars() 33 ASSERT_EQ(skel->bss->output_bss2, 1000 + 2000 + 3000, "output_bss2"); in test_linked_vars() [all …]
|
D | sockmap_basic.c | 113 struct test_skmsg_load_helpers *skel; in test_skmsg_helpers() local 116 skel = test_skmsg_load_helpers__open_and_load(); in test_skmsg_helpers() 117 if (CHECK_FAIL(!skel)) { in test_skmsg_helpers() 122 verdict = bpf_program__fd(skel->progs.prog_msg_verdict); in test_skmsg_helpers() 123 map = bpf_map__fd(skel->maps.sock_map); in test_skmsg_helpers() 137 test_skmsg_load_helpers__destroy(skel); in test_skmsg_helpers() 144 struct test_sockmap_update *skel; in test_sockmap_update() local 154 skel = test_sockmap_update__open_and_load(); in test_sockmap_update() 155 if (CHECK(!skel, "open_and_load", "cannot load skeleton\n")) in test_sockmap_update() 158 prog = bpf_program__fd(skel->progs.copy_sock_map); in test_sockmap_update() [all …]
|
D | recursion.c | 10 struct recursion *skel; in test_recursion() local 14 skel = recursion__open_and_load(); in test_recursion() 15 if (!ASSERT_OK_PTR(skel, "skel_open_and_load")) in test_recursion() 18 err = recursion__attach(skel); in test_recursion() 22 ASSERT_EQ(skel->bss->pass1, 0, "pass1 == 0"); in test_recursion() 23 bpf_map_delete_elem(bpf_map__fd(skel->maps.hash1), &key); in test_recursion() 24 ASSERT_EQ(skel->bss->pass1, 1, "pass1 == 1"); in test_recursion() 25 bpf_map_delete_elem(bpf_map__fd(skel->maps.hash1), &key); in test_recursion() 26 ASSERT_EQ(skel->bss->pass1, 2, "pass1 == 2"); in test_recursion() 28 ASSERT_EQ(skel->bss->pass2, 0, "pass2 == 0"); in test_recursion() [all …]
|
/external/bcc/libbpf-tools/ |
D | Android.bp | 129 name: "bindsnoop.skel.h", 131 out: ["bindsnoop.skel.h"], 138 generated_headers: ["bindsnoop.skel.h"], 149 name: "cpudist.skel.h", 151 out: ["cpudist.skel.h"], 158 generated_headers: ["cpudist.skel.h"], 169 name: "cpufreq.skel.h", 171 out: ["cpufreq.skel.h"], 178 generated_headers: ["cpufreq.skel.h"], 189 name: "drsnoop.skel.h", [all …]
|