summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-07-03 12:36:34 +0000
committerRalf Baechle <ralf@linux-mips.org>1997-07-03 12:36:34 +0000
commit26a7c190bb399132581654f8347d04252e4df456 (patch)
tree623654e98025e9d65c9bda10f7b00d695820e2ce /arch
parent66b0a462f497de7e93fbbd390b69c9f2dd1cb5ac (diff)
Fix byteorder bugs, do some cleanup and minor speedup.
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/lib/checksum.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/mips/lib/checksum.c b/arch/mips/lib/checksum.c
index ee48f659a..d48dbb245 100644
--- a/arch/mips/lib/checksum.c
+++ b/arch/mips/lib/checksum.c
@@ -5,7 +5,7 @@
*
* MIPS specific IP/TCP/UDP checksumming routines
*
- * Authors: Ralf Baechle, <ralf@waldorf-gmbh.de>
+ * Authors: Ralf Baechle, <ralf@gnu.ai.mit.edu>
* Lots of code moved from tcp.c and ip.c; see those files
* for more names.
*
@@ -13,8 +13,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
+ *
+ * $Id:$
*/
#include <net/checksum.h>
+#include <linux/types.h>
+#include <asm/byteorder.h>
#include <asm/string.h>
#include <asm/uaccess.h>
@@ -36,7 +40,7 @@ static inline unsigned long do_csum(const unsigned char * buff, int len)
goto out;
odd = 1 & (unsigned long) buff;
if (odd) {
- result = *buff;
+ result = be16_to_cpu(*buff);
len--;
buff++;
}
@@ -68,7 +72,7 @@ static inline unsigned long do_csum(const unsigned char * buff, int len)
}
}
if (len & 1)
- result += (*buff << 8);
+ result += le16_to_cpu(*buff);
result = from32to16(result);
if (odd)
result = ((result >> 8) & 0xff) | ((result & 0xff) << 8);