Lines Matching +full:cpu +full:- +full:map

1 // SPDX-License-Identifier: GPL-2.0-only
82 static void test_hash_prealloc(int cpu) in test_hash_prealloc() argument
90 printf("%d:hash_map_perf pre-alloc %lld events per sec\n", in test_hash_prealloc()
91 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_hash_prealloc()
106 * It is fine that the user requests for a map with in pre_test_lru_hash_lookup()
108 * may return not found. For LRU map, we are not interested in pre_test_lru_hash_lookup()
109 * in such small map performance. in pre_test_lru_hash_lookup()
120 static void do_test_lru(enum test_type test, int cpu) in do_test_lru() argument
129 if (test == INNER_LRU_HASH_PREALLOC && cpu) { in do_test_lru()
130 /* If CPU is not 0, create inner_lru hash map and insert the fd in do_test_lru()
131 * value into the array_of_lru_hash map. In case of CPU 0, in do_test_lru()
132 * 'inner_lru_hash_map' was statically inserted on the map init in do_test_lru()
140 assert(cpu < MAX_NR_CPUS); in do_test_lru()
146 inner_lru_map_fds[cpu] = in do_test_lru()
152 if (inner_lru_map_fds[cpu] == -1) { in do_test_lru()
158 ret = bpf_map_update_elem(outer_fd, &cpu, in do_test_lru()
159 &inner_lru_map_fds[cpu], in do_test_lru()
163 cpu, strerror(errno), errno); in do_test_lru()
190 ret = connect(-1, (const struct sockaddr *)&in6, sizeof(in6)); in do_test_lru()
191 assert(ret == -1 && errno == EBADF); in do_test_lru()
193 lru_hash_lookup_test_entries - 32) in do_test_lru()
198 printf("%d:%s pre-alloc %lld events per sec\n", in do_test_lru()
199 cpu, test_name, in do_test_lru()
200 max_cnt * 1000000000ll / (time_get_ns() - start_time)); in do_test_lru()
203 static void test_lru_hash_prealloc(int cpu) in test_lru_hash_prealloc() argument
205 do_test_lru(LRU_HASH_PREALLOC, cpu); in test_lru_hash_prealloc()
208 static void test_nocommon_lru_hash_prealloc(int cpu) in test_nocommon_lru_hash_prealloc() argument
210 do_test_lru(NOCOMMON_LRU_HASH_PREALLOC, cpu); in test_nocommon_lru_hash_prealloc()
213 static void test_inner_lru_hash_prealloc(int cpu) in test_inner_lru_hash_prealloc() argument
215 do_test_lru(INNER_LRU_HASH_PREALLOC, cpu); in test_inner_lru_hash_prealloc()
218 static void test_lru_hash_lookup(int cpu) in test_lru_hash_lookup() argument
220 do_test_lru(LRU_HASH_LOOKUP, cpu); in test_lru_hash_lookup()
223 static void test_percpu_hash_prealloc(int cpu) in test_percpu_hash_prealloc() argument
231 printf("%d:percpu_hash_map_perf pre-alloc %lld events per sec\n", in test_percpu_hash_prealloc()
232 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_percpu_hash_prealloc()
235 static void test_hash_kmalloc(int cpu) in test_hash_kmalloc() argument
244 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_hash_kmalloc()
247 static void test_percpu_hash_kmalloc(int cpu) in test_percpu_hash_kmalloc() argument
256 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_percpu_hash_kmalloc()
259 static void test_lpm_kmalloc(int cpu) in test_lpm_kmalloc() argument
268 cpu, max_cnt * 1000000000ll / (time_get_ns() - start_time)); in test_lpm_kmalloc()
271 static void test_hash_lookup(int cpu) in test_hash_lookup() argument
280 cpu, max_cnt * 1000000000ll * 64 / (time_get_ns() - start_time)); in test_hash_lookup()
283 static void test_array_lookup(int cpu) in test_array_lookup() argument
292 cpu, max_cnt * 1000000000ll * 64 / (time_get_ns() - start_time)); in test_array_lookup()
300 typedef void (*test_func)(int cpu);
331 static void loop(int cpu) in loop() argument
337 CPU_SET(cpu, &cpuset); in loop()
342 test_funcs[i](cpu); in loop()
358 } else if (pid[i] == -1) { in run_perf_test()
379 key->prefixlen = 32; in fill_lpm_trie()
382 key->prefixlen = rand() % 33; in fill_lpm_trie()
383 key->data[0] = rand() & 0xff; in fill_lpm_trie()
384 key->data[1] = rand() & 0xff; in fill_lpm_trie()
385 key->data[2] = rand() & 0xff; in fill_lpm_trie()
386 key->data[3] = rand() & 0xff; in fill_lpm_trie()
392 key->prefixlen = 32; in fill_lpm_trie()
393 key->data[0] = 192; in fill_lpm_trie()
394 key->data[1] = 168; in fill_lpm_trie()
395 key->data[2] = 0; in fill_lpm_trie()
396 key->data[3] = 1; in fill_lpm_trie()
405 struct bpf_map *map; in fixup_map() local
408 bpf_object__for_each_map(map, obj) { in fixup_map()
409 const char *name = bpf_map__name(map); in fixup_map()
415 bpf_map__set_max_entries(map, num_map_entries); in fixup_map()
430 struct bpf_map *map; in main() local
453 map = bpf_object__find_map_by_name(obj, "inner_lru_hash_map"); in main()
454 if (libbpf_get_error(map)) { in main()
455 fprintf(stderr, "ERROR: finding a map in obj file failed\n"); in main()
459 inner_lru_hash_size = bpf_map__max_entries(map); in main()
461 fprintf(stderr, "ERROR: failed to get map attribute\n"); in main()
465 /* resize BPF map prior to loading */ in main()
479 fprintf(stderr, "ERROR: finding a map in obj file failed\n"); in main()
498 for (i--; i >= 0; i--) in main()