summaryrefslogtreecommitdiffstats
path: root/include/net/checksum.h
diff options
context:
space:
mode:
authorTom Herbert <therbert@google.com>2014-05-03 01:28:03 +0200
committerDavid S. Miller <davem@davemloft.net>2014-05-05 21:26:29 +0200
commit07064c6e022ba8dc0c86ce12f7851a1de24e04fc (patch)
treef1a0af6e9e69360d987bb8a40ba802f5cd715f97 /include/net/checksum.h
parentMerge branch 'for-davem' of git://git.kernel.org/pub/scm/linux/kernel/git/lin... (diff)
downloadlinux-07064c6e022ba8dc0c86ce12f7851a1de24e04fc.tar.xz
linux-07064c6e022ba8dc0c86ce12f7851a1de24e04fc.zip
net: Allow csum_add to be provided in arch
csum_add is really nothing more then add-with-carry which can be implemented efficiently in some architectures. Allow architecture to define this protected by HAVE_ARCH_CSUM_ADD. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/checksum.h')
-rw-r--r--include/net/checksum.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/checksum.h b/include/net/checksum.h
index a28f4e0f6251..87cb1903640d 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -57,12 +57,14 @@ static __inline__ __wsum csum_and_copy_to_user
}
#endif
+#ifndef HAVE_ARCH_CSUM_ADD
static inline __wsum csum_add(__wsum csum, __wsum addend)
{
u32 res = (__force u32)csum;
res += (__force u32)addend;
return (__force __wsum)(res + (res < (__force u32)addend));
}
+#endif
static inline __wsum csum_sub(__wsum csum, __wsum addend)
{