bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Andrii Nakryiko <andrii@kernel.org>, bpf@vger.kernel.org, ast@kernel.org
Cc: kernel-team@fb.com
Subject: Re: [PATCH v3 bpf-next 2/9] selftests/bpf: normalize SEC("classifier") usage
Date: Mon, 27 Sep 2021 17:14:21 +0200	[thread overview]
Message-ID: <270e27b1-e5be-5b1c-b343-51bd644d0747@iogearbox.net> (raw)
In-Reply-To: <20210922234113.1965663-3-andrii@kernel.org>

On 9/23/21 1:41 AM, Andrii Nakryiko wrote:
> Convert all SEC("classifier*") uses to strict SEC("classifier") with no
> extra characters. In reference_tracking selftests also drop the usage of
> broken bpf_program__load(). Along the way switch from ambiguous searching by
> program title (section name) to non-ambiguous searching by name in some
> selftests, getting closer to completely removing
> bpf_object__find_program_by_title().
> 
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
[...]
> diff --git a/tools/testing/selftests/bpf/progs/test_tc_peer.c b/tools/testing/selftests/bpf/progs/test_tc_peer.c
> index fe818cd5f010..7d0256d7db82 100644
> --- a/tools/testing/selftests/bpf/progs/test_tc_peer.c
> +++ b/tools/testing/selftests/bpf/progs/test_tc_peer.c
> @@ -16,31 +16,31 @@ volatile const __u32 IFINDEX_DST;
>   static const __u8 src_mac[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
>   static const __u8 dst_mac[] = {0x00, 0x22, 0x33, 0x44, 0x55, 0x66};
>   
> -SEC("classifier/chk_egress")
> +SEC("classifier")

Can be a follow-up, but lets just deprecate the whole "classifier" terminology
for libbpf since tc BPF programs do significantly more than just that since long
time and it's otherwise just a confusing UX. The whole "classifier" / "action"
terminology is just remains from legacy tc. See also libbpf.h's 'TC related API'
where there is no notion of "classifier". Given you have SEC("xdp"), lets name
all these in here SEC("tc"), and for compat we can keep the old "classifier" name
as a hidden option in libbpf if we have to.

>   int tc_chk(struct __sk_buff *skb)
>   {
>   	return TC_ACT_SHOT;
>   }
>   
> -SEC("classifier/dst_ingress")
> +SEC("classifier")
>   int tc_dst(struct __sk_buff *skb)
>   {
>   	return bpf_redirect_peer(IFINDEX_SRC, 0);
>   }
>   
> -SEC("classifier/src_ingress")
> +SEC("classifier")
>   int tc_src(struct __sk_buff *skb)
>   {
>   	return bpf_redirect_peer(IFINDEX_DST, 0);
>   }
>   
> -SEC("classifier/dst_ingress_l3")
> +SEC("classifier")
>   int tc_dst_l3(struct __sk_buff *skb)
>   {
>   	return bpf_redirect(IFINDEX_SRC, 0);
>   }
>   
> -SEC("classifier/src_ingress_l3")
> +SEC("classifier")
>   int tc_src_l3(struct __sk_buff *skb)
>   {
>   	__u16 proto = skb->protocol;
> 


  parent reply	other threads:[~2021-09-27 15:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 23:41 [PATCH v3 bpf-next 0/9] libbpf: stricter BPF program section name handling Andrii Nakryiko
2021-09-22 23:41 ` [PATCH v3 bpf-next 1/9] selftests/bpf: normalize XDP section names in selftests Andrii Nakryiko
2021-09-22 23:41 ` [PATCH v3 bpf-next 2/9] selftests/bpf: normalize SEC("classifier") usage Andrii Nakryiko
2021-09-23 16:52   ` Dave Marchevsky
2021-09-27 15:14   ` Daniel Borkmann [this message]
2021-09-27 16:12     ` Alexei Starovoitov
2021-09-28  1:53       ` Andrii Nakryiko
2021-09-22 23:41 ` [PATCH v3 bpf-next 3/9] selftests/bpf: normalize all the rest SEC() uses Andrii Nakryiko
2021-09-22 23:41 ` [PATCH v3 bpf-next 4/9] libbpf: refactor internal sec_def handling to enable pluggability Andrii Nakryiko
2021-09-22 23:41 ` [PATCH v3 bpf-next 5/9] libbpf: reduce reliance of attach_fns on sec_def internals Andrii Nakryiko
2021-09-22 23:41 ` [PATCH v3 bpf-next 6/9] libbpf: refactor ELF section handler definitions Andrii Nakryiko
2021-09-23 17:21   ` Dave Marchevsky
2021-09-22 23:41 ` [PATCH v3 bpf-next 7/9] libbpf: complete SEC() table unification for BPF_APROG_SEC/BPF_EAPROG_SEC Andrii Nakryiko
2021-09-23 20:41   ` Dave Marchevsky
2021-09-22 23:41 ` [PATCH v3 bpf-next 8/9] libbpf: add opt-in strict BPF program section name handling logic Andrii Nakryiko
2021-09-23 16:43   ` Dave Marchevsky
2021-09-22 23:41 ` [PATCH v3 bpf-next 9/9] selftests/bpf: switch sk_lookup selftests to strict SEC("sk_lookup") use 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=270e27b1-e5be-5b1c-b343-51bd644d0747@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@fb.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;
as well as URLs for NNTP newsgroup(s).