diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-15 00:16:30 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:23:05 -0500 |
commit | 322529961e3b3e64fdf1a3e46a45294456c91acf (patch) | |
tree | 94f029cb2fce7d2672e1bba0e80a47a0bb170d0c /include/asm-ia64 | |
parent | db521083bcb75505e9c3e21cbabe8274ee0daea6 (diff) |
[NET]: IA64 checksum annotations and cleanups.
* sanitize prototypes, annotate
* ntohs -> shift in checksum calculations
* kill access_ok() in csum_partial_copy_from_user
* collapse do_csum_partial_copy_from_user
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-ia64')
-rw-r--r-- | include/asm-ia64/checksum.h | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/include/asm-ia64/checksum.h b/include/asm-ia64/checksum.h index 1f230ff8ea81..bd40f4756ce1 100644 --- a/include/asm-ia64/checksum.h +++ b/include/asm-ia64/checksum.h | |||
@@ -10,23 +10,21 @@ | |||
10 | * This is a version of ip_compute_csum() optimized for IP headers, | 10 | * This is a version of ip_compute_csum() optimized for IP headers, |
11 | * which always checksum on 4 octet boundaries. | 11 | * which always checksum on 4 octet boundaries. |
12 | */ | 12 | */ |
13 | extern unsigned short ip_fast_csum (unsigned char * iph, unsigned int ihl); | 13 | extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); |
14 | 14 | ||
15 | /* | 15 | /* |
16 | * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit | 16 | * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit |
17 | * checksum, already complemented | 17 | * checksum, already complemented |
18 | */ | 18 | */ |
19 | extern unsigned short int csum_tcpudp_magic (unsigned long saddr, | 19 | extern __sum16 csum_tcpudp_magic (__be32 saddr, __be32 daddr, |
20 | unsigned long daddr, | ||
21 | unsigned short len, | 20 | unsigned short len, |
22 | unsigned short proto, | 21 | unsigned short proto, |
23 | unsigned int sum); | 22 | __wsum sum); |
24 | 23 | ||
25 | extern unsigned int csum_tcpudp_nofold (unsigned long saddr, | 24 | extern __wsum csum_tcpudp_nofold (__be32 saddr, __be32 daddr, |
26 | unsigned long daddr, | ||
27 | unsigned short len, | 25 | unsigned short len, |
28 | unsigned short proto, | 26 | unsigned short proto, |
29 | unsigned int sum); | 27 | __wsum sum); |
30 | 28 | ||
31 | /* | 29 | /* |
32 | * Computes the checksum of a memory block at buff, length len, | 30 | * Computes the checksum of a memory block at buff, length len, |
@@ -40,8 +38,7 @@ extern unsigned int csum_tcpudp_nofold (unsigned long saddr, | |||
40 | * | 38 | * |
41 | * it's best to have buff aligned on a 32-bit boundary | 39 | * it's best to have buff aligned on a 32-bit boundary |
42 | */ | 40 | */ |
43 | extern unsigned int csum_partial (const unsigned char * buff, int len, | 41 | extern __wsum csum_partial(const void *buff, int len, __wsum sum); |
44 | unsigned int sum); | ||
45 | 42 | ||
46 | /* | 43 | /* |
47 | * Same as csum_partial, but copies from src while it checksums. | 44 | * Same as csum_partial, but copies from src while it checksums. |
@@ -49,28 +46,28 @@ extern unsigned int csum_partial (const unsigned char * buff, int len, | |||
49 | * Here it is even more important to align src and dst on a 32-bit (or | 46 | * Here it is even more important to align src and dst on a 32-bit (or |
50 | * even better 64-bit) boundary. | 47 | * even better 64-bit) boundary. |
51 | */ | 48 | */ |
52 | extern unsigned int csum_partial_copy_from_user (const char *src, char *dst, | 49 | extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, |
53 | int len, unsigned int sum, | 50 | int len, __wsum sum, |
54 | int *errp); | 51 | int *errp); |
55 | 52 | ||
56 | extern unsigned int csum_partial_copy_nocheck (const char *src, char *dst, | 53 | extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, |
57 | int len, unsigned int sum); | 54 | int len, __wsum sum); |
58 | 55 | ||
59 | /* | 56 | /* |
60 | * This routine is used for miscellaneous IP-like checksums, mainly in | 57 | * This routine is used for miscellaneous IP-like checksums, mainly in |
61 | * icmp.c | 58 | * icmp.c |
62 | */ | 59 | */ |
63 | extern unsigned short ip_compute_csum (unsigned char *buff, int len); | 60 | extern __sum16 ip_compute_csum(const void *buff, int len); |
64 | 61 | ||
65 | /* | 62 | /* |
66 | * Fold a partial checksum without adding pseudo headers. | 63 | * Fold a partial checksum without adding pseudo headers. |
67 | */ | 64 | */ |
68 | static inline unsigned short | 65 | static inline __sum16 csum_fold(__wsum csum) |
69 | csum_fold (unsigned int sum) | ||
70 | { | 66 | { |
67 | u32 sum = (__force u32)csum; | ||
71 | sum = (sum & 0xffff) + (sum >> 16); | 68 | sum = (sum & 0xffff) + (sum >> 16); |
72 | sum = (sum & 0xffff) + (sum >> 16); | 69 | sum = (sum & 0xffff) + (sum >> 16); |
73 | return ~sum; | 70 | return (__force __sum16)~sum; |
74 | } | 71 | } |
75 | 72 | ||
76 | #endif /* _ASM_IA64_CHECKSUM_H */ | 73 | #endif /* _ASM_IA64_CHECKSUM_H */ |