Home
last modified time | relevance | path

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

1234

/tools/testing/selftests/bpf/prog_tests/
Dkfunc_call.c11 int prog_fd, retval, err; in test_main() local
17 prog_fd = skel->progs.kfunc_call_test1.prog_fd; in test_main()
18 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4), in test_main()
23 prog_fd = skel->progs.kfunc_call_test2.prog_fd; in test_main()
24 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4), in test_main()
35 int prog_fd, retval, err; in test_subprog() local
41 prog_fd = bpf_program__fd(skel->progs.kfunc_call_test1); in test_subprog()
42 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4), in test_subprog()
Datomics.c9 int err, prog_fd; in test_add() local
17 prog_fd = skel->progs.add.prog_fd; in test_add()
18 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in test_add()
41 int err, prog_fd; in test_sub() local
49 prog_fd = skel->progs.sub.prog_fd; in test_sub()
50 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in test_sub()
74 int err, prog_fd; in test_and() local
82 prog_fd = skel->progs.and.prog_fd; in test_and()
83 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in test_and()
102 int err, prog_fd; in test_or() local
[all …]
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, 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 …]
Dspinlock.c8 int err, prog_fd = *(u32 *) arg; in spin_lock_thread() local
10 err = bpf_prog_test_run(prog_fd, 10000, &pkt_v4, sizeof(pkt_v4), in spin_lock_thread()
23 int prog_fd; in test_spinlock() local
27 err = bpf_prog_load(file, BPF_PROG_TYPE_CGROUP_SKB, &obj, &prog_fd); in test_spinlock()
34 &spin_lock_thread, &prog_fd))) in test_spinlock()
39 ret != (void *)&prog_fd)) in test_spinlock()
Dxdp_cpumap_attach.c18 int err, prog_fd, map_fd; in test_xdp_cpumap_attach() local
25 prog_fd = bpf_program__fd(skel->progs.xdp_redir_prog); in test_xdp_cpumap_attach()
26 err = bpf_set_link_xdp_fd(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE); in test_xdp_cpumap_attach()
33 prog_fd = bpf_program__fd(skel->progs.xdp_dummy_cm); in test_xdp_cpumap_attach()
35 err = bpf_obj_get_info_by_fd(prog_fd, &info, &len); in test_xdp_cpumap_attach()
39 val.bpf_prog.fd = prog_fd; in test_xdp_cpumap_attach()
48 err = bpf_set_link_xdp_fd(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE); in test_xdp_cpumap_attach()
Dtailcalls.c11 int err, map_fd, prog_fd, main_fd, i, j; in test_tailcall_1() local
20 &prog_fd); in test_tailcall_1()
47 prog_fd = bpf_program__fd(prog); in test_tailcall_1()
48 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1()
51 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in test_tailcall_1()
79 prog_fd = bpf_program__fd(prog); in test_tailcall_1()
80 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1()
83 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in test_tailcall_1()
101 prog_fd = bpf_program__fd(prog); in test_tailcall_1()
102 if (CHECK_FAIL(prog_fd < 0)) in test_tailcall_1()
[all …]
Draw_tp_test_run.c13 int comm_fd = -1, err, nr_online, i, prog_fd; in test_raw_tp_test_run() local
48 prog_fd = bpf_program__fd(skel->progs.rename); in test_raw_tp_test_run()
49 test_attr.prog_fd = prog_fd; in test_raw_tp_test_run()
68 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_raw_tp_test_run()
79 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_raw_tp_test_run()
87 err = bpf_prog_test_run_opts(prog_fd, &opts); in test_raw_tp_test_run()
Dsyscall.c11 int prog_fd; member
35 tattr.prog_fd = bpf_program__fd(skel->progs.bpf_prog); 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()
Dpkt_access.c10 int err, prog_fd; in test_pkt_access() local
12 err = bpf_prog_load(file, BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd); in test_pkt_access()
16 err = bpf_prog_test_run(prog_fd, 100000, &pkt_v4, sizeof(pkt_v4), in test_pkt_access()
22 err = bpf_prog_test_run(prog_fd, 100000, &pkt_v6, sizeof(pkt_v6), in test_pkt_access()
Dprog_run_xattr.c9 static void check_run_cnt(int prog_fd, __u64 run_cnt) in check_run_cnt() argument
15 err = bpf_obj_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()
46 tattr.prog_fd = bpf_program__fd(skel->progs.test_pkt_access); in test_prog_run_xattr()
60 check_run_cnt(tattr.prog_fd, run_cnt); in test_prog_run_xattr()
76 check_run_cnt(tattr.prog_fd, run_cnt); in test_prog_run_xattr()
Dxdp_adjust_tail.c10 int err, prog_fd; in test_xdp_adjust_tail_shrink() local
13 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_adjust_tail_shrink()
17 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4), in test_xdp_adjust_tail_shrink()
25 err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6), in test_xdp_adjust_tail_shrink()
39 int err, prog_fd; in test_xdp_adjust_tail_grow() local
41 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_adjust_tail_grow()
45 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4), in test_xdp_adjust_tail_grow()
52 err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6) /* 74 */, in test_xdp_adjust_tail_grow()
78 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &tattr.prog_fd); in test_xdp_adjust_tail_grow2()
Dget_func_ip_test.c9 int err, prog_fd; in test_get_func_ip_test() local
31 prog_fd = bpf_program__fd(skel->progs.test1); in test_get_func_ip_test()
32 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in test_get_func_ip_test()
37 prog_fd = bpf_program__fd(skel->progs.test5); in test_get_func_ip_test()
38 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in test_get_func_ip_test()
Denable_stats.c8 int stats_fd, err, prog_fd; in test_enable_stats() local
29 prog_fd = bpf_program__fd(skel->progs.test_enable_stats); in test_enable_stats()
31 err = bpf_obj_get_info_by_fd(prog_fd, &info, &info_len); in test_enable_stats()
33 "failed to get bpf_prog_info for fd %d\n", prog_fd)) in test_enable_stats()
Dmap_lock.c8 int err, prog_fd = *(u32 *) arg; in spin_lock_thread() local
10 err = bpf_prog_test_run(prog_fd, 10000, &pkt_v4, sizeof(pkt_v4), in spin_lock_thread()
50 int prog_fd, map_fd[2], vars[17] = {}; in test_map_lock() local
56 err = bpf_prog_load(file, BPF_PROG_TYPE_CGROUP_SKB, &obj, &prog_fd); in test_map_lock()
72 &spin_lock_thread, &prog_fd))) in test_map_lock()
81 ret != (void *)&prog_fd)) in test_map_lock()
Dsignal_pending.c17 int prog_fd; in test_signal_pending_by_type() local
25 prog_fd = bpf_load_program(prog_type, prog, ARRAY_SIZE(prog), in test_signal_pending_by_type()
27 CHECK(prog_fd < 0, "test-run", "errno %d\n", errno); in test_signal_pending_by_type()
35 err = bpf_prog_test_run(prog_fd, 0xffffffff, &pkt_v4, sizeof(pkt_v4), in test_signal_pending_by_type()
Dpkt_md_access.c10 int err, prog_fd; in test_pkt_md_access() local
12 err = bpf_prog_load(file, BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd); in test_pkt_md_access()
16 err = bpf_prog_test_run(prog_fd, 10, &pkt_v4, sizeof(pkt_v4), in test_pkt_md_access()
Dfexit_test.c8 int err, prog_fd, i; in fexit_test() local
22 prog_fd = fexit_skel->progs.test1.prog_fd; in fexit_test()
23 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in fexit_test()
Dfentry_test.c8 int err, prog_fd, i; in fentry_test() local
22 prog_fd = fentry_skel->progs.test1.prog_fd; in fentry_test()
23 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in fentry_test()
Dxdp_perf.c10 int err, prog_fd; in test_xdp_perf() local
12 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_perf()
16 err = bpf_prog_test_run(prog_fd, 1000000, &in[0], 128, in test_xdp_perf()
/tools/lib/bpf/
Dskel_internal.h31 int prog_fd; member
65 int map_fd = -1, prog_fd = -1, key = 0, err; in bpf_load_and_run() local
94 prog_fd = skel_sys_bpf(BPF_PROG_LOAD, &attr, sizeof(attr)); in bpf_load_and_run()
95 if (prog_fd < 0) { in bpf_load_and_run()
102 attr.test.prog_fd = prog_fd; in bpf_load_and_run()
120 if (prog_fd >= 0) in bpf_load_and_run()
121 close(prog_fd); in bpf_load_and_run()
/tools/testing/selftests/bpf/
Dflow_dissector_load.h13 int *prog_fd, in bpf_flow_load() argument
22 prog_fd); in bpf_flow_load()
36 *prog_fd = bpf_program__fd(main_prog); in bpf_flow_load()
37 if (*prog_fd < 0) in bpf_flow_load()
64 if (fd != *prog_fd) { in bpf_flow_load()
Dtest_skb_cgroup_id_user.c85 int prog_fd = -1; in get_map_fd_by_prog_id() local
88 prog_fd = bpf_prog_get_fd_by_id(prog_id); in get_map_fd_by_prog_id()
89 if (prog_fd < 0) { in get_map_fd_by_prog_id()
97 if (bpf_obj_get_info_by_fd(prog_fd, &info, &info_len)) { in get_map_fd_by_prog_id()
98 log_err("Failed to get info by prog fd %d", prog_fd); in get_map_fd_by_prog_id()
103 log_err("No maps found for prog fd %d", prog_fd); in get_map_fd_by_prog_id()
111 if (prog_fd >= 0) in get_map_fd_by_prog_id()
112 close(prog_fd); in get_map_fd_by_prog_id()
Dxdping.c96 int prog_fd = -1, map_fd = -1; in main() local
176 if (bpf_prog_load(filename, BPF_PROG_TYPE_XDP, &obj, &prog_fd)) { in main()
184 prog_fd = bpf_program__fd(main_prog); in main()
185 if (!main_prog || prog_fd < 0) { in main()
205 if (bpf_set_link_xdp_fd(ifindex, prog_fd, xdp_flags) < 0) { in main()
211 close(prog_fd); in main()
251 if (prog_fd > 0) in main()
252 close(prog_fd); in main()
Dtest_tcp_check_syncookie_user.c86 int prog_fd = -1; in get_map_fd_by_prog_id() local
89 prog_fd = bpf_prog_get_fd_by_id(prog_id); in get_map_fd_by_prog_id()
90 if (prog_fd < 0) { in get_map_fd_by_prog_id()
98 if (bpf_obj_get_info_by_fd(prog_fd, &info, &info_len)) { in get_map_fd_by_prog_id()
99 log_err("Failed to get info by prog fd %d", prog_fd); in get_map_fd_by_prog_id()
104 log_err("No maps found for prog fd %d", prog_fd); in get_map_fd_by_prog_id()
114 if (prog_fd >= 0) in get_map_fd_by_prog_id()
115 close(prog_fd); in get_map_fd_by_prog_id()
/tools/bpf/bpftool/
Dcgroup.c55 int prog_fd; in show_bpf_prog() local
57 prog_fd = bpf_prog_get_fd_by_id(id); in show_bpf_prog()
58 if (prog_fd < 0) in show_bpf_prog()
61 if (bpf_obj_get_info_by_fd(prog_fd, &info, &info_len)) { in show_bpf_prog()
62 close(prog_fd); in show_bpf_prog()
87 close(prog_fd); in show_bpf_prog()
383 int cgroup_fd, prog_fd; in do_attach() local
407 prog_fd = prog_parse_fd(&argc, &argv); in do_attach()
408 if (prog_fd < 0) in do_attach()
422 if (bpf_prog_attach(prog_fd, cgroup_fd, attach_type, attach_flags)) { in do_attach()
[all …]

1234