public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Vernet <void@manifault.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
	yhs@meta.com, john.fastabend@gmail.com, kpsingh@kernel.org,
	sdf@google.com, haoluo@google.com, jolsa@kernel.org,
	linux-kernel@vger.kernel.org, kernel-team@meta.com,
	memxor@gmail.com
Subject: Re: [PATCH bpf-next v2 3/3] bpf: Use BPF_KFUNC macro at all kfunc definitions
Date: Mon, 23 Jan 2023 13:01:23 -0600	[thread overview]
Message-ID: <Y87Zg1SEOwDmpwmx@maniforge.lan> (raw)
In-Reply-To: <20230123185434.ybfhrmbootcnjuoj@macbook-pro-6.dhcp.thefacebook.com>

On Mon, Jan 23, 2023 at 10:54:34AM -0800, Alexei Starovoitov wrote:
> On Mon, Jan 23, 2023 at 12:48:27PM -0600, David Vernet wrote:
> > On Mon, Jan 23, 2023 at 10:33:05AM -0800, Alexei Starovoitov wrote:
> > > On Mon, Jan 23, 2023 at 11:15:06AM -0600, David Vernet wrote:
> > > > -void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
> > > > +BPF_KFUNC(void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign))
> > > >  {
> > > >  	struct btf_struct_meta *meta = meta__ign;
> > > >  	u64 size = local_type_id__k;
> > > > @@ -1790,7 +1786,7 @@ void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
> > > >  	return p;
> > > >  }
> > > >  
> > > > -void bpf_obj_drop_impl(void *p__alloc, void *meta__ign)
> > > > +BPF_KFUNC(void bpf_obj_drop_impl(void *p__alloc, void *meta__ign))
> > > >  {
> > > 
> > > The following also works:
> > > -BPF_KFUNC(void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign))
> > > +BPF_KFUNC(
> > > +void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
> > > +)
> > > 
> > > and it looks little bit cleaner to me.
> > > 
> > > git grep -A1 BPF_KFUNC
> > > can still find all instances of kfuncs.
> > > 
> > > wdyt?
> > 
> > I'm fine with putting it on its own line if that's your preference.
> > Agreed that it might be a bit cleaner, especially for functions with the
> > return type on its own line, so we'd have e.g.:
> > 
> > BPF_KFUNC(
> > struct nf_conn *
> > bpf_skb_ct_lookup(struct __sk_buff *skb_ctx, struct bpf_sock_tuple *bpf_tuple,
> > 		  u32 tuple__sz, struct bpf_ct_opts *opts, u32 opts__sz)
> 
> Yeah. Especially for those.
> 
> > ) {
> > 
> > // ...
> > 
> > }
> > 
> > Note the presence of the { on the closing paren. Are you ok with that?
> > Otherwise I think it will look a bit odd:
> 
> Yep. Good idea. Either ){ or ) { look good to me.

Ack, will send v3 with that change later today, along with anything else
if someone else reviews.

> 
> > BPF_KFUNC(
> > struct nf_conn *
> > bpf_skb_ct_lookup(struct __sk_buff *skb_ctx, struct bpf_sock_tuple *bpf_tuple,
> > 		  u32 tuple__sz, struct bpf_ct_opts *opts, u32 opts__sz)
> > )
> > {
> > 
> > }
> > 
> > Thanks,
> > David

  reply	other threads:[~2023-01-23 19:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-23 17:15 [PATCH bpf-next v2 0/3] Add BPF_KFUNC macro for kfunc definitions David Vernet
2023-01-23 17:15 ` [PATCH bpf-next v2 1/3] bpf: Add BPF_KFUNC macro for defining kfuncs David Vernet
2023-01-23 17:15 ` [PATCH bpf-next v2 2/3] bpf: Document usage of the new BPF_KFUNC macro David Vernet
2023-01-23 17:15 ` [PATCH bpf-next v2 3/3] bpf: Use BPF_KFUNC macro at all kfunc definitions David Vernet
2023-01-23 18:33   ` Alexei Starovoitov
2023-01-23 18:48     ` David Vernet
2023-01-23 18:54       ` Alexei Starovoitov
2023-01-23 19:01         ` David Vernet [this message]
2023-01-23 19:04         ` Daniel Borkmann
2023-01-23 21:00           ` Jonathan Corbet
2023-01-24  0:54             ` David Vernet
2023-01-24 14:50               ` Jonathan Corbet
2023-01-24 16:20                 ` David Vernet
2023-01-31 15:15                   ` Alan Maguire
2023-01-31 15:44                     ` David Vernet
2023-01-31 17:30                       ` Alexei Starovoitov
2023-01-23 19:01   ` kernel test robot
2023-01-23 19:12   ` kernel test robot
2023-01-24  7:15   ` Christoph Hellwig
2023-01-24 14:15     ` David Vernet

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=Y87Zg1SEOwDmpwmx@maniforge.lan \
    --to=void@manifault.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=yhs@meta.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