patch-2.1.8 linux/include/asm-mips/checksum.h
Next file: linux/include/asm-sparc/checksum.h
Previous file: linux/include/asm-m68k/ide.h
Back to the patch index
Back to the overall index
- Lines: 77
- Date:
Sun Nov 3 11:04:41 1996
- Orig file:
v2.1.7/linux/include/asm-mips/checksum.h
- Orig date:
Wed Dec 13 12:39:45 1995
diff -u --recursive --new-file v2.1.7/linux/include/asm-mips/checksum.h linux/include/asm-mips/checksum.h
@@ -176,4 +176,76 @@
return sum;
}
+#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)
+{
+ unsigned long scratch;
+
+ __asm__("
+ .set noreorder
+ .set noat
+ addu %0,%5 # proto (long in network byte order)
+ sltu $1,%0,%5
+ addu %0,$1
+
+ addu %0,%6 # csum
+ sltu $1,%0,%6
+ lw %1,0(%2) # four words source address
+ addu %0,$1
+ addu %0,%1
+ sltu $1,%0,$1
+
+ lw %1,4(%2)
+ addu %0,$1
+ addu %0,%1
+ sltu $1,%0,$1
+
+ lw %1,8(%2)
+ addu %0,$1
+ addu %0,%1
+ sltu $1,%0,$1
+
+ lw %1,12(%2)
+ addu %0,$1
+ addu %0,%1
+ sltu $1,%0,$1
+
+ lw %1,0(%3)
+ addu %0,$1
+ addu %0,%1
+ sltu $1,%0,$1
+
+ lw %1,4(%3)
+ addu %0,$1
+ addu %0,%1
+ sltu $1,%0,$1
+
+ lw %1,8(%3)
+ addu %0,$1
+ addu %0,%1
+ sltu $1,%0,$1
+
+ lw %1,12(%3)
+ addu %0,$1
+ addu %0,%1
+ sltu $1,%0,$1
+ .set noat
+ .set noreorder
+ "
+ : "=r" (sum),
+ "=r" (scratch)
+ : "r" (saddr),
+ "r" (daddr),
+ "0" (htonl((__u32) (len))),
+ "r" (htonl(proto)),
+ "r"(sum)
+ : "$1");
+
+ return csum_fold(sum);
+}
+
#endif /* __ASM_MIPS_CHECKSUM_H */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov