netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Andrii Nakryiko <andriin@fb.com>, bpf <bpf@vger.kernel.org>,
	Networking <netdev@vger.kernel.org>,
	Alexei Starovoitov <ast@fb.com>,
	Quentin Monnet <quentin.monnet@netronome.com>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v4 bpf-next 1/3] uapi/bpf: fix helper docs
Date: Fri, 11 Oct 2019 01:55:21 +0200	[thread overview]
Message-ID: <20191010235521.GC20202@pc-63.home> (raw)
In-Reply-To: <CAEf4Bza=p1uiV0mHvzrbisSYS1s2Gnx4S2109eGjtP0Vhr_mbg@mail.gmail.com>

On Tue, Oct 08, 2019 at 04:32:01PM -0700, Andrii Nakryiko wrote:
> On Tue, Oct 8, 2019 at 2:49 PM Daniel Borkmann <daniel@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 <daniel@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 <andriin@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?

Yes, definitely.

Thanks,
Daniel

  reply	other threads:[~2019-10-10 23:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07  3:07 [PATCH v4 bpf-next 0/3] Auto-generate list of BPF helpers Andrii Nakryiko
2019-10-07  3:07 ` [PATCH v4 bpf-next 1/3] uapi/bpf: fix helper docs Andrii Nakryiko
2019-10-07  9:43   ` Daniel Borkmann
2019-10-07 17:47     ` Andrii Nakryiko
2019-10-08 21:49       ` Daniel Borkmann
2019-10-08 23:32         ` Andrii Nakryiko
2019-10-10 23:55           ` Daniel Borkmann [this message]
2019-10-07  3:07 ` [PATCH v4 bpf-next 2/3] scripts/bpf: teach bpf_helpers_doc.py to dump BPF helper definitions Andrii Nakryiko
2019-10-07  3:07 ` [PATCH v4 bpf-next 3/3] libbpf: auto-generate list of " Andrii Nakryiko
2019-10-07  5:35 ` [PATCH v4 bpf-next 0/3] Auto-generate list of BPF helpers Alexei Starovoitov

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=20191010235521.GC20202@pc-63.home \
    --to=daniel@iogearbox.net \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andriin@fb.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=quentin.monnet@netronome.com \
    /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).