Re: [PATCH bpf-next v2 3/3] samples: bpf: refactor XDP kern program maps with BTF-defined map

Andrii Nakryiko <[email protected]>
Newsgroups org.kernel.vger.xdp-newbies,org.kernel.vger.bpf,org.kernel.vger.netdev
Message-ID <CAEf4Bzbz8Ycikmsg5mKeuMkBboJ7DuTTBGq0yv+ZMg2TDLqNtw@mail.gmail.com>
On Sat, Oct 10, 2020 at 11:17 AM Daniel T. Lee <[email protected]> wrote:
>
> 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 <[email protected]>
>
> ---
> Changes in v2:
>  - revert BTF key/val type to default of BPF_MAP_TYPE_PERF_EVENT_ARRAY
>

Acked-by: Andrii Nakryiko <[email protected]>


>  samples/bpf/xdp_monitor_kern.c     | 60 +++++++++++++++---------------
>  samples/bpf/xdp_sample_pkts_kern.c | 14 +++----
>  samples/bpf/xdp_sample_pkts_user.c |  1 -
>  3 files changed, 36 insertions(+), 39 deletions(-)
>

[...]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.