On Tue, Oct 8, 2019 at 2:49 PM Daniel Borkmann <dan...@iogearbox.net> wrote:
>
> On Mon, Oct 07, 2019 at 10:47:19AM -0700, Andrii Nakryiko wrote:
> > On Mon, Oct 7, 2019 at 2:43 AM Daniel Borkmann <dan...@iogearbox.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 <andr...@fb.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.

Ok, I can create a follow-up clean up patch changing all of them to
void *. There is also a weird singular case of having three
declarations of bpf_get_socket_cookie() with different contexts. I
assume I should just combine them into a single
declaration/description, right?

>
> Thanks,
> Daniel

Reply via email to