From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: "Toke Høiland-Jørgensen" <toke@redhat.com>,
bpf <bpf@vger.kernel.org>, "Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"David Ahern" <dsahern@kernel.org>,
"Jesper Dangaard Brouer" <brouer@redhat.com>,
"Lorenzo Bianconi" <lorenzo.bianconi@redhat.com>,
"Andrii Nakryiko" <andrii@kernel.org>,
"john fastabend" <john.fastabend@gmail.com>
Subject: Re: [PATCH bpf-next] libbpf: deprecate xdp_cpumap and xdp_devmap sec definitions
Date: Thu, 27 Jan 2022 18:24:16 +0100 [thread overview]
Message-ID: <YfLVQAbbR+dcZfii@lore-desk> (raw)
In-Reply-To: <CAEf4BzYOZ6fi_SSgJmWRD7TM44w71L_+QPv9H13OCA08f9RHww@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4978 bytes --]
> On Thu, Jan 27, 2022 at 7:37 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> >
> > Lorenzo Bianconi <lorenzo@kernel.org> writes:
> >
> > > 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@kernel.org>
> > > ---
> > > 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 +-
> > > 9 files changed, 21 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/samples/bpf/xdp_redirect_cpu.bpf.c b/samples/bpf/xdp_redirect_cpu.bpf.c
> > > index 25e3a405375f..87c54bfdbb70 100644
> > > --- a/samples/bpf/xdp_redirect_cpu.bpf.c
> > > +++ b/samples/bpf/xdp_redirect_cpu.bpf.c
> > > @@ -491,7 +491,7 @@ int xdp_prognum5_lb_hash_ip_pairs(struct xdp_md *ctx)
> > > return bpf_redirect_map(&cpu_map, cpu_dest, 0);
> > > }
> > >
> > > -SEC("xdp_cpumap/redirect")
> > > +SEC("xdp/cpumap")
> > > int xdp_redirect_cpu_devmap(struct xdp_md *ctx)
> > > {
> > > void *data_end = (void *)(long)ctx->data_end;
> > > @@ -507,19 +507,19 @@ int xdp_redirect_cpu_devmap(struct xdp_md *ctx)
> > > return bpf_redirect_map(&tx_port, 0, 0);
> > > }
> > >
> > > -SEC("xdp_cpumap/pass")
> > > +SEC("xdp/cpumap")
> > > int xdp_redirect_cpu_pass(struct xdp_md *ctx)
> > > {
> > > return XDP_PASS;
> > > }
> > >
> > > -SEC("xdp_cpumap/drop")
> > > +SEC("xdp/cpumap")
> > > int xdp_redirect_cpu_drop(struct xdp_md *ctx)
> > > {
> > > return XDP_DROP;
> > > }
> > >
> > > -SEC("xdp_devmap/egress")
> > > +SEC("xdp/devmap")
> > > int xdp_redirect_egress_prog(struct xdp_md *ctx)
> > > {
> > > void *data_end = (void *)(long)ctx->data_end;
> > > diff --git a/samples/bpf/xdp_redirect_map.bpf.c b/samples/bpf/xdp_redirect_map.bpf.c
> > > index 59efd656e1b2..415bac1758e3 100644
> > > --- a/samples/bpf/xdp_redirect_map.bpf.c
> > > +++ b/samples/bpf/xdp_redirect_map.bpf.c
> > > @@ -68,7 +68,7 @@ int xdp_redirect_map_native(struct xdp_md *ctx)
> > > return xdp_redirect_map(ctx, &tx_port_native);
> > > }
> > >
> > > -SEC("xdp_devmap/egress")
> > > +SEC("xdp/devmap")
> > > int xdp_redirect_map_egress(struct xdp_md *ctx)
> > > {
> > > void *data_end = (void *)(long)ctx->data_end;
> > > diff --git a/samples/bpf/xdp_redirect_map_multi.bpf.c b/samples/bpf/xdp_redirect_map_multi.bpf.c
> > > index bb0a5a3bfcf0..8b2fd4ec2c76 100644
> > > --- a/samples/bpf/xdp_redirect_map_multi.bpf.c
> > > +++ b/samples/bpf/xdp_redirect_map_multi.bpf.c
> > > @@ -53,7 +53,7 @@ int xdp_redirect_map_native(struct xdp_md *ctx)
> > > return xdp_redirect_map(ctx, &forward_map_native);
> > > }
> > >
> > > -SEC("xdp_devmap/egress")
> > > +SEC("xdp/devmap")
> > > int xdp_devmap_prog(struct xdp_md *ctx)
> > > {
> > > void *data_end = (void *)(long)ctx->data_end;
> > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > > index 4ce94f4ed34a..1d97bc346be6 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 use new version instead\n",
> > > + prog->sec_name);
> > > +
> >
> > How is the user supposed to figure out what "the new version" is?
>
>
> Let's add the section to
> https://github.com/libbpf/libbpf/wiki/Libbpf-1.0-migration-guide and
> link to it from the deprecation warning.
so, is it better to add an utility routine to map the deprecated sec_name to
the new one, or is it enough to add a section in Libbpf-1.0-migration-guide?
I am fine both ways.
Regards,
Lorenzo
>
> >
> > -Toke
> >
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2022-01-27 17:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 12:12 [PATCH bpf-next] libbpf: deprecate xdp_cpumap and xdp_devmap sec definitions Lorenzo Bianconi
2022-01-27 15:37 ` Toke Høiland-Jørgensen
2022-01-27 17:08 ` Andrii Nakryiko
2022-01-27 17:24 ` Lorenzo Bianconi [this message]
2022-02-01 0:53 ` Andrii Nakryiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YfLVQAbbR+dcZfii@lore-desk \
--to=lorenzo@kernel.org \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=dsahern@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=lorenzo.bianconi@redhat.com \
--cc=toke@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox