Lines Matching +full:key +full:- +full:value
1 // SPDX-License-Identifier: GPL-2.0
22 __type(key, int);
23 __type(value, struct hmap_elem);
30 __type(key, int);
31 __type(value, struct hmap_elem);
42 __type(key, int);
43 __type(value, struct elem);
49 __type(key, int);
50 __type(value, struct elem);
56 static int test_elem_callback(void *map, int *key, in test_elem_callback() argument
57 int (callback_fn)(void *map, int *key, void *value)) in test_elem_callback() argument
62 if ((ok & (1 << *key) || in test_elem_callback()
63 (ok_sleepable & (1 << *key)))) in test_elem_callback()
64 return -22; in test_elem_callback()
67 bpf_map_update_elem(map, key, &init, 0)) in test_elem_callback()
68 return -1; in test_elem_callback()
70 val = bpf_map_lookup_elem(map, key); in test_elem_callback()
72 return -2; in test_elem_callback()
74 val->ok_offset = *key; in test_elem_callback()
76 wq = &val->w; in test_elem_callback()
78 return -3; in test_elem_callback()
81 return -4; in test_elem_callback()
84 return -5; in test_elem_callback()
89 static int test_hmap_elem_callback(void *map, int *key, in test_hmap_elem_callback() argument
90 int (callback_fn)(void *map, int *key, void *value)) in test_hmap_elem_callback() argument
95 if ((ok & (1 << *key) || in test_hmap_elem_callback()
96 (ok_sleepable & (1 << *key)))) in test_hmap_elem_callback()
97 return -22; in test_hmap_elem_callback()
99 if (bpf_map_update_elem(map, key, &init, 0)) in test_hmap_elem_callback()
100 return -1; in test_hmap_elem_callback()
102 val = bpf_map_lookup_elem(map, key); in test_hmap_elem_callback()
104 return -2; in test_hmap_elem_callback()
106 wq = &val->work; in test_hmap_elem_callback()
108 return -3; in test_hmap_elem_callback()
111 return -4; in test_hmap_elem_callback()
114 return -5; in test_hmap_elem_callback()
120 static int wq_callback(void *map, int *key, void *value) in wq_callback() argument
123 ok |= (1 << *key); in wq_callback()
128 static int wq_cb_sleepable(void *map, int *key, void *value) in wq_cb_sleepable() argument
130 struct elem *data = (struct elem *)value; in wq_cb_sleepable()
131 int offset = data->ok_offset; in wq_cb_sleepable()
133 if (*key != offset) in wq_cb_sleepable()
146 int key = 0; in test_call_array_sleepable() local
148 return test_elem_callback(&array, &key, wq_cb_sleepable); in test_call_array_sleepable()
156 int key = 1; in test_syscall_array_sleepable() local
158 return test_elem_callback(&array, &key, wq_cb_sleepable); in test_syscall_array_sleepable()
166 int key = 2; in test_call_hash_sleepable() local
168 return test_hmap_elem_callback(&hmap, &key, wq_callback); in test_call_hash_sleepable()
176 int key = 3; in test_call_hash_malloc_sleepable() local
178 return test_hmap_elem_callback(&hmap_malloc, &key, wq_callback); in test_call_hash_malloc_sleepable()
186 int key = 4; in test_call_lru_sleepable() local
188 return test_elem_callback(&lru, &key, wq_callback); in test_call_lru_sleepable()