aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/m68k/lib/checksum.c13
-rw-r--r--include/asm-m68k/checksum.h46
2 files changed, 28 insertions, 31 deletions
diff --git a/arch/m68k/lib/checksum.c b/arch/m68k/lib/checksum.c
index cb13c6e3ccae..aed3be29e06b 100644
--- a/arch/m68k/lib/checksum.c
+++ b/arch/m68k/lib/checksum.c
@@ -39,8 +39,7 @@
39 * computes a partial checksum, e.g. for TCP/UDP fragments 39 * computes a partial checksum, e.g. for TCP/UDP fragments
40 */ 40 */
41 41
42unsigned int 42__wsum csum_partial(const void *buff, int len, __wsum sum)
43csum_partial (const unsigned char *buff, int len, unsigned int sum)
44{ 43{
45 unsigned long tmp1, tmp2; 44 unsigned long tmp1, tmp2;
46 /* 45 /*
@@ -133,9 +132,9 @@ EXPORT_SYMBOL(csum_partial);
133 * copy from user space while checksumming, with exception handling. 132 * copy from user space while checksumming, with exception handling.
134 */ 133 */
135 134
136unsigned int 135__wsum
137csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, 136csum_partial_copy_from_user(const void __user *src, void *dst,
138 int len, int sum, int *csum_err) 137 int len, __wsum sum, int *csum_err)
139{ 138{
140 /* 139 /*
141 * GCC doesn't like more than 10 operands for the asm 140 * GCC doesn't like more than 10 operands for the asm
@@ -325,8 +324,8 @@ csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst,
325 * copy from kernel space while checksumming, otherwise like csum_partial 324 * copy from kernel space while checksumming, otherwise like csum_partial
326 */ 325 */
327 326
328unsigned int 327__wsum
329csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst, int len, int sum) 328csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum)
330{ 329{
331 unsigned long tmp1, tmp2; 330 unsigned long tmp1, tmp2;
332 __asm__("movel %2,%4\n\t" 331 __asm__("movel %2,%4\n\t"
diff --git a/include/asm-m68k/checksum.h b/include/asm-m68k/checksum.h
index 17280ef719f5..494f9aec37ea 100644
--- a/include/asm-m68k/checksum.h
+++ b/include/asm-m68k/checksum.h
@@ -15,7 +15,7 @@
15 * 15 *
16 * it's best to have buff aligned on a 32-bit boundary 16 * it's best to have buff aligned on a 32-bit boundary
17 */ 17 */
18unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 18__wsum csum_partial(const void *buff, int len, __wsum sum);
19 19
20/* 20/*
21 * the same as csum_partial, but copies from src while it 21 * the same as csum_partial, but copies from src while it
@@ -25,22 +25,21 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
25 * better 64-bit) boundary 25 * better 64-bit) boundary
26 */ 26 */
27 27
28extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src, 28extern __wsum csum_partial_copy_from_user(const void __user *src,
29 unsigned char *dst, 29 void *dst,
30 int len, int sum, 30 int len, __wsum sum,
31 int *csum_err); 31 int *csum_err);
32 32
33extern unsigned int csum_partial_copy_nocheck(const unsigned char *src, 33extern __wsum csum_partial_copy_nocheck(const void *src,
34 unsigned char *dst, int len, 34 void *dst, int len,
35 int sum); 35 __wsum sum);
36 36
37/* 37/*
38 * This is a version of ip_compute_csum() optimized for IP headers, 38 * This is a version of ip_compute_csum() optimized for IP headers,
39 * which always checksum on 4 octet boundaries. 39 * which always checksum on 4 octet boundaries.
40 * 40 *
41 */ 41 */
42static inline unsigned short 42static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
43ip_fast_csum(unsigned char *iph, unsigned int ihl)
44{ 43{
45 unsigned int sum = 0; 44 unsigned int sum = 0;
46 unsigned long tmp; 45 unsigned long tmp;
@@ -58,29 +57,29 @@ ip_fast_csum(unsigned char *iph, unsigned int ihl)
58 : "=d" (sum), "=&a" (iph), "=&d" (ihl), "=&d" (tmp) 57 : "=d" (sum), "=&a" (iph), "=&d" (ihl), "=&d" (tmp)
59 : "0" (sum), "1" (iph), "2" (ihl) 58 : "0" (sum), "1" (iph), "2" (ihl)
60 : "memory"); 59 : "memory");
61 return ~sum; 60 return (__force __sum16)~sum;
62} 61}
63 62
64/* 63/*
65 * Fold a partial checksum 64 * Fold a partial checksum
66 */ 65 */
67 66
68static inline unsigned int csum_fold(unsigned int sum) 67static inline __sum16 csum_fold(__wsum sum)
69{ 68{
70 unsigned int tmp = sum; 69 unsigned int tmp = (__force u32)sum;
71 __asm__("swap %1\n\t" 70 __asm__("swap %1\n\t"
72 "addw %1, %0\n\t" 71 "addw %1, %0\n\t"
73 "clrw %1\n\t" 72 "clrw %1\n\t"
74 "addxw %1, %0" 73 "addxw %1, %0"
75 : "=&d" (sum), "=&d" (tmp) 74 : "=&d" (sum), "=&d" (tmp)
76 : "0" (sum), "1" (tmp)); 75 : "0" (sum), "1" (tmp));
77 return ~sum; 76 return (__force __sum16)~sum;
78} 77}
79 78
80 79
81static inline unsigned int 80static inline __wsum
82csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len, 81csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
83 unsigned short proto, unsigned int sum) 82 unsigned short proto, __wsum sum)
84{ 83{
85 __asm__ ("addl %2,%0\n\t" 84 __asm__ ("addl %2,%0\n\t"
86 "addxl %3,%0\n\t" 85 "addxl %3,%0\n\t"
@@ -98,9 +97,9 @@ csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned short len,
98 * computes the checksum of the TCP/UDP pseudo-header 97 * computes the checksum of the TCP/UDP pseudo-header
99 * returns a 16-bit checksum, already complemented 98 * returns a 16-bit checksum, already complemented
100 */ 99 */
101static inline unsigned short int 100static inline __sum16
102csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len, 101csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
103 unsigned short proto, unsigned int sum) 102 unsigned short proto, __wsum sum)
104{ 103{
105 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 104 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
106} 105}
@@ -110,16 +109,15 @@ csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, unsigned short len,
110 * in icmp.c 109 * in icmp.c
111 */ 110 */
112 111
113static inline unsigned short 112static inline __sum16 ip_compute_csum(const void *buff, int len)
114ip_compute_csum(unsigned char * buff, int len)
115{ 113{
116 return csum_fold (csum_partial(buff, len, 0)); 114 return csum_fold (csum_partial(buff, len, 0));
117} 115}
118 116
119#define _HAVE_ARCH_IPV6_CSUM 117#define _HAVE_ARCH_IPV6_CSUM
120static __inline__ unsigned short int 118static __inline__ __sum16
121csum_ipv6_magic(struct in6_addr *saddr, struct in6_addr *daddr, 119csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
122 __u32 len, unsigned short proto, unsigned int sum) 120 __u32 len, unsigned short proto, __wsum sum)
123{ 121{
124 register unsigned long tmp; 122 register unsigned long tmp;
125 __asm__("addl %2@,%0\n\t" 123 __asm__("addl %2@,%0\n\t"