Merge branch 'x86-asm-generic-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / arch / microblaze / include / asm / checksum.h
1 /*
2  * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
3  * Copyright (C) 2006 Atmark Techno, Inc.
4  *
5  * This file is subject to the terms and conditions of the GNU General Public
6  * License. See the file "COPYING" in the main directory of this archive
7  * for more details.
8  */
9
10 #ifndef _ASM_MICROBLAZE_CHECKSUM_H
11 #define _ASM_MICROBLAZE_CHECKSUM_H
12
13 /*
14  * computes the checksum of the TCP/UDP pseudo-header
15  * returns a 16-bit checksum, already complemented
16  */
17 #define csum_tcpudp_nofold      csum_tcpudp_nofold
18 static inline __wsum
19 csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
20                    unsigned short proto, __wsum sum)
21 {
22         __asm__("add %0, %0, %1\n\t"
23                 "addc %0, %0, %2\n\t"
24                 "addc %0, %0, %3\n\t"
25                 "addc %0, %0, r0\n\t"
26                 : "+&d" (sum)
27                 : "d" (saddr), "d" (daddr), "d" (len + proto));
28
29         return sum;
30 }
31
32 #include <asm-generic/checksum.h>
33
34 #endif /* _ASM_MICROBLAZE_CHECKSUM_H */