samples: bpf: Add devmap_xmit tracepoint statistics support
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sat, 21 Aug 2021 00:19:59 +0000 (05:49 +0530)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 24 Aug 2021 21:48:41 +0000 (14:48 -0700)
commitaf93d58c27b6ac4154f1651f47be2a159f8ce30f
tree7cad9d1507b0b8c03cbd7653357f56be916ec469
parent5f116212f4018fc9aa7a2a828b27aab540b8e5fa
samples: bpf: Add devmap_xmit tracepoint statistics support

This adds support for retrieval and printing for devmap_xmit total and
mutli mode tracepoint. For multi mode, we keep a hash map entry for each
redirection stream, such that we can dynamically add and remove entries
on output.

The from_match and to_match will be set by individual samples when
setting up the XDP program on these devices.

The multi mode tracepoint is also handy for xdp_redirect_map_multi,
where up to 32 devices can be specified.

Also add samples_init_pre_load macro to finally set up the resized maps
and mmap them in place for low overhead stats retrieval.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210821002010.845777-12-memxor@gmail.com
samples/bpf/xdp_sample_user.c
samples/bpf/xdp_sample_user.h