summaryrefslogtreecommitdiff
path: root/include/asm-v850
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-14 21:19:44 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-02 21:23:13 -0800
commit9d3d41955845939cb41b87affb039db0bae03b65 (patch)
tree468f7564a834edb54a30e49dd678e583568c6933 /include/asm-v850
parentabf419b809bed2333267e4b23dd2b3b4f10da88c (diff)
[NET]: V850 checksum annotations and cleanups.
* sanitize prototypes, annotate * collapse csum_partial_copy * usual ntohs->shift Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-v850')
-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 @@
*
* it's best to have buff aligned on a 32-bit boundary
*/
-extern unsigned int csum_partial (const unsigned char * buff, int len,
- unsigned int sum);
+extern __wsum csum_partial(const void *buff, int len, __wsum sum);
/*
* 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,
* here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary
*/
-extern unsigned csum_partial_copy (const unsigned char *src,
- unsigned char *dst, int len, unsigned sum);
+extern __wsum csum_partial_copy_nocheck(const void *src,
+ void *dst, int len, __wsum sum);
/*
@@ -46,20 +45,17 @@ extern unsigned csum_partial_copy (const unsigned char *src,
* here even more important to align src and dst on a 32-bit (or even
* better 64-bit) boundary
*/
-extern unsigned csum_partial_copy_from_user (const unsigned char *src,
- unsigned char *dst,
- int len, unsigned sum,
+extern __wsum csum_partial_copy_from_user (const void *src,
+ void *dst,
+ int len, __wsum sum,
int *csum_err);
-#define csum_partial_copy_nocheck(src, dst, len, sum) \
- csum_partial_copy ((src), (dst), (len), (sum))
-
-unsigned short ip_fast_csum (unsigned char *iph, unsigned int ihl);
+__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
/*
* Fold a partial checksum
*/
-static inline unsigned int csum_fold (unsigned long sum)
+static inline __sum16 csum_fold (__wsum sum)
{
unsigned int result;
/*
@@ -68,7 +64,7 @@ static inline unsigned int csum_fold (unsigned long sum)
add %1, %0 H L H+L+C H+L
*/
asm ("hsw %1, %0; add %1, %0" : "=&r" (result) : "r" (sum));
- return (~result) >> 16;
+ return (__force __sum16)(~result >> 16);
}
@@ -76,10 +72,10 @@ static inline unsigned int csum_fold (unsigned long sum)
* computes the checksum of the TCP/UDP pseudo-header
* returns a 16-bit checksum, already complemented
*/
-static inline unsigned int
-csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr,
+static inline __wsum
+csum_tcpudp_nofold (__be32 saddr, __be32 daddr,
unsigned short len,
- unsigned short proto, unsigned int sum)
+ unsigned short proto, __wsum sum)
{
int __carry;
__asm__ ("add %2, %0;"
@@ -93,15 +89,15 @@ csum_tcpudp_nofold (unsigned long saddr, unsigned long daddr,
"add %1, %0"
: "=&r" (sum), "=&r" (__carry)
: "r" (daddr), "r" (saddr),
- "r" (ntohs (len) + (proto << 8)),
+ "r" ((len + proto) << 8),
"0" (sum));
return sum;
}
-static inline unsigned short int
-csum_tcpudp_magic (unsigned long saddr, unsigned long daddr,
+static inline __sum16
+csum_tcpudp_magic (__be32 saddr, __be32 daddr,
unsigned short len,
- unsigned short proto, unsigned int sum)
+ unsigned short proto, __wsum sum)
{
return csum_fold (csum_tcpudp_nofold (saddr, daddr, len, proto, sum));
}
@@ -110,7 +106,7 @@ csum_tcpudp_magic (unsigned long saddr, unsigned long daddr,
* this routine is used for miscellaneous IP-like checksums, mainly
* in icmp.c
*/
-extern unsigned short ip_compute_csum (const unsigned char * buff, int len);
+extern __sum16 ip_compute_csum(const void *buff, int len);
#endif /* __V850_CHECKSUM_H__ */