Commit | Line | Data |
---|---|---|
96f1050d RG |
1 | /* |
2 | * Copyright 2004-2009 Analog Devices Inc. | |
3 | * akbar.hussain@lineo.com | |
4 | * | |
5 | * Licensed under the GPL-2 or later. | |
6 | */ | |
7 | ||
1394f032 BW |
8 | #ifndef _BFIN_CHECKSUM_H |
9 | #define _BFIN_CHECKSUM_H | |
10 | ||
1394f032 BW |
11 | /* |
12 | * computes the checksum of the TCP/UDP pseudo-header | |
13 | * returns a 16-bit checksum, already complemented | |
14 | */ | |
15 | ||
45b3947c | 16 | static inline __wsum |
ddf9ddac | 17 | __csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, |
45b3947c | 18 | unsigned short proto, __wsum sum) |
1394f032 | 19 | { |
aa9c33b4 MH |
20 | unsigned int carry; |
21 | ||
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"); | |
1394f032 BW |
37 | |
38 | return (sum); | |
39 | } | |
ddf9ddac | 40 | #define csum_tcpudp_nofold __csum_tcpudp_nofold |
1394f032 | 41 | |
ddf9ddac | 42 | #include <asm-generic/checksum.h> |
1394f032 | 43 | |
ddf9ddac | 44 | #endif |