netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: lirongqing@baidu.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH][net-next] net/ipv6: compute anycast address hash only if dev is null
Date: Wed, 07 Nov 2018 21:49:57 -0800 (PST)	[thread overview]
Message-ID: <20181107.214957.452822093411627013.davem@davemloft.net> (raw)
In-Reply-To: <1541655340-7035-1-git-send-email-lirongqing@baidu.com>

From: Li RongQing <lirongqing@baidu.com>
Date: Thu,  8 Nov 2018 13:35:40 +0800

> avoid to compute the hash value if dev is not null, since
> hash value is not used
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
>  net/ipv6/anycast.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
> index 94999058e110..a20e344486cb 100644
> --- a/net/ipv6/anycast.c
> +++ b/net/ipv6/anycast.c
> @@ -433,15 +433,16 @@ static bool ipv6_chk_acast_dev(struct net_device *dev, const struct in6_addr *ad
>  bool ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
>  			 const struct in6_addr *addr)
>  {
> -	unsigned int hash = inet6_acaddr_hash(net, addr);
>  	struct net_device *nh_dev;
>  	struct ifacaddr6 *aca;
>  	bool found = false;
> +	unsigned int hash;
>  
>  	rcu_read_lock();
>  	if (dev)
>  		found = ipv6_chk_acast_dev(dev, addr);
> -	else
> +	else {
> +		hash = inet6_acaddr_hash(net, addr);
>  		hlist_for_each_entry_rcu(aca, &inet6_acaddr_lst[hash],

Please move the hash local variable declaration into this basic block
too, if you're going to do this.

Thanks.

      reply	other threads:[~2018-11-08 15:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-08  5:35 [PATCH][net-next] net/ipv6: compute anycast address hash only if dev is null Li RongQing
2018-11-08  5:49 ` David Miller [this message]

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=20181107.214957.452822093411627013.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=lirongqing@baidu.com \
    --cc=netdev@vger.kernel.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).