summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_btf_map_in_map.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <kafai@fb.com>2020-08-28 04:18:19 +0300
committerDaniel Borkmann <daniel@iogearbox.net>2020-08-28 16:41:30 +0300
commitd557ea39a5f894630c403b78703ac92b08b7dd62 (patch)
tree714f7ac76f01cccffac5b91d4a6f04d6c7603f83 /tools/testing/selftests/bpf/progs/test_btf_map_in_map.c
parent134fede4eecfcbe7900e789f625fa6f9c3a8cd0e (diff)
downloadlinux-d557ea39a5f894630c403b78703ac92b08b7dd62.tar.xz
bpf: selftests: Add test for different inner map size
This patch tests the inner map size can be different for reuseport_sockarray but has to be the same for arraymap. A new subtest "diff_size" is added for this. The existing test is moved to a subtest "lookup_update". Signed-off-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20200828011819.1970825-1-kafai@fb.com
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_btf_map_in_map.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_btf_map_in_map.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_btf_map_in_map.c b/tools/testing/selftests/bpf/progs/test_btf_map_in_map.c
index e5093796be97..193fe0198b21 100644
--- a/tools/testing/selftests/bpf/progs/test_btf_map_in_map.c
+++ b/tools/testing/selftests/bpf/progs/test_btf_map_in_map.c
@@ -11,6 +11,13 @@ struct inner_map {
} inner_map1 SEC(".maps"),
inner_map2 SEC(".maps");
+struct inner_map_sz2 {
+ __uint(type, BPF_MAP_TYPE_ARRAY);
+ __uint(max_entries, 2);
+ __type(key, int);
+ __type(value, int);
+} inner_map_sz2 SEC(".maps");
+
struct outer_arr {
__uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
__uint(max_entries, 3);
@@ -50,6 +57,30 @@ struct outer_hash {
},
};
+struct sockarr_sz1 {
+ __uint(type, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY);
+ __uint(max_entries, 1);
+ __type(key, int);
+ __type(value, int);
+} sockarr_sz1 SEC(".maps");
+
+struct sockarr_sz2 {
+ __uint(type, BPF_MAP_TYPE_REUSEPORT_SOCKARRAY);
+ __uint(max_entries, 2);
+ __type(key, int);
+ __type(value, int);
+} sockarr_sz2 SEC(".maps");
+
+struct outer_sockarr_sz1 {
+ __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS);
+ __uint(max_entries, 1);
+ __uint(key_size, sizeof(int));
+ __uint(value_size, sizeof(int));
+ __array(values, struct sockarr_sz1);
+} outer_sockarr SEC(".maps") = {
+ .values = { (void *)&sockarr_sz1 },
+};
+
int input = 0;
SEC("raw_tp/sys_enter")