All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Haley <brian.haley@hp.com>
To: Joe Perches <joe@perches.com>
Cc: netdev <netdev@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next?] pktgen: Use simpler test for non-zero ipv6 address
Date: Wed, 10 Oct 2012 14:59:30 -0400	[thread overview]
Message-ID: <5075C592.1070406@hp.com> (raw)
In-Reply-To: <1349894559.2035.12.camel@joe-AO722>

On 10/10/2012 02:42 PM, Joe Perches wrote:
> Found by looking for if (foo) ; tests with a perl regex
> 
> Yes Eric, it could be 2 compares instead of 4 on 64-bit
> systems with HAS_EFFICIENT_UNALIGNED_ACCESS.  Maybe later
> or if there are other tests that could become something
> like ipv6_is_zeronet.
> 
> cheers, Joe
> 
>  net/core/pktgen.c |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 148e73d..3aa8417 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -2422,11 +2422,10 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
>  		}
>  	} else {		/* IPV6 * */
>  
> -		if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
> -		    pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
> -		    pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
> -		    pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
> -		else {
> +		if (pkt_dev->min_in6_daddr.s6_addr32[0] |
> +		    pkt_dev->min_in6_daddr.s6_addr32[1] |
> +		    pkt_dev->min_in6_daddr.s6_addr32[2] |
> +		    pkt_dev->min_in6_daddr.s6_addr32[3]) {
>  			int i;

Why not just use ipv6_addr_any() ?  It has an HAS_EFFICIENT_UNALIGNED_ACCESS
check too.

-Brian

  reply	other threads:[~2012-10-10 18:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 18:42 [PATCH net-next?] pktgen: Use simpler test for non-zero ipv6 address Joe Perches
2012-10-10 18:59 ` Brian Haley [this message]
2012-10-10 19:01 ` Eric Dumazet
2012-10-10 19:23   ` [PATCH net-next? V2] " Joe Perches
2012-10-10 19:38     ` [RFC net-next] treewide: s/ipv4_is_<foo>()/ipv4_addr_<foo>/ Joe Perches
2012-10-11  0:56       ` [RFC net-next] treewide: s/is_<foo>_ether_addr/eth_addr_<foo> Joe Perches
2012-10-11  8:11       ` [RFC net-next] treewide: s/ipv4_is_<foo>()/ipv4_addr_<foo>/ David Laight
2012-10-11  8:28         ` Joe Perches
2012-10-11  2:15     ` [PATCH net-next? V2] pktgen: Use simpler test for non-zero ipv6 address Cong Wang
2012-10-11 19:20     ` David Miller
2012-10-11  8:08 ` [PATCH net-next?] " David Laight

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=5075C592.1070406@hp.com \
    --to=brian.haley@hp.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 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.