10 #include <linux/module.h>
11 #include <linux/types.h>
12 #include <linux/string.h>
14 #include <asm/uaccess.h>
19 static inline unsigned
20 short from64to16(
unsigned long x)
23 x = (x & 0xffffffff) + (x >> 32);
25 x = (x & 0xffff) + (x >> 16);
27 x = (x & 0xffff) + (x >> 16);
29 x = (x & 0xffff) + (x >> 16);
34 unsigned long do_csum_c(
const unsigned char * buff,
int len,
unsigned int psum)
41 odd = 1 & (
unsigned long) buff;
49 if (2 & (
unsigned long) buff) {
50 result += *(
unsigned short *) buff;
57 if (4 & (
unsigned long) buff) {
58 result += *(
unsigned int *) buff;
65 unsigned long carry = 0;
67 unsigned long w = *(
unsigned long *) buff;
75 result = (result & 0xffffffff) + (result >> 32);
78 result += *(
unsigned int *) buff;
83 result += *(
unsigned short *) buff;
90 result = from64to16(result);
93 result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);
105 extern unsigned long do_csum(
const unsigned char *,
long);
109 int len,
__wsum psum,
int *errp)
127 result = (result & 0xffffffff) + (result >> 32);
137 dst, len, sum,
NULL);