> On Fri, Jan 28, 2022 at 5:29 AM Lorenzo Bianconi <lorenzo@xxxxxxxxxx> wrote: > > > > Deprecate xdp_cpumap xdp_devmap sec definitions. > > Introduce xdp/devmap and xdp/cpumap definitions according to the standard > > for SEC("") in libbpf: > > - prog_type.prog_flags/attach_place > > Update cpumap/devmap samples and kselftests > > > > Signed-off-by: Lorenzo Bianconi <lorenzo@xxxxxxxxxx> > > --- > > Changes since v1: > > - refer to Libbpf-1.0-migration-guide in the warning rised by libbpf > > --- > > samples/bpf/xdp_redirect_cpu.bpf.c | 8 ++++---- > > samples/bpf/xdp_redirect_map.bpf.c | 2 +- > > samples/bpf/xdp_redirect_map_multi.bpf.c | 2 +- > > tools/lib/bpf/libbpf.c | 12 ++++++++++-- > > .../bpf/progs/test_xdp_with_cpumap_frags_helpers.c | 2 +- > > .../bpf/progs/test_xdp_with_cpumap_helpers.c | 2 +- > > .../bpf/progs/test_xdp_with_devmap_frags_helpers.c | 2 +- > > .../bpf/progs/test_xdp_with_devmap_helpers.c | 2 +- > > .../selftests/bpf/progs/xdp_redirect_multi_kern.c | 2 +- > > Please split samples/bpf, selftests/bpf, and libbpf changes into > separate patches. We keep them separate whenever possible. ack, I will do in v3. > > > 9 files changed, 21 insertions(+), 13 deletions(-) > > > > [...] > > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > > index 4ce94f4ed34a..ba003cabe4a4 100644 > > --- a/tools/lib/bpf/libbpf.c > > +++ b/tools/lib/bpf/libbpf.c > > @@ -237,6 +237,8 @@ enum sec_def_flags { > > SEC_SLOPPY_PFX = 16, > > /* BPF program support non-linear XDP buffer */ > > SEC_XDP_FRAGS = 32, > > + /* deprecated sec definitions not supposed to be used */ > > + SEC_DEPRECATED = 64, > > }; > > > > struct bpf_sec_def { > > @@ -6575,6 +6577,10 @@ static int libbpf_preload_prog(struct bpf_program *prog, > > if (prog->type == BPF_PROG_TYPE_XDP && (def & SEC_XDP_FRAGS)) > > opts->prog_flags |= BPF_F_XDP_HAS_FRAGS; > > > > + if (def & SEC_DEPRECATED) > > + pr_warn("sec '%s' is deprecated, please take a look at https://github.com/libbpf/libbpf/wiki/Libbpf-1.0-migration-guide\n", > > + prog->sec_name); > > + > > Please add a link directly to [0]. I just added a new section listing > xdp_devmap and xdp_cpumap. I also added SEC("classifier") -> > SEC("tc"), so let's mark SEC("classifier") as deprecated as well in > the next revision? ack, I will do. > > Daniel, does that sound reasonable to you or should we leave > SEC("classifier") intact? > > Let's use also the syntax consistent with the code people write. > Something like "SEC(\"%s\") is deprecated, please see > https://github.com/libbpf/libbpf/wiki/Libbpf-1.0-migration-guide#bpf-program-sec-annotation-deprecations > for details"? ack, I will do in v3. Regards, Lorenzo > > [0] https://github.com/libbpf/libbpf/wiki/Libbpf-1.0-migration-guide#bpf-program-sec-annotation-deprecations > > > if ((prog->type == BPF_PROG_TYPE_TRACING || > > prog->type == BPF_PROG_TYPE_LSM || > > prog->type == BPF_PROG_TYPE_EXT) && !prog->attach_btf_id) { > > @@ -8618,9 +8624,11 @@ static const struct bpf_sec_def section_defs[] = { > > SEC_DEF("iter.s/", TRACING, BPF_TRACE_ITER, SEC_ATTACH_BTF | SEC_SLEEPABLE, attach_iter), > > SEC_DEF("syscall", SYSCALL, 0, SEC_SLEEPABLE), > > SEC_DEF("xdp.frags/devmap", XDP, BPF_XDP_DEVMAP, SEC_XDP_FRAGS), > > - SEC_DEF("xdp_devmap/", XDP, BPF_XDP_DEVMAP, SEC_ATTACHABLE), > > + SEC_DEF("xdp/devmap", XDP, BPF_XDP_DEVMAP, SEC_ATTACHABLE), > > + SEC_DEF("xdp_devmap/", XDP, BPF_XDP_DEVMAP, SEC_ATTACHABLE | SEC_DEPRECATED), > > SEC_DEF("xdp.frags/cpumap", XDP, BPF_XDP_CPUMAP, SEC_XDP_FRAGS), > > - SEC_DEF("xdp_cpumap/", XDP, BPF_XDP_CPUMAP, SEC_ATTACHABLE), > > + SEC_DEF("xdp/cpumap", XDP, BPF_XDP_CPUMAP, SEC_ATTACHABLE), > > + SEC_DEF("xdp_cpumap/", XDP, BPF_XDP_CPUMAP, SEC_ATTACHABLE | SEC_DEPRECATED), > > SEC_DEF("xdp.frags", XDP, BPF_XDP, SEC_XDP_FRAGS), > > SEC_DEF("xdp", XDP, BPF_XDP, SEC_ATTACHABLE_OPT | SEC_SLOPPY_PFX), > > SEC_DEF("perf_event", PERF_EVENT, 0, SEC_NONE | SEC_SLOPPY_PFX), > > [...]
Attachment:
signature.asc
Description: PGP signature