1 #ifndef _ASM_IA64_CHECKSUM_H
2 #define _ASM_IA64_CHECKSUM_H
5 * Copyright (C) 1998, 1999 Hewlett-Packard Co
6 * Copyright (C) 1998, 1999 David Mosberger-Tang <davidm@hpl.hp.com>
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,
25 extern unsigned int csum_tcpudp_nofold (unsigned long saddr,
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,
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 (const char *src, char *dst, int len,
56 * The same as csum_partial, but copies from user space (but on the
57 * ia-64 we have just one address space, so this is identical to the
60 * This is obsolete and will go away.
62 #define csum_partial_copy_fromuser csum_partial_copy
65 * This is a new version of the above that records errors it finds in
66 * *errp, but continues and zeros the rest of the buffer.
68 extern unsigned int csum_partial_copy_from_user (const char *src, char *dst,
69 int len, unsigned int sum,
72 extern unsigned int csum_partial_copy_nocheck (const char *src, char *dst,
73 int len, unsigned int sum);
76 * This routine is used for miscellaneous IP-like checksums, mainly in
79 extern unsigned short ip_compute_csum (unsigned char *buff, int len);
82 * Fold a partial checksum without adding pseudo headers.
84 static inline unsigned short
85 csum_fold (unsigned int sum)
87 sum = (sum & 0xffff) + (sum >> 16);
88 sum = (sum & 0xffff) + (sum >> 16);
92 #endif /* _ASM_IA64_CHECKSUM_H */