samples: bpf: Refactor XDP kern program maps with BTF-defined map
authorDaniel T. Lee <danieltimlee@gmail.com>
Sat, 10 Oct 2020 18:17:34 +0000 (03:17 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 11 Oct 2020 19:14:36 +0000 (12:14 -0700)
commit321f6324500eb2ec75b6fcff7dcd66d64ba18529
tree97287b42afa877971bfa2c065438a47c9b369170
parent151936bf51afcdd6db52b3b73e339d021064b0ea
samples: bpf: Refactor XDP kern program maps with BTF-defined map

Most of the samples were converted to use the new BTF-defined MAP as
they moved to libbpf, but some of the samples were missing.

Instead of using the previous BPF MAP definition, this commit refactors
xdp_monitor and xdp_sample_pkts_kern MAP definition with the new
BTF-defined MAP format.

Also, this commit removes the max_entries attribute at PERF_EVENT_ARRAY
map type. The libbpf's bpf_object__create_map() will automatically
set max_entries to the maximum configured number of CPUs on the host.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201010181734.1109-4-danieltimlee@gmail.com
samples/bpf/xdp_monitor_kern.c
samples/bpf/xdp_sample_pkts_kern.c
samples/bpf/xdp_sample_pkts_user.c