aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/lib/csum-partial.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/lib/csum-partial.c')
-rw-r--r--arch/x86_64/lib/csum-partial.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86_64/lib/csum-partial.c b/arch/x86_64/lib/csum-partial.c
index c493735218da..bc503f506903 100644
--- a/arch/x86_64/lib/csum-partial.c
+++ b/arch/x86_64/lib/csum-partial.c
@@ -9,8 +9,6 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <asm/checksum.h> 10#include <asm/checksum.h>
11 11
12#define __force_inline inline __attribute__((always_inline))
13
14static inline unsigned short from32to16(unsigned a) 12static inline unsigned short from32to16(unsigned a)
15{ 13{
16 unsigned short b = a >> 16; 14 unsigned short b = a >> 16;
@@ -33,7 +31,7 @@ static inline unsigned short from32to16(unsigned a)
33 * Unrolling to an 128 bytes inner loop. 31 * Unrolling to an 128 bytes inner loop.
34 * Using interleaving with more registers to break the carry chains. 32 * Using interleaving with more registers to break the carry chains.
35 */ 33 */
36static __force_inline unsigned do_csum(const unsigned char *buff, unsigned len) 34static unsigned do_csum(const unsigned char *buff, unsigned len)
37{ 35{
38 unsigned odd, count; 36 unsigned odd, count;
39 unsigned long result = 0; 37 unsigned long result = 0;
@@ -132,9 +130,10 @@ static __force_inline unsigned do_csum(const unsigned char *buff, unsigned len)
132 * 130 *
133 * it's best to have buff aligned on a 64-bit boundary 131 * it's best to have buff aligned on a 64-bit boundary
134 */ 132 */
135unsigned csum_partial(const unsigned char *buff, unsigned len, unsigned sum) 133__wsum csum_partial(const void *buff, int len, __wsum sum)
136{ 134{
137 return add32_with_carry(do_csum(buff, len), sum); 135 return (__force __wsum)add32_with_carry(do_csum(buff, len),
136 (__force u32)sum);
138} 137}
139 138
140EXPORT_SYMBOL(csum_partial); 139EXPORT_SYMBOL(csum_partial);
@@ -143,7 +142,7 @@ EXPORT_SYMBOL(csum_partial);
143 * this routine is used for miscellaneous IP-like checksums, mainly 142 * this routine is used for miscellaneous IP-like checksums, mainly
144 * in icmp.c 143 * in icmp.c
145 */ 144 */
146unsigned short ip_compute_csum(unsigned char * buff, int len) 145__sum16 ip_compute_csum(const void *buff, int len)
147{ 146{
148 return csum_fold(csum_partial(buff,len,0)); 147 return csum_fold(csum_partial(buff,len,0));
149} 148}