All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@savoirfairelinux.com,
	"David S. Miller" <davem@davemloft.net>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code
Date: Tue, 30 May 2017 17:01:44 +0200	[thread overview]
Message-ID: <20170530150144.GC22758@lunn.ch> (raw)
In-Reply-To: <20170530142131.23568-2-vivien.didelot@savoirfairelinux.com>

On Tue, May 30, 2017 at 10:21:25AM -0400, Vivien Didelot wrote:
> Hide the implementation of dsa_uses_tagged_protocol in dsa.c since this
> helper will be extended to access the opaque dsa_device_ops structure.
> 
> At the same time, fix the checkpatch comparison check:
> 
>     CHECK: Comparison to NULL could be written "dst->rcv"
>     #41: FILE: net/dsa/dsa.c:32:
>     +	return dst->rcv != NULL;
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
>  include/net/dsa.h | 5 +----
>  net/dsa/dsa.c     | 5 +++++
>  2 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index c0e567c0c824..cb5d668b265d 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -464,10 +464,7 @@ struct mii_bus *dsa_host_dev_to_mii_bus(struct device *dev);
>  
>  struct net_device *dsa_dev_to_net_device(struct device *dev);
>  
> -static inline bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
> -{
> -	return dst->rcv != NULL;
> -}
> +bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst);
>  
>  static inline bool netdev_uses_dsa(struct net_device *dev)
>  {
> diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
> index 3288a80d4d6c..7a8a0358299b 100644
> --- a/net/dsa/dsa.c
> +++ b/net/dsa/dsa.c
> @@ -27,6 +27,11 @@
>  
>  #include "dsa_priv.h"
>  
> +bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
> +{
> +	return !!dst->rcv;
> +}
> +

Hi Vivien

You need to be careful here. This is in the hot path. Every frame
received uses this code. And think about a distro kernel, which might
have DSA enabled by default, yet is unlikely to have any switches. You
are adding a function call which can be called millions of times per
second....

     Andrew

  reply	other threads:[~2017-05-30 15:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 14:21 [PATCH net-next 0/7] net: dsa: tagger simplification Vivien Didelot
2017-05-30 14:21 ` [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code Vivien Didelot
2017-05-30 15:01   ` Andrew Lunn [this message]
2017-05-30 15:09     ` David Miller
2017-05-30 15:56       ` Vivien Didelot
2017-05-30 16:12         ` Andrew Lunn
2017-05-30 16:14           ` Vivien Didelot
2017-05-30 21:08   ` kbuild test robot
2017-05-30 14:21 ` [PATCH net-next 2/7] net: dsa: remove useless rcv copy in DSA tree Vivien Didelot
2017-05-30 15:05   ` Andrew Lunn
2017-05-30 15:09     ` David Miller
2017-05-30 14:21 ` [PATCH net-next 3/7] net: dsa: remove unused arguments of tagger rcv Vivien Didelot
2017-05-30 15:13   ` Andrew Lunn
2017-05-30 14:21 ` [PATCH net-next 4/7] net: dsa: free orig skb on rcv if reallocated Vivien Didelot
2017-05-30 15:25   ` Andrew Lunn
2017-05-30 15:41     ` Vivien Didelot
2017-05-30 16:26       ` Andrew Lunn
2017-05-30 14:21 ` [PATCH net-next 5/7] net: dsa: remove useless goto label in tagger rcv Vivien Didelot
2017-05-30 14:21 ` [PATCH net-next 6/7] net: dsa: remove useless copy of tagger xmit Vivien Didelot
2017-05-30 15:29   ` Andrew Lunn
2017-05-30 15:43     ` Vivien Didelot
2017-05-30 14:21 ` [PATCH net-next 7/7] net: dsa: factor skb freeing on xmit Vivien Didelot
2017-05-30 15:37   ` Andrew Lunn
2017-05-30 15:08 ` [PATCH net-next 0/7] net: dsa: tagger simplification Andrew Lunn

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=20170530150144.GC22758@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.