aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-v850/checksum.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-v850/checksum.h')
-rw-r--r--include/asm-v850/checksum.h38
1 files changed, 17 insertions, 21 deletions
diff --git a/include/asm-v850/checksum.h b/include/asm-v850/checksum.h
index 4df5e71098f9..d1dddd938262 100644
--- a/include/asm-v850/checksum.h
+++ b/include/asm-v850/checksum.h
@@ -26,8 +26,7 @@
26 * 26 *
27 * it's best to have buff aligned on a 32-bit boundary 27 * it's best to have buff aligned on a 32-bit boundary
28 */ 28 */
29extern unsigned int csum_partial (const unsigned char * buff, int len, 29extern __wsum csum_partial(const void *buff, int len, __wsum sum);
30 unsigned int sum);
31 30
32/* 31/*
33 * the same as csum_partial, but copies from src while it 32 * the same as csum_partial, but copies from src while it
@@ -36,8 +35,8 @@ extern unsigned int csum_partial (const unsigned char * buff, int len,
36 * here even more important to align src and dst on a 32-bit (or even 35 * here even more important to align src and dst on a 32-bit (or even
37 * better 64-bit) boundary 36 * better 64-bit) boundary
38 */ 37 */
39extern unsigned csum_partial_copy (const unsigned char *src, 38extern __wsum csum_partial_copy_nocheck(const void *src,
40 unsigned char *dst, int len, unsigned sum); 39 void *dst, int len, __wsum sum);
41 40
42 41
43/* 42/*
@@ -46,20 +45,17 @@ extern unsigned csum_partial_copy (const unsigned char *src,
46 * here even more important to align src and dst on a 32-bit (or even 45 * here even more important to align src and dst on a 32-bit (or even
47 * better 64-bit) boundary 46 * better 64-bit) boundary
48 */ 47 */
49extern unsigned csum_partial_copy_from_user (const unsigned char *src, 48extern __wsum csum_partial_copy_from_user (const void *src,
50 unsigned char *dst, 49 void *dst,
51 int len, unsigned sum, 50 int len, __wsum sum,
52 int *csum_err); 51 int *csum_err);
53 52
54#define csum_partial_copy_nocheck(src, dst, len, sum) \ 53__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
55 csum_partial_copy ((src), (dst), (len), (sum))
56
57unsigned short ip_fast_csum (unsigned char *iph, unsigned int ihl);
58 54
59/* 55/*
60 * Fold a partial checksum 56 * Fold a partial checksum
61 */ 57 */
62static inline unsigned int csum_fold (unsigned long sum) 58static inline __sum16 csum_fold (__wsum sum)
63{ 59{
64 unsigned int result; 60 unsigned int result;
65 /* 61 /*
@@ -68,7 +64,7 @@ static inline unsigned int csum_fold (unsigned long sum)
68 add %1, %0 H L H+L+C H+L 64 add %1, %0 H L H+L+C H+L
69 */ 65 */
70 asm ("hsw %1, %0; add %1, %0" : "=&r" (result) : "r" (sum)); 66 asm ("hsw %1, %0; add %1, %0" : "=&r" (result) : "r" (sum));
71 return (~result) >> 16; 67 return (__force __sum16)(~result >> 16);
72} 68}
73 69
74 70
@@ -76,10 +72,10 @@ static inline unsigned int csum_fold (unsigned long sum)
76 * computes the checksum of the TCP/UDP pseudo-header 72 * computes the checksum of the TCP/UDP pseudo-header
77 * returns a 16-bit checksum, already complemented 73 * returns a 16-bit checksum, already complemented
78 */ 74 */
79static inline unsigned int 75static inline __wsum
80csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr, 76csum_tcpudp_nofold (__be32 saddr, __be32 daddr,
81 unsigned short len, 77 unsigned short len,
82 unsigned short proto, unsigned int sum) 78 unsigned short proto, __wsum sum)
83{ 79{
84 int __carry; 80 int __carry;
85 __asm__ ("add %2, %0;" 81 __asm__ ("add %2, %0;"
@@ -93,15 +89,15 @@ csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr,
93 "add %1, %0" 89 "add %1, %0"
94 : "=&r" (sum), "=&r" (__carry) 90 : "=&r" (sum), "=&r" (__carry)
95 : "r" (daddr), "r" (saddr), 91 : "r" (daddr), "r" (saddr),
96 "r" (ntohs (len) + (proto << 8)), 92 "r" ((len + proto) << 8),
97 "0" (sum)); 93 "0" (sum));
98 return sum; 94 return sum;
99} 95}
100 96
101static inline unsigned short int 97static inline __sum16
102csum_tcpudp_magic (unsigned long saddr, unsigned long daddr, 98csum_tcpudp_magic (__be32 saddr, __be32 daddr,
103 unsigned short len, 99 unsigned short len,
104 unsigned short proto, unsigned int sum) 100 unsigned short proto, __wsum sum)
105{ 101{
106 return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum)); 102 return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum));
107} 103}
@@ -110,7 +106,7 @@ csum_tcpudp_magic (unsigned long saddr, unsigned long daddr,
110 * this routine is used for miscellaneous IP-like checksums, mainly 106 * this routine is used for miscellaneous IP-like checksums, mainly
111 * in icmp.c 107 * in icmp.c
112 */ 108 */
113extern unsigned short ip_compute_csum (const unsigned char * buff, int len); 109extern __sum16 ip_compute_csum(const void *buff, int len);
114 110
115 111
116#endif /* __V850_CHECKSUM_H__ */ 112#endif /* __V850_CHECKSUM_H__ */