diff options
Diffstat (limited to 'include/asm-alpha')
-rw-r--r-- | include/asm-alpha/checksum.h | 34 |
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 | */ |
10 | extern unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl); | 10 | extern __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 | */ |
16 | extern unsigned short int csum_tcpudp_magic(unsigned long saddr, | 16 | extern __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 | ||
22 | unsigned 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 | */ |
38 | extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); | 37 | extern __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 | */ |
47 | unsigned 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 | ||
49 | unsigned 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 | ||
57 | extern unsigned short ip_compute_csum(unsigned char * buff, int len); | 56 | extern __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 | ||
63 | static inline unsigned short csum_fold(unsigned int sum) | 62 | static 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 |
71 | extern unsigned short int csum_ipv6_magic(struct in6_addr *saddr, | 71 | extern __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 |