Home
last modified time | relevance | path

Searched refs:key (Results 1 – 25 of 68) sorted by relevance

123

/samples/bpf/
Dmap_perf_test_kern.c21 __type(key, u32);
28 __type(key, u32);
35 __type(key, u32);
43 __type(key, u32);
69 __type(key, u32);
93 __type(key, u32);
100 __type(key, u32);
108 u32 key = bpf_get_current_pid_tgid(); in SYSCALL() local
112 bpf_map_update_elem(&hash_map, &key, &init_val, BPF_ANY); in SYSCALL()
113 value = bpf_map_lookup_elem(&hash_map, &key); in SYSCALL()
[all …]
Dcpustat_kern.c56 __type(key, u32);
64 __type(key, u32);
72 __type(key, u32);
107 u32 key, cpu, pstate_idx; in bpf_prog1() local
115 key = cpu * MAP_OFF_NUM + MAP_OFF_CSTATE_TIME; in bpf_prog1()
116 cts = bpf_map_lookup_elem(&my_map, &key); in bpf_prog1()
120 key = cpu * MAP_OFF_NUM + MAP_OFF_CSTATE_IDX; in bpf_prog1()
121 cstate = bpf_map_lookup_elem(&my_map, &key); in bpf_prog1()
125 key = cpu * MAP_OFF_NUM + MAP_OFF_PSTATE_TIME; in bpf_prog1()
126 pts = bpf_map_lookup_elem(&my_map, &key); in bpf_prog1()
[all …]
Dtracex3_user.c22 __u32 key; in clear_stats() local
25 for (key = 0; key < SLOTS; key++) in clear_stats()
26 bpf_map_update_elem(fd, &key, values, BPF_ANY); in clear_stats()
83 __u32 key; in print_hist() local
86 for (key = 0; key < SLOTS; key++) { in print_hist()
87 bpf_map_lookup_elem(fd, &key, values); in print_hist()
91 cnt[key] = value; in print_hist()
97 for (key = full_range ? 0 : 29; key < SLOTS; key++) { in print_hist()
98 int c = num_colors * cnt[key] / (max_cnt + 1); in print_hist()
Dtracex6_kern.c17 __type(key, int);
24 __type(key, int);
32 u32 key = bpf_get_smp_processor_id(); in bpf_prog1() local
36 count = bpf_perf_event_read(&counters, key); in bpf_prog1()
41 val = bpf_map_lookup_elem(&values, &key); in bpf_prog1()
45 bpf_map_update_elem(&values, &key, &count, BPF_NOEXIST); in bpf_prog1()
59 u32 key = bpf_get_smp_processor_id(); in BPF_KPROBE() local
68 error = bpf_perf_event_read_value(&counters, key, &buf, sizeof(buf)); in BPF_KPROBE()
72 val = bpf_map_lookup_elem(&values2, &key); in BPF_KPROBE()
76 bpf_map_update_elem(&values2, &key, &buf, BPF_NOEXIST); in BPF_KPROBE()
Dtrace_event_kern.c22 __type(key, struct key_t);
46 struct key_t key; in bpf_prog1() local
53 bpf_get_current_comm(&key.comm, sizeof(key.comm)); in bpf_prog1()
54 key.kernstack = bpf_get_stackid(ctx, &stackmap, KERN_STACKID_FLAGS); in bpf_prog1()
55 key.userstack = bpf_get_stackid(ctx, &stackmap, USER_STACKID_FLAGS); in bpf_prog1()
56 if ((int)key.kernstack < 0 && (int)key.userstack < 0) { in bpf_prog1()
71 val = bpf_map_lookup_elem(&counts, &key); in bpf_prog1()
75 bpf_map_update_elem(&counts, &key, &one, BPF_NOEXIST); in bpf_prog1()
Doffwaketime_user.c48 static void print_stack(struct key_t *key, __u64 count) in print_stack() argument
54 printf("%s;", key->target); in print_stack()
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()
68 printf(";%s %lld\n", key->waker, count); in print_stack()
70 if ((key->tret == -EEXIST || key->wret == -EEXIST) && !warned) { in print_stack()
73 } else if (((int)(key->tret) < 0 || (int)(key->wret) < 0)) { in print_stack()
74 printf("err stackid %d %d\n", key->tret, key->wret); in print_stack()
80 struct key_t key = {}, next_key; in print_stacks() local
83 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_stacks()
[all …]
Doffwaketime_kern.c34 __type(key, struct key_t);
41 __type(key, u32);
53 __type(key, u32);
87 struct key_t key; in update_counts() local
89 __builtin_memset(&key.waker, 0, sizeof(key.waker)); in update_counts()
90 bpf_get_current_comm(&key.target, sizeof(key.target)); in update_counts()
91 key.tret = bpf_get_stackid(ctx, &stackmap, STACKID_FLAGS); in update_counts()
92 key.wret = 0; in update_counts()
96 key.wret = woke->ret; in update_counts()
97 __builtin_memcpy(&key.waker, woke->name, sizeof(key.waker)); in update_counts()
[all …]
Dsockex1_user.c37 int key; in main() local
39 key = IPPROTO_TCP; in main()
40 assert(bpf_map_lookup_elem(map_fd, &key, &tcp_cnt) == 0); in main()
42 key = IPPROTO_UDP; in main()
43 assert(bpf_map_lookup_elem(map_fd, &key, &udp_cnt) == 0); in main()
45 key = IPPROTO_ICMP; in main()
46 assert(bpf_map_lookup_elem(map_fd, &key, &icmp_cnt) == 0); in main()
Dxdp_rxq_info_kern.c29 __type(key, int);
42 __type(key, u32);
52 __type(key, u32);
82 u32 key = 0; in xdp_prognum0() local
85 rec = bpf_map_lookup_elem(&stats_global_map, &key); in xdp_prognum0()
95 config = bpf_map_lookup_elem(&config_map, &key); in xdp_prognum0()
109 key = ctx->rx_queue_index; in xdp_prognum0()
110 if (key >= MAX_RXQs) in xdp_prognum0()
111 key = MAX_RXQs; in xdp_prognum0()
112 rxq_rec = bpf_map_lookup_elem(&rx_queue_index_map, &key); in xdp_prognum0()
[all …]
Dtest_lru_dist.c91 unsigned long long key; member
130 unsigned long long key) in pfect_lru_lookup_or_insert() argument
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()
156 node->key = key; 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()
273 unsigned long long key, value = 1234; in do_test_lru_dist() local
283 key = dist_keys[i] + key_offset; in do_test_lru_dist()
285 pfect_lru_lookup_or_insert(&pfect_lru, key); in do_test_lru_dist()
[all …]
Dtracex2_kern.c17 __type(key, long);
87 struct hist_key key; in SYSCALL() local
89 key.index = log2l(write_size); in SYSCALL()
90 key.pid_tgid = bpf_get_current_pid_tgid(); in SYSCALL()
91 key.uid_gid = bpf_get_current_uid_gid(); in SYSCALL()
92 bpf_get_current_comm(&key.comm, sizeof(key.comm)); in SYSCALL()
94 value = bpf_map_lookup_elem(&my_hist_map, &key); in SYSCALL()
98 bpf_map_update_elem(&my_hist_map, &key, &init_val, BPF_ANY); in SYSCALL()
Dsock_example.c37 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()
79 key = IPPROTO_TCP; in test_sock()
80 assert(bpf_map_lookup_elem(map_fd, &key, &tcp_cnt) == 0); in test_sock()
82 key = IPPROTO_UDP; in test_sock()
83 assert(bpf_map_lookup_elem(map_fd, &key, &udp_cnt) == 0); in test_sock()
85 key = IPPROTO_ICMP; in test_sock()
86 assert(bpf_map_lookup_elem(map_fd, &key, &icmp_cnt) == 0); in test_sock()
Dspintest_user.c16 long key, next_key, value; in main() local
65 key = 0; in main()
67 while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) { in main()
71 key = next_key; in main()
79 if (key) in main()
81 key = 0; in main()
82 while (bpf_map_get_next_key(map_fd, &key, &next_key) == 0) in main()
Dtracex2_user.c46 struct hist_key key = {}, next_key; in print_hist_for_pid() local
55 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_hist_for_pid()
57 key = next_key; in print_hist_for_pid()
70 key = next_key; in print_hist_for_pid()
85 struct hist_key key = {}, next_key; in print_hist() local
90 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_hist()
98 key = next_key; in print_hist()
119 long key, next_key, value; in main() local
169 key = 0; in main()
170 while (bpf_map_get_next_key(map_fd[0], &key, &next_key) == 0) { in main()
[all …]
Dsockex3_user.c28 int i, sock, key, fd, main_prog_fd, jmp_table_fd, hash_map_fd; in main() local
60 if (sscanf(section, "socket/%d", &key) != 1) { in main()
65 if (key == 0) in main()
68 bpf_map_update_elem(jmp_table_fd, &key, &fd, BPF_ANY); in main()
84 struct flow_key_record key = {}, next_key; in main() local
89 while (bpf_map_get_next_key(hash_map_fd, &key, &next_key) == 0) { in main()
97 key = next_key; in main()
Dsyscall_tp_kern.c23 __type(key, u32);
30 __type(key, u32);
37 u32 key = 0; in count() local
40 value = bpf_map_lookup_elem(map, &key); in count()
44 bpf_map_update_elem(map, &key, &init_val, BPF_NOEXIST); in count()
Dxdp1_user.c51 __u32 key = UINT32_MAX; in poll_stats() local
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()
61 if (sum > prev[key]) in poll_stats()
63 key, (sum - prev[key]) / interval); in poll_stats()
64 prev[key] = sum; in poll_stats()
Dibumad_user.c37 __u32 key; in dump_counts() local
40 for (key = 0; key < 256; key++) { in dump_counts()
41 if (bpf_map_lookup_elem(fd, &key, &value)) { in dump_counts()
42 printf("failed to read key %u\n", key); in dump_counts()
46 printf("0x%02x : %llu\n", key, value); in dump_counts()
Dmap_perf_test_user.c98 uint32_t key; in pre_test_lru_hash_lookup() local
112 for (key = 0; key < lru_hash_lookup_test_entries; key++) { in pre_test_lru_hash_lookup()
113 ret = bpf_map_update_elem(fd, &key, &val, BPF_NOEXIST); in pre_test_lru_hash_lookup()
371 struct bpf_lpm_trie_key *key; in fill_lpm_trie() local
376 key = alloca(sizeof(*key) + 4); in fill_lpm_trie()
377 key->prefixlen = 32; in fill_lpm_trie()
380 key->prefixlen = rand() % 33; in fill_lpm_trie()
381 key->data[0] = rand() & 0xff; in fill_lpm_trie()
382 key->data[1] = rand() & 0xff; in fill_lpm_trie()
383 key->data[2] = rand() & 0xff; in fill_lpm_trie()
[all …]
Dtracex4_user.c32 __u64 key, next_key; in print_old_objects() local
35 key = write(1, "\e[1;1H\e[2J", 11); /* clear screen */ in print_old_objects()
37 key = -1; in print_old_objects()
38 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_old_objects()
40 key = next_key; in print_old_objects()
Dxdp_redirect_map_multi.bpf.c25 __type(key, u32);
32 u32 key = bpf_get_smp_processor_id(); in xdp_redirect_map() local
35 rec = bpf_map_lookup_elem(&rx_cnt, &key); in xdp_redirect_map()
61 u32 key = ctx->egress_ifindex; in xdp_devmap_prog() local
70 mac = bpf_map_lookup_elem(&mac_map, &key); in xdp_devmap_prog()
Dlathist_kern.c23 __type(key, int);
66 __type(key, int);
75 int key, cpu; in bpf_prog2() local
89 key = cpu * MAX_ENTRIES + delta; in bpf_prog2()
90 val = bpf_map_lookup_elem(&my_lat, &key); in bpf_prog2()
Dtrace_event_user.c61 static void print_stack(struct key_t *key, __u64 count) in print_stack() argument
67 printf("%3lld %s;", count, key->comm); in print_stack()
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()
86 if (key->kernstack == -EEXIST && !warned) { in print_stack()
89 } else if ((int)key->kernstack < 0 && (int)key->userstack < 0) { in print_stack()
90 printf("err stackid %d %d\n", key->kernstack, key->userstack); in print_stack()
102 struct key_t key = {}, next_key; in print_stacks() local
108 while (bpf_map_get_next_key(fd, &key, &next_key) == 0) { in print_stacks()
112 key = next_key; in print_stacks()
Dfds_example.c76 static int bpf_do_map(const char *file, uint32_t flags, uint32_t key, in bpf_do_map() argument
96 ret = bpf_map_update_elem(fd, &key, &value, 0); in bpf_do_map()
97 printf("bpf: fd:%d u->(%u:%u) ret:(%d,%s)\n", fd, key, value, in bpf_do_map()
101 ret = bpf_map_lookup_elem(fd, &key, &value); in bpf_do_map()
102 printf("bpf: fd:%d l->(%u):%u ret:(%d,%s)\n", fd, key, value, in bpf_do_map()
142 uint32_t key = 0, value = 0, flags = 0; in main() local
162 key = strtoul(optarg, NULL, 0); in main()
186 return bpf_do_map(file, flags, key, value); in main()
Dlwt_len_hist_kern.c62 __u64 *value, key, init_val = 1; in do_len_hist() local
64 key = log2l(skb->len); in do_len_hist()
66 value = bpf_map_lookup_elem(&lwt_len_hist_map, &key); in do_len_hist()
70 bpf_map_update_elem(&lwt_len_hist_map, &key, &init_val, BPF_ANY); in do_len_hist()

123