diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-05-07 02:55:41 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-05-07 02:55:41 +0000 |
commit | dcec8a13bf565e47942a1751a9cec21bec5648fe (patch) | |
tree | 548b69625b18cc2e88c3e68d0923be546c9ebb03 /include/asm-sparc64/checksum.h | |
parent | 2e0f55e79c49509b7ff70ff1a10e1e9e90a3dfd4 (diff) |
o Merge with Linux 2.1.99.
o Fix ancient bug in the ELF loader making ldd crash.
o Fix ancient bug in the keyboard code for SGI, SNI and Jazz.
Diffstat (limited to 'include/asm-sparc64/checksum.h')
-rw-r--r-- | include/asm-sparc64/checksum.h | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/include/asm-sparc64/checksum.h b/include/asm-sparc64/checksum.h index bb32044c0..e3da2651a 100644 --- a/include/asm-sparc64/checksum.h +++ b/include/asm-sparc64/checksum.h @@ -1,4 +1,4 @@ -/* $Id: checksum.h,v 1.10 1997/08/09 18:09:03 jj Exp $ */ +/* $Id: checksum.h,v 1.11 1998/04/17 02:37:22 davem Exp $ */ #ifndef __SPARC64_CHECKSUM_H #define __SPARC64_CHECKSUM_H @@ -116,10 +116,23 @@ extern __inline__ unsigned short ip_fast_csum(__const__ unsigned char *iph, return sum; } -/* computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ -extern __inline__ unsigned short csum_tcpudp_magic(unsigned long saddr, +/* Fold a partial checksum without adding pseudo headers. */ +extern __inline__ unsigned short csum_fold(unsigned int sum) +{ + unsigned int tmp; + + __asm__ __volatile__(" + addcc %0, %1, %1 + srl %1, 16, %1 + addc %1, %%g0, %1 + xnor %%g0, %1, %0 +" : "=&r" (sum), "=r" (tmp) + : "0" (sum), "1" (sum<<16) + : "cc"); + return (sum & 0xffff); +} + +extern __inline__ unsigned long csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, unsigned int len, unsigned short proto, @@ -130,31 +143,23 @@ extern __inline__ unsigned short csum_tcpudp_magic(unsigned long saddr, addccc %2, %0, %0 addccc %3, %0, %0 addc %0, %%g0, %0 - sll %0, 16, %1 - addcc %1, %0, %0 - srl %0, 16, %0 - addc %0, %%g0, %0 - xnor %%g0, %0, %0 " : "=r" (sum), "=r" (saddr) : "r" (daddr), "r" ((proto<<16)+len), "0" (sum), "1" (saddr) : "cc"); - return (sum & 0xffff); + return sum; } -/* Fold a partial checksum without adding pseudo headers. */ -extern __inline__ unsigned short csum_fold(unsigned int sum) +/* + * computes the checksum of the TCP/UDP pseudo-header + * returns a 16-bit checksum, already complemented + */ +static inline unsigned short int csum_tcpudp_magic(unsigned long saddr, + unsigned long daddr, + unsigned short len, + unsigned short proto, + unsigned int sum) { - unsigned int tmp; - - __asm__ __volatile__(" - addcc %0, %1, %1 - srl %1, 16, %1 - addc %1, %%g0, %1 - xnor %%g0, %1, %0 -" : "=&r" (sum), "=r" (tmp) - : "0" (sum), "1" (sum<<16) - : "cc"); - return (sum & 0xffff); + return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); } #define _HAVE_ARCH_IPV6_CSUM |