summaryrefslogtreecommitdiff
path: root/include/net/ip6_checksum.h
diff options
context:
space:
mode:
authorCong Wang <amwang@redhat.com>2013-01-08 00:52:40 +0400
committerDavid S. Miller <davem@davemloft.net>2013-01-09 05:56:10 +0400
commitacb3e04119fbf9145eb6d6bb707f6fb662ab4d3b (patch)
tree16e6114957ce9d739dc3c0c63de3b7d52dd8812c /include/net/ip6_checksum.h
parentb7394d2429c198b1da3d46ac39192e891029ec0f (diff)
downloadlinux-acb3e04119fbf9145eb6d6bb707f6fb662ab4d3b.tar.xz
ipv6: move csum_ipv6_magic() and udp6_csum_init() into static library
As suggested by David, udp6_csum_init() is too big to be inlined, move it to ipv6 static library, net/ipv6/ip6_checksum.c. And the generic csum_ipv6_magic() too. Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <amwang@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ip6_checksum.h')
-rw-r--r--include/net/ip6_checksum.h62
1 files changed, 5 insertions, 57 deletions
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 652d3d309357..7686e3f5033d 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -35,63 +35,10 @@
#include <linux/ipv6.h>
#ifndef _HAVE_ARCH_IPV6_CSUM
-
-static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
- const struct in6_addr *daddr,
- __u32 len, unsigned short proto,
- __wsum csum)
-{
-
- int carry;
- __u32 ulen;
- __u32 uproto;
- __u32 sum = (__force u32)csum;
-
- sum += (__force u32)saddr->s6_addr32[0];
- carry = (sum < (__force u32)saddr->s6_addr32[0]);
- sum += carry;
-
- sum += (__force u32)saddr->s6_addr32[1];
- carry = (sum < (__force u32)saddr->s6_addr32[1]);
- sum += carry;
-
- sum += (__force u32)saddr->s6_addr32[2];
- carry = (sum < (__force u32)saddr->s6_addr32[2]);
- sum += carry;
-
- sum += (__force u32)saddr->s6_addr32[3];
- carry = (sum < (__force u32)saddr->s6_addr32[3]);
- sum += carry;
-
- sum += (__force u32)daddr->s6_addr32[0];
- carry = (sum < (__force u32)daddr->s6_addr32[0]);
- sum += carry;
-
- sum += (__force u32)daddr->s6_addr32[1];
- carry = (sum < (__force u32)daddr->s6_addr32[1]);
- sum += carry;
-
- sum += (__force u32)daddr->s6_addr32[2];
- carry = (sum < (__force u32)daddr->s6_addr32[2]);
- sum += carry;
-
- sum += (__force u32)daddr->s6_addr32[3];
- carry = (sum < (__force u32)daddr->s6_addr32[3]);
- sum += carry;
-
- ulen = (__force u32)htonl((__u32) len);
- sum += ulen;
- carry = (sum < ulen);
- sum += carry;
-
- uproto = (__force u32)htonl(proto);
- sum += uproto;
- carry = (sum < uproto);
- sum += carry;
-
- return csum_fold((__force __wsum)sum);
-}
-
+__sum16 csum_ipv6_magic(const struct in6_addr *saddr,
+ const struct in6_addr *daddr,
+ __u32 len, unsigned short proto,
+ __wsum csum);
#endif
static __inline__ __sum16 tcp_v6_check(int len,
@@ -126,4 +73,5 @@ static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
__tcp_v6_send_check(skb, &np->saddr, &np->daddr);
}
+int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
#endif