All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: netdev@vger.kernel.org
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Subject: Re: [PATCH v2 1/2] bpf: remove struct bpf_prog_type_list
Date: Fri, 07 Apr 2017 21:03:15 +0200	[thread overview]
Message-ID: <1491591795.5800.3.camel@sipsolutions.net> (raw)
In-Reply-To: <20170407190008.32632-1-johannes@sipsolutions.net> (sfid-20170407_210037_465123_47EA385C)

So two things about this, and they apply to the other patch as well:

> +extern const struct bpf_verifier_ops sk_filter_prog_ops;
> +extern const struct bpf_verifier_ops tc_cls_act_prog_ops;
> +extern const struct bpf_verifier_ops xdp_prog_ops;
> +extern const struct bpf_verifier_ops cg_skb_prog_ops;
> +extern const struct bpf_verifier_ops cg_sock_prog_ops;
> +extern const struct bpf_verifier_ops lwt_inout_prog_ops;
> +extern const struct bpf_verifier_ops lwt_xmit_prog_ops;
> +extern const struct bpf_verifier_ops kprobe_prog_ops;
> +extern const struct bpf_verifier_ops tracepoint_prog_ops;
> +extern const struct bpf_verifier_ops perf_event_prog_ops;

I'm not super happy with having to list it here - and maybe I should
add ifdefs here as well.

+static const struct bpf_verifier_ops * const bpf_prog_types[] = {
> +#ifdef CONFIG_NET
> +	[BPF_PROG_TYPE_SOCKET_FILTER] = &sk_filter_prog_ops,
> +	[BPF_PROG_TYPE_SCHED_CLS] = &tc_cls_act_prog_ops,
> +	[BPF_PROG_TYPE_SCHED_ACT] = &tc_cls_act_prog_ops,
> +	[BPF_PROG_TYPE_XDP] = &xdp_prog_ops,
> +	[BPF_PROG_TYPE_CGROUP_SKB] = &cg_skb_prog_ops,
> +	[BPF_PROG_TYPE_CGROUP_SOCK] = &cg_sock_prog_ops,
> +	[BPF_PROG_TYPE_LWT_IN] = &lwt_inout_prog_ops,
> +	[BPF_PROG_TYPE_LWT_OUT] = &lwt_inout_prog_ops,
> +	[BPF_PROG_TYPE_LWT_XMIT] = &lwt_xmit_prog_ops,
> +#endif
> +#ifdef CONFIG_BPF_EVENTS
> +	[BPF_PROG_TYPE_KPROBE] = &kprobe_prog_ops,
> +	[BPF_PROG_TYPE_TRACEPOINT] = &tracepoint_prog_ops,
> +	[BPF_PROG_TYPE_PERF_EVENT] = &perf_event_prog_ops,
> +#endif

And here I list it again.

Something I considered was to add the prog_type to the ops struct, and
use the linker (putting this into a special section) to assemble an
array. But that
 * makes the lwt_inout_prog_ops that are shared not work without
   duplicating
 * requires more complicated search code

This seems optimal for the resulting binary, but it's a bunch more
typing.

johannes

  parent reply	other threads:[~2017-04-07 19:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 19:00 [PATCH v2 1/2] bpf: remove struct bpf_prog_type_list Johannes Berg
2017-04-07 19:00 ` [PATCH v2 2/2] bpf: remove struct bpf_map_type_list Johannes Berg
2017-04-07 19:03 ` Johannes Berg [this message]
2017-04-10  1:22 ` [PATCH v2 1/2] bpf: remove struct bpf_prog_type_list David Miller
2017-04-10  2:23   ` Alexei Starovoitov
2017-04-10  5:42     ` Johannes Berg

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=1491591795.5800.3.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=alexei.starovoitov@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.