diff options
Diffstat (limited to 'arch/m68k/include/asm/checksum.h')
-rw-r--r-- | arch/m68k/include/asm/checksum.h | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/arch/m68k/include/asm/checksum.h b/arch/m68k/include/asm/checksum.h index ec514485c8b6..2f88d867c711 100644 --- a/arch/m68k/include/asm/checksum.h +++ b/arch/m68k/include/asm/checksum.h | |||
@@ -3,6 +3,10 @@ | |||
3 | 3 | ||
4 | #include <linux/in6.h> | 4 | #include <linux/in6.h> |
5 | 5 | ||
6 | #ifdef CONFIG_GENERIC_CSUM | ||
7 | #include <asm-generic/checksum.h> | ||
8 | #else | ||
9 | |||
6 | /* | 10 | /* |
7 | * computes the checksum of a memory block at buff, length len, | 11 | * computes the checksum of a memory block at buff, length len, |
8 | * and adds in "sum" (32-bit) | 12 | * and adds in "sum" (32-bit) |
@@ -34,30 +38,6 @@ extern __wsum csum_partial_copy_nocheck(const void *src, | |||
34 | void *dst, int len, | 38 | void *dst, int len, |
35 | __wsum sum); | 39 | __wsum sum); |
36 | 40 | ||
37 | |||
38 | #ifdef CONFIG_COLDFIRE | ||
39 | |||
40 | /* | ||
41 | * The ColdFire cores don't support all the 68k instructions used | ||
42 | * in the optimized checksum code below. So it reverts back to using | ||
43 | * more standard C coded checksums. The fast checksum code is | ||
44 | * significantly larger than the optimized version, so it is not | ||
45 | * inlined here. | ||
46 | */ | ||
47 | __sum16 ip_fast_csum(const void *iph, unsigned int ihl); | ||
48 | |||
49 | static inline __sum16 csum_fold(__wsum sum) | ||
50 | { | ||
51 | unsigned int tmp = (__force u32)sum; | ||
52 | |||
53 | tmp = (tmp & 0xffff) + (tmp >> 16); | ||
54 | tmp = (tmp & 0xffff) + (tmp >> 16); | ||
55 | |||
56 | return (__force __sum16)~tmp; | ||
57 | } | ||
58 | |||
59 | #else | ||
60 | |||
61 | /* | 41 | /* |
62 | * This is a version of ip_fast_csum() optimized for IP headers, | 42 | * This is a version of ip_fast_csum() optimized for IP headers, |
63 | * which always checksum on 4 octet boundaries. | 43 | * which always checksum on 4 octet boundaries. |
@@ -97,8 +77,6 @@ static inline __sum16 csum_fold(__wsum sum) | |||
97 | return (__force __sum16)~sum; | 77 | return (__force __sum16)~sum; |
98 | } | 78 | } |
99 | 79 | ||
100 | #endif /* CONFIG_COLDFIRE */ | ||
101 | |||
102 | static inline __wsum | 80 | static inline __wsum |
103 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | 81 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, |
104 | unsigned short proto, __wsum sum) | 82 | unsigned short proto, __wsum sum) |
@@ -167,4 +145,5 @@ csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, | |||
167 | return csum_fold(sum); | 145 | return csum_fold(sum); |
168 | } | 146 | } |
169 | 147 | ||
148 | #endif /* CONFIG_GENERIC_CSUM */ | ||
170 | #endif /* _M68K_CHECKSUM_H */ | 149 | #endif /* _M68K_CHECKSUM_H */ |