diff options
| author | Remis Lima Baima <remis.developer@googlemail.com> | 2009-06-18 13:55:32 -0400 |
|---|---|---|
| committer | Michal Simek <monstr@monstr.eu> | 2009-07-06 04:26:52 -0400 |
| commit | 14f8738976991d2f8fb6ab6e10e9003562c3d6bb (patch) | |
| tree | 1deca31ee3be5e6632bfc2fa3da9e7b4679780ea /arch/microblaze/include | |
| parent | 81d8279ea31a3fc6d4ffacd87119a04c561ca62e (diff) | |
microblaze: use the generic lib/checksum.c
The microblaze checksum code is mostly identical to
the asm-generic+lib version, so use that instead.
Signed-off-by: Remis Lima Baima <remis.developer@googlemail.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
Diffstat (limited to 'arch/microblaze/include')
| -rw-r--r-- | arch/microblaze/include/asm/checksum.h | 70 |
1 files changed, 2 insertions, 68 deletions
diff --git a/arch/microblaze/include/asm/checksum.h b/arch/microblaze/include/asm/checksum.h index 97ea46b5cf80..128bf03b54b7 100644 --- a/arch/microblaze/include/asm/checksum.h +++ b/arch/microblaze/include/asm/checksum.h | |||
| @@ -10,12 +10,11 @@ | |||
| 10 | #ifndef _ASM_MICROBLAZE_CHECKSUM_H | 10 | #ifndef _ASM_MICROBLAZE_CHECKSUM_H |
| 11 | #define _ASM_MICROBLAZE_CHECKSUM_H | 11 | #define _ASM_MICROBLAZE_CHECKSUM_H |
| 12 | 12 | ||
| 13 | #include <linux/in6.h> | ||
| 14 | |||
| 15 | /* | 13 | /* |
| 16 | * computes the checksum of the TCP/UDP pseudo-header | 14 | * computes the checksum of the TCP/UDP pseudo-header |
| 17 | * returns a 16-bit checksum, already complemented | 15 | * returns a 16-bit checksum, already complemented |
| 18 | */ | 16 | */ |
| 17 | #define csum_tcpudp_nofold csum_tcpudp_nofold | ||
| 19 | static inline __wsum | 18 | static inline __wsum |
| 20 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | 19 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, |
| 21 | unsigned short proto, __wsum sum) | 20 | unsigned short proto, __wsum sum) |
| @@ -30,71 +29,6 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | |||
| 30 | return sum; | 29 | return sum; |
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | /* | 32 | #include <asm-generic/checksum.h> |
| 34 | * computes the checksum of a memory block at buff, length len, | ||
| 35 | * and adds in "sum" (32-bit) | ||
| 36 | * | ||
| 37 | * returns a 32-bit number suitable for feeding into itself | ||
| 38 | * or csum_tcpudp_magic | ||
| 39 | * | ||
| 40 | * this function must be called with even lengths, except | ||
| 41 | * for the last fragment, which may be odd | ||
| 42 | * | ||
| 43 | * it's best to have buff aligned on a 32-bit boundary | ||
| 44 | */ | ||
| 45 | extern __wsum csum_partial(const void *buff, int len, __wsum sum); | ||
| 46 | |||
| 47 | /* | ||
| 48 | * the same as csum_partial, but copies from src while it | ||
| 49 | * checksums | ||
| 50 | * | ||
| 51 | * here even more important to align src and dst on a 32-bit (or even | ||
| 52 | * better 64-bit) boundary | ||
| 53 | */ | ||
| 54 | extern __wsum csum_partial_copy(const void *src, void *dst, int len, | ||
| 55 | __wsum sum); | ||
| 56 | |||
| 57 | /* | ||
| 58 | * the same as csum_partial_copy, but copies from user space. | ||
| 59 | * | ||
| 60 | * here even more important to align src and dst on a 32-bit (or even | ||
| 61 | * better 64-bit) boundary | ||
| 62 | */ | ||
| 63 | extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | ||
| 64 | int len, __wsum sum, int *csum_err); | ||
| 65 | |||
| 66 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ | ||
| 67 | csum_partial_copy((src), (dst), (len), (sum)) | ||
| 68 | |||
| 69 | /* | ||
| 70 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
| 71 | * which always checksum on 4 octet boundaries. | ||
| 72 | * | ||
| 73 | */ | ||
| 74 | extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); | ||
| 75 | |||
| 76 | /* | ||
| 77 | * Fold a partial checksum | ||
| 78 | */ | ||
| 79 | static inline __sum16 csum_fold(__wsum csum) | ||
| 80 | { | ||
| 81 | u32 sum = (__force u32)csum; | ||
| 82 | sum = (sum & 0xffff) + (sum >> 16); | ||
| 83 | sum = (sum & 0xffff) + (sum >> 16); | ||
| 84 | return (__force __sum16)~sum; | ||
| 85 | } | ||
| 86 | |||
| 87 | static inline __sum16 | ||
| 88 | csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, | ||
| 89 | unsigned short proto, __wsum sum) | ||
| 90 | { | ||
| 91 | return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); | ||
| 92 | } | ||
| 93 | |||
| 94 | /* | ||
| 95 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
| 96 | * in icmp.c | ||
| 97 | */ | ||
| 98 | extern __sum16 ip_compute_csum(const void *buff, int len); | ||
| 99 | 33 | ||
| 100 | #endif /* _ASM_MICROBLAZE_CHECKSUM_H */ | 34 | #endif /* _ASM_MICROBLAZE_CHECKSUM_H */ |
