selftests/bpf: add btf annotations for cgroup_local_storage maps
authorRoman Gushchin <guroan@gmail.com>
Mon, 10 Dec 2018 23:43:02 +0000 (15:43 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 12 Dec 2018 23:33:44 +0000 (15:33 -0800)
Add btf annotations to cgroup local storage maps (per-cpu and shared)
in the network packet counting example.

Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/netcnt_prog.c

index 1198abca136076dc11eaef858695ae2c6d840d1f..9f741e69cebe895798a8393a032a369770ab73d2 100644 (file)
@@ -16,12 +16,18 @@ struct bpf_map_def SEC("maps") percpu_netcnt = {
        .value_size = sizeof(struct percpu_net_cnt),
 };
 
+BPF_ANNOTATE_KV_PAIR(percpu_netcnt, struct bpf_cgroup_storage_key,
+                    struct percpu_net_cnt);
+
 struct bpf_map_def SEC("maps") netcnt = {
        .type = BPF_MAP_TYPE_CGROUP_STORAGE,
        .key_size = sizeof(struct bpf_cgroup_storage_key),
        .value_size = sizeof(struct net_cnt),
 };
 
+BPF_ANNOTATE_KV_PAIR(netcnt, struct bpf_cgroup_storage_key,
+                    struct net_cnt);
+
 SEC("cgroup/skb")
 int bpf_nextcnt(struct __sk_buff *skb)
 {