diff options
author | Tom Herbert <therbert@google.com> | 2014-05-02 19:28:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-05 15:26:29 -0400 |
commit | 07064c6e022ba8dc0c86ce12f7851a1de24e04fc (patch) | |
tree | f1a0af6e9e69360d987bb8a40ba802f5cd715f97 /include/net | |
parent | 2ad064968762534c0f3b552d5fe88496787bade9 (diff) |
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')
-rw-r--r-- | include/net/checksum.h | 2 |
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 | |||
57 | } | 57 | } |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifndef HAVE_ARCH_CSUM_ADD | ||
60 | static inline __wsum csum_add(__wsum csum, __wsum addend) | 61 | static inline __wsum csum_add(__wsum csum, __wsum addend) |
61 | { | 62 | { |
62 | u32 res = (__force u32)csum; | 63 | u32 res = (__force u32)csum; |
63 | res += (__force u32)addend; | 64 | res += (__force u32)addend; |
64 | return (__force __wsum)(res + (res < (__force u32)addend)); | 65 | return (__force __wsum)(res + (res < (__force u32)addend)); |
65 | } | 66 | } |
67 | #endif | ||
66 | 68 | ||
67 | static inline __wsum csum_sub(__wsum csum, __wsum addend) | 69 | static inline __wsum csum_sub(__wsum csum, __wsum addend) |
68 | { | 70 | { |