Commit 07064c6e authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

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: default avatarTom Herbert <therbert@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2ad06496
...@@ -57,12 +57,14 @@ static __inline__ __wsum csum_and_copy_to_user ...@@ -57,12 +57,14 @@ static __inline__ __wsum csum_and_copy_to_user
} }
#endif #endif
#ifndef HAVE_ARCH_CSUM_ADD
static inline __wsum csum_add(__wsum csum, __wsum addend) static inline __wsum csum_add(__wsum csum, __wsum addend)
{ {
u32 res = (__force u32)csum; u32 res = (__force u32)csum;
res += (__force u32)addend; res += (__force u32)addend;
return (__force __wsum)(res + (res < (__force u32)addend)); return (__force __wsum)(res + (res < (__force u32)addend));
} }
#endif
static inline __wsum csum_sub(__wsum csum, __wsum addend) static inline __wsum csum_sub(__wsum csum, __wsum addend)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment