netdev.vger.kernel.org archive mirror
 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 3/4] net: dsa: change dsa_ptr for a dsa_master
Date: Sat, 2 Sep 2017 17:30:08 +0200	[thread overview]
Message-ID: <20170902153008.GA21003@lunn.ch> (raw)
In-Reply-To: <20170831183746.2109-4-vivien.didelot@savoirfairelinux.com>

Hi Vivien


> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index f4a5afc4255b..d5b24cd10f79 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -130,11 +130,6 @@ struct dsa_switch_tree {
>  	 */
>  	struct dsa_platform_data	*pd;
>  
> -	/* Copy of tag_ops->rcv for faster access in hot path */
> -	struct sk_buff *	(*rcv)(struct sk_buff *skb,
> -				       struct net_device *dev,
> -				       struct packet_type *pt);
> -
>  	/*
>  	 * The switch port to which the CPU is attached.
>  	 */


> diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c
> index fbf9ca954773..7897bbd1a110 100644
> --- a/net/dsa/tag_dsa.c
> +++ b/net/dsa/tag_dsa.c
> @@ -67,7 +67,8 @@ static struct sk_buff *dsa_xmit(struct sk_buff *skb, struct net_device *dev)
>  static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev,
>  			       struct packet_type *pt)
>  {
> -	struct dsa_switch_tree *dst = dev->dsa_ptr;
> +	struct dsa_master *master = dev->dsa_ptr;
> +	struct dsa_switch_tree *dst = master->port->ds->dst;

This is on the hot path. Every frame received comes through here. We
have gone from one dereference to 4 dereference. That is going to
impact performance. 

How about keeping a copy of dst and ds in master?

    Andrew

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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31 18:37 [PATCH net-next 0/4] net: dsa: add master interface Vivien Didelot
2017-08-31 18:37 ` [PATCH net-next 1/4] net: dsa: introduce dsa_master Vivien Didelot
2017-08-31 18:37 ` [PATCH net-next 2/4] net: dsa: move master ethtool ops in dsa_master Vivien Didelot
2017-08-31 18:37 ` [PATCH net-next 3/4] net: dsa: change dsa_ptr for a dsa_master Vivien Didelot
2017-09-02 15:30   ` Andrew Lunn [this message]
2017-08-31 18:37 ` [PATCH net-next 4/4] net: dsa: assign a master to slave ports Vivien Didelot
2017-09-02 15:34   ` Andrew Lunn
2017-09-02 16:29     ` Florian Fainelli
2017-09-02 16:42 ` [PATCH net-next 0/4] net: dsa: add master interface Florian Fainelli

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=20170902153008.GA21003@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 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).