aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-alpha/checksum.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-11-15 00:14:53 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:23:01 -0500
commit9be259aae5264511fe0a8b5e3d6711e0fd1d55df (patch)
treed424fd156edc0568a1d47b9322b1159202be109b /include/asm-alpha/checksum.h
parent2bc357987a6510e61d33f3b20fa989fb2b6a10b8 (diff)
[NET]: Alpha checksum annotations and cleanups.
* sanitize prototypes and annotate * kill useless access_ok() in csum_partial_copy_from_user() (the only caller checks it already). * do_csum_partial_copy_from_user() is not needed now * replace htons(len) with len << 8 - they are the same wrt checksums on little-endian. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-alpha/checksum.h')
-rw-r--r--include/asm-alpha/checksum.h34
1 files changed, 16 insertions, 18 deletions
diff --git a/include/asm-alpha/checksum.h b/include/asm-alpha/checksum.h
index a5c9f08447fb..d3854bbf0a9e 100644
--- a/include/asm-alpha/checksum.h
+++ b/include/asm-alpha/checksum.h
@@ -7,21 +7,20 @@
7 * This is a version of ip_compute_csum() optimized for IP headers, 7 * This is a version of ip_compute_csum() optimized for IP headers,
8 * which always checksum on 4 octet boundaries. 8 * which always checksum on 4 octet boundaries.
9 */ 9 */
10extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); 10extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
11 11
12/* 12/*
13 * computes the checksum of the TCP/UDP pseudo-header 13 * computes the checksum of the TCP/UDP pseudo-header
14 * returns a 16-bit checksum, already complemented 14 * returns a 16-bit checksum, already complemented
15 */ 15 */
16extern unsigned short int csum_tcpudp_magic(unsigned long saddr, 16extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
17 unsigned long daddr,
18 unsigned short len, 17 unsigned short len,
19 unsigned short proto, 18 unsigned short proto,
20 unsigned int sum); 19 __wsum sum);
21 20
22unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 21__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
23 unsigned short len, unsigned short proto, 22 unsigned short len, unsigned short proto,
24 unsigned int sum); 23 __wsum sum);
25 24
26/* 25/*
27 * computes the checksum of a memory block at buff, length len, 26 * computes the checksum of a memory block at buff, length len,
@@ -35,7 +34,7 @@ unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
35 * 34 *
36 * it's best to have buff aligned on a 32-bit boundary 35 * it's best to have buff aligned on a 32-bit boundary
37 */ 36 */
38extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); 37extern __wsum csum_partial(const void *buff, int len, __wsum sum);
39 38
40/* 39/*
41 * the same as csum_partial, but copies from src while it 40 * the same as csum_partial, but copies from src while it
@@ -44,9 +43,9 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i
44 * here even more important to align src and dst on a 32-bit (or even 43 * here even more important to align src and dst on a 32-bit (or even
45 * better 64-bit) boundary 44 * better 64-bit) boundary
46 */ 45 */
47unsigned int csum_partial_copy_from_user(const char __user *src, char *dst, int len, unsigned int sum, int *errp); 46__wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *errp);
48 47
49unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsigned int sum); 48__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
50 49
51 50
52/* 51/*
@@ -54,24 +53,23 @@ unsigned int csum_partial_copy_nocheck(const char *src, char *dst, int len, unsi
54 * in icmp.c 53 * in icmp.c
55 */ 54 */
56 55
57extern unsigned short ip_compute_csum(unsigned char * buff, int len); 56extern __sum16 ip_compute_csum(const void *buff, int len);
58 57
59/* 58/*
60 * Fold a partial checksum without adding pseudo headers 59 * Fold a partial checksum without adding pseudo headers
61 */ 60 */
62 61
63static inline unsigned short csum_fold(unsigned int sum) 62static inline __sum16 csum_fold(__wsum csum)
64{ 63{
64 u32 sum = (__force u32)csum;
65 sum = (sum & 0xffff) + (sum >> 16); 65 sum = (sum & 0xffff) + (sum >> 16);
66 sum = (sum & 0xffff) + (sum >> 16); 66 sum = (sum & 0xffff) + (sum >> 16);
67 return ~sum; 67 return (__force __sum16)~sum;
68} 68}
69 69
70#define _HAVE_ARCH_IPV6_CSUM 70#define _HAVE_ARCH_IPV6_CSUM
71extern unsigned short int csum_ipv6_magic(struct in6_addr *saddr, 71extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
72 struct in6_addr *daddr, 72 const struct in6_addr *daddr,
73 __u32 len, 73 __u32 len, unsigned short proto,
74 unsigned short proto, 74 __wsum sum);
75 unsigned int sum);
76
77#endif 75#endif