diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-07-05 08:50:11 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-07-05 22:52:25 +0200 |
commit | bc7430cc8bfb51577e466a8ca02ad87375a70bde (patch) | |
tree | c56b050f3bb07c491da3f0fa082e651dbfe6d993 /tools/testing/selftests/bpf/progs/test_l4lb_noinline.c | |
parent | 00acd00814527a1856c92beda17475205bddaba6 (diff) | |
download | linux-bc7430cc8bfb51577e466a8ca02ad87375a70bde.tar.bz2 |
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_l4lb_noinline.c')
-rw-r--r-- | tools/testing/selftests/bpf/progs/test_l4lb_noinline.c | 65 |
1 files changed, 25 insertions, 40 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_l4lb_noinline.c b/tools/testing/selftests/bpf/progs/test_l4lb_noinline.c index c63ecf3ca573..2e4efe70b1e5 100644 --- a/tools/testing/selftests/bpf/progs/test_l4lb_noinline.c +++ b/tools/testing/selftests/bpf/progs/test_l4lb_noinline.c @@ -166,54 +166,39 @@ struct eth_hdr { }; struct { - __u32 type; - __u32 max_entries; - struct vip *key; - struct vip_meta *value; -} vip_map SEC(".maps") = { - .type = BPF_MAP_TYPE_HASH, - .max_entries = MAX_VIPS, -}; + __uint(type, BPF_MAP_TYPE_HASH); + __uint(max_entries, MAX_VIPS); + __type(key, struct vip); + __type(value, struct vip_meta); +} vip_map SEC(".maps"); struct { - __u32 type; - __u32 max_entries; - __u32 *key; - __u32 *value; -} ch_rings SEC(".maps") = { - .type = BPF_MAP_TYPE_ARRAY, - .max_entries = CH_RINGS_SIZE, -}; + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, CH_RINGS_SIZE); + __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 = MAX_REALS, -}; + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, MAX_REALS); + __type(key, __u32); + __type(value, struct real_definition); +} reals SEC(".maps"); struct { - __u32 type; - __u32 max_entries; - __u32 *key; - struct vip_stats *value; -} stats SEC(".maps") = { - .type = BPF_MAP_TYPE_PERCPU_ARRAY, - .max_entries = MAX_VIPS, -}; + __uint(type, BPF_MAP_TYPE_PERCPU_ARRAY); + __uint(max_entries, MAX_VIPS); + __type(key, __u32); + __type(value, struct vip_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 = CTL_MAP_SIZE, -}; + __uint(type, BPF_MAP_TYPE_ARRAY); + __uint(max_entries, CTL_MAP_SIZE); + __type(key, __u32); + __type(value, struct ctl_value); +} ctl_array SEC(".maps"); static __u32 get_packet_hash(struct packet_description *pckt, bool ipv6) |