/linux-6.6.21/tools/testing/selftests/bpf/prog_tests/ |
D | atomics.c | 9 int err, prog_fd; in test_add() local 13 prog_fd = skel->progs.add.prog_fd; in test_add() 14 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_add() 34 int err, prog_fd; in test_sub() local 38 prog_fd = skel->progs.sub.prog_fd; in test_sub() 39 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_sub() 59 int err, prog_fd; in test_and() local 63 prog_fd = skel->progs.and.prog_fd; in test_and() 64 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_and() 81 int err, prog_fd; in test_or() local [all …]
|
D | xdp_context_test_run.c | 6 void test_xdp_context_error(int prog_fd, struct bpf_test_run_opts opts, in test_xdp_context_error() argument 23 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_xdp_context_error() 41 int err, prog_fd; in test_xdp_context_test_run() local 46 prog_fd = bpf_program__fd(skel->progs.xdp_context); in test_xdp_context_test_run() 52 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_xdp_context_test_run() 64 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_xdp_context_test_run() 74 test_xdp_context_error(prog_fd, opts, 0, 1, sizeof(data), 0, 0, 0); in test_xdp_context_test_run() 77 test_xdp_context_error(prog_fd, opts, 4, sizeof(__u32), sizeof(data), in test_xdp_context_test_run() 81 test_xdp_context_error(prog_fd, opts, 0, 36, sizeof(data), 0, 0, 0); in test_xdp_context_test_run() 84 test_xdp_context_error(prog_fd, opts, 0, sizeof(__u32), in test_xdp_context_test_run() [all …]
|
D | tailcalls.c | 11 int err, map_fd, prog_fd, main_fd, i, j; in test_tailcall_1() local 24 &prog_fd); in test_tailcall_1() 51 prog_fd = bpf_program__fd(prog); in test_tailcall_1() 52 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1() 55 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in test_tailcall_1() 81 prog_fd = bpf_program__fd(prog); in test_tailcall_1() 82 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1() 85 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in test_tailcall_1() 102 prog_fd = bpf_program__fd(prog); in test_tailcall_1() 103 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1() [all …]
|
D | xdp_adjust_tail.c | 10 int err, prog_fd; in test_xdp_adjust_tail_shrink() local 20 err = bpf_prog_test_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_adjust_tail_shrink() 24 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_adjust_tail_shrink() 32 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_adjust_tail_shrink() 46 int err, prog_fd; in test_xdp_adjust_tail_grow() local 55 err = bpf_prog_test_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_adjust_tail_grow() 59 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_adjust_tail_grow() 67 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_adjust_tail_grow() 81 int max_grow, prog_fd; in test_xdp_adjust_tail_grow2() local 97 err = bpf_prog_test_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_adjust_tail_grow2() [all …]
|
D | prog_run_opts.c | 9 static void check_run_cnt(int prog_fd, __u64 run_cnt) in check_run_cnt() argument 15 err = bpf_prog_get_info_by_fd(prog_fd, &info, &info_len); in check_run_cnt() 16 if (CHECK(err, "get_prog_info", "failed to get bpf_prog_info for fd %d\n", prog_fd)) in check_run_cnt() 26 int err, stats_fd = -1, prog_fd; in test_prog_run_opts() local 46 prog_fd = bpf_program__fd(skel->progs.test_pkt_access); in test_prog_run_opts() 48 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_prog_run_opts() 57 check_run_cnt(prog_fd, run_cnt); in test_prog_run_opts() 64 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_prog_run_opts() 70 check_run_cnt(prog_fd, run_cnt); in test_prog_run_opts()
|
D | skb_ctx.c | 32 int err, prog_fd, i; in test_skb_ctx() local 35 &obj, &prog_fd); in test_skb_ctx() 42 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_ctx() 49 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_ctx() 56 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_ctx() 61 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_ctx() 68 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_ctx() 73 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_ctx() 77 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_ctx()
|
D | kfunc_call.c | 95 int prog_fd, err; in verify_success() local 123 prog_fd = bpf_program__fd(prog); in verify_success() 124 err = bpf_prog_test_run_opts(prog_fd, &topts); in verify_success() 138 prog_fd = lskel_prog->prog_fd; in verify_success() 139 err = bpf_prog_test_run_opts(prog_fd, &topts); in verify_success() 157 int prog_fd, err; in verify_fail() local 201 prog_fd = bpf_program__fd(prog); in verify_fail() 202 err = bpf_prog_test_run_opts(prog_fd, &topts); in verify_fail() 235 int prog_fd, err; in test_subprog() local 246 prog_fd = bpf_program__fd(skel->progs.kfunc_call_test1); in test_subprog() [all …]
|
D | syscall.c | 11 int prog_fd; member 29 int err, prog_fd; in test_syscall() local 35 prog_fd = bpf_program__fd(skel->progs.bpf_prog); in test_syscall() 36 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_syscall() 40 ASSERT_GT(ctx.prog_fd, 0, "ctx.prog_fd"); in test_syscall() 49 if (ctx.prog_fd > 0) in test_syscall() 50 close(ctx.prog_fd); in test_syscall()
|
D | get_func_ip_test.c | 13 int err, prog_fd; in test_function_entry() local 30 prog_fd = bpf_program__fd(skel->progs.test1); in test_function_entry() 31 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_function_entry() 35 prog_fd = bpf_program__fd(skel->progs.test5); in test_function_entry() 36 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_function_entry() 70 int err, prog_fd; in test_function_body_kprobe() local 91 prog_fd = bpf_program__fd(skel->progs.test1); in test_function_body_kprobe() 92 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_function_body_kprobe()
|
D | raw_tp_test_run.c | 10 int comm_fd = -1, err, nr_online, i, prog_fd; in test_raw_tp_test_run() local 45 prog_fd = bpf_program__fd(skel->progs.rename); in test_raw_tp_test_run() 49 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_raw_tp_test_run() 53 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_raw_tp_test_run() 63 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_raw_tp_test_run() 71 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_raw_tp_test_run() 78 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_raw_tp_test_run()
|
D | verifier_log.c | 10 static bool check_prog_load(int prog_fd, bool expect_err, const char *tag) in check_prog_load() argument 13 if (!ASSERT_LT(prog_fd, 0, tag)) { in check_prog_load() 14 close(prog_fd); in check_prog_load() 18 if (!ASSERT_GT(prog_fd, 0, tag)) in check_prog_load() 21 if (prog_fd >= 0) in check_prog_load() 22 close(prog_fd); in check_prog_load() 38 int prog_fd; in load_prog() local 40 prog_fd = bpf_prog_load(BPF_PROG_TYPE_RAW_TRACEPOINT, "log_prog", in load_prog() 42 check_prog_load(prog_fd, expect_load_error, "prog_load"); in load_prog() 44 return prog_fd; in load_prog() [all …]
|
D | bpf_cookie.c | 74 int err, prog_fd; in kprobe_multi_test_run() local 76 prog_fd = bpf_program__fd(skel->progs.trigger); in kprobe_multi_test_run() 77 err = bpf_prog_test_run_opts(prog_fd, &topts); in kprobe_multi_test_run() 102 int prog_fd, link1_fd = -1, link2_fd = -1; in kprobe_multi_link_api_subtest() local 147 prog_fd = bpf_program__fd(skel->progs.test_kprobe); in kprobe_multi_link_api_subtest() 149 link1_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_KPROBE_MULTI, &opts); in kprobe_multi_link_api_subtest() 163 prog_fd = bpf_program__fd(skel->progs.test_kretprobe); in kprobe_multi_link_api_subtest() 165 link2_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_KPROBE_MULTI, &opts); in kprobe_multi_link_api_subtest() 495 int prog_fd; in tracing_subtest() local 504 prog_fd = bpf_program__fd(skel->progs.fentry_test1); in tracing_subtest() [all …]
|
D | module_fentry_shadow.c | 60 int prog_fd[2] = {}; in test_module_fentry_shadow() local 101 prog_fd[i] = bpf_prog_load(BPF_PROG_TYPE_TRACING, NULL, "GPL", in test_module_fentry_shadow() 105 if (!ASSERT_GE(prog_fd[i], 0, "bpf_prog_load")) in test_module_fentry_shadow() 114 link_fd[i] = bpf_link_create(prog_fd[i], 0, BPF_TRACE_FENTRY, NULL); in test_module_fentry_shadow() 119 err = bpf_prog_test_run_opts(prog_fd[0], NULL); in test_module_fentry_shadow() 128 if (prog_fd[i] > 0) in test_module_fentry_shadow() 129 close(prog_fd[i]); in test_module_fentry_shadow()
|
D | task_local_storage.c | 82 int err, map_fd, prog_fd, task_fd; in test_recursion() local 120 prog_fd = bpf_program__fd(skel->progs.on_lookup); in test_recursion() 122 err = bpf_prog_get_info_by_fd(prog_fd, &info, &info_len); in test_recursion() 126 prog_fd = bpf_program__fd(skel->progs.on_update); in test_recursion() 128 err = bpf_prog_get_info_by_fd(prog_fd, &info, &info_len); in test_recursion() 132 prog_fd = bpf_program__fd(skel->progs.on_enter); in test_recursion() 134 err = bpf_prog_get_info_by_fd(prog_fd, &info, &info_len); in test_recursion() 176 int i, prog_fd, err; in test_nodeadlock() local 223 prog_fd = bpf_program__fd(skel->progs.socket_post_create); in test_nodeadlock() 224 err = bpf_prog_get_info_by_fd(prog_fd, &info, &info_len); in test_nodeadlock()
|
D | get_func_args_test.c | 8 int err, prog_fd; in test_get_func_args_test() local 22 prog_fd = bpf_program__fd(skel->progs.test1); in test_get_func_args_test() 23 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_get_func_args_test() 30 prog_fd = bpf_program__fd(skel->progs.fmod_ret_test); in test_get_func_args_test() 31 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_get_func_args_test()
|
D | skb_load_bytes.c | 9 int err, prog_fd, test_result; in test_skb_load_bytes() local 23 prog_fd = bpf_program__fd(skel->progs.skb_process); in test_skb_load_bytes() 24 if (!ASSERT_GE(prog_fd, 0, "prog_fd")) in test_skb_load_bytes() 28 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_load_bytes() 36 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_skb_load_bytes()
|
D | xdp_adjust_frags.c | 8 int err, prog_fd, max_skb_frags, buf_size, num; in test_xdp_update_frags() local 24 prog_fd = bpf_program__fd(prog); in test_xdp_update_frags() 41 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_update_frags() 66 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_update_frags() 80 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_update_frags() 94 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_update_frags() 134 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_xdp_update_frags()
|
/linux-6.6.21/samples/bpf/ |
D | xdp_fwd_user.c | 32 static int do_attach(int idx, int prog_fd, int map_fd, const char *name) in do_attach() argument 36 err = bpf_xdp_attach(idx, prog_fd, xdp_flags, NULL); in do_attach() 56 int prog_fd; in do_detach() local 72 prog_fd = bpf_prog_get_fd_by_id(curr_prog_id); in do_detach() 73 if (prog_fd < 0) { in do_detach() 76 return prog_fd; in do_detach() 79 err = bpf_prog_get_info_by_fd(prog_fd, &prog_info, &info_len); in do_detach() 94 opts.old_prog_fd = prog_fd; in do_detach() 103 close(prog_fd); in do_detach() 125 int prog_fd = -1, map_fd = -1; in main() local [all …]
|
/linux-6.6.21/tools/testing/selftests/bpf/ |
D | xdp_synproxy.c | 26 int prog_fd; in cleanup() local 46 prog_fd = bpf_prog_get_fd_by_id(attached_prog_id); in cleanup() 47 if (prog_fd < 0) { in cleanup() 48 fprintf(stderr, "Error: bpf_prog_get_fd_by_id: %s\n", strerror(-prog_fd)); in cleanup() 56 opts.old_prog_fd = prog_fd; in cleanup() 58 close(prog_fd); in cleanup() 195 int prog_fd; in syncookie_attach() local 218 prog_fd = bpf_program__fd(prog); in syncookie_attach() 220 err = bpf_prog_get_info_by_fd(prog_fd, &info, &info_len); in syncookie_attach() 237 .prog_fd = prog_fd); in syncookie_attach() [all …]
|
D | test_skb_cgroup_id_user.c | 84 int prog_fd = -1; in get_map_fd_by_prog_id() local 87 prog_fd = bpf_prog_get_fd_by_id(prog_id); in get_map_fd_by_prog_id() 88 if (prog_fd < 0) { in get_map_fd_by_prog_id() 96 if (bpf_prog_get_info_by_fd(prog_fd, &info, &info_len)) { in get_map_fd_by_prog_id() 97 log_err("Failed to get info by prog fd %d", prog_fd); in get_map_fd_by_prog_id() 102 log_err("No maps found for prog fd %d", prog_fd); in get_map_fd_by_prog_id() 110 if (prog_fd >= 0) in get_map_fd_by_prog_id() 111 close(prog_fd); in get_map_fd_by_prog_id()
|
D | flow_dissector_load.h | 14 int *prog_fd, in bpf_flow_load() argument 23 prog_fd); in bpf_flow_load() 31 *prog_fd = bpf_program__fd(main_prog); in bpf_flow_load() 32 if (*prog_fd < 0) in bpf_flow_load() 59 if (fd != *prog_fd) { in bpf_flow_load()
|
/linux-6.6.21/kernel/bpf/preload/iterators/ |
D | iterators.lskel-big-endian.h | 26 int prog_fd = skel->progs.dump_bpf_map.prog_fd; in iterators_bpf__dump_bpf_map__attach() local 27 int fd = skel_link_create(prog_fd, 0, BPF_TRACE_ITER); in iterators_bpf__dump_bpf_map__attach() 37 int prog_fd = skel->progs.dump_bpf_prog.prog_fd; in iterators_bpf__dump_bpf_prog__attach() local 38 int fd = skel_link_create(prog_fd, 0, BPF_TRACE_ITER); in iterators_bpf__dump_bpf_prog__attach() 67 skel_closenz(skel->progs.dump_bpf_map.prog_fd); in iterators_bpf__destroy() 68 skel_closenz(skel->progs.dump_bpf_prog.prog_fd); in iterators_bpf__destroy()
|
D | iterators.lskel-little-endian.h | 26 int prog_fd = skel->progs.dump_bpf_map.prog_fd; in iterators_bpf__dump_bpf_map__attach() local 27 int fd = skel_link_create(prog_fd, 0, BPF_TRACE_ITER); in iterators_bpf__dump_bpf_map__attach() 37 int prog_fd = skel->progs.dump_bpf_prog.prog_fd; in iterators_bpf__dump_bpf_prog__attach() local 38 int fd = skel_link_create(prog_fd, 0, BPF_TRACE_ITER); in iterators_bpf__dump_bpf_prog__attach() 67 skel_closenz(skel->progs.dump_bpf_map.prog_fd); in iterators_bpf__destroy() 68 skel_closenz(skel->progs.dump_bpf_prog.prog_fd); in iterators_bpf__destroy()
|
/linux-6.6.21/tools/lib/bpf/ |
D | skel_internal.h | 45 int prog_fd; member 277 static inline int skel_raw_tracepoint_open(const char *name, int prog_fd) in skel_raw_tracepoint_open() argument 279 const size_t attr_sz = offsetofend(union bpf_attr, raw_tracepoint.prog_fd); in skel_raw_tracepoint_open() 284 attr.raw_tracepoint.prog_fd = prog_fd; in skel_raw_tracepoint_open() 289 static inline int skel_link_create(int prog_fd, int target_fd, in skel_link_create() argument 296 attr.link_create.prog_fd = prog_fd; in skel_link_create() 313 int map_fd = -1, prog_fd = -1, key = 0, err; in bpf_load_and_run() local 341 err = prog_fd = skel_sys_bpf(BPF_PROG_LOAD, &attr, prog_load_attr_sz); in bpf_load_and_run() 342 if (prog_fd < 0) { in bpf_load_and_run() 349 attr.test.prog_fd = prog_fd; in bpf_load_and_run() [all …]
|
/linux-6.6.21/tools/bpf/bpftool/ |
D | cgroup.c | 105 int prog_fd; in show_bpf_prog() local 107 prog_fd = bpf_prog_get_fd_by_id(id); in show_bpf_prog() 108 if (prog_fd < 0) in show_bpf_prog() 111 if (bpf_prog_get_info_by_fd(prog_fd, &info, &info_len)) { in show_bpf_prog() 112 close(prog_fd); in show_bpf_prog() 131 get_prog_full_name(&info, prog_fd, prog_name, sizeof(prog_name)); in show_bpf_prog() 165 close(prog_fd); in show_bpf_prog() 513 int cgroup_fd, prog_fd; in do_attach() local 537 prog_fd = prog_parse_fd(&argc, &argv); in do_attach() 538 if (prog_fd < 0) in do_attach() [all …]
|