lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 9 Sep 2020 02:38:26 +0900 From: "Daniel T. Lee" <danieltimlee@...il.com> To: Andrii Nakryiko <andrii.nakryiko@...il.com> Cc: Daniel Borkmann <daniel@...earbox.net>, Alexei Starovoitov <ast@...nel.org>, Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org> Subject: Re: [PATCH bpf-next] samples: bpf: refactor xdp_sample_pkts_kern with BTF-defined map On Wed, Sep 9, 2020 at 8:24 AM Andrii Nakryiko <andrii.nakryiko@...il.com> wrote: > > On Sat, Sep 5, 2020 at 8:41 AM Daniel T. Lee <danieltimlee@...il.com> wrote: > > > > Most of the samples were converted to use the new BTF-defined MAP as > > they moved to libbbpf, but some of the samples were missing. > > > > Instead of using the previous BPF MAP definition, this commit refactors > > xdp_sample_pkts_kern MAP definition with the new BTF-defined MAP format. > > > > Signed-off-by: Daniel T. Lee <danieltimlee@...il.com> > > --- > > samples/bpf/xdp_sample_pkts_kern.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/samples/bpf/xdp_sample_pkts_kern.c b/samples/bpf/xdp_sample_pkts_kern.c > > index 33377289e2a8..b15172b7d455 100644 > > --- a/samples/bpf/xdp_sample_pkts_kern.c > > +++ b/samples/bpf/xdp_sample_pkts_kern.c > > @@ -7,12 +7,12 @@ > > #define SAMPLE_SIZE 64ul > > #define MAX_CPUS 128 > > > > -struct bpf_map_def SEC("maps") my_map = { > > - .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, > > - .key_size = sizeof(int), > > - .value_size = sizeof(u32), > > - .max_entries = MAX_CPUS, > > -}; > > +struct { > > + __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); > > + __uint(key_size, sizeof(int)); > > + __uint(value_size, sizeof(u32)); > > + __uint(max_entries, MAX_CPUS); > > if you drop max_entries property, libbpf will set it to the maximum > configured number of CPUs on the host, which is what you probably > want. Do you might sending v2 without MAX_CPUS (check if macro is > still used anywhere else). Thanks! > Thanks for your time and effort for the review. I'll check and send the next version of patch. > > +} my_map SEC(".maps"); > > > > SEC("xdp_sample") > > int xdp_sample_prog(struct xdp_md *ctx) > > -- > > 2.25.1 > > -- Best, Daniel T. Lee
Powered by blists - more mailing lists