Path: blob/master/arch/alpha/include/asm/checksum.h
15126 views
#ifndef _ALPHA_CHECKSUM_H1#define _ALPHA_CHECKSUM_H23#include <linux/in6.h>45/*6* This is a version of ip_compute_csum() optimized for IP headers,7* which always checksum on 4 octet boundaries.8*/9extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);1011/*12* computes the checksum of the TCP/UDP pseudo-header13* returns a 16-bit checksum, already complemented14*/15extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,16unsigned short len,17unsigned short proto,18__wsum sum);1920__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,21unsigned short len, unsigned short proto,22__wsum sum);2324/*25* computes the checksum of a memory block at buff, length len,26* and adds in "sum" (32-bit)27*28* returns a 32-bit number suitable for feeding into itself29* or csum_tcpudp_magic30*31* this function must be called with even lengths, except32* for the last fragment, which may be odd33*34* it's best to have buff aligned on a 32-bit boundary35*/36extern __wsum csum_partial(const void *buff, int len, __wsum sum);3738/*39* the same as csum_partial, but copies from src while it40* checksums41*42* here even more important to align src and dst on a 32-bit (or even43* better 64-bit) boundary44*/45__wsum csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *errp);4647__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);484950/*51* this routine is used for miscellaneous IP-like checksums, mainly52* in icmp.c53*/5455extern __sum16 ip_compute_csum(const void *buff, int len);5657/*58* Fold a partial checksum without adding pseudo headers59*/6061static inline __sum16 csum_fold(__wsum csum)62{63u32 sum = (__force u32)csum;64sum = (sum & 0xffff) + (sum >> 16);65sum = (sum & 0xffff) + (sum >> 16);66return (__force __sum16)~sum;67}6869#define _HAVE_ARCH_IPV6_CSUM70extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr,71const struct in6_addr *daddr,72__u32 len, unsigned short proto,73__wsum sum);74#endif757677