[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191008214937.GH27307@pc-66.home>
Date: Tue, 8 Oct 2019 23:49:37 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...com>,
Quentin Monnet <quentin.monnet@...ronome.com>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v4 bpf-next 1/3] uapi/bpf: fix helper docs
On Mon, Oct 07, 2019 at 10:47:19AM -0700, Andrii Nakryiko wrote:
> On Mon, Oct 7, 2019 at 2:43 AM Daniel Borkmann <daniel@...earbox.net> wrote:
> > On Sun, Oct 06, 2019 at 08:07:36PM -0700, Andrii Nakryiko wrote:
> > > Various small fixes to BPF helper documentation comments, enabling
> > > automatic header generation with a list of BPF helpers.
> > >
> > > Signed-off-by: Andrii Nakryiko <andriin@...com>
[...]
> > I'm wondering whether it would simply be much better to always just use 'void *ctx'
> > for everything that is BPF context as it may be just confusing to people why different
> > types are chosen sometimes leading to buggy drive-by attempts to 'fix' them back into
> > struct sk_buff * et al.
>
> I'm impartial on this issue. In some cases it might be helpful to
> specify what is the expected type of the context, if it's only ever
> one type, but there are lots of helpers that accept various contexts,
> so for consistency its better to just have "void *context".
I would favor consistency here to always have "void *context". One
additional issue I could see happening otherwise on top of the 'fix'
attempts is that if existing helpers get enabled for multiple program
types and these have different BPF context, then it might be quite
easy to forget converting struct __sk_buff * and whatnot to void * in
the helper API doc, so the auto-generated BPF helpers will continue
to have only the old type.
Thanks,
Daniel
Powered by blists - more mailing lists