diff mbox series

[v2,bpf-next,3/3] selftests/bpf: add btf annotations for cgroup_local_storage maps

Message ID 20181210234302.31327-4-guro@fb.com
State Accepted, archived
Delegated to: BPF Maintainers
Headers show
Series bpffs pretty print for cgroup local storage | expand

Commit Message

Roman Gushchin Dec. 10, 2018, 11:43 p.m. UTC
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>
---
 tools/testing/selftests/bpf/netcnt_prog.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Martin KaFai Lau Dec. 11, 2018, 5:18 p.m. UTC | #1
On Mon, Dec 10, 2018 at 03:43:02PM -0800, Roman Gushchin wrote:
> Add btf annotations to cgroup local storage maps (per-cpu and shared)
> in the network packet counting example.
Acked-by: Martin KaFai Lau <kafai@fb.com>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/netcnt_prog.c b/tools/testing/selftests/bpf/netcnt_prog.c
index 1198abca1360..9f741e69cebe 100644
--- a/tools/testing/selftests/bpf/netcnt_prog.c
+++ b/tools/testing/selftests/bpf/netcnt_prog.c
@@ -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)
 {