summaryrefslogtreecommitdiffstats
path: root/include/net/addrconf.h
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-20 07:38:52 +0000
committerDavid S. Miller <davem@davemloft.net>2013-01-20 22:29:49 -0500
commitd1641565f6926c2e9f5859d81bc6f72fc0e1ad76 (patch)
treefa5f134b9f5faa2413c439019918d0020742c685 /include/net/addrconf.h
parent9d1007740041613bae8492be092932a3f0eb1ebf (diff)
downloadop-kernel-dev-d1641565f6926c2e9f5859d81bc6f72fc0e1ad76.zip
op-kernel-dev-d1641565f6926c2e9f5859d81bc6f72fc0e1ad76.tar.gz
ipv6: Optimize ipv6_addr_is_ll_all_{nodes,routers}().
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/addrconf.h')
-rw-r--r--include/net/addrconf.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 9dc5efc..6c58d50 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -288,16 +288,26 @@ static inline bool ipv6_addr_is_multicast(const struct in6_addr *addr)
static inline bool ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
{
+#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(1))) == 0UL;
+#else
return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
addr->s6_addr32[1] | addr->s6_addr32[2] |
(addr->s6_addr32[3] ^ htonl(0x00000001))) == 0;
+#endif
}
static inline bool ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
{
+#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(2))) == 0UL;
+#else
return ((addr->s6_addr32[0] ^ htonl(0xff020000)) |
addr->s6_addr32[1] | addr->s6_addr32[2] |
(addr->s6_addr32[3] ^ htonl(0x00000002))) == 0;
+#endif
}
static inline bool ipv6_addr_is_isatap(const struct in6_addr *addr)
OpenPOWER on IntegriCloud