diff options
author | Cong Wang <amwang@redhat.com> | 2013-01-07 15:52:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-08 20:56:10 -0500 |
commit | acb3e04119fbf9145eb6d6bb707f6fb662ab4d3b (patch) | |
tree | 16e6114957ce9d739dc3c0c63de3b7d52dd8812c /include/net/ip6_checksum.h | |
parent | b7394d2429c198b1da3d46ac39192e891029ec0f (diff) |
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.h | 62 |
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 @@ | |||
35 | #include <linux/ipv6.h> | 35 | #include <linux/ipv6.h> |
36 | 36 | ||
37 | #ifndef _HAVE_ARCH_IPV6_CSUM | 37 | #ifndef _HAVE_ARCH_IPV6_CSUM |
38 | 38 | __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | |
39 | static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr, | 39 | const struct in6_addr *daddr, |
40 | const struct in6_addr *daddr, | 40 | __u32 len, unsigned short proto, |
41 | __u32 len, unsigned short proto, | 41 | __wsum csum); |
42 | __wsum csum) | ||
43 | { | ||
44 | |||
45 | int carry; | ||
46 | __u32 ulen; | ||
47 | __u32 uproto; | ||
48 | __u32 sum = (__force u32)csum; | ||
49 | |||
50 | sum += (__force u32)saddr->s6_addr32[0]; | ||
51 | carry = (sum < (__force u32)saddr->s6_addr32[0]); | ||
52 | sum += carry; | ||
53 | |||
54 | sum += (__force u32)saddr->s6_addr32[1]; | ||
55 | carry = (sum < (__force u32)saddr->s6_addr32[1]); | ||
56 | sum += carry; | ||
57 | |||
58 | sum += (__force u32)saddr->s6_addr32[2]; | ||
59 | carry = (sum < (__force u32)saddr->s6_addr32[2]); | ||
60 | sum += carry; | ||
61 | |||
62 | sum += (__force u32)saddr->s6_addr32[3]; | ||
63 | carry = (sum < (__force u32)saddr->s6_addr32[3]); | ||
64 | sum += carry; | ||
65 | |||
66 | sum += (__force u32)daddr->s6_addr32[0]; | ||
67 | carry = (sum < (__force u32)daddr->s6_addr32[0]); | ||
68 | sum += carry; | ||
69 | |||
70 | sum += (__force u32)daddr->s6_addr32[1]; | ||
71 | carry = (sum < (__force u32)daddr->s6_addr32[1]); | ||
72 | sum += carry; | ||
73 | |||
74 | sum += (__force u32)daddr->s6_addr32[2]; | ||
75 | carry = (sum < (__force u32)daddr->s6_addr32[2]); | ||
76 | sum += carry; | ||
77 | |||
78 | sum += (__force u32)daddr->s6_addr32[3]; | ||
79 | carry = (sum < (__force u32)daddr->s6_addr32[3]); | ||
80 | sum += carry; | ||
81 | |||
82 | ulen = (__force u32)htonl((__u32) len); | ||
83 | sum += ulen; | ||
84 | carry = (sum < ulen); | ||
85 | sum += carry; | ||
86 | |||
87 | uproto = (__force u32)htonl(proto); | ||
88 | sum += uproto; | ||
89 | carry = (sum < uproto); | ||
90 | sum += carry; | ||
91 | |||
92 | return csum_fold((__force __wsum)sum); | ||
93 | } | ||
94 | |||
95 | #endif | 42 | #endif |
96 | 43 | ||
97 | static __inline__ __sum16 tcp_v6_check(int len, | 44 | 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) | |||
126 | __tcp_v6_send_check(skb, &np->saddr, &np->daddr); | 73 | __tcp_v6_send_check(skb, &np->saddr, &np->daddr); |
127 | } | 74 | } |
128 | 75 | ||
76 | int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); | ||
129 | #endif | 77 | #endif |