aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2015-03-10 09:33:40 +0800
committerAlex Shi <alex.shi@linaro.org>2015-03-10 09:48:38 +0800
commit42f504e28a169ebfea0e3d9c6e151451800e41d5 (patch)
treed01c160e4e9a5c094e91706ab60651e26098fb60 /lib
parentc810fcb930d9c705774427bb6eb551b2e1108adb (diff)
parent389fb5fb0b8b812ce0e853d5eca748b08fc73289 (diff)
Merge tag 'v3.10.71' into linux-linaro-lsk
This is the 3.10.71 stable release Conflicts: arch/arm64/kernel/setup.c
Diffstat (limited to 'lib')
-rw-r--r--lib/checksum.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/checksum.c b/lib/checksum.c
index 129775eb6de6..8b39e86dbab5 100644
--- a/lib/checksum.c
+++ b/lib/checksum.c
@@ -181,6 +181,15 @@ csum_partial_copy(const void *src, void *dst, int len, __wsum sum)
EXPORT_SYMBOL(csum_partial_copy);
#ifndef csum_tcpudp_nofold
+static inline u32 from64to32(u64 x)
+{
+ /* add up 32-bit and 32-bit for 32+c bit */
+ x = (x & 0xffffffff) + (x >> 32);
+ /* add up carry.. */
+ x = (x & 0xffffffff) + (x >> 32);
+ return (u32)x;
+}
+
__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
unsigned short len,
unsigned short proto,
@@ -195,8 +204,7 @@ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
#else
s += (proto + len) << 8;
#endif
- s += (s >> 32);
- return (__force __wsum)s;
+ return (__force __wsum)from64to32(s);
}
EXPORT_SYMBOL(csum_tcpudp_nofold);
#endif