From: Alexei Starovoitov <ast@plumgrid.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: "Jiří Pírko" <jiri@resnulli.us>,
"Network Development" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 6/7] ebpf: remove CONFIG_BPF_SYSCALL ifdefs in socket filter code
Date: Tue, 10 Feb 2015 17:51:14 -0800 [thread overview]
Message-ID: <CAMEtUuzruMSO7zwhYLfVdO0=YN_dJ+pLAoEg_pCVT8FT=DRz_Q@mail.gmail.com> (raw)
On Tue, Feb 10, 2015 at 4:15 PM, Daniel Borkmann <daniel@iogearbox.net> wrote:
> Socket filter code and other subsystems with upcoming eBPF support
> should not need to deal with the fact that we have CONFIG_BPF_SYSCALL
> defined or not. Having the bpf syscall as a config option is a nice
> thing and I'd expect it to stay that way for expert users (I presume
> one day the default setting of it might change, though), but code
> making use of it should not care if it's actually enabled or not.
> Instead, hide this via header files and let the rest deal with it.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> ---
> include/linux/bpf.h | 27 +++++++--
> net/core/filter.c | 166 ++++++++++++++++++++++++----------------------------
> 2 files changed, 100 insertions(+), 93 deletions(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index 4fe1bd3..def0103 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -114,9 +114,6 @@ struct bpf_prog_type_list {
> enum bpf_prog_type type;
> };
>
> -int bpf_register_prog_type(struct bpf_prog_type_list *tl);
> -void bpf_unregister_prog_type(struct bpf_prog_type_list *tl);
> -
> struct bpf_prog;
>
> struct bpf_prog_aux {
> @@ -130,11 +127,31 @@ struct bpf_prog_aux {
> };
>
> #ifdef CONFIG_BPF_SYSCALL
> +int bpf_register_prog_type(struct bpf_prog_type_list *tl);
> +void bpf_unregister_prog_type(struct bpf_prog_type_list *tl);
> +
> void bpf_prog_put(struct bpf_prog *prog);
> +struct bpf_prog *bpf_prog_get(u32 ufd);
> #else
> -static inline void bpf_prog_put(struct bpf_prog *prog) {}
> +static inline int bpf_register_prog_type(struct bpf_prog_type_list *tl)
> +{
> + return 0;
> +}
> +
> +static inline void bpf_unregister_prog_type(struct bpf_prog_type_list *tl)
> +{
> +}
> +
> +static inline struct bpf_prog *bpf_prog_get(u32 ufd)
> +{
> + return ERR_PTR(-EOPNOTSUPP);
> +}
> +
> +static inline void bpf_prog_put(struct bpf_prog *prog)
> +{
> +}
> #endif
> -struct bpf_prog *bpf_prog_get(u32 ufd);
makes sense. I have similar change for bpf+tracing.
> -#ifdef CONFIG_BPF_SYSCALL
> -int sk_attach_bpf(u32 ufd, struct sock *sk)
> -{
> - struct sk_filter *fp, *old_fp;
> - struct bpf_prog *prog;
why move the functions inside filter.c ?
couldn't we just remove two lines with #ifdef/endif ?
next reply other threads:[~2015-02-11 1:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 1:51 Alexei Starovoitov [this message]
2015-02-12 20:09 ` [PATCH net-next 6/7] ebpf: remove CONFIG_BPF_SYSCALL ifdefs in socket filter code Daniel Borkmann
-- strict thread matches above, loose matches on Subject: below --
2015-02-11 0:15 [RFC PATCH net-next 0/7] eBPF support for cls_bpf Daniel Borkmann
2015-02-11 0:15 ` [PATCH net-next 6/7] ebpf: remove CONFIG_BPF_SYSCALL ifdefs in socket filter code 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='CAMEtUuzruMSO7zwhYLfVdO0=YN_dJ+pLAoEg_pCVT8FT=DRz_Q@mail.gmail.com' \
--to=ast@plumgrid.com \
--cc=daniel@iogearbox.net \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
/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).