aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh64
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-15 00:19:01 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:23:11 -0500
commitc459dd90f0de00db1ca1328482214019f6ca292f (patch)
treee97df3667e9146c1531b88980e05b315af58a1bc /include/asm-sh64
parent7814e4b6d6ce59071887600a8659641ba3d30a43 (diff)
[NET]: SH64 checksum annotations and cleanups.
* sanitize prototypes, annotate * collapse csum_partial_copy * kill csum_partial_copy_fromuser * ntohs->shift in checksum calculation Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sh64')
-rw-r--r--include/asm-sh64/checksum.h41
1 files changed, 14 insertions, 27 deletions
diff --git a/include/asm-sh64/checksum.h b/include/asm-sh64/checksum.h
index fd034e9ae6e3..ba594ccb42e5 100644
--- a/include/asm-sh64/checksum.h
+++ b/include/asm-sh64/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 */
29asmlinkage unsigned int csum_partial(const unsigned char *buff, int len, 29asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum);
30 unsigned int sum);
31 30
32/* 31/*
33 * Note: when you get a NULL pointer exception here this means someone 32 * Note: when you get a NULL pointer exception here this means someone
@@ -38,46 +37,34 @@ asmlinkage unsigned int csum_partial(const unsigned char *buff, int len,
38 */ 37 */
39 38
40 39
41unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, 40__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len,
42 unsigned int sum); 41 __wsum sum);
43 42
44unsigned int csum_partial_copy_from_user(const char *src, char *dst, 43__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
45 int len, int sum, int *err_ptr); 44 int len, __wsum sum, int *err_ptr);
46 45
47/* 46static inline __sum16 csum_fold(__wsum csum)
48 * These are the old (and unsafe) way of doing checksums, a warning message will be
49 * printed if they are used and an exeption occurs.
50 *
51 * these functions should go away after some time.
52 */
53
54#define csum_partial_copy_fromuser csum_partial_copy
55
56unsigned int csum_partial_copy(const char *src, char *dst, int len,
57 unsigned int sum);
58
59static inline unsigned short csum_fold(unsigned int sum)
60{ 47{
48 u32 sum = (__force u32)csum;
61 sum = (sum & 0xffff) + (sum >> 16); 49 sum = (sum & 0xffff) + (sum >> 16);
62 sum = (sum & 0xffff) + (sum >> 16); 50 sum = (sum & 0xffff) + (sum >> 16);
63 return ~(sum); 51 return (__force __sum16)~sum;
64} 52}
65 53
66unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); 54__sum16 ip_fast_csum(const void *iph, unsigned int ihl);
67 55
68unsigned long csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 56__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
69 unsigned short len, unsigned short proto, 57 unsigned short len, unsigned short proto,
70 unsigned int sum); 58 __wsum sum);
71 59
72/* 60/*
73 * computes the checksum of the TCP/UDP pseudo-header 61 * computes the checksum of the TCP/UDP pseudo-header
74 * returns a 16-bit checksum, already complemented 62 * returns a 16-bit checksum, already complemented
75 */ 63 */
76static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, 64static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
77 unsigned long daddr,
78 unsigned short len, 65 unsigned short len,
79 unsigned short proto, 66 unsigned short proto,
80 unsigned int sum) 67 __wsum sum)
81{ 68{
82 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 69 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
83} 70}
@@ -86,7 +73,7 @@ static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
86 * this routine is used for miscellaneous IP-like checksums, mainly 73 * this routine is used for miscellaneous IP-like checksums, mainly
87 * in icmp.c 74 * in icmp.c
88 */ 75 */
89static inline unsigned short ip_compute_csum(unsigned char * buff, int len) 76static inline __sum16 ip_compute_csum(const void *buff, int len)
90{ 77{
91 return csum_fold(csum_partial(buff, len, 0)); 78 return csum_fold(csum_partial(buff, len, 0));
92} 79}