Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Dave Marchevsky <davemarchevsky@fb.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>
Subject: Re: [PATCH bpf-next 1/1] bpf: migrate cgroup_bpf to internal cgroup_bpf_attach_type enum
Date: Tue, 10 Aug 2021 13:51:18 +0200 [thread overview]
Message-ID: <9883d0ca-df89-5bca-aa94-67fb4e620ac2@iogearbox.net> (raw)
In-Reply-To: <CAEf4BzYJanf4gCmeeNHZhjJeUwwOQOCteCP4Uoj3yRD698BJCg@mail.gmail.com>
On 8/2/21 11:35 PM, Andrii Nakryiko wrote:
> On Sat, Jul 31, 2021 at 4:33 PM Dave Marchevsky <davemarchevsky@fb.com> wrote:
[...]
>
>> #define BPF_CGROUP_RUN_PROG_INET_SOCK(sk) \
>> - BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET_SOCK_CREATE)
>> + BPF_CGROUP_RUN_SK_PROG(sk, CG_BPF_CGROUP_INET_SOCK_CREATE)
>>
>> #define BPF_CGROUP_RUN_PROG_INET_SOCK_RELEASE(sk) \
>> - BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET_SOCK_RELEASE)
>> + BPF_CGROUP_RUN_SK_PROG(sk, CG_BPF_CGROUP_INET_SOCK_RELEASE)
>>
>> #define BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk) \
>> - BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET4_POST_BIND)
>> + BPF_CGROUP_RUN_SK_PROG(sk, CG_BPF_CGROUP_INET4_POST_BIND)
>>
>> #define BPF_CGROUP_RUN_PROG_INET6_POST_BIND(sk) \
>> - BPF_CGROUP_RUN_SK_PROG(sk, BPF_CGROUP_INET6_POST_BIND)
>> + BPF_CGROUP_RUN_SK_PROG(sk, CG_BPF_CGROUP_INET6_POST_BIND)
>>
>
> all these macros are candidate for a rewrite to proper (always
> inlined) functions, similarly to what I did in [0]. It would make it
> much harder to accidentally use wrong constant and will make typing
> explicit. But let's see how that change goes first.
Fully agree, this has grown into a horrible mess over time, would be nice
to have this refactored and cleaned up. :/
> [0] https://patchwork.kernel.org/project/netdevbpf/patch/20210730053413.1090371-3-andrii@kernel.org/
>
>> -#define BPF_CGROUP_RUN_SA_PROG(sk, uaddr, type) \
>> +#define BPF_CGROUP_RUN_SA_PROG(sk, uaddr, atype) \
>> ({ \
>> u32 __unused_flags; \
>> int __ret = 0; \
>> - if (cgroup_bpf_enabled(type)) \
>> - __ret = __cgroup_bpf_run_filter_sock_addr(sk, uaddr, type, \
>> + if (cgroup_bpf_enabled(atype)) \
>> + __ret = __cgroup_bpf_run_filter_sock_addr(sk, uaddr, atype, \
>> NULL, \
>> &__unused_flags); \
>> __ret; \
>> })
>>
>
> [...]
>
next prev parent reply other threads:[~2021-08-10 11:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210731233056.850105-1-davemarchevsky@fb.com>
[not found] ` <20210731233056.850105-2-davemarchevsky@fb.com>
2021-08-02 21:35 ` Andrii Nakryiko
2021-08-10 11:51 ` Daniel Borkmann [this message]
2021-08-10 11:48 ` Daniel Borkmann
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=9883d0ca-df89-5bca-aa94-67fb4e620ac2@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davemarchevsky@fb.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
--subject='Re: [PATCH bpf-next 1/1] bpf: migrate cgroup_bpf to internal cgroup_bpf_attach_type enum' \
/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
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).