Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / arch / blackfin / include / asm / checksum.h
blobe7134bf94e3c48502d861166dd42fabf1f2b5ee5
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, __u32 len,
18 __u8 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