patch-1.3.31 linux/include/asm-alpha/checksum.h

Next file: linux/include/asm-alpha/io.h
Previous file: linux/fs/read_write.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.30/linux/include/asm-alpha/checksum.h linux/include/asm-alpha/checksum.h
@@ -55,4 +55,15 @@
 
 extern unsigned short ip_compute_csum(unsigned char * buff, int len);
 
+/*
+ *	Fold a partial checksum without adding pseudo headers
+ */
+
+static inline unsigned short csum_fold(unsigned int sum)
+{
+	sum = (sum & 0xffff) + (sum >> 16);
+	sum = (sum & 0xffff) + (sum >> 16);
+	return ~sum;
+}
+
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this