/samples/bpf/ |
D | test_map_in_map_user.c | 16 static int map_fd[7]; variable 18 #define PORT_A (map_fd[0]) 19 #define PORT_H (map_fd[1]) 20 #define REG_RESULT_H (map_fd[2]) 21 #define INLINE_RESULT_H (map_fd[3]) 22 #define A_OF_PORT_A (map_fd[4]) /* Test case #0 */ 23 #define H_OF_PORT_A (map_fd[5]) /* Test case #1 */ 24 #define H_OF_PORT_H (map_fd[6]) /* Test case #2 */ 141 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "port_a"); in main() 142 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "port_h"); in main() [all …]
|
D | test_current_task_under_cgroup_user.c | 22 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()
|
D | test_lru_dist.c | 102 int map_fd; member 108 lru->map_fd = bpf_create_map(BPF_MAP_TYPE_HASH, in pfect_lru_init() 112 assert(lru->map_fd != -1); in pfect_lru_init() 125 close(lru->map_fd); in pfect_lru_destroy() 136 if (!bpf_map_lookup_elem(lru->map_fd, &key, &node)) { in pfect_lru_lookup_or_insert() 153 bpf_map_update_elem(lru->map_fd, &node->key, &null_node, BPF_EXIST); in pfect_lru_lookup_or_insert() 161 assert(!bpf_map_update_elem(lru->map_fd, &key, &node, BPF_EXIST)); in pfect_lru_lookup_or_insert() 164 assert(!bpf_map_update_elem(lru->map_fd, &key, &node, BPF_NOEXIST)); in pfect_lru_lookup_or_insert() 210 int map_fd; in create_map() local 212 map_fd = bpf_create_map(map_type, sizeof(unsigned long long), in create_map() [all …]
|
D | tracex6_user.c | 24 static int map_fd[3]; variable 44 assert(bpf_map_update_elem(map_fd[0], &cpu, &pmu_fd, BPF_ANY) == 0); in check_on_cpu() 47 bpf_map_get_next_key(map_fd[1], &cpu, NULL); in check_on_cpu() 49 if (bpf_map_lookup_elem(map_fd[1], &cpu, &value)) { in check_on_cpu() 57 if (bpf_map_lookup_elem(map_fd[2], &cpu, &value2)) { in check_on_cpu() 67 assert(bpf_map_delete_elem(map_fd[0], &cpu) == 0 || error); in check_on_cpu() 70 assert(bpf_map_delete_elem(map_fd[1], &cpu) == 0 || error); in check_on_cpu() 197 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "counters"); in main() 198 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "values"); in main() 199 map_fd[2] = bpf_object__find_map_fd_by_name(obj, "values2"); in main() [all …]
|
D | spintest_user.c | 18 int map_fd, i, j = 0; in main() local 41 map_fd = bpf_object__find_map_fd_by_name(obj, "my_map"); in main() 42 if (map_fd < 0) { in main() 67 while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) { in main() 68 bpf_map_lookup_elem(map_fd, &next_key, &value); in main() 82 while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) in main() 83 bpf_map_delete_elem(map_fd, &next_key); in main()
|
D | sockex1_user.c | 14 int map_fd, prog_fd; in main() local 25 map_fd = bpf_object__find_map_fd_by_name(obj, "my_map"); in main() 40 assert(bpf_map_lookup_elem(map_fd, &key, &tcp_cnt) == 0); in main() 43 assert(bpf_map_lookup_elem(map_fd, &key, &udp_cnt) == 0); in main() 46 assert(bpf_map_lookup_elem(map_fd, &key, &icmp_cnt) == 0); in main()
|
D | sock_example.c | 37 int sock = -1, map_fd, prog_fd, i, key; in test_sock() local 40 map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(key), sizeof(value), in test_sock() 42 if (map_fd < 0) { in test_sock() 53 BPF_LD_MAP_FD(BPF_REG_1, map_fd), in test_sock() 80 assert(bpf_map_lookup_elem(map_fd, &key, &tcp_cnt) == 0); in test_sock() 83 assert(bpf_map_lookup_elem(map_fd, &key, &udp_cnt) == 0); in test_sock() 86 assert(bpf_map_lookup_elem(map_fd, &key, &icmp_cnt) == 0); in test_sock()
|
D | lwt_len_hist_user.c | 36 int i, map_fd; in main() local 38 map_fd = bpf_obj_get(map_filename); in main() 39 if (map_fd < 0) { in main() 45 while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) { in main() 51 bpf_map_lookup_elem(map_fd, &next_key, values); in main() 74 close(map_fd); in main()
|
D | offwaketime_user.c | 19 static int map_fd[2]; variable 55 if (bpf_map_lookup_elem(map_fd[1], &key->tret, ip) != 0) { in print_stack() 62 if (bpf_map_lookup_elem(map_fd[1], &key->wret, ip) != 0) { in print_stack() 92 print_stacks(map_fd[0]); in int_exit() 123 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "counts"); in main() 124 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "stackmap"); in main() 125 if (map_fd[0] < 0 || map_fd[1] < 0) { in main() 146 print_stacks(map_fd[0]); in main()
|
D | xdp_adjust_tail_user.c | 53 static void poll_stats(unsigned int map_fd, unsigned int kill_after_s) in poll_stats() argument 63 assert(bpf_map_lookup_elem(map_fd, &key, &value) == 0); in poll_stats() 93 int i, prog_fd, map_fd, opt; in main() local 158 map_fd = bpf_object__find_map_fd_by_name(obj, "xdp_adju.data"); in main() 159 if (map_fd < 0) { in main() 163 bpf_map_update_elem(map_fd, &key, &max_pckt_size, BPF_ANY); in main() 167 map_fd = bpf_object__find_map_fd_by_name(obj, "icmpcnt"); in main() 168 if (map_fd < 0) { in main() 188 poll_stats(map_fd, kill_after_s); in main()
|
D | ibumad_user.c | 32 static int map_fd[2]; variable 53 dump_counts(map_fd[0]); in dump_all_counts() 55 dump_counts(map_fd[1]); in dump_all_counts() 129 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "read_count"); in main() 130 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "write_count"); in main() 131 if (map_fd[0] < 0 || map_fd[1] < 0) { in main()
|
D | test_cgrp2_attach.c | 42 static int prog_load(int map_fd, int verdict) in prog_load() argument 52 BPF_LD_MAP_FD(BPF_REG_1, map_fd), /* load map fd to r1 */ in prog_load() 63 BPF_LD_MAP_FD(BPF_REG_1, map_fd), in prog_load() 90 int prog_fd, map_fd, ret, key; in attach_filter() local 93 map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, in attach_filter() 96 if (map_fd < 0) { in attach_filter() 101 prog_fd = prog_load(map_fd, verdict); in attach_filter() 117 assert(bpf_map_lookup_elem(map_fd, &key, &pkt_cnt) == 0); in attach_filter() 120 assert(bpf_map_lookup_elem(map_fd, &key, &byte_cnt) == 0); in attach_filter()
|
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 43 err = bpf_map_update_elem(map_fd, &idx, &idx, 0); in do_attach() 83 int prog_fd, map_fd = -1; in main() local 143 map_fd = bpf_map__fd(bpf_object__find_map_by_name(obj, in main() 145 if (map_fd < 0) { in main() 146 printf("map not found: %s\n", strerror(map_fd)); in main() 165 err = do_attach(idx, prog_fd, map_fd, argv[i]); in main()
|
D | sockex2_user.c | 20 int map_fd, prog_fd; in main() local 31 map_fd = bpf_object__find_map_fd_by_name(obj, "hash_map"); in main() 45 while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) { in main() 46 bpf_map_lookup_elem(map_fd, &next_key, &value); in main()
|
D | tracex2_user.c | 17 static int map_fd[2]; variable 113 print_hist(map_fd[1]); in int_exit() 140 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "my_map"); in main() 141 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "my_hist_map"); in main() 142 if (map_fd[0] < 0 || map_fd[1] < 0) { in main() 170 while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) { in main() 171 bpf_map_lookup_elem(map_fd[0], &next_key, &value); in main() 179 print_hist(map_fd[1]); in main()
|
D | xdp1_user.c | 44 static void poll_stats(int map_fd, int interval) in poll_stats() argument 55 while (bpf_map_get_next_key(map_fd, &key, &key) != -1) { in poll_stats() 58 assert(bpf_map_lookup_elem(map_fd, &key, values) == 0); in poll_stats() 88 int prog_fd, map_fd, opt; in main() local 136 map_fd = bpf_map__fd(map); in main() 158 poll_stats(map_fd, 2); in main()
|
D | tracex4_user.c | 55 int map_fd, i, j = 0; in main() local 70 map_fd = bpf_object__find_map_fd_by_name(obj, "my_map"); in main() 71 if (map_fd < 0) { in main() 87 print_old_objects(map_fd); in main()
|
D | cookie_uid_helper_example.c | 64 static int map_fd, prog_fd; variable 70 map_fd = bpf_create_map(BPF_MAP_TYPE_HASH, sizeof(uint32_t), in maps_create() 72 if (map_fd < 0) in maps_create() 100 BPF_LD_MAP_FD(BPF_REG_1, map_fd), in prog_load() 135 BPF_LD_MAP_FD(BPF_REG_1, map_fd), in prog_load() 199 while (bpf_map_get_next_key(map_fd, &curN, &nextN) > -1) { in print_table() 201 res = bpf_map_lookup_elem(map_fd, &curN, &curEntry); in print_table() 241 res = bpf_map_lookup_elem(map_fd, &cookie, &dataEntry); in udp_client() 260 res = bpf_map_lookup_elem(map_fd, &cookie, &dataEntry); in udp_client() 326 close(map_fd); in main()
|
D | trace_output_user.c | 51 int map_fd, ret = 0; in main() local 68 map_fd = bpf_object__find_map_fd_by_name(obj, "my_map"); in main() 69 if (map_fd < 0) { in main() 88 pb = perf_buffer__new(map_fd, 8, &pb_opts); in main()
|
D | trace_event_user.c | 23 static int map_fd[2]; variable 68 if (bpf_map_lookup_elem(map_fd[1], &key->kernstack, ip) != 0) { in print_stack() 75 if (bpf_map_lookup_elem(map_fd[1], &key->userstack, ip) != 0) { in print_stack() 105 int error = 1, fd = map_fd[0], stack_map = map_fd[1]; in print_stacks() 330 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "counts"); in main() 331 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "stackmap"); in main() 332 if (map_fd[0] < 0 || map_fd[1] < 0) { in main()
|
D | lathist_user.c | 87 int map_fd, i = 0; in main() local 102 map_fd = bpf_object__find_map_fd_by_name(obj, "my_lat"); in main() 103 if (map_fd < 0) { in main() 119 get_data(map_fd); in main()
|
D | map_perf_test_user.c | 70 static int map_fd[NR_IDXES]; variable 97 int fd = map_fd[lru_hash_lookup_idx]; in pre_test_lru_hash_lookup() 135 int outer_fd = map_fd[array_of_lru_hashs_idx]; in do_test_lru() 385 r = bpf_map_update_elem(map_fd[hash_map_alloc_idx], in fill_lpm_trie() 397 r = bpf_map_update_elem(map_fd[hash_map_alloc_idx], key, &value, 0); in fill_lpm_trie() 473 map_fd[0] = bpf_object__find_map_fd_by_name(obj, "array_of_lru_hashs"); in main() 474 map_fd[1] = bpf_object__find_map_fd_by_name(obj, "hash_map_alloc"); in main() 475 map_fd[2] = bpf_object__find_map_fd_by_name(obj, "lru_hash_lookup_map"); in main() 476 if (map_fd[0] < 0 || map_fd[1] < 0 || map_fd[2] < 0) { in main()
|
D | sampleip_user.c | 26 static int map_fd; variable 135 print_ip_map(map_fd); in int_exit() 200 map_fd = bpf_object__find_map_fd_by_name(obj, "ip_map"); in main() 201 if (map_fd < 0) { in main() 222 print_ip_map(map_fd); in main()
|
D | test_probe_write_user_user.c | 15 int serverfd, serverconnfd, clientfd, map_fd; in main() local 46 map_fd = bpf_object__find_map_fd_by_name(obj, "dnat_map"); in main() 47 if (map_fd < 0) { in main() 80 assert(!bpf_map_update_elem(map_fd, &mapped_addr, &serv_addr, BPF_ANY)); in main()
|
D | tracex3_user.c | 114 int map_fd, i, j = 0; in main() local 142 map_fd = bpf_object__find_map_fd_by_name(obj, "lat_map"); in main() 143 if (map_fd < 0) { in main() 174 print_hist(map_fd); in main()
|