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

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

diff -u --recursive --new-file v2.1.7/linux/include/asm-i386/checksum.h linux/include/asm-i386/checksum.h
@@ -115,4 +115,31 @@
     return csum_fold (csum_partial(buff, len, 0));
 }
 
+#define _HAVE_ARCH_IPV6_CSUM
+static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
+						     struct in6_addr *daddr,
+						     __u16 len,
+						     unsigned short proto,
+						     unsigned int sum) 
+{
+	__asm__("
+		addl 0(%1), %0
+		adcl 4(%1), %0
+		adcl 8(%1), %0
+		adcl 12(%1), %0
+		adcl 0(%2), %0
+		adcl 4(%2), %0
+		adcl 8(%2), %0
+		adcl 12(%2), %0
+		adcl %3, %0
+		adcl %4, %0
+		adcl $0, %0
+		"
+		: "=&r" (sum)
+		: "r" (saddr), "r" (daddr), 
+		  "r"(htonl((__u32) (len))), "r"(htonl(proto)), "0"(sum));
+
+	return csum_fold(sum);
+}
+
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov