Skip to content

Commit

Permalink
ipv6: Optimize ipv6_addr_is_solict_mult().
Browse files Browse the repository at this point in the history
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
YOSHIFUJI Hideaki / 吉藤英明 authored and David S. Miller committed Jan 21, 2013
1 parent ca97a64 commit 9d10077
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions include/net/addrconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,17 @@ static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr)

static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr)
{
return (addr->s6_addr32[0] == htonl(0xff020000) &&
addr->s6_addr32[1] == htonl(0x00000000) &&
addr->s6_addr32[2] == htonl(0x00000001) &&
addr->s6_addr[12] == 0xff);
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64
__u64 *p = (__u64 *)addr;
return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) |
((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) &
cpu_to_be64(0xffffffffff000000UL))) == 0UL;
#else
return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
addr->s6_addr32[1] |
(addr->s6_addr32[2] ^ htonl(0x00000001)) |
(addr->s6_addr[12] ^ 0xff)) == 0;
#endif
}

#ifdef CONFIG_PROC_FS
Expand Down

0 comments on commit 9d10077

Please sign in to comment.