1 #ifndef __NET_CHECKSUM_WRAPPER_H
2 #define __NET_CHECKSUM_WRAPPER_H 1
4 #include_next <net/checksum.h>
6 #ifndef HAVE_CSUM_UNFOLD
7 static inline __wsum csum_unfold(__sum16 n)
9 return (__force __wsum)n;
11 #endif /* !HAVE_CSUM_UNFOLD */
13 /* Workaround for debugging included in certain versions of XenServer. It only
14 * applies to 32-bit x86.
16 #if defined(HAVE_CSUM_COPY_DBG) && defined(CONFIG_X86_32)
17 #define csum_and_copy_to_user(src, dst, len, sum, err_ptr) \
18 csum_and_copy_to_user(src, dst, len, sum, NULL, err_ptr)
21 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
22 static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
24 __be32 diff[] = { ~from, to };
26 *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum)));
29 #define inet_proto_csum_replace2(sum, skb, from, to, pseudohdr) \
30 inet_proto_csum_replace4(sum, skb, (__force __be32)(from), \
31 (__force __be32)(to), pseudohdr)
34 #endif /* checksum.h */