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.
19 #include <linux/module.h>
20 #include <linux/types.h>
22 #include <net/checksum.h>
23 #include <asm/byteorder.h>
24 #include <asm/string.h>
25 #include <asm/uaccess.h>
28 * Copy while checksumming, otherwise like csum_partial
30 unsigned int csum_partial_copy_nocheck (const char *src
, char *dst
,
31 int len
, unsigned int sum
)
33 sum
= csum_partial(src
, len
, sum
);
34 memcpy(dst
, src
, len
);
38 EXPORT_SYMBOL(csum_partial_copy_nocheck
);
41 * Copy from userspace and compute checksum. If we catch an exception
42 * then zero the rest of the buffer.
44 unsigned int csum_partial_copy_from_user (const char __user
*src
, char *dst
,
45 int len
, unsigned int sum
,
50 missing
= copy_from_user(dst
, src
, len
);
52 memset(dst
+ len
- missing
, 0, missing
);
56 return csum_partial(dst
, len
-missing
, sum
);
58 EXPORT_SYMBOL(csum_partial_copy_from_user
);