[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170409.182236.865920818973965236.davem@davemloft.net>
Date: Sun, 09 Apr 2017 18:22:36 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: johannes@...solutions.net
Cc: netdev@...r.kernel.org, alexei.starovoitov@...il.com,
johannes.berg@...el.com
Subject: Re: [PATCH v2 1/2] bpf: remove struct bpf_prog_type_list
From: Johannes Berg <johannes@...solutions.net>
Date: Fri, 7 Apr 2017 21:00:07 +0200
> From: Johannes Berg <johannes.berg@...el.com>
>
> There's no need to have struct bpf_prog_type_list since
> it just contains a list_head, the type, and the ops
> pointer. Since the types are densely packed and not
> actually dynamically registered, it's much easier and
> smaller to have an array of type->ops pointer. Also
> initialize this array statically to remove code needed
> to initialize it.
>
> Signed-off-by: Johannes Berg <johannes.berg@...el.com>
If you just don't want to list things multiple times how about:
linux/bpf_verifiers.h:
BPF_VERIFIER(BPF_PROG_TYPE_SOCKET_FILTER, sk_filter_prog_ops)
BPF_VERIFIER(BPF_PROG_TYPE_SCHED_CLS, tc_cls_prog_ops)
...
Then in bpf.h:
#define BPF_VERIFIER(TYPE_VAL, SYM) extern const struct bpf_verifier_ops SYM;
#include <linux/bpf_verifiers.h"
and in kernel/bpf/syscall.c:
#define BPF_VERIFIER(TYPE_VAL, SYM) [TYPE_VAL] = &SYM,
#include <linux/bpf_verifiers.h"
or something like that.
Maybe there is some even more straightforward way to do this without
using sections or anything like that, which we can't see right now :)
Powered by blists - more mailing lists