Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / blackfin / include / asm / checksum.h
blob623cc7fb00bc0602871c905c5e14b164b726d4e2
1 /*
2 * Copyright 2004-2009 Analog Devices Inc.
3 * akbar.hussain@lineo.com
5 * Licensed under the GPL-2 or later.
6 */
8 #ifndef _BFIN_CHECKSUM_H
9 #define _BFIN_CHECKSUM_H
12 * computes the checksum of the TCP/UDP pseudo-header
13 * returns a 16-bit checksum, already complemented
16 static inline __wsum
17 __csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
18 unsigned short proto, __wsum sum)
20 unsigned int carry;
22 __asm__ ("%0 = %0 + %2;\n\t"
23 "CC = AC0;\n\t"
24 "%1 = CC;\n\t"
25 "%0 = %0 + %1;\n\t"
26 "%0 = %0 + %3;\n\t"
27 "CC = AC0;\n\t"
28 "%1 = CC;\n\t"
29 "%0 = %0 + %1;\n\t"
30 "%0 = %0 + %4;\n\t"
31 "CC = AC0;\n\t"
32 "%1 = CC;\n\t"
33 "%0 = %0 + %1;\n\t"
34 : "=d" (sum), "=&d" (carry)
35 : "d" (daddr), "d" (saddr), "d" ((len + proto) << 8), "0"(sum)
36 : "CC");
38 return (sum);
40 #define csum_tcpudp_nofold __csum_tcpudp_nofold
42 #include <asm-generic/checksum.h>
44 #endif