Path: blob/master/arch/ia64/include/asm/checksum.h
17525 views
#ifndef _ASM_IA64_CHECKSUM_H1#define _ASM_IA64_CHECKSUM_H23/*4* Modified 1998, 19995* David Mosberger-Tang <[email protected]>, Hewlett-Packard Co6*/78/*9* This is a version of ip_compute_csum() optimized for IP headers,10* which always checksum on 4 octet boundaries.11*/12extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);1314/*15* Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit16* checksum, already complemented17*/18extern __sum16 csum_tcpudp_magic (__be32 saddr, __be32 daddr,19unsigned short len,20unsigned short proto,21__wsum sum);2223extern __wsum csum_tcpudp_nofold (__be32 saddr, __be32 daddr,24unsigned short len,25unsigned short proto,26__wsum sum);2728/*29* Computes the checksum of a memory block at buff, length len,30* and adds in "sum" (32-bit)31*32* returns a 32-bit number suitable for feeding into itself33* or csum_tcpudp_magic34*35* this function must be called with even lengths, except36* for the last fragment, which may be odd37*38* it's best to have buff aligned on a 32-bit boundary39*/40extern __wsum csum_partial(const void *buff, int len, __wsum sum);4142/*43* Same as csum_partial, but copies from src while it checksums.44*45* Here it is even more important to align src and dst on a 32-bit (or46* even better 64-bit) boundary.47*/48extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,49int len, __wsum sum,50int *errp);5152extern __wsum csum_partial_copy_nocheck(const void *src, void *dst,53int len, __wsum sum);5455/*56* This routine is used for miscellaneous IP-like checksums, mainly in57* icmp.c58*/59extern __sum16 ip_compute_csum(const void *buff, int len);6061/*62* Fold a partial checksum without adding pseudo headers.63*/64static inline __sum16 csum_fold(__wsum csum)65{66u32 sum = (__force u32)csum;67sum = (sum & 0xffff) + (sum >> 16);68sum = (sum & 0xffff) + (sum >> 16);69return (__force __sum16)~sum;70}7172#define _HAVE_ARCH_IPV6_CSUM 173struct in6_addr;74extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr,75const struct in6_addr *daddr, __u32 len, unsigned short proto,76__wsum csum);7778#endif /* _ASM_IA64_CHECKSUM_H */798081