/kernel/linux/linux-5.10/tools/testing/selftests/bpf/prog_tests/ |
D | tailcalls.c | 11 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 …]
|
D | xdp_cpumap_attach.c | 19 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()
|
D | spinlock.c | 8 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()
|
D | xdp_adjust_tail.c | 10 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()
|
D | raw_tp_test_run.c | 13 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()
|
D | map_lock.c | 8 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()
|
D | pkt_access.c | 10 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()
|
D | enable_stats.c | 8 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()
|
D | signal_pending.c | 17 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()
|
D | cgroup_link.c | 43 int i = 0, err, prog_fd; in test_cgroup_link() local 49 prog_fd = bpf_program__fd(skel->progs.egress); in test_cgroup_link() 116 err = bpf_prog_attach(prog_fd, cgs[last_cg].fd, in test_cgroup_link() 135 err = bpf_prog_detach2(prog_fd, cgs[last_cg].fd, BPF_CGROUP_INET_EGRESS); in test_cgroup_link() 141 err = bpf_prog_attach(prog_fd, cgs[last_cg].fd, in test_cgroup_link() 158 err = bpf_prog_detach2(prog_fd, cgs[last_cg].fd, BPF_CGROUP_INET_EGRESS); in test_cgroup_link() 175 err = bpf_prog_attach(prog_fd, cgs[last_cg].fd, in test_cgroup_link() 178 bpf_prog_detach2(prog_fd, cgs[last_cg].fd, BPF_CGROUP_INET_EGRESS); in test_cgroup_link() 248 bpf_prog_detach2(prog_fd, cgs[last_cg].fd, in test_cgroup_link()
|
D | flow_dissector.c | 452 int i, err, map_fd, prog_fd; in init_prog_array() local 467 prog_fd = bpf_program__fd(prog); in init_prog_array() 468 if (prog_fd < 0) in init_prog_array() 471 err = bpf_map_update_elem(map_fd, &i, &prog_fd, BPF_ANY); in init_prog_array() 518 int err, prog_fd; in test_skb_less_prog_attach() local 520 prog_fd = bpf_program__fd(skel->progs._dissect); in test_skb_less_prog_attach() 521 if (CHECK(prog_fd < 0, "bpf_program__fd", "err %d\n", prog_fd)) in test_skb_less_prog_attach() 524 err = bpf_prog_attach(prog_fd, 0, BPF_FLOW_DISSECTOR, 0); in test_skb_less_prog_attach() 530 err = bpf_prog_detach2(prog_fd, 0, BPF_FLOW_DISSECTOR); in test_skb_less_prog_attach() 557 int i, err, prog_fd, keys_fd = -1, tap_fd; in test_flow_dissector() local [all …]
|
D | xdp.c | 17 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()
|
D | xdp_info.c | 13 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()
|
D | test_profiler.c | 14 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()
|
/kernel/linux/linux-5.10/tools/bpf/bpftool/ |
D | cgroup.c | 55 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 …]
|
/kernel/linux/linux-5.10/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_set_link_xdp_fd(idx, prog_fd, xdp_flags); in do_attach() 81 int prog_fd, map_fd = -1; in main() local 126 err = bpf_prog_load_xattr(&prog_load_attr, &obj, &prog_fd); in main() 136 prog_fd = bpf_program__fd(prog); in main() 137 if (prog_fd < 0) { in main() 138 printf("program not found: %s\n", strerror(prog_fd)); in main() 163 err = do_attach(idx, prog_fd, map_fd, argv[i]); in main()
|
D | sock_example.c | 37 int sock = -1, map_fd, prog_fd, i, key; in test_sock() local 63 prog_fd = bpf_load_program(BPF_PROG_TYPE_SOCKET_FILTER, prog, insns_cnt, in test_sock() 65 if (prog_fd < 0) { in test_sock() 72 if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd, in test_sock() 73 sizeof(prog_fd)) < 0) { in test_sock()
|
D | sockex1_user.c | 14 int map_fd, prog_fd; in main() local 22 &obj, &prog_fd)) in main() 29 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd, in main() 30 sizeof(prog_fd)) == 0); in main()
|
D | sockex2_user.c | 21 int map_fd, prog_fd; in main() local 30 &obj, &prog_fd)) in main() 37 assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd, in main() 38 sizeof(prog_fd)) == 0); in main()
|
D | xdp1_user.c | 89 int prog_fd, map_fd, opt; in main() local 134 if (bpf_prog_load_xattr(&prog_load_attr, &obj, &prog_fd)) in main() 144 if (!prog_fd) { in main() 152 if (bpf_set_link_xdp_fd(ifindex, prog_fd, xdp_flags) < 0) { in main() 157 err = bpf_obj_get_info_by_fd(prog_fd, &info, &info_len); in main()
|
/kernel/linux/linux-5.10/tools/testing/selftests/bpf/ |
D | test_skb_cgroup_id_user.c | 85 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()
|
D | flow_dissector_load.h | 13 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()
|
D | test_tcp_check_syncookie_user.c | 86 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()
|
D | xdping.c | 96 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()
|
/kernel/linux/linux-5.10/tools/lib/bpf/ |
D | bpf.h | 162 LIBBPF_API int bpf_prog_attach(int prog_fd, int attachable_fd, 164 LIBBPF_API int bpf_prog_attach_xattr(int prog_fd, int attachable_fd, 168 LIBBPF_API int bpf_prog_detach2(int prog_fd, int attachable_fd, 181 LIBBPF_API int bpf_link_create(int prog_fd, int target_fd, 200 int prog_fd; member 222 LIBBPF_API int bpf_prog_test_run(int prog_fd, int repeat, void *data, 237 LIBBPF_API int bpf_raw_tracepoint_open(const char *name, int prog_fd); 260 LIBBPF_API int bpf_prog_bind_map(int prog_fd, int map_fd, 285 LIBBPF_API int bpf_prog_test_run_opts(int prog_fd,
|