Home
last modified time | relevance | path

Searched refs:prog_fd (Results 1 – 25 of 149) sorted by relevance

123456

/linux/tools/testing/selftests/bpf/prog_tests/
H A Datomics.c9 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 …]
H A Darena_atomics.c9 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()
38 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_sub()
59 int err, prog_fd; in test_and() local
62 prog_fd = bpf_program__fd(skel->progs.and); in test_and()
63 err = bpf_prog_test_run_opts(prog_fd, &topts); in test_and()
76 int err, prog_fd; in test_or() local
[all …]
H A Dtailcalls.c18 int err, map_fd, prog_fd, main_fd, i, j; in test_tailcall_1() local
31 &prog_fd); in test_tailcall_1()
58 prog_fd = bpf_program__fd(prog); in test_tailcall_1()
59 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1()
62 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in test_tailcall_1()
88 prog_fd = bpf_program__fd(prog); in test_tailcall_1()
89 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1()
92 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in test_tailcall_1()
109 prog_fd = bpf_program__fd(prog); in test_tailcall_1()
110 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1()
[all …]
H A Dxdp_context_test_run.c6 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 Dxdp_adjust_tail.c10 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 …]
H A Dsyscall.c11 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 Dprog_run_opts.c9 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 Dbpf_cookie.c74 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 in tracing_subtest()
548 int prog_fd; lsm_subtest() local
579 int prog_fd, link_fd = -1; tp_btf_subtest() local
641 int prog_fd, link_fd = -1; raw_tp_subtest() local
[all...]
H A Dskb_ctx.c32 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 Dkfunc_call.c97 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()
204 err = bpf_prog_test_run_opts(prog_fd, &topts); in verify_fail()
237 int prog_fd, err; in test_subprog() local
248 prog_fd = bpf_program__fd(skel->progs.kfunc_call_test1); in test_subprog()
[all …]
H A Dtimer.c11 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 Dpercpu_alloc.c10 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 Dmissed.c18 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 Dverifier_log.c10 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 …]
H A Dget_func_ip_test.c13 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 Draw_tp_test_run.c10 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 Dmodule_fentry_shadow.c61 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 Dxdp_fwd_user.c32 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/tools/testing/selftests/bpf/
H A Dxdp_synproxy.c26 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 …]
H A Dtest_tcp_check_syncookie_user.c
/linux/tools/lib/bpf/
H A Dskel_internal.h45 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/kernel/bpf/preload/iterators/
H A Diterators.lskel-little-endian.h26 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 Diterators.lskel-big-endian.h26 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/bpf/bpftool/
H A Dcgroup.c139 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()
145 if (bpf_prog_get_info_by_fd(prog_fd, &info, &info_len)) { in show_bpf_prog()
146 close(prog_fd); in show_bpf_prog()
165 get_prog_full_name(&info, prog_fd, prog_name, sizeof(prog_name)); in show_bpf_prog()
199 close(prog_fd); in show_bpf_prog()
547 int cgroup_fd, prog_fd; in do_attach() local
571 prog_fd = prog_parse_fd(&argc, &argv); in do_attach()
572 if (prog_fd < 0) in do_attach()
[all …]
/linux/tools/testing/selftests/sched_ext/
H A Dprog_run.c32 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()

123456