1 #ifndef _ASM_IA64_CHECKSUM_H
2 #define _ASM_IA64_CHECKSUM_H
6 * David Mosberger-Tang <davidm@hpl.hp.com>, Hewlett-Packard Co
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_from_user (const char *src
, char *dst
,
53 int len
, unsigned int sum
,
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
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);
76 #endif /* _ASM_IA64_CHECKSUM_H */