diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-12 13:15:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-12 13:15:17 -0700 |
commit | 02a99ed6207e9a1d787bb360ef97de023c7edf4a (patch) | |
tree | f5818df7dd3f3741d02afbdd4271deed48c41f3d /arch/microblaze/lib/checksum.c | |
parent | 2b10dc45d15150434d7f206264e912eacbff734b (diff) | |
parent | 3447ef29a7f3b1fd0d8d58376950e695e04f6f8b (diff) |
Merge branch 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze
* 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze: (55 commits)
microblaze: Don't use access_ok for unaligned
microblaze: remove unused flat_stack_align() definition
microblaze: Fix problem with early_printk in startup
microblaze_mmu_v2: Makefiles
microblaze_mmu_v2: Kconfig update
microblaze_mmu_v2: stat.h MMU update
microblaze_mmu_v2: Elf update
microblaze_mmu_v2: Update dma.h for MMU
microblaze_mmu_v2: Update cacheflush.h
microblaze_mmu_v2: Update signal returning address
microblaze_mmu_v2: Traps MMU update
microblaze_mmu_v2: Enable fork syscall for MMU and add fork as vfork for noMMU
microblaze_mmu_v2: Update linker script for MMU
microblaze_mmu_v2: Add MMU related exceptions handling
microblaze_mmu_v2: uaccess MMU update
microblaze_mmu_v2: Update exception handling - MMU exception
microblaze_mmu_v2: entry.S, entry.h
microblaze_mmu_v2: Add CURRENT_TASK for entry.S
microblaze_mmu_v2: MMU asm offset update
microblaze_mmu_v2: Update tlb.h and tlbflush.h
...
Diffstat (limited to 'arch/microblaze/lib/checksum.c')
-rw-r--r-- | arch/microblaze/lib/checksum.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/arch/microblaze/lib/checksum.c b/arch/microblaze/lib/checksum.c index 809340070a1..f08e7459141 100644 --- a/arch/microblaze/lib/checksum.c +++ b/arch/microblaze/lib/checksum.c @@ -32,9 +32,10 @@ /* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access kills, so most of the assembly has to go. */ -#include <net/checksum.h> -#include <asm/checksum.h> #include <linux/module.h> +#include <net/checksum.h> + +#include <asm/byteorder.h> static inline unsigned short from32to16(unsigned long x) { @@ -102,6 +103,7 @@ __sum16 ip_fast_csum(const void *iph, unsigned int ihl) { return (__force __sum16)~do_csum(iph, ihl*4); } +EXPORT_SYMBOL(ip_fast_csum); /* * computes the checksum of a memory block at buff, length len, @@ -115,15 +117,16 @@ __sum16 ip_fast_csum(const void *iph, unsigned int ihl) * * it's best to have buff aligned on a 32-bit boundary */ -__wsum csum_partial(const void *buff, int len, __wsum sum) +__wsum csum_partial(const void *buff, int len, __wsum wsum) { + unsigned int sum = (__force unsigned int)wsum; unsigned int result = do_csum(buff, len); /* add in old sum, and carry.. */ result += sum; if (sum > result) result += 1; - return result; + return (__force __wsum)result; } EXPORT_SYMBOL(csum_partial); @@ -131,9 +134,9 @@ EXPORT_SYMBOL(csum_partial); * this routine is used for miscellaneous IP-like checksums, mainly * in icmp.c */ -__sum16 ip_compute_csum(const unsigned char *buff, int len) +__sum16 ip_compute_csum(const void *buff, int len) { - return ~do_csum(buff, len); + return (__force __sum16)~do_csum(buff, len); } EXPORT_SYMBOL(ip_compute_csum); @@ -141,12 +144,18 @@ EXPORT_SYMBOL(ip_compute_csum); * copy from fs while checksumming, otherwise like csum_partial */ __wsum -csum_partial_copy_from_user(const char __user *src, char *dst, int len, - int sum, int *csum_err) +csum_partial_copy_from_user(const void __user *src, void *dst, int len, + __wsum sum, int *csum_err) { - if (csum_err) + int missing; + + missing = __copy_from_user(dst, src, len); + if (missing) { + memset(dst + len - missing, 0, missing); + *csum_err = -EFAULT; + } else *csum_err = 0; - memcpy(dst, src, len); + return csum_partial(dst, len, sum); } EXPORT_SYMBOL(csum_partial_copy_from_user); @@ -155,7 +164,7 @@ EXPORT_SYMBOL(csum_partial_copy_from_user); * copy from ds while checksumming, otherwise like csum_partial */ __wsum -csum_partial_copy(const char *src, char *dst, int len, int sum) +csum_partial_copy(const void *src, void *dst, int len, __wsum sum) { memcpy(dst, src, len); return csum_partial(dst, len, sum); |