Skip to content

Commit 2322113

Browse files
anakryikoAlexei Starovoitov
authored andcommitted
selftests/bpf: add more variations of map-in-map situations
Add test cases validating usage of PERCPU_ARRAY and PERCPU_HASH maps as inner maps. Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Kumar Kartikeya Dwivedi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 9ee9822 commit 2322113

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tools/testing/selftests/bpf/progs/map_kptr.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,14 @@ DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_ARRAY_OF_MAPS, array_map, array_of_array_maps);
110110
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_ARRAY_OF_MAPS, hash_map, array_of_hash_maps);
111111
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_ARRAY_OF_MAPS, hash_malloc_map, array_of_hash_malloc_maps);
112112
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_ARRAY_OF_MAPS, lru_hash_map, array_of_lru_hash_maps);
113+
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_ARRAY_OF_MAPS, pcpu_array_map, array_of_pcpu_array_maps);
114+
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_ARRAY_OF_MAPS, pcpu_hash_map, array_of_pcpu_hash_maps);
113115
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_HASH_OF_MAPS, array_map, hash_of_array_maps);
114116
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_HASH_OF_MAPS, hash_map, hash_of_hash_maps);
115117
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_HASH_OF_MAPS, hash_malloc_map, hash_of_hash_malloc_maps);
116118
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_HASH_OF_MAPS, lru_hash_map, hash_of_lru_hash_maps);
119+
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_HASH_OF_MAPS, pcpu_array_map, hash_of_pcpu_array_maps);
120+
DEFINE_MAP_OF_MAP(BPF_MAP_TYPE_HASH_OF_MAPS, pcpu_hash_map, hash_of_pcpu_hash_maps);
117121

118122
#define WRITE_ONCE(x, val) ((*(volatile typeof(x) *) &(x)) = (val))
119123

@@ -204,6 +208,8 @@ int test_map_kptr(struct __sk_buff *ctx)
204208
TEST(hash_map);
205209
TEST(hash_malloc_map);
206210
TEST(lru_hash_map);
211+
TEST(pcpu_array_map);
212+
TEST(pcpu_hash_map);
207213

208214
#undef TEST
209215
return 0;
@@ -281,10 +287,14 @@ int test_map_in_map_kptr(struct __sk_buff *ctx)
281287
TEST(array_of_hash_maps);
282288
TEST(array_of_hash_malloc_maps);
283289
TEST(array_of_lru_hash_maps);
290+
TEST(array_of_pcpu_array_maps);
291+
TEST(array_of_pcpu_hash_maps);
284292
TEST(hash_of_array_maps);
285293
TEST(hash_of_hash_maps);
286294
TEST(hash_of_hash_malloc_maps);
287295
TEST(hash_of_lru_hash_maps);
296+
TEST(hash_of_pcpu_array_maps);
297+
TEST(hash_of_pcpu_hash_maps);
288298

289299
#undef TEST
290300
return 0;

0 commit comments

Comments
 (0)