11 #ifndef _ASM_CHECKSUM_H
12 #define _ASM_CHECKSUM_H
14 #include <linux/in6.h>
16 #include <asm/uaccess.h>
51 #define HAVE_CSUM_COPY_USER
79 " .set push # csum_fold\n"
103 const unsigned int *
word = iph;
104 const unsigned int *
stop = word + ihl;
110 carry = (csum < word[1]);
114 carry = (csum < word[2]);
118 carry = (csum < word[3]);
124 carry = (csum < *
word);
127 }
while (word != stop);
129 return csum_fold(csum);
137 " .set push # csum_tcpudp_nofold\n"
141 " sltu $1, %0, %2 \n"
145 " sltu $1, %0, %3 \n"
149 " sltu $1, %0, %4 \n"
156 " dsll32 $1, %0, 0 \n"
158 " dsra32 %0, %0, 0 \n"
162 :
"0" ((
__force unsigned long)daddr),
163 "r" ((
__force unsigned long)saddr),
165 "r" ((proto + len) << 8),
169 "r" ((
__force unsigned long)sum));
180 unsigned short proto,
195 #define _HAVE_ARCH_IPV6_CSUM
198 __u32 len,
unsigned short proto,
202 " .set push # csum_ipv6_magic\n"
205 " addu %0, %5 # proto (long in network byte order)\n"
206 " sltu $1, %0, %5 \n"
209 " addu %0, %6 # csum\n"
210 " sltu $1, %0, %6 \n"
211 " lw %1, 0(%2) # four words source address\n"
214 " sltu $1, %0, %1 \n"
219 " sltu $1, %0, %1 \n"
224 " sltu $1, %0, %1 \n"
229 " sltu $1, %0, %1 \n"
234 " sltu $1, %0, %1 \n"
239 " sltu $1, %0, %1 \n"
244 " sltu $1, %0, %1 \n"
249 " sltu $1, %0, %1 \n"
251 " addu %0, $1 # Add final carry\n"
253 :
"=r" (sum),
"=r" (proto)
254 :
"r" (saddr),
"r" (daddr),
255 "0" (
htonl(len)),
"1" (
htonl(proto)),
"r" (sum));
257 return csum_fold(sum);