Skip to content

Commit 8f9a8a6

Browse files
rgushchinAlexei Starovoitov
authored andcommitted
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: 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>
1 parent 9a1126b commit 8f9a8a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/testing/selftests/bpf/netcnt_prog.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ struct bpf_map_def SEC("maps") percpu_netcnt = {
1616
.value_size = sizeof(struct percpu_net_cnt),
1717
};
1818

19+
BPF_ANNOTATE_KV_PAIR(percpu_netcnt, struct bpf_cgroup_storage_key,
20+
struct percpu_net_cnt);
21+
1922
struct bpf_map_def SEC("maps") netcnt = {
2023
.type = BPF_MAP_TYPE_CGROUP_STORAGE,
2124
.key_size = sizeof(struct bpf_cgroup_storage_key),
2225
.value_size = sizeof(struct net_cnt),
2326
};
2427

28+
BPF_ANNOTATE_KV_PAIR(netcnt, struct bpf_cgroup_storage_key,
29+
struct net_cnt);
30+
2531
SEC("cgroup/skb")
2632
int bpf_nextcnt(struct __sk_buff *skb)
2733
{

0 commit comments

Comments
 (0)