0001
0002 #ifndef __ASM_GENERIC_CHECKSUM_H
0003 #define __ASM_GENERIC_CHECKSUM_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 extern __wsum csum_partial(const void *buff, int len, __wsum sum);
0018
0019 #ifndef ip_fast_csum
0020
0021
0022
0023
0024 extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
0025 #endif
0026
0027 #ifndef csum_fold
0028
0029
0030
0031 static inline __sum16 csum_fold(__wsum csum)
0032 {
0033 u32 sum = (__force u32)csum;
0034 sum = (sum & 0xffff) + (sum >> 16);
0035 sum = (sum & 0xffff) + (sum >> 16);
0036 return (__force __sum16)~sum;
0037 }
0038 #endif
0039
0040 #ifndef csum_tcpudp_nofold
0041
0042
0043
0044
0045 extern __wsum
0046 csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
0047 __u8 proto, __wsum sum);
0048 #endif
0049
0050 #ifndef csum_tcpudp_magic
0051 static inline __sum16
0052 csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
0053 __u8 proto, __wsum sum)
0054 {
0055 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
0056 }
0057 #endif
0058
0059
0060
0061
0062
0063 extern __sum16 ip_compute_csum(const void *buff, int len);
0064
0065 #endif