Home
last modified time | relevance | path

Searched refs:map_fd (Results 1 – 25 of 113) sorted by relevance

12345

/openbmc/linux/samples/bpf/
H A Dtest_map_in_map_user.c17 static int map_fd[7]; variable
19 #define PORT_A (map_fd[0])
20 #define PORT_H (map_fd[1])
21 #define REG_RESULT_H (map_fd[2])
22 #define INLINE_RESULT_H (map_fd[3])
23 #define A_OF_PORT_A (map_fd[4]) /* Test case #0 */
24 #define H_OF_PORT_A (map_fd[5]) /* Test case #1 */
25 #define H_OF_PORT_H (map_fd[6]) /* Test case #2 */
142 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "port_a"); in main()
149 if (map_fd[0] < 0 || map_fd[1] < 0 || map_fd[2] < 0 || in main()
[all …]
H A Dtest_lru_dist.c96 int map_fd; member
119 close(lru->map_fd); in pfect_lru_destroy()
207 int map_fd; in create_map() local
212 if (map_fd == -1) in create_map()
215 return map_fd; in create_map()
338 int map_fd; in test_lru_loss0() local
379 close(map_fd); in test_lru_loss0()
389 int map_fd; in test_lru_loss1() local
414 close(map_fd); in test_lru_loss1()
467 int map_fd; in test_parallel_lru_loss() local
[all …]
H A Dtest_current_task_under_cgroup_user.c22 int map_fd[2]; in main() local
43 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "cgroup_map"); in main()
44 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "perf_map"); in main()
45 if (map_fd[0] < 0 || map_fd[1] < 0) { in main()
65 if (bpf_map_update_elem(map_fd[0], &idx, &cg2, BPF_ANY)) { in main()
79 bpf_map_lookup_elem(map_fd[1], &idx, &remote_pid); in main()
93 bpf_map_update_elem(map_fd[1], &idx, &remote_pid, BPF_ANY); in main()
96 bpf_map_lookup_elem(map_fd[1], &idx, &remote_pid); in main()
H A Dtracex6_user.c23 static int map_fd[3]; variable
43 assert(bpf_map_update_elem(map_fd[0], &cpu, &pmu_fd, BPF_ANY) == 0); in check_on_cpu()
46 bpf_map_get_next_key(map_fd[1], &cpu, NULL); in check_on_cpu()
48 if (bpf_map_lookup_elem(map_fd[1], &cpu, &value)) { in check_on_cpu()
56 if (bpf_map_lookup_elem(map_fd[2], &cpu, &value2)) { in check_on_cpu()
66 assert(bpf_map_delete_elem(map_fd[0], &cpu) == 0 || error); in check_on_cpu()
69 assert(bpf_map_delete_elem(map_fd[1], &cpu) == 0 || error); in check_on_cpu()
196 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "counters"); in main()
197 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "values"); in main()
198 map_fd[2] = bpf_object__find_map_fd_by_name(obj, "values2"); in main()
[all …]
H A Dspintest_user.c16 int map_fd, i, j = 0; in main() local
39 map_fd = bpf_object__find_map_fd_by_name(obj, "my_map"); in main()
40 if (map_fd < 0) { in main()
58 while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) { in main()
59 bpf_map_lookup_elem(map_fd, &next_key, &value); in main()
73 while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) in main()
74 bpf_map_delete_elem(map_fd, &next_key); in main()
H A Doffwaketime_user.c18 static int map_fd[2]; variable
54 if (bpf_map_lookup_elem(map_fd[1], &key->tret, ip) != 0) { in print_stack()
61 if (bpf_map_lookup_elem(map_fd[1], &key->wret, ip) != 0) { in print_stack()
91 print_stacks(map_fd[0]); in int_exit()
122 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "counts"); in main()
123 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "stackmap"); in main()
124 if (map_fd[0] < 0 || map_fd[1] < 0) { in main()
145 print_stacks(map_fd[0]); in main()
H A Dtest_cgrp2_attach.c43 static int prog_load(int map_fd, int verdict) in prog_load() argument
53 BPF_LD_MAP_FD(BPF_REG_1, map_fd), /* load map fd to r1 */ in prog_load()
64 BPF_LD_MAP_FD(BPF_REG_1, map_fd), in prog_load()
94 int prog_fd, map_fd, ret, key; in attach_filter() local
97 map_fd = bpf_map_create(BPF_MAP_TYPE_ARRAY, NULL, in attach_filter()
100 if (map_fd < 0) { in attach_filter()
105 prog_fd = prog_load(map_fd, verdict); in attach_filter()
121 assert(bpf_map_lookup_elem(map_fd, &key, &pkt_cnt) == 0); in attach_filter()
124 assert(bpf_map_lookup_elem(map_fd, &key, &byte_cnt) == 0); in attach_filter()
H A Dxdp_adjust_tail_user.c52 static void poll_stats(unsigned int map_fd, unsigned int kill_after_s) in poll_stats() argument
62 assert(bpf_map_lookup_elem(map_fd, &key, &value) == 0); in poll_stats()
89 int i, prog_fd, map_fd, opt; in main() local
164 map_fd = bpf_object__find_map_fd_by_name(obj, "xdp_adju.data"); in main()
165 if (map_fd < 0) { in main()
169 bpf_map_update_elem(map_fd, &key, &max_pckt_size, BPF_ANY); in main()
173 map_fd = bpf_object__find_map_fd_by_name(obj, "icmpcnt"); in main()
174 if (map_fd < 0) { in main()
194 poll_stats(map_fd, kill_after_s); in main()
/openbmc/linux/tools/testing/selftests/bpf/prog_tests/
H A Dlookup_and_delete.c13 static int fill_values(int map_fd) in fill_values() argument
27 static int fill_values_percpu(int map_fd) in fill_values_percpu() argument
45 int *map_fd) in setup_prog() argument
102 int map_fd, err; in test_lookup_and_delete_hash() local
109 err = fill_values(map_fd); in test_lookup_and_delete_hash()
138 int map_fd, err, i; in test_lookup_and_delete_percpu_hash() local
145 err = fill_values_percpu(map_fd); in test_lookup_and_delete_percpu_hash()
178 int map_fd, err; in test_lookup_and_delete_lru_hash() local
185 err = fill_values(map_fd); in test_lookup_and_delete_lru_hash()
224 int map_fd, err, i, cpucnt = 0; in test_lookup_and_delete_lru_percpu_hash() local
[all …]
H A Dglobal_data.c7 int i, err, map_fd; in test_global_data_number() local
10 map_fd = bpf_find_map(__func__, obj, "result_number"); in test_global_data_number()
11 if (CHECK_FAIL(map_fd < 0)) in test_global_data_number()
42 int i, err, map_fd; in test_global_data_string() local
46 if (CHECK_FAIL(map_fd < 0)) in test_global_data_string()
77 int i, err, map_fd; in test_global_data_struct() local
81 if (CHECK_FAIL(map_fd < 0)) in test_global_data_struct()
105 int err = -ENOMEM, map_fd, zero = 0; in test_global_data_rdonly() local
120 map_fd = bpf_map__fd(map); in test_global_data_rdonly()
121 if (CHECK_FAIL(map_fd < 0)) in test_global_data_rdonly()
[all …]
H A Dl4lb_all.c26 int err, i, prog_fd, map_fd; in test_l4lb() local
41 map_fd = bpf_find_map(__func__, obj, "vip_map"); in test_l4lb()
42 if (map_fd < 0) in test_l4lb()
44 bpf_map_update_elem(map_fd, &key, &value, 0); in test_l4lb()
46 map_fd = bpf_find_map(__func__, obj, "ch_rings"); in test_l4lb()
47 if (map_fd < 0) in test_l4lb()
51 map_fd = bpf_find_map(__func__, obj, "reals"); in test_l4lb()
52 if (map_fd < 0) in test_l4lb()
75 map_fd = bpf_find_map(__func__, obj, "stats"); in test_l4lb()
76 if (map_fd < 0) in test_l4lb()
[all …]
H A Dtailcalls.c40 map_fd = bpf_map__fd(prog_array); in test_tailcall_1()
41 if (CHECK_FAIL(map_fd < 0)) in test_tailcall_1()
176 map_fd = bpf_map__fd(prog_array); in test_tailcall_2()
177 if (CHECK_FAIL(map_fd < 0)) in test_tailcall_2()
252 if (CHECK_FAIL(map_fd < 0)) in test_tailcall_count()
350 if (CHECK_FAIL(map_fd < 0)) in test_tailcall_4()
440 if (CHECK_FAIL(map_fd < 0)) in test_tailcall_5()
528 if (CHECK_FAIL(map_fd < 0)) in test_tailcall_bpf2bpf_1()
612 if (CHECK_FAIL(map_fd < 0)) in test_tailcall_bpf2bpf_2()
692 if (CHECK_FAIL(map_fd < 0)) in test_tailcall_bpf2bpf_3()
[all …]
H A Dbpf_obj_pinning.c41 int map_fd = -1, map_fd2 = -1; in bpf_obj_pinning_detached() local
76 if (!ASSERT_GE(map_fd, 0, "map_fd")) in bpf_obj_pinning_detached()
82 err = bpf_obj_pin_opts(map_fd, map_name, &pin_opts); in bpf_obj_pinning_detached()
95 err = bpf_map_update_elem(map_fd, &zero, &src_value, 0); in bpf_obj_pinning_detached()
106 if (map_fd >= 0) in bpf_obj_pinning_detached()
107 ASSERT_OK(close(map_fd), "close_map_fd"); in bpf_obj_pinning_detached()
155 err = bpf_obj_pin_opts(map_fd, pin_path, &pin_opts); in validate_pin()
193 err = bpf_obj_pin(map_fd, abs_path); in validate_get()
247 int map_fd; in bpf_obj_pinning_mounted() local
251 if (!ASSERT_GE(map_fd, 0, "map_fd")) in bpf_obj_pinning_mounted()
[all …]
H A Dmap_init.c20 static int map_populate(int map_fd, int num) in map_populate() argument
39 int *map_fd, int populate) in setup() argument
60 *map_fd = bpf_map__fd(skel->maps.hashmap1); in setup()
61 if (CHECK(*map_fd < 0, "bpf_map__fd", "failed\n")) in setup()
64 err = map_populate(*map_fd, populate); in setup()
71 close(*map_fd); in setup()
133 int map_fd, err; in test_pcpu_map_init() local
143 err = bpf_map_delete_elem(map_fd, &key); in test_pcpu_map_init()
153 err = bpf_map_lookup_elem(map_fd, &key, value); in test_pcpu_map_init()
173 int map_fd, err; in test_pcpu_lru_map_init() local
[all …]
H A Dmap_lock.c23 int err, map_fd = *(u32 *) arg; in parallel_map_access() local
27 err = bpf_map_lookup_elem_flags(map_fd, &key, vars, BPF_F_LOCK); in parallel_map_access()
53 int prog_fd, map_fd[2], vars[17] = {}; in test_map_lock() local
64 map_fd[0] = bpf_find_map(__func__, obj, "hash_map"); in test_map_lock()
65 if (CHECK_FAIL(map_fd[0] < 0)) in test_map_lock()
67 map_fd[1] = bpf_find_map(__func__, obj, "array_map"); in test_map_lock()
68 if (CHECK_FAIL(map_fd[1] < 0)) in test_map_lock()
71 bpf_map_update_elem(map_fd[0], &key, vars, BPF_F_LOCK); in test_map_lock()
80 &map_fd[i - 4]))) in test_map_lock()
88 ret != (void *)&map_fd[i - 4])) in test_map_lock()
H A Dxdp_cpumap_attach.c19 int err, prog_fd, map_fd; in test_xdp_with_cpumap_helpers() local
35 map_fd = bpf_map__fd(skel->maps.cpu_map); in test_xdp_with_cpumap_helpers()
41 err = bpf_map_update_elem(map_fd, &idx, &val, 0); in test_xdp_with_cpumap_helpers()
44 err = bpf_map_lookup_elem(map_fd, &idx, &val); in test_xdp_with_cpumap_helpers()
55 err = bpf_map_update_elem(map_fd, &idx, &val, 0); in test_xdp_with_cpumap_helpers()
64 err = bpf_map_update_elem(map_fd, &idx, &val, 0); in test_xdp_with_cpumap_helpers()
79 int err, frags_prog_fd, map_fd; in test_xdp_with_cpumap_frags_helpers() local
87 map_fd = bpf_map__fd(skel->maps.cpu_map); in test_xdp_with_cpumap_frags_helpers()
93 err = bpf_map_update_elem(map_fd, &idx, &val, 0); in test_xdp_with_cpumap_frags_helpers()
96 err = bpf_map_lookup_elem(map_fd, &idx, &val); in test_xdp_with_cpumap_frags_helpers()
[all …]
H A Dxdp_devmap_attach.c20 int err, dm_fd, map_fd; in test_xdp_with_devmap_helpers() local
37 map_fd = bpf_map__fd(skel->maps.dm_ports); in test_xdp_with_devmap_helpers()
43 err = bpf_map_update_elem(map_fd, &idx, &val, 0); in test_xdp_with_devmap_helpers()
46 err = bpf_map_lookup_elem(map_fd, &idx, &val); in test_xdp_with_devmap_helpers()
57 err = bpf_map_update_elem(map_fd, &idx, &val, 0); in test_xdp_with_devmap_helpers()
66 err = bpf_map_update_elem(map_fd, &idx, &val, 0); in test_xdp_with_devmap_helpers()
92 int err, dm_fd_frags, map_fd; in test_xdp_with_devmap_frags_helpers() local
100 map_fd = bpf_map__fd(skel->maps.dm_ports); in test_xdp_with_devmap_frags_helpers()
106 err = bpf_map_update_elem(map_fd, &idx, &val, 0); in test_xdp_with_devmap_frags_helpers()
109 err = bpf_map_lookup_elem(map_fd, &idx, &val); in test_xdp_with_devmap_frags_helpers()
[all …]
/openbmc/linux/tools/testing/selftests/bpf/map_tests/
H A Dmap_percpu_stats.c107 delete_and_lookup_batch(map_fd, keys, n); in delete_all_elements()
114 ret = bpf_map_delete_elem(map_fd, keyp); in delete_all_elements()
136 int map_fd; member
142 int map_fd; in create_small_hash() local
148 return map_fd; in create_small_hash()
265 static void __test(int map_fd) in __test() argument
268 .map_fd = map_fd, in __test()
272 map_info(map_fd, &info); in __test()
300 close(map_fd); in __test()
308 int map_fd; in map_create_opts() local
[all …]
H A Dsk_storage_map.c144 int btf_fd, map_fd; in create_sk_storage_map() local
154 CHECK(map_fd == -1, in create_sk_storage_map()
157 return map_fd; in create_sk_storage_map()
166 int i, map_fd, err, *sk_fds; in insert_close_thread() local
253 close(map_fd); in do_sk_storage_map_stress_free()
254 map_fd = -1; in do_sk_storage_map_stress_free()
271 if (map_fd != -1) in do_sk_storage_map_stress_free()
272 close(map_fd); in do_sk_storage_map_stress_free()
379 close(map_fd); in do_sk_storage_map_stress_change()
463 int btf_fd, map_fd, sk_fd, err; in test_sk_storage_map_basic() local
[all …]
H A Dhtab_map_batch_ops.c14 static void map_batch_update(int map_fd, __u32 max_entries, int *keys, in map_batch_update() argument
81 int map_fd, *keys, *visited, key; in __test_map_lookup_and_delete_batch() local
94 CHECK(map_fd == -1, in __test_map_lookup_and_delete_batch()
115 map_batch_update(map_fd, max_entries, keys, values, is_pcpu); in __test_map_lookup_and_delete_batch()
136 err = bpf_map_get_next_key(map_fd, NULL, &key); in __test_map_lookup_and_delete_batch()
152 err = bpf_map_lookup_batch(map_fd, in __test_map_lookup_and_delete_batch()
188 err = bpf_map_delete_batch(map_fd, in __test_map_lookup_and_delete_batch()
201 err = bpf_map_get_next_key(map_fd, NULL, &key); in __test_map_lookup_and_delete_batch()
215 err = bpf_map_lookup_and_delete_batch(map_fd, in __test_map_lookup_and_delete_batch()
246 err = bpf_map_get_next_key(map_fd, NULL, &key); in __test_map_lookup_and_delete_batch()
[all …]
H A Dlpm_trie_map_batch_ops.c22 static void map_batch_update(int map_fd, __u32 max_entries, in map_batch_update() argument
40 err = bpf_map_update_batch(map_fd, keys, values, &max_entries, &opts); in map_batch_update()
70 int map_fd, *values, *visited; in test_lpm_trie_map_batch_ops() local
80 map_fd = bpf_map_create(BPF_MAP_TYPE_LPM_TRIE, "lpm_trie_map", in test_lpm_trie_map_batch_ops()
83 CHECK(map_fd == -1, "bpf_map_create()", "error:%s\n", in test_lpm_trie_map_batch_ops()
94 map_batch_update(map_fd, max_entries, keys, values); in test_lpm_trie_map_batch_ops()
105 err = bpf_map_lookup_batch(map_fd, in test_lpm_trie_map_batch_ops()
127 err = bpf_map_delete_batch(map_fd, keys + total, &count, in test_lpm_trie_map_batch_ops()
139 err = bpf_map_get_next_key(map_fd, NULL, &key); in test_lpm_trie_map_batch_ops()
154 close(map_fd); in test_lpm_trie_map_batch_ops()
/openbmc/linux/tools/testing/selftests/bpf/
H A Dtest_lpm_map.c428 int map_fd; in test_lpm_delete() local
437 assert(map_fd >= 0); in test_lpm_delete()
529 close(map_fd); in test_lpm_delete()
538 int map_fd; in test_lpm_get_next_key() local
545 assert(map_fd >= 0); in test_lpm_get_next_key()
678 close(map_fd); in test_lpm_get_next_key()
685 int map_fd; member
733 info->map_fd = map_fd; in setup_lpm_mt_test_info()
750 int i, map_fd; in test_lpm_multi_thread() local
759 setup_lpm_mt_test_info(&info[0], map_fd); in test_lpm_multi_thread()
[all …]
H A Dtest_skb_cgroup_id_user.c85 int map_fd = -1; in get_map_fd_by_prog_id() local
106 map_fd = bpf_map_get_fd_by_id(map_ids[0]); in get_map_fd_by_prog_id()
107 if (map_fd < 0) in get_map_fd_by_prog_id()
112 return map_fd; in get_map_fd_by_prog_id()
120 int map_fd; in check_ancestor_cgroup_ids() local
127 map_fd = get_map_fd_by_prog_id(prog_id); in check_ancestor_cgroup_ids()
128 if (map_fd < 0) in check_ancestor_cgroup_ids()
132 if (bpf_map_lookup_elem(map_fd, &level, &actual_ids[level])) { in check_ancestor_cgroup_ids()
147 if (map_fd >= 0) in check_ancestor_cgroup_ids()
148 close(map_fd); in check_ancestor_cgroup_ids()
H A Dtest_cgroup_storage.c41 int map_fd, percpu_map_fd, prog_fd, cgroup_fd; in main() local
57 map_fd = bpf_map_create(BPF_MAP_TYPE_CGROUP_STORAGE, NULL, sizeof(key), in main()
59 if (map_fd < 0) { in main()
72 prog[7].imm = map_fd; in main()
89 if (bpf_map_get_next_key(map_fd, NULL, &key)) { in main()
94 if (bpf_map_lookup_elem(map_fd, &key, &value)) { in main()
113 if (bpf_map_lookup_elem(map_fd, &key, &value)) { in main()
125 if (bpf_map_update_elem(map_fd, &key, &value, 0)) { in main()
136 if (bpf_map_lookup_elem(map_fd, &key, &value)) { in main()
/openbmc/linux/tools/lib/bpf/
H A Dringbuf.c32 int map_fd; member
50 int map_fd; member
90 map_fd, err); in ring_buffer__add()
96 map_fd); in ring_buffer__add()
113 r->map_fd = map_fd; in ring_buffer__add()
123 map_fd, err); in ring_buffer__add()
142 map_fd, err); in ring_buffer__add()
157 map_fd, err); in ring_buffer__add()
374 rb->map_fd = map_fd; in user_ringbuf_map()
382 map_fd, err); in user_ringbuf_map()
[all …]

12345