Home
last modified time | relevance | path

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

123

/tools/testing/selftests/bpf/prog_tests/
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()
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 …]
Dxdp_cpumap_attach.c19 int err, prog_fd, map_fd; in test_xdp_with_cpumap_helpers() local
30 prog_fd = bpf_program__fd(skel->progs.xdp_redir_prog); in test_xdp_with_cpumap_helpers()
31 err = bpf_set_link_xdp_fd(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE); in test_xdp_with_cpumap_helpers()
35 prog_fd = bpf_program__fd(skel->progs.xdp_dummy_cm); in test_xdp_with_cpumap_helpers()
37 err = bpf_obj_get_info_by_fd(prog_fd, &info, &len); in test_xdp_with_cpumap_helpers()
41 val.bpf_prog.fd = prog_fd; in test_xdp_with_cpumap_helpers()
52 err = bpf_set_link_xdp_fd(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE); in test_xdp_with_cpumap_helpers()
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()
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()
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()
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()
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()
Dtest_profiler.c14 int err, prog_fd; in sanity_run() local
16 prog_fd = bpf_program__fd(prog); in sanity_run()
17 test_attr.prog_fd = prog_fd; in sanity_run()
Dxdp.c17 int err, prog_fd, map_fd; in test_xdp() local
19 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp()
29 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4), in test_xdp()
37 err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6), in test_xdp()
Dxdp_info.c13 int err, prog_fd; in test_xdp_info() local
32 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd); in test_xdp_info()
36 err = bpf_obj_get_info_by_fd(prog_fd, &info, &len); in test_xdp_info()
40 err = bpf_set_link_xdp_fd(IFINDEX_LO, prog_fd, XDP_FLAGS_SKB_MODE); in test_xdp_info()
Dfentry_test.c9 int err, prog_fd, i; in test_fentry_test() local
21 prog_fd = bpf_program__fd(fentry_skel->progs.test1); in test_fentry_test()
22 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in test_fentry_test()
Dfexit_test.c9 int err, prog_fd, i; in test_fexit_test() local
21 prog_fd = bpf_program__fd(fexit_skel->progs.test1); in test_fexit_test()
22 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, in test_fexit_test()
Dtcp_estats.c7 int err, prog_fd; in test_tcp_estats() local
11 err = bpf_prog_load(file, BPF_PROG_TYPE_TRACEPOINT, &obj, &prog_fd); in test_tcp_estats()
Dload_bytes_relative.c12 int server_fd, cgroup_fd, prog_fd, map_fd, client_fd; in test_load_bytes_relative() local
31 &obj, &prog_fd); in test_load_bytes_relative()
47 err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_INET_EGRESS, in test_load_bytes_relative()
Dmodify_return.c17 int err, prog_fd; in run_test() local
31 prog_fd = bpf_program__fd(skel->progs.fmod_ret_test); in run_test()
32 err = bpf_prog_test_run(prog_fd, 1, NULL, 0, NULL, 0, in run_test()
/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()
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()
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()
185 prog_fd = bpf_program__fd(main_prog); in main()
186 if (!main_prog || prog_fd < 0) { in main()
206 if (bpf_set_link_xdp_fd(ifindex, prog_fd, xdp_flags) < 0) { in main()
212 close(prog_fd); in main()
252 if (prog_fd > 0) in main()
253 close(prog_fd); in main()
Dtest_dev_cgroup.c27 int prog_fd, cgroup_fd; in main() local
31 &obj, &prog_fd)) { in main()
43 if (bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_DEVICE, 0)) { in main()
/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 …]

123