Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f9a8a61 authored by Roman Gushchin's avatar Roman Gushchin Committed by Alexei Starovoitov
Browse files

selftests/bpf: add btf annotations for cgroup_local_storage maps



Add btf annotations to cgroup local storage maps (per-cpu and shared)
in the network packet counting example.

Signed-off-by: default avatarRoman Gushchin <guro@fb.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 9a1126b6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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)
{