diff options
Diffstat (limited to 'net/ipv6/ip6_fib.c')
| -rw-r--r-- | net/ipv6/ip6_fib.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 6b82e02158c6..92a122b7795d 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
| @@ -128,12 +128,24 @@ static __inline__ u32 fib6_new_sernum(void) | |||
| 128 | /* | 128 | /* |
| 129 | * test bit | 129 | * test bit |
| 130 | */ | 130 | */ |
| 131 | #if defined(__LITTLE_ENDIAN) | ||
| 132 | # define BITOP_BE32_SWIZZLE (0x1F & ~7) | ||
| 133 | #else | ||
| 134 | # define BITOP_BE32_SWIZZLE 0 | ||
| 135 | #endif | ||
| 131 | 136 | ||
| 132 | static __inline__ __be32 addr_bit_set(void *token, int fn_bit) | 137 | static __inline__ __be32 addr_bit_set(void *token, int fn_bit) |
| 133 | { | 138 | { |
| 134 | __be32 *addr = token; | 139 | __be32 *addr = token; |
| 135 | 140 | /* | |
| 136 | return htonl(1 << ((~fn_bit)&0x1F)) & addr[fn_bit>>5]; | 141 | * Here, |
| 142 | * 1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f) | ||
| 143 | * is optimized version of | ||
| 144 | * htonl(1 << ((~fn_bit)&0x1F)) | ||
| 145 | * See include/asm-generic/bitops/le.h. | ||
| 146 | */ | ||
| 147 | return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) & | ||
| 148 | addr[fn_bit >> 5]; | ||
| 137 | } | 149 | } |
| 138 | 150 | ||
| 139 | static __inline__ struct fib6_node * node_alloc(void) | 151 | static __inline__ struct fib6_node * node_alloc(void) |
