This source file includes following definitions.
- csum_fold
- csum_tcpudp_nofold
1
2
3
4 #ifndef __ASM_CSKY_CHECKSUM_H
5 #define __ASM_CSKY_CHECKSUM_H
6
7 #include <linux/in6.h>
8 #include <asm/byteorder.h>
9
10 static inline __sum16 csum_fold(__wsum csum)
11 {
12 u32 tmp;
13
14 asm volatile(
15 "mov %1, %0\n"
16 "rori %0, 16\n"
17 "addu %0, %1\n"
18 "lsri %0, 16\n"
19 : "=r"(csum), "=r"(tmp)
20 : "0"(csum));
21
22 return (__force __sum16) ~csum;
23 }
24 #define csum_fold csum_fold
25
26 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
27 unsigned short len, unsigned short proto, __wsum sum)
28 {
29 asm volatile(
30 "clrc\n"
31 "addc %0, %1\n"
32 "addc %0, %2\n"
33 "addc %0, %3\n"
34 "inct %0\n"
35 : "=r"(sum)
36 : "r"((__force u32)saddr), "r"((__force u32)daddr),
37 #ifdef __BIG_ENDIAN
38 "r"(proto + len),
39 #else
40 "r"((proto + len) << 8),
41 #endif
42 "0" ((__force unsigned long)sum)
43 : "cc");
44 return sum;
45 }
46 #define csum_tcpudp_nofold csum_tcpudp_nofold
47
48 #include <asm-generic/checksum.h>
49
50 #endif