/linux/tools/testing/selftests/bpf/prog_tests/ |
H A D | atomics.c | 9 int err, prog_fd; in test_add() local 13 prog_fd = skel->progs.add.prog_fd; in test_add() 34 int err, prog_fd; in test_sub() local 38 prog_fd = skel->progs.sub.prog_fd; in test_sub() 59 int err, prog_fd; in test_and() local 63 prog_fd = skel->progs.and.prog_fd; in test_and() 81 int err, prog_fd; in test_or() local 85 prog_fd = skel->progs.or.prog_fd; in test_or() 107 prog_fd = skel->progs.xor.prog_fd; in test_xor() 129 prog_fd = skel->progs.cmpxchg.prog_fd; in test_cmpxchg() [all …]
|
H A D | arena_atomics.c | 9 int err, prog_fd; in test_add() local 12 prog_fd = bpf_program__fd(skel->progs.add); in test_add() 13 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_add() 34 int err, prog_fd; in test_sub() local 37 prog_fd = bpf_program__fd(skel->progs.sub); in test_sub() 59 int err, prog_fd; in test_and() local 76 int err, prog_fd; in test_or() local 93 int err, prog_fd; in test_xor() local 110 int err, prog_fd; in test_cmpxchg() local 132 int err, prog_fd; in test_xchg() local [all …]
|
H A 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, 256, 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 …]
|
H A D | tailcalls.c | 30 &prog_fd); in test_tailcall_1() 166 &prog_fd); in test_tailcall_2() 243 &prog_fd); in test_tailcall_count() 427 &prog_fd); in test_tailcall_4() 517 &prog_fd); in test_tailcall_5() 605 &obj, &prog_fd); in test_tailcall_bpf2bpf_1() 689 &obj, &prog_fd); in test_tailcall_bpf2bpf_2() 769 &obj, &prog_fd); in test_tailcall_bpf2bpf_3() 864 &obj, &prog_fd); in test_tailcall_bpf2bpf_4() 1212 &prog_fd); in test_tailcall_hierarchy_count() [all …]
|
H A D | xdp_adjust_tail.c | 10 int err, prog_fd; in test_xdp_adjust_tail_shrink() local 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 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 148 int err, prog_fd; in test_xdp_adjust_frags_tail_shrink() local 163 prog_fd = bpf_program__fd(prog); in test_xdp_adjust_frags_tail_shrink() 215 int err, i, prog_fd; in test_xdp_adjust_frags_tail_grow() local [all …]
|
H A D | syscall.c | 11 int prog_fd; member 29 int err, prog_fd; in test_syscall_load_prog() local 35 prog_fd = bpf_program__fd(skel->progs.load_prog); in test_syscall_load_prog() 36 err = bpf_prog_test_run_opts(prog_fd, &tattr); in test_syscall_load_prog() 40 ASSERT_GT(ctx.prog_fd, 0, "ctx.prog_fd"); in test_syscall_load_prog() 49 if (ctx.prog_fd > 0) in test_syscall_load_prog() 50 close(ctx.prog_fd); in test_syscall_load_prog() 61 int err, prog_fd; in test_syscall_update_outer_map() local 67 prog_fd = bpf_program__fd(skel->progs.update_outer_map); in test_syscall_update_outer_map() 68 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_syscall_update_outer_map()
|
H A 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()
|
H A 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()
|
H A D | kfunc_call.c | 97 int prog_fd, err; in verify_success() local 125 prog_fd = bpf_program__fd(prog); in verify_success() 126 err = bpf_prog_test_run_opts(prog_fd, &topts); in verify_success() 140 prog_fd = lskel_prog->prog_fd; in verify_success() 141 err = bpf_prog_test_run_opts(prog_fd, &topts); in verify_success() 159 int prog_fd, err; in verify_fail() local 203 prog_fd = bpf_program__fd(prog); in verify_fail() 237 int prog_fd, err; in test_subprog() local 249 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_subprog() 261 int prog_fd, err; in test_subprog_lskel() local [all …]
|
H A 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() 495 int prog_fd; in tracing_subtest() local 525 bpf_prog_test_run_opts(prog_fd, &opts); in tracing_subtest() 528 bpf_prog_test_run_opts(prog_fd, &opts); in tracing_subtest() 548 int prog_fd; in lsm_subtest() local 579 int prog_fd, link_fd = -1; in tp_btf_subtest() local [all …]
|
H A D | timer.c | 11 int i, err, prog_fd = *(int *)arg; in spin_lock_thread() local 15 err = bpf_prog_test_run_opts(prog_fd, &topts); in spin_lock_thread() 26 int i, err, prog_fd; in timer() local 39 prog_fd = bpf_program__fd(timer_skel->progs.test1); in timer() 40 err = bpf_prog_test_run_opts(prog_fd, &topts); in timer() 65 prog_fd = bpf_program__fd(timer_skel->progs.race); in timer() 68 &spin_lock_thread, &prog_fd); in timer() 76 ASSERT_EQ(ret, (void *)&prog_fd, "pthread_join"); in timer()
|
H A D | percpu_alloc.c | 10 int err, prog_fd; in test_array() local 33 prog_fd = bpf_program__fd(skel->progs.test_array_map_1); in test_array() 34 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_array() 46 int err, prog_fd; in test_array_sleepable() local 66 prog_fd = bpf_program__fd(skel->progs.test_array_map_10); in test_array_sleepable() 67 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_array_sleepable() 79 int err, cgroup_fd, prog_fd; in test_cgrp_local_storage() local 101 prog_fd = bpf_program__fd(skel->progs.test_cgrp_local_storage_1); in test_cgrp_local_storage() 102 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_cgrp_local_storage()
|
H A D | missed.c | 18 int err, prog_fd; in test_missed_perf_kprobe() local 28 prog_fd = bpf_program__fd(skel->progs.trigger); in test_missed_perf_kprobe() 29 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_missed_perf_kprobe() 68 int err, prog_fd; in test_missed_kprobe_recursion() local 78 prog_fd = bpf_program__fd(skel->progs.trigger); in test_missed_kprobe_recursion() 79 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_missed_kprobe_recursion() 106 int err, prog_fd; in test_missed_tp_recursion() local 116 prog_fd = bpf_program__fd(skel->progs.trigger); in test_missed_tp_recursion() 117 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_missed_tp_recursion()
|
H A 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()
|
H A 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()
|
H A D | verifier_log.c | 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 44 return prog_fd; in load_prog() 107 if (prog_fd >= 0) in verif_log_subtest() 108 close(prog_fd); in verif_log_subtest() 142 if (prog_fd >= 0) in verif_log_subtest() [all …]
|
H A D | module_fentry_shadow.c | 61 int prog_fd[2] = {}; in test_module_fentry_shadow() local 102 prog_fd[i] = bpf_prog_load(BPF_PROG_TYPE_TRACING, NULL, "GPL", in test_module_fentry_shadow() 106 if (!ASSERT_GE(prog_fd[i], 0, "bpf_prog_load")) in test_module_fentry_shadow() 115 link_fd[i] = bpf_link_create(prog_fd[i], 0, BPF_TRACE_FENTRY, NULL); in test_module_fentry_shadow() 120 err = bpf_prog_test_run_opts(prog_fd[0], NULL); in test_module_fentry_shadow() 129 if (prog_fd[i] > 0) in test_module_fentry_shadow() 130 close(prog_fd[i]); in test_module_fentry_shadow()
|
/linux/samples/bpf/ |
H A D | xdp_fwd_user.c | 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() 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 192 prog_fd = bpf_program__fd(prog); in main() 193 if (prog_fd < 0) { in main() [all …]
|
/linux/tools/testing/selftests/bpf/ |
H A D | xdp_synproxy.c | 26 int prog_fd; in cleanup() local 47 if (prog_fd < 0) { 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() 237 .prog_fd = prog_fd); in syncookie_attach() 277 int prog_fd; in syncookie_open_bpf_maps() local 285 if (prog_fd < 0) { in syncookie_open_bpf_maps() 287 return prog_fd; in syncookie_open_bpf_maps() [all …]
|
H A D | test_tcp_check_syncookie_user.c | 26 int prog_fd = -1; in get_map_fd_by_prog_id() local 29 prog_fd = bpf_prog_get_fd_by_id(prog_id); in get_map_fd_by_prog_id() 30 if (prog_fd < 0) { in get_map_fd_by_prog_id() 38 if (bpf_prog_get_info_by_fd(prog_fd, &info, &info_len)) { in get_map_fd_by_prog_id() 39 log_err("Failed to get info by prog fd %d", prog_fd); in get_map_fd_by_prog_id() 44 log_err("No maps found for prog fd %d", prog_fd); in get_map_fd_by_prog_id() 54 if (prog_fd >= 0) in get_map_fd_by_prog_id() 55 close(prog_fd); in get_map_fd_by_prog_id()
|
/linux/kernel/bpf/preload/iterators/ |
H A 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()
|
H A 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/tools/lib/bpf/ |
H A 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 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() 369 if (prog_fd >= 0) in bpf_load_and_run() [all …]
|
/linux/tools/testing/selftests/sched_ext/ |
H A D | prog_run.c | 32 int prog_fd, err = 0; in run() local 34 prog_fd = bpf_program__fd(skel->progs.prog_run_syscall); in run() 35 if (prog_fd < 0) { in run() 45 close(prog_fd); in run() 49 err = bpf_prog_test_run_opts(prog_fd, &topts); in run() 58 close(prog_fd); in run()
|
/linux/tools/bpf/bpftool/ |
H A D | cgroup.c | 139 int prog_fd; in show_bpf_prog() local 141 prog_fd = bpf_prog_get_fd_by_id(id); in show_bpf_prog() 142 if (prog_fd < 0) in show_bpf_prog() 146 close(prog_fd); in show_bpf_prog() 199 close(prog_fd); in show_bpf_prog() 547 int cgroup_fd, prog_fd; in do_attach() local 572 if (prog_fd < 0) in do_attach() 597 close(prog_fd); in do_attach() 607 int prog_fd, cgroup_fd; in do_detach() local 630 if (prog_fd < 0) in do_detach() [all …]
|