lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1342620841.2626.2786.camel@edumazet-glaptop>
Date:	Wed, 18 Jul 2012 16:14:01 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Joe Perches <joe@...ches.com>
Cc:	David Miller <davem@...emloft.net>,
	netdev <netdev@...r.kernel.org>,
	Andrew McGregor <andrewmcgr@...il.com>,
	Dave Taht <dave.taht@...il.com>,
	Tom Herbert <therbert@...gle.com>
Subject: Re: [PATCH net-next] ipv6: add ipv6_addr_hash() helper

On Wed, 2012-07-18 at 06:57 -0700, Joe Perches wrote:
> 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.

In fact, returning an "unsigned long" here might give more shuffling
capabilities on 64bit arches, thanks to hash_long()

but hash_long() on 64bit sounds a bit expensive for our needs...


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ