2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * MIPS specific IP/TCP/UDP checksumming routines
8 * Authors: Ralf Baechle, <ralf@waldorf-gmbh.de>
9 * Lots of code moved from tcp.c and ip.c; see those files
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
17 #include <net/checksum.h>
18 #include <linux/types.h>
19 #include <asm/byteorder.h>
20 #include <asm/string.h>
21 #include <asm/uaccess.h>
24 * copy while checksumming, otherwise like csum_partial
26 unsigned int csum_partial_copy(const char *src, char *dst,
27 int len, unsigned int sum)
30 * It's 2:30 am and I don't feel like doing it real ...
31 * This is lots slower than the real thing (tm)
33 sum = csum_partial(src, len, sum);
34 memcpy(dst, src, len);
40 * Copy from userspace and compute checksum. If we catch an exception
41 * then zero the rest of the buffer.
43 unsigned int csum_partial_copy_from_user (const char *src, char *dst,
44 int len, unsigned int sum,
49 missing = copy_from_user(dst, src, len);
51 memset(dst + len - missing, 0, missing);
55 return csum_partial(dst, len, sum);