patch-1.3.26 linux/include/asm-i386/checksum.h

Next file: linux/include/asm-i386/i82489.h
Previous file: linux/include/asm-alpha/unistd.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.25/linux/include/asm-i386/checksum.h linux/include/asm-i386/checksum.h
@@ -100,6 +100,25 @@
 }
 
 /*
+ *	Fold a partial checksum without adding pseudo headers
+ */
+
+static inline unsigned short int csum_fold(unsigned int sum)
+{
+ 	__asm__("
+ 		movl %0, %1
+ 		shrl $16, %1
+ 		addw %w1, %w0
+ 		adcl $0, %0
+ 		notl %0
+ 		"
+ 		: "=&r" (sum)
+ 		: "0" (sum)
+ 	);
+ 	return sum;
+ }
+ 
+/*
  * this routine is used for miscellaneous IP-like checksums, mainly
  * in icmp.c
  */

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