From 2c76e9cbef811629ceec071b3f5b541538e34f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?YOSHIFUJI=20Hideaki=20/=20=E5=90=89=E8=97=A4=E8=8B=B1?= =?UTF-8?q?=E6=98=8E?= Date: Mon, 14 Jan 2013 07:10:38 +0000 Subject: [PATCH] --- yaml --- r: 351381 b: refs/heads/master c: 38675170e4235f859bb85564c33ffa077a1c1ef7 h: refs/heads/master i: 351379: 32847bba338e8793f4fd9d1afd6a6bd8d081f9e3 v: v3 --- [refs] | 2 +- trunk/include/net/ipv6.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 4fe34acf382a..5ec48a088e1d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2ef973320349cd536b33427aed98512e532d4cc6 +refs/heads/master: 38675170e4235f859bb85564c33ffa077a1c1ef7 diff --git a/trunk/include/net/ipv6.h b/trunk/include/net/ipv6.h index fe95053d02ce..dfc1363a97b5 100644 --- a/trunk/include/net/ipv6.h +++ b/trunk/include/net/ipv6.h @@ -399,6 +399,31 @@ static inline bool ipv6_addr_equal(const struct in6_addr *a1, #endif } +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) && BITS_PER_LONG == 64 +static inline bool __ipv6_prefix_equal64_half(const __be64 *a1, + const __be64 *a2, + unsigned int len) +{ + if (len && ((*a1 ^ *a2) & cpu_to_be64(~0UL) << (64 - len))) + return false; + return true; +} + +static inline bool ipv6_prefix_equal(const struct in6_addr *addr1, + const struct in6_addr *addr2, + unsigned int prefixlen) +{ + const __be64 *a1 = (const __be64 *)addr1; + const __be64 *a2 = (const __be64 *)addr2; + + if (prefixlen >= 64) { + if (a1[0] ^ a2[0]) + return false; + return __ipv6_prefix_equal64_half(a1 + 1, a2 + 1, prefixlen - 64); + } + return __ipv6_prefix_equal64_half(a1, a2, prefixlen); +} +#else static inline bool ipv6_prefix_equal(const struct in6_addr *addr1, const struct in6_addr *addr2, unsigned int prefixlen) @@ -419,6 +444,7 @@ static inline bool ipv6_prefix_equal(const struct in6_addr *addr1, return true; } +#endif struct inet_frag_queue;