Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
checksum.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2009 Analog Devices Inc.
4  *
5  * Licensed under the GPL-2 or later.
6  */
7 
8 #ifndef _BFIN_CHECKSUM_H
9 #define _BFIN_CHECKSUM_H
10 
11 /*
12  * computes the checksum of the TCP/UDP pseudo-header
13  * returns a 16-bit checksum, already complemented
14  */
15 
16 static inline __wsum
17 __csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
18  unsigned short proto, __wsum sum)
19 {
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");
37 
38  return (sum);
39 }
40 #define csum_tcpudp_nofold __csum_tcpudp_nofold
41 
42 #include <asm-generic/checksum.h>
43 
44 #endif