diff options
author | YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org> | 2013-01-20 02:39:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-20 22:29:49 -0500 |
commit | 9d1007740041613bae8492be092932a3f0eb1ebf (patch) | |
tree | e6032ef5ab4ec9ea33bad69043613ddfab0430f2 /include/net | |
parent | ca97a644d752b46e5e08526e36705c3b0dd03f5f (diff) |
ipv6: Optimize ipv6_addr_is_solict_mult().
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/addrconf.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 3a3eeb407f4b..9dc5efc3b0d6 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -307,10 +307,17 @@ static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr) | |||
307 | 307 | ||
308 | static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr) | 308 | static inline bool ipv6_addr_is_solict_mult(const struct in6_addr *addr) |
309 | { | 309 | { |
310 | return (addr->s6_addr32[0] == htonl(0xff020000) && | 310 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 |
311 | addr->s6_addr32[1] == htonl(0x00000000) && | 311 | __u64 *p = (__u64 *)addr; |
312 | addr->s6_addr32[2] == htonl(0x00000001) && | 312 | return ((p[0] ^ cpu_to_be64(0xff02000000000000UL)) | |
313 | addr->s6_addr[12] == 0xff); | 313 | ((p[1] ^ cpu_to_be64(0x00000001ff000000UL)) & |
314 | cpu_to_be64(0xffffffffff000000UL))) == 0UL; | ||
315 | #else | ||
316 | return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | | ||
317 | addr->s6_addr32[1] | | ||
318 | (addr->s6_addr32[2] ^ htonl(0x00000001)) | | ||
319 | (addr->s6_addr[12] ^ 0xff)) == 0; | ||
320 | #endif | ||
314 | } | 321 | } |
315 | 322 | ||
316 | #ifdef CONFIG_PROC_FS | 323 | #ifdef CONFIG_PROC_FS |