From: Joe Perches <joe@perches.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
Andrew McGregor <andrewmcgr@gmail.com>,
Dave Taht <dave.taht@gmail.com>,
Tom Herbert <therbert@google.com>
Subject: Re: [PATCH net-next] ipv6: add ipv6_addr_hash() helper
Date: Wed, 18 Jul 2012 06:57:59 -0700 [thread overview]
Message-ID: <1342619879.9551.14.camel@joe2Laptop> (raw)
In-Reply-To: <1342613334.2626.2504.camel@edumazet-glaptop>
On Wed, 2012-07-18 at 14:08 +0200, Eric Dumazet wrote:
> Introduce ipv6_addr_hash() helper doing a XOR on all bits
> of an IPv6 address, with an optimized x86_64 version.
[]
> diff --git a/include/net/ipv6.h b/include/net/ipv6.h
[]
> @@ -419,6 +419,19 @@ static inline bool ipv6_addr_any(const struct in6_addr *a)
> #endif
> }
>
> +static inline u32 ipv6_addr_hash(const struct in6_addr *a)
> +{
> +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
> + const unsigned long *ul = (const unsigned long *)a;
> + unsigned long x = ul[0] ^ ul[1];
> +
> + return x ^ (x >> 32);
Thanks Eric.
Perhaps this would be better with an explicit rather
than implicit cast.
next prev parent reply other threads:[~2012-07-18 13:58 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-18 12:08 [PATCH net-next] ipv6: add ipv6_addr_hash() helper Eric Dumazet
2012-07-18 12:28 ` David Laight
2012-07-18 14:06 ` Eric Dumazet
2012-07-18 16:15 ` David Miller
2012-07-18 13:57 ` Joe Perches [this message]
2012-07-18 14:14 ` Eric Dumazet
2012-07-18 14:27 ` [PATCH net-next v3] " Eric Dumazet
2012-07-18 16:16 ` David Miller
2012-07-18 16:19 ` David Miller
2012-07-18 16:30 ` Eric Dumazet
2012-07-18 18:11 ` [PATCH net-next v4] " Eric Dumazet
2012-07-18 18:29 ` David Miller
2012-07-18 16:16 ` [PATCH net-next] " David Miller
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=1342619879.9551.14.camel@joe2Laptop \
--to=joe@perches.com \
--cc=andrewmcgr@gmail.com \
--cc=dave.taht@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.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).