diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-07-05 18:50:11 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-07-05 23:52:25 +0300 |
commit | bc7430cc8bfb51577e466a8ca02ad87375a70bde (patch) | |
tree | c56b050f3bb07c491da3f0fa082e651dbfe6d993 /tools/testing/selftests/bpf/progs/test_xdp_noinline.c | |
parent | 00acd00814527a1856c92beda17475205bddaba6 (diff) | |
download | linux-bc7430cc8bfb51577e466a8ca02ad87375a70bde.tar.xz |
selftests/bpf: convert selftests using BTF-defined maps to new syntax
Convert all the existing selftests that are already using BTF-defined
maps to use new syntax (with no static data initialization).
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_xdp_noinline.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/test_xdp_noinline.c | 81 |
1 files changed, 31 insertions, 50 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_xdp_noinline.c b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c index d2eddb5553d1..dad8a7e33eaa 100644 --- a/tools/testing/selftests/bpf/progs/test_xdp_noinline.c +++ b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c @@ -164,66 +164,47 @@ struct lb_stats { }; struct { - __u32 type; - __u32 max_entries; - struct vip_definition *key; - struct vip_meta *value; -} vip_map SEC(".maps") = { - .type = BPF_MAP_TYPE_HASH, - .max_entries = 512, -}; + __uint(type, BPF_MAP_TYPE_HASH); + __uint(max_entries, 512); + __type(key, struct vip_definition); + __type(value, struct vip_meta); +} vip_map SEC(".maps"); struct { - __u32 type; - __u32 max_entries; - __u32 map_flags; - struct flow_key *key; - struct real_pos_lru *value; -} lru_cache SEC(".maps") = { - .type = BPF_MAP_TYPE_LRU_HASH, - .max_entries = 300, - .map_flags = 1U << 1, -}; + __uint(type, BPF_MAP_TYPE_LRU_HASH); + __uint(max_entries, 300); + __uint(map_flags, 1U << 1); + __type(key, struct flow_key); + __type(value, struct real_pos_lru); +} lru_cache SEC(".maps"); struct { - __u32 type; - __u32 max_entries; - __u32 *key; - __u32 *value; -} ch_rings SEC(".maps") = { - .type = BPF_MAP_TYPE_ARRAY, - .max_entries = 12 * 655, -}; + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, 12 * 655); + __type(key, __u32); + __type(value, __u32); +} ch_rings SEC(".maps"); struct { - __u32 type; - __u32 max_entries; - __u32 *key; - struct real_definition *value; -} reals SEC(".maps") = { - .type = BPF_MAP_TYPE_ARRAY, - .max_entries = 40, -}; + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, 40); + __type(key, __u32); + __type(value, struct real_definition); +} reals SEC(".maps"); struct { - __u32 type; - __u32 max_entries; - __u32 *key; - struct lb_stats *value; -} stats SEC(".maps") = { - .type = BPF_MAP_TYPE_PERCPU_ARRAY, - .max_entries = 515, -}; + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); + __uint(max_entries, 515); + __type(key, __u32); + __type(value, struct lb_stats); +} stats SEC(".maps"); struct { - __u32 type; - __u32 max_entries; - __u32 *key; - struct ctl_value *value; -} ctl_array SEC(".maps") = { - .type = BPF_MAP_TYPE_ARRAY, - .max_entries = 16, -}; + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, 16); + __type(key, __u32); + __type(value, struct ctl_value); +} ctl_array SEC(".maps"); struct eth_hdr { unsigned char eth_dest[6]; |