[IA64] add vmlinuz target
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-ia64 / checksum.h
blob1f230ff8ea81ce9694bc76ec07c6d9858e04862d
1 #ifndef _ASM_IA64_CHECKSUM_H
2 #define _ASM_IA64_CHECKSUM_H
4 /*
5 * Modified 1998, 1999
6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
7 */
9 /*
10 * This is a version of ip_compute_csum() optimized for IP headers,
11 * which always checksum on 4 octet boundaries.
13 extern unsigned short ip_fast_csum (unsigned char * iph, unsigned int ihl);
16 * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit
17 * checksum, already complemented
19 extern unsigned short int csum_tcpudp_magic (unsigned long saddr,
20 unsigned long daddr,
21 unsigned short len,
22 unsigned short proto,
23 unsigned int sum);
25 extern unsigned int csum_tcpudp_nofold (unsigned long saddr,
26 unsigned long daddr,
27 unsigned short len,
28 unsigned short proto,
29 unsigned int sum);
32 * Computes the checksum of a memory block at buff, length len,
33 * and adds in "sum" (32-bit)
35 * returns a 32-bit number suitable for feeding into itself
36 * or csum_tcpudp_magic
38 * this function must be called with even lengths, except
39 * for the last fragment, which may be odd
41 * it's best to have buff aligned on a 32-bit boundary
43 extern unsigned int csum_partial (const unsigned char * buff, int len,
44 unsigned int sum);
47 * Same as csum_partial, but copies from src while it checksums.
49 * Here it is even more important to align src and dst on a 32-bit (or
50 * even better 64-bit) boundary.
52 extern unsigned int csum_partial_copy_from_user (const char *src, char *dst,
53 int len, unsigned int sum,
54 int *errp);
56 extern unsigned int csum_partial_copy_nocheck (const char *src, char *dst,
57 int len, unsigned int sum);
60 * This routine is used for miscellaneous IP-like checksums, mainly in
61 * icmp.c
63 extern unsigned short ip_compute_csum (unsigned char *buff, int len);
66 * Fold a partial checksum without adding pseudo headers.
68 static inline unsigned short
69 csum_fold (unsigned int sum)
71 sum = (sum & 0xffff) + (sum >> 16);
72 sum = (sum & 0xffff) + (sum >> 16);
73 return ~sum;
76 #endif /* _ASM_IA64_CHECKSUM_H */