Home
last modified time | relevance | path

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

12

/external/linux-kselftest/tools/testing/selftests/bpf/
Dtest_lpm_map.c428 int map_fd; in test_lpm_delete() local
434 map_fd = bpf_create_map(BPF_MAP_TYPE_LPM_TRIE, in test_lpm_delete()
437 assert(map_fd >= 0); in test_lpm_delete()
454 assert(bpf_map_update_elem(map_fd, key, &value, 0) == 0); in test_lpm_delete()
459 assert(bpf_map_update_elem(map_fd, key, &value, 0) == 0); in test_lpm_delete()
464 assert(bpf_map_update_elem(map_fd, key, &value, 0) == 0); in test_lpm_delete()
469 assert(bpf_map_update_elem(map_fd, key, &value, 0) == 0); in test_lpm_delete()
474 assert(bpf_map_lookup_elem(map_fd, key, &value) == -1 && in test_lpm_delete()
480 assert(bpf_map_lookup_elem(map_fd, key, &value) == 0); in test_lpm_delete()
486 assert(bpf_map_delete_elem(map_fd, key) == 0); in test_lpm_delete()
[all …]
Dtest_skb_cgroup_id_user.c86 int map_fd = -1; in get_map_fd_by_prog_id() local
107 map_fd = bpf_map_get_fd_by_id(map_ids[0]); in get_map_fd_by_prog_id()
108 if (map_fd < 0) in get_map_fd_by_prog_id()
113 return map_fd; in get_map_fd_by_prog_id()
121 int map_fd; in check_ancestor_cgroup_ids() local
128 map_fd = get_map_fd_by_prog_id(prog_id); in check_ancestor_cgroup_ids()
129 if (map_fd < 0) in check_ancestor_cgroup_ids()
133 if (bpf_map_lookup_elem(map_fd, &level, &actual_ids[level])) { in check_ancestor_cgroup_ids()
148 if (map_fd >= 0) in check_ancestor_cgroup_ids()
149 close(map_fd); in check_ancestor_cgroup_ids()
Dtest_cgroup_storage.c40 int map_fd, percpu_map_fd, prog_fd, cgroup_fd; in main() local
53 map_fd = bpf_create_map(BPF_MAP_TYPE_CGROUP_STORAGE, sizeof(key), in main()
55 if (map_fd < 0) { in main()
68 prog[7].imm = map_fd; in main()
100 if (bpf_map_get_next_key(map_fd, NULL, &key)) { in main()
105 if (bpf_map_lookup_elem(map_fd, &key, &value)) { in main()
124 if (bpf_map_lookup_elem(map_fd, &key, &value)) { in main()
136 if (bpf_map_update_elem(map_fd, &key, &value, 0)) { in main()
147 if (bpf_map_lookup_elem(map_fd, &key, &value)) { in main()
Dtest_lru_map.c32 int map_fd; in create_map() local
34 map_fd = bpf_create_map(map_type, sizeof(unsigned long long), in create_map()
37 if (map_fd == -1) in create_map()
40 return map_fd; in create_map()
492 static void do_test_lru_sanity5(unsigned long long last_key, int map_fd) in do_test_lru_sanity5() argument
497 assert(!bpf_map_lookup_elem(map_fd, &last_key, value)); in do_test_lru_sanity5()
502 assert(!bpf_map_update_elem(map_fd, &key, value, BPF_NOEXIST)); in do_test_lru_sanity5()
503 assert(!bpf_map_lookup_elem(map_fd, &key, value)); in do_test_lru_sanity5()
506 assert(bpf_map_lookup_elem(map_fd, &last_key, value)); in do_test_lru_sanity5()
514 int map_fd; in test_lru_sanity5() local
[all …]
Dtest_progs.c139 int err, prog_fd, map_fd; in test_xdp() local
147 map_fd = bpf_find_map(__func__, obj, "vip2tnl"); in test_xdp()
148 if (map_fd < 0) in test_xdp()
150 bpf_map_update_elem(map_fd, &key4, &value4, 0); in test_xdp()
151 bpf_map_update_elem(map_fd, &key6, &value6, 0); in test_xdp()
228 int err, i, prog_fd, map_fd; in test_l4lb() local
240 map_fd = bpf_find_map(__func__, obj, "vip_map"); in test_l4lb()
241 if (map_fd < 0) in test_l4lb()
243 bpf_map_update_elem(map_fd, &key, &value, 0); in test_l4lb()
245 map_fd = bpf_find_map(__func__, obj, "ch_rings"); in test_l4lb()
[all …]
Dtest_maps.c1288 static void prepare_reuseport_grp(int type, int map_fd, in prepare_reuseport_grp() argument
1319 err = bpf_map_update_elem(map_fd, &index0, &fd64, in prepare_reuseport_grp()
1348 err = bpf_map_update_elem(map_fd, &index0, &fd64, in prepare_reuseport_grp()
1374 int map_fd, err, t, f; in test_reuseport_array() local
1378 map_fd = bpf_create_map(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY, in test_reuseport_array()
1380 CHECK(map_fd == -1, "reuseport array create", in test_reuseport_array()
1381 "map_fd:%d, errno:%d\n", map_fd, errno); in test_reuseport_array()
1384 err = bpf_map_delete_elem(map_fd, &bad_index); in test_reuseport_array()
1388 err = bpf_map_update_elem(map_fd, &bad_index, &fd64, BPF_ANY); in test_reuseport_array()
1393 err = bpf_map_lookup_elem(map_fd, &bad_index, &map_cookie); in test_reuseport_array()
[all …]
Dtest_netcnt.c38 int map_fd, percpu_map_fd; in main() local
95 map_fd = bpf_find_map(__func__, obj, "netcnt"); in main()
96 if (map_fd < 0) { in main()
107 if (bpf_map_get_next_key(map_fd, NULL, &key)) { in main()
112 if (bpf_map_lookup_elem(map_fd, &key, &netcnt)) { in main()
Dtest_sockmap.c67 int map_fd[8]; variable
781 err = bpf_prog_attach(prog_fd[0], map_fd[0], in run_options()
786 prog_fd[0], map_fd[0], err, strerror(errno)); in run_options()
790 err = bpf_prog_attach(prog_fd[1], map_fd[0], in run_options()
836 map_fd[1], BPF_SK_MSG_VERDICT, 0); in run_options()
844 err = bpf_map_update_elem(map_fd[1], &i, &c1, BPF_ANY); in run_options()
857 err = bpf_map_update_elem(map_fd[2], &i, &redir_fd, BPF_ANY); in run_options()
866 err = bpf_map_update_elem(map_fd[3], in run_options()
877 err = bpf_map_update_elem(map_fd[4], in run_options()
888 err = bpf_map_update_elem(map_fd[5], in run_options()
[all …]
Dtest_tcpbpf_user.c93 int prog_fd, map_fd, sock_map_fd; in main() local
129 map_fd = bpf_find_map(__func__, obj, "global_map"); in main()
130 if (map_fd < 0) in main()
137 rv = bpf_map_lookup_elem(map_fd, &key, &g); in main()
Dtest_socket_cookie.c95 int map_fd; in validate_map() local
102 map_fd = bpf_map__fd(map); in validate_map()
104 err = bpf_map_get_next_key(map_fd, NULL, &cookie_key); in validate_map()
110 err = bpf_map_lookup_elem(map_fd, &cookie_key, &cookie_value); in validate_map()
Dtest_btf.c1817 int map_fd = -1, btf_fd = -1; in do_test_raw() local
1867 map_fd = bpf_create_map_xattr(&create_attr); in do_test_raw()
1869 err = ((map_fd == -1) != test->map_create_err); in do_test_raw()
1871 map_fd, test->map_create_err); in do_test_raw()
1882 if (map_fd != -1) in do_test_raw()
1883 close(map_fd); in do_test_raw()
2058 int btf_fd[2] = {-1, -1}, map_fd = -1; in test_btf_id() local
2130 map_fd = bpf_create_map_xattr(&create_attr); in test_btf_id()
2131 if (CHECK(map_fd == -1, "errno:%d", errno)) { in test_btf_id()
2137 err = bpf_obj_get_info_by_fd(map_fd, &map_info, &info_len); in test_btf_id()
[all …]
/external/bcc/src/lua/bcc/
Dtable.lua34 function BaseTable:initialize(t_type, bpf, map_id, map_fd, key_type, leaf_type)
40 self.map_fd = map_fd
89 if libbcc.bpf_lookup_elem(self.map_fd, pkey, pvalue) < 0 then
99 assert(libbcc.bpf_update_elem(self.map_fd, pkey, pvalue, 0) == 0, "could not update table")
108 if libbcc.bpf_lookup_elem(self.map_fd, pkey, pvalue) < 0 then
122 if libbcc.bpf_get_next_key(self.map_fd, pkey, pkey_next) < 0 then
138 if libbcc.bpf_get_next_key(self.map_fd, pkey, pkey_next) < 0 then
143 assert(libbcc.bpf_lookup_elem(self.map_fd, pkey, pvalue) == 0)
152 function HashTable:initialize(bpf, map_id, map_fd, key_type, leaf_type)
153 BaseTable.initialize(self, BaseTable.BPF_MAP_TYPE_HASH, bpf, map_id, map_fd, key_type, leaf_type)
[all …]
/external/bcc/src/python/bcc/
Dtable.py125 def Table(bpf, map_id, map_fd, keytype, leaftype, **kwargs): argument
133 t = HashTable(bpf, map_id, map_fd, keytype, leaftype)
135 t = Array(bpf, map_id, map_fd, keytype, leaftype)
137 t = ProgArray(bpf, map_id, map_fd, keytype, leaftype)
139 t = PerfEventArray(bpf, map_id, map_fd, keytype, leaftype)
141 t = PerCpuHash(bpf, map_id, map_fd, keytype, leaftype, **kwargs)
143 t = PerCpuArray(bpf, map_id, map_fd, keytype, leaftype, **kwargs)
145 t = LpmTrie(bpf, map_id, map_fd, keytype, leaftype)
147 t = StackTrace(bpf, map_id, map_fd, keytype, leaftype)
149 t = LruHash(bpf, map_id, map_fd, keytype, leaftype)
[all …]
/external/strace/
Dbpf_attr_check.c77 static_assert(SoM(struct BPF_MAP_LOOKUP_ELEM_struct, map_fd) == SoM(union bpf_attr, map_fd),
79 …tic_assert(offsetof(struct BPF_MAP_LOOKUP_ELEM_struct, map_fd) == offsetof(union bpf_attr, map_fd),
101 static_assert(SoM(struct BPF_MAP_UPDATE_ELEM_struct, map_fd) == SoM(union bpf_attr, map_fd),
103 …tic_assert(offsetof(struct BPF_MAP_UPDATE_ELEM_struct, map_fd) == offsetof(union bpf_attr, map_fd),
132 static_assert(SoM(struct BPF_MAP_DELETE_ELEM_struct, map_fd) == SoM(union bpf_attr, map_fd),
134 …tic_assert(offsetof(struct BPF_MAP_DELETE_ELEM_struct, map_fd) == offsetof(union bpf_attr, map_fd),
149 static_assert(SoM(struct BPF_MAP_GET_NEXT_KEY_struct, map_fd) == SoM(union bpf_attr, map_fd),
151 …ic_assert(offsetof(struct BPF_MAP_GET_NEXT_KEY_struct, map_fd) == offsetof(union bpf_attr, map_fd),
Dbpf_attr.h75 uint32_t map_fd; member
85 uint32_t map_fd; member
96 uint32_t map_fd; member
105 uint32_t map_fd; member
Dbpf.c240 PRINT_FIELD_FD("{", attr, map_fd, tcp); in BEGIN_BPF_CMD_DECODER()
248 PRINT_FIELD_FD("{", attr, map_fd, tcp); in BEGIN_BPF_CMD_DECODER()
258 PRINT_FIELD_FD("{", attr, map_fd, tcp); in BEGIN_BPF_CMD_DECODER()
265 PRINT_FIELD_FD("{", attr, map_fd, tcp); in BEGIN_BPF_CMD_DECODER()
/external/compiler-rt/lib/sanitizer_common/
Dsanitizer_coverage_mapping_libcdep.cc99 fd_t map_fd = OpenFile(tmp_path.data(), WrOnly, &err); in CovUpdateMapping() local
100 if (map_fd == kInvalidFd) { in CovUpdateMapping()
106 if (!WriteToFile(map_fd, text.data(), text.length(), nullptr, &err)) { in CovUpdateMapping()
110 CloseFile(map_fd); in CovUpdateMapping()
/external/bcc/introspection/
Dbps.c242 int map_fd; in print_one_prog() local
244 map_fd = bpf_map_get_fd_by_id(map_ids[i]); in print_one_prog()
245 if (map_fd == -1) { in print_one_prog()
252 ret = map_fd; in print_one_prog()
256 ret = bpf_obj_get_info(map_fd, &map_info, &info_len); in print_one_prog()
257 close(map_fd); in print_one_prog()
/external/strace/tests-mx32/
Dbpf.c427 .data = { .BPF_MAP_LOOKUP_ELEM_data = { .map_fd = -1 } },
428 .size = offsetofend(struct BPF_MAP_LOOKUP_ELEM_struct, map_fd),
433 .map_fd = -1,
444 .data = { .BPF_MAP_UPDATE_ELEM_data = { .map_fd = -1 } },
445 .size = offsetofend(struct BPF_MAP_UPDATE_ELEM_struct, map_fd),
450 .map_fd = -1,
463 .data = { .BPF_MAP_DELETE_ELEM_data = { .map_fd = -1 } },
464 .size = offsetofend(struct BPF_MAP_DELETE_ELEM_struct, map_fd),
469 .map_fd = -1,
479 .data = { .BPF_MAP_GET_NEXT_KEY_data = { .map_fd = -1 } },
[all …]
Dbpf-obj_get_info_by_fd.c276 int map_fd = try_bpf(BPF_MAP_CREATE, print_map_create, in main() local
278 if (map_fd < 0) in main()
282 socket_prog[4].imm = map_fd; in main()
299 .bpf_fd = map_fd, in main()
311 map_fd, MAP_INFO_SZ); in main()
/external/strace/tests-m32/
Dbpf.c427 .data = { .BPF_MAP_LOOKUP_ELEM_data = { .map_fd = -1 } },
428 .size = offsetofend(struct BPF_MAP_LOOKUP_ELEM_struct, map_fd),
433 .map_fd = -1,
444 .data = { .BPF_MAP_UPDATE_ELEM_data = { .map_fd = -1 } },
445 .size = offsetofend(struct BPF_MAP_UPDATE_ELEM_struct, map_fd),
450 .map_fd = -1,
463 .data = { .BPF_MAP_DELETE_ELEM_data = { .map_fd = -1 } },
464 .size = offsetofend(struct BPF_MAP_DELETE_ELEM_struct, map_fd),
469 .map_fd = -1,
479 .data = { .BPF_MAP_GET_NEXT_KEY_data = { .map_fd = -1 } },
[all …]
Dbpf-obj_get_info_by_fd.c276 int map_fd = try_bpf(BPF_MAP_CREATE, print_map_create, in main() local
278 if (map_fd < 0) in main()
282 socket_prog[4].imm = map_fd; in main()
299 .bpf_fd = map_fd, in main()
311 map_fd, MAP_INFO_SZ); in main()
/external/strace/tests/
Dbpf.c427 .data = { .BPF_MAP_LOOKUP_ELEM_data = { .map_fd = -1 } },
428 .size = offsetofend(struct BPF_MAP_LOOKUP_ELEM_struct, map_fd),
433 .map_fd = -1,
444 .data = { .BPF_MAP_UPDATE_ELEM_data = { .map_fd = -1 } },
445 .size = offsetofend(struct BPF_MAP_UPDATE_ELEM_struct, map_fd),
450 .map_fd = -1,
463 .data = { .BPF_MAP_DELETE_ELEM_data = { .map_fd = -1 } },
464 .size = offsetofend(struct BPF_MAP_DELETE_ELEM_struct, map_fd),
469 .map_fd = -1,
479 .data = { .BPF_MAP_GET_NEXT_KEY_data = { .map_fd = -1 } },
[all …]
Dbpf-obj_get_info_by_fd.c276 int map_fd = try_bpf(BPF_MAP_CREATE, print_map_create, in main() local
278 if (map_fd < 0) in main()
282 socket_prog[4].imm = map_fd; in main()
299 .bpf_fd = map_fd, in main()
311 map_fd, MAP_INFO_SZ); in main()
/external/iproute2/lib/
Dbpf.c148 attr.map_fd = fd; in bpf_map_update()
985 int ret, prog_fd, map_fd; in bpf_graft_map() local
1003 map_fd = bpf_obj_get(map_path, type); in bpf_graft_map()
1004 if (map_fd < 0) { in bpf_graft_map()
1007 ret = map_fd; in bpf_graft_map()
1011 ret = bpf_map_selfcheck_pinned(map_fd, &test, &ext, in bpf_graft_map()
1019 ret = bpf_map_update(map_fd, &map_key, &prog_fd, BPF_ANY); in bpf_graft_map()
1023 close(map_fd); in bpf_graft_map()
2135 int map_fd; member
2171 ret = bpf_derive_elf_map_from_fdinfo(aux->map_fd, &tmp, &aux->map); in bpf_tail_call_get_aux()
[all …]

12