Update of /cvsroot/linux-vax/kernel-2.4/include/asm-vax
In directory usw-pr-cvs1:/tmp/cvs-serv24183/include/asm-vax
Modified Files:
checksum.h
Log Message:
added tcpudp_magic and tcpudp_nofold not verified .. will verify later
Index: checksum.h
===================================================================
RCS file: /cvsroot/linux-vax/kernel-2.4/include/asm-vax/checksum.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- checksum.h 2001/02/22 23:25:08 1.3
+++ checksum.h 2001/02/25 00:09:22 1.4
@@ -62,17 +62,17 @@
* computes the checksum of the TCP/UDP pseudo-header
* returns a 16-bit checksum, already complemented
*/
-
-extern unsigned short int csum_tcpudp_magic(unsigned long saddr,
- unsigned long daddr,
- unsigned short len,
- unsigned short proto,
- unsigned int sum);
-
-unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
- unsigned short len, unsigned short proto,
- unsigned int sum);
-
+/*
+ extern unsigned short int csum_tcpudp_magic(unsigned long saddr,
+ unsigned long daddr,
+ unsigned short len,
+ unsigned short proto,
+ unsigned int sum);
+
+ unsigned int csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
+ unsigned short len, unsigned short proto,
+ unsigned int sum)
+*/
/*
* computes the checksum of a memory block at buff, length len,
@@ -149,6 +149,43 @@
sum = (sum & 0xffff) + (sum >> 16);
sum = (sum & 0xffff) + (sum >> 16);
return ~sum;
+}
+
+
+/*
+ * computes the checksum of the TCP/UDP pseudo-header
+ * returns a 16-bit checksum, already complemented
+ */
+static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
+ unsigned long daddr,
+ unsigned short len,
+ unsigned short proto,
+ unsigned int sum)
+{
+
+ /* in X86 this is addl %1, %0
+ adcl %2, %0
+ adcl %3, %0
+ adcl $0, %0 */
+
+ __asm__("addl2 %1, %0\n"
+ "adwc %2, %0\n"
+ "adwc %3, %0\n"
+ "adwc $0, %0\n"
+ : "=r" (sum) : "g" (daddr), "g" (saddr), "g"((ntohs(len)<<16)+proto*256), "0" (sum));
+ return 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)
+{
+ return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
}
/*
|