netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: "Adrián Moreno" <amorenoz@redhat.com>
Cc: Aaron Conole <aconole@redhat.com>,
	netdev@vger.kernel.org, echaudro@redhat.com, i.maximets@ovn.org,
	dev@openvswitch.org, Donald Hunter <donald.hunter@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Pravin B Shelar <pshelar@ovn.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v7 05/10] net: openvswitch: add psample action
Date: Tue, 2 Jul 2024 10:37:26 +0100	[thread overview]
Message-ID: <20240702093726.GD598357@kernel.org> (raw)
In-Reply-To: <CAG=2xmOaMy2DVNfTOkh1sK+NR_gz+bXvKLg9YSp1t_K+sEUzJg@mail.gmail.com>

On Tue, Jul 02, 2024 at 03:05:02AM -0400, Adrián Moreno wrote:
> On Mon, Jul 01, 2024 at 02:23:12PM GMT, Aaron Conole wrote:
> > Adrian Moreno <amorenoz@redhat.com> writes:

...

> > > diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c

...

> > > @@ -1299,6 +1304,39 @@ static int execute_dec_ttl(struct sk_buff *skb, struct sw_flow_key *key)
> > >  	return 0;
> > >  }
> > >
> > > +#if IS_ENABLED(CONFIG_PSAMPLE)
> > > +static void execute_psample(struct datapath *dp, struct sk_buff *skb,
> > > +			    const struct nlattr *attr)
> > > +{
> > > +	struct psample_group psample_group = {};
> > > +	struct psample_metadata md = {};
> > > +	const struct nlattr *a;
> > > +	int rem;
> > > +
> > > +	nla_for_each_attr(a, nla_data(attr), nla_len(attr), rem) {
> > > +		switch (nla_type(a)) {
> > > +		case OVS_PSAMPLE_ATTR_GROUP:
> > > +			psample_group.group_num = nla_get_u32(a);
> > > +			break;
> > > +
> > > +		case OVS_PSAMPLE_ATTR_COOKIE:
> > > +			md.user_cookie = nla_data(a);
> > > +			md.user_cookie_len = nla_len(a);
> > > +			break;
> > > +		}
> > > +	}
> > > +
> > > +	psample_group.net = ovs_dp_get_net(dp);
> > > +	md.in_ifindex = OVS_CB(skb)->input_vport->dev->ifindex;
> > > +	md.trunc_size = skb->len - OVS_CB(skb)->cutlen;
> > > +
> > > +	psample_sample_packet(&psample_group, skb, 0, &md);
> > > +}
> > > +#else
> > > +static inline void execute_psample(struct datapath *dp, struct sk_buff *skb,
> > > +				   const struct nlattr *attr) {}
> >
> > I noticed that this got flagged in patchwork since it is 'static inline'
> > while being part of a complete translation unit - but I also see some
> > other places where that has been done.  I guess it should be just
> > 'static' though.  I don't feel very strongly about it.
> >
> 
> We had a bit of discussion about this with Ilya. It seems "static
> inline" is a common pattern around the kernel. The coding style
> documentation says:
> "Generally, inline functions are preferable to macros resembling functions."
> 
> So I think this "inline" is correct but I might be missing something.

Hi Adrián,

TL;DR: Please remove this inline keyword

For Kernel networking code at least it is strongly preferred not
to use inline in .c files unless there is a demonstrable - usually
performance - reason to do so. Rather, it is preferred to let the
compiler decide when to inline such functions. OTOH, the inline
keyword in .h files is fine.

...

  parent reply	other threads:[~2024-07-02  9:37 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-30 19:57 [PATCH net-next v7 00/10] net: openvswitch: Add sample multicasting Adrian Moreno
2024-06-30 19:57 ` [PATCH net-next v7 01/10] net: psample: add user cookie Adrian Moreno
2024-07-01 11:20   ` Michal Kubiak
2024-07-01 18:05   ` Aaron Conole
2024-06-30 19:57 ` [PATCH net-next v7 02/10] net: sched: act_sample: add action cookie to sample Adrian Moreno
2024-07-01 18:06   ` Aaron Conole
2024-06-30 19:57 ` [PATCH net-next v7 03/10] net: psample: skip packet copy if no listeners Adrian Moreno
2024-07-01 18:07   ` Aaron Conole
2024-06-30 19:57 ` [PATCH net-next v7 04/10] net: psample: allow using rate as probability Adrian Moreno
2024-07-01 18:10   ` Aaron Conole
2024-06-30 19:57 ` [PATCH net-next v7 05/10] net: openvswitch: add psample action Adrian Moreno
2024-07-01 11:40   ` Michal Kubiak
2024-07-01 12:56     ` Adrián Moreno
2024-07-02 11:10       ` Michal Kubiak
2024-07-01 18:13   ` Ilya Maximets
2024-07-01 18:23   ` Aaron Conole
2024-07-02  7:05     ` Adrián Moreno
2024-07-02  7:29       ` Adrián Moreno
2024-07-02  9:37       ` Simon Horman [this message]
2024-07-02  9:52         ` Adrián Moreno
2024-07-02  9:53         ` Ilya Maximets
2024-07-02 12:33           ` [ovs-dev] " Simon Horman
2024-07-02 18:37             ` Adrián Moreno
2024-07-02 18:06           ` Jakub Kicinski
2024-07-02 18:16             ` Ilya Maximets
2024-07-02 18:24               ` Jakub Kicinski
2024-07-02 18:52                 ` Ilya Maximets
2024-06-30 19:57 ` [PATCH net-next v7 06/10] net: openvswitch: store sampling probability in cb Adrian Moreno
2024-07-01 18:24   ` Aaron Conole
2024-06-30 19:57 ` [PATCH net-next v7 07/10] selftests: openvswitch: add psample action Adrian Moreno
2024-07-01 18:40   ` Aaron Conole
2024-06-30 19:57 ` [PATCH net-next v7 08/10] selftests: openvswitch: add userspace parsing Adrian Moreno
2024-06-30 19:57 ` [PATCH net-next v7 09/10] selftests: openvswitch: parse trunc action Adrian Moreno
2024-06-30 19:57 ` [PATCH net-next v7 10/10] selftests: openvswitch: add psample test Adrian Moreno
2024-07-01 18:34   ` Ilya Maximets
2024-07-01 18:38   ` Aaron Conole
2024-07-02  7:16     ` Adrián Moreno
2024-07-02 11:45       ` Aaron Conole

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=20240702093726.GD598357@kernel.org \
    --to=horms@kernel.org \
    --cc=aconole@redhat.com \
    --cc=amorenoz@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=donald.hunter@gmail.com \
    --cc=echaudro@redhat.com \
    --cc=edumazet@google.com \
    --cc=i.maximets@ovn.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pshelar@ovn.org \
    /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).