summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Duyck <aduyck@mirantis.com>2016-03-11 17:05:34 -0500
committerDavid S. Miller <davem@davemloft.net>2016-03-13 23:55:13 -0400
commit01cfbad79a5e2b835abf6a8154a341d75a6fc8cd (patch)
tree6065020f79b979c7e0a4f37489d26279c27379f6
parentfbd40ea0180a2d328c5adc61414dc8bab9335ce2 (diff)
ipv4: Update parameters for csum_tcpudp_magic to their original types
This patch updates all instances of csum_tcpudp_magic and csum_tcpudp_nofold to reflect the types that are usually used as the source inputs. For example the protocol field is populated based on nexthdr which is actually an unsigned 8 bit value. The length is usually populated based on skb->len which is an unsigned integer. This addresses an issue in which the IPv6 function csum_ipv6_magic was generating a checksum using the full 32b of skb->len while csum_tcpudp_magic was only using the lower 16 bits. As a result we could run into issues when attempting to adjust the checksum as there was no protocol agnostic way to update it. With this change the value is still truncated as many architectures use "(len + proto) << 8", however this truncation only occurs for values greater than 16776960 in length and as such is unlikely to occur as we stop the inner headers at ~64K in size. I did have to make a few minor changes in the arm, mn10300, nios2, and score versions of the function in order to support these changes as they were either using things such as an OR to combine the protocol and length, or were using ntohs to convert the length which would have truncated the value. I also updated a few spots in terms of whitespace and type differences for the addresses. Most of this was just to make sure all of the definitions were in sync going forward. Signed-off-by: Alexander Duyck <aduyck@mirantis.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/alpha/include/asm/checksum.h9
-rw-r--r--arch/alpha/lib/checksum.c8
-rw-r--r--arch/arc/include/asm/checksum.h4
-rw-r--r--arch/arm/include/asm/checksum.h10
-rw-r--r--arch/avr32/include/asm/checksum.h10
-rw-r--r--arch/blackfin/include/asm/checksum.h4
-rw-r--r--arch/c6x/include/asm/checksum.h4
-rw-r--r--arch/cris/include/arch-v10/arch/checksum.h4
-rw-r--r--arch/cris/include/arch-v32/arch/checksum.h2
-rw-r--r--arch/cris/include/asm/checksum.h5
-rw-r--r--arch/frv/include/asm/checksum.h8
-rw-r--r--arch/hexagon/include/asm/checksum.h8
-rw-r--r--arch/hexagon/lib/checksum.c10
-rw-r--r--arch/ia64/include/asm/checksum.h12
-rw-r--r--arch/ia64/lib/checksum.c8
-rw-r--r--arch/m32r/include/asm/checksum.h10
-rw-r--r--arch/metag/include/asm/checksum.h7
-rw-r--r--arch/microblaze/include/asm/checksum.h4
-rw-r--r--arch/mips/include/asm/checksum.h6
-rw-r--r--arch/mn10300/include/asm/checksum.h17
-rw-r--r--arch/nios2/include/asm/checksum.h9
-rw-r--r--arch/parisc/include/asm/checksum.h10
-rw-r--r--arch/s390/include/asm/checksum.h6
-rw-r--r--arch/score/include/asm/checksum.h10
-rw-r--r--arch/sh/include/asm/checksum_32.h6
-rw-r--r--arch/sparc/include/asm/checksum_32.h10
-rw-r--r--arch/sparc/include/asm/checksum_64.h6
-rw-r--r--arch/unicore32/include/asm/checksum.h4
-rw-r--r--arch/x86/include/asm/checksum_32.h6
-rw-r--r--arch/x86/include/asm/checksum_64.h8
-rw-r--r--arch/x86/um/asm/checksum.h9
-rw-r--r--arch/xtensa/include/asm/checksum.h10
-rw-r--r--include/asm-generic/checksum.h8
-rw-r--r--lib/checksum.c4
34 files changed, 106 insertions, 150 deletions
diff --git a/arch/alpha/include/asm/checksum.h b/arch/alpha/include/asm/checksum.h
index d3854bbf0a9e..cba34b1c738c 100644
--- a/arch/alpha/include/asm/checksum.h
+++ b/arch/alpha/include/asm/checksum.h
@@ -13,14 +13,11 @@ extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
13 * computes the checksum of the TCP/UDP pseudo-header 13 * computes the checksum of the TCP/UDP pseudo-header
14 * returns a 16-bit checksum, already complemented 14 * returns a 16-bit checksum, already complemented
15 */ 15 */
16extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 16__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
17 unsigned short len, 17 __u32 len, __u8 proto, __wsum sum);
18 unsigned short proto,
19 __wsum sum);
20 18
21__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 19__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
22 unsigned short len, unsigned short proto, 20 __u32 len, __u8 proto, __wsum sum);
23 __wsum sum);
24 21
25/* 22/*
26 * computes the checksum of a memory block at buff, length len, 23 * computes the checksum of a memory block at buff, length len,
diff --git a/arch/alpha/lib/checksum.c b/arch/alpha/lib/checksum.c
index 199f6efa83fa..377f9e34eb97 100644
--- a/arch/alpha/lib/checksum.c
+++ b/arch/alpha/lib/checksum.c
@@ -42,9 +42,7 @@ static inline unsigned short from64to16(unsigned long x)
42 * returns a 16-bit checksum, already complemented. 42 * returns a 16-bit checksum, already complemented.
43 */ 43 */
44__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 44__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
45 unsigned short len, 45 __u32 len, __u8 proto, __wsum sum)
46 unsigned short proto,
47 __wsum sum)
48{ 46{
49 return (__force __sum16)~from64to16( 47 return (__force __sum16)~from64to16(
50 (__force u64)saddr + (__force u64)daddr + 48 (__force u64)saddr + (__force u64)daddr +
@@ -52,9 +50,7 @@ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
52} 50}
53 51
54__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 52__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
55 unsigned short len, 53 __u32 len, __u8 proto, __wsum sum)
56 unsigned short proto,
57 __wsum sum)
58{ 54{
59 unsigned long result; 55 unsigned long result;
60 56
diff --git a/arch/arc/include/asm/checksum.h b/arch/arc/include/asm/checksum.h
index 10957298b7a3..913eb4aab05b 100644
--- a/arch/arc/include/asm/checksum.h
+++ b/arch/arc/include/asm/checksum.h
@@ -70,8 +70,8 @@ ip_fast_csum(const void *iph, unsigned int ihl)
70 * SA [4], DA [4], zeroes [1], Proto[1], TCP Seg(hdr+data) Len [2] 70 * SA [4], DA [4], zeroes [1], Proto[1], TCP Seg(hdr+data) Len [2]
71 */ 71 */
72static inline __wsum 72static inline __wsum
73csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 73csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
74 unsigned short proto, __wsum sum) 74 __u8 proto, __wsum sum)
75{ 75{
76 __asm__ __volatile__( 76 __asm__ __volatile__(
77 " add.f %0, %0, %1 \n" 77 " add.f %0, %0, %1 \n"
diff --git a/arch/arm/include/asm/checksum.h b/arch/arm/include/asm/checksum.h
index 523315115478..42d020b7dfba 100644
--- a/arch/arm/include/asm/checksum.h
+++ b/arch/arm/include/asm/checksum.h
@@ -84,10 +84,10 @@ ip_fast_csum(const void *iph, unsigned int ihl)
84} 84}
85 85
86static inline __wsum 86static inline __wsum
87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
88 unsigned short proto, __wsum sum) 88 __u8 proto, __wsum sum)
89{ 89{
90 u32 lenprot = len | proto << 16; 90 u32 lenprot = len + proto;
91 if (__builtin_constant_p(sum) && sum == 0) { 91 if (__builtin_constant_p(sum) && sum == 0) {
92 __asm__( 92 __asm__(
93 "adds %0, %1, %2 @ csum_tcpudp_nofold0 \n\t" 93 "adds %0, %1, %2 @ csum_tcpudp_nofold0 \n\t"
@@ -121,8 +121,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
121 * returns a 16-bit checksum, already complemented 121 * returns a 16-bit checksum, already complemented
122 */ 122 */
123static inline __sum16 123static inline __sum16
124csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 124csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
125 unsigned short proto, __wsum sum) 125 __u8 proto, __wsum sum)
126{ 126{
127 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 127 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
128} 128}
diff --git a/arch/avr32/include/asm/checksum.h b/arch/avr32/include/asm/checksum.h
index 4ddbfd2486af..4ab7d5bdaf53 100644
--- a/arch/avr32/include/asm/checksum.h
+++ b/arch/avr32/include/asm/checksum.h
@@ -111,9 +111,8 @@ static inline __sum16 csum_fold(__wsum sum)
111} 111}
112 112
113static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 113static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
114 unsigned short len, 114 __u32 len, __u8 proto,
115 unsigned short proto, 115 __wsum sum)
116 __wsum sum)
117{ 116{
118 asm(" add %0, %1\n" 117 asm(" add %0, %1\n"
119 " adc %0, %0, %2\n" 118 " adc %0, %0, %2\n"
@@ -132,9 +131,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
132 * returns a 16-bit checksum, already complemented 131 * returns a 16-bit checksum, already complemented
133 */ 132 */
134static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 133static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
135 unsigned short len, 134 __u32 len, __u8 proto,
136 unsigned short proto, 135 __wsum sum)
137 __wsum sum)
138{ 136{
139 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 137 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
140} 138}
diff --git a/arch/blackfin/include/asm/checksum.h b/arch/blackfin/include/asm/checksum.h
index 623cc7fb00bc..e7134bf94e3c 100644
--- a/arch/blackfin/include/asm/checksum.h
+++ b/arch/blackfin/include/asm/checksum.h
@@ -14,8 +14,8 @@
14 */ 14 */
15 15
16static inline __wsum 16static inline __wsum
17__csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 17__csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
18 unsigned short proto, __wsum sum) 18 __u8 proto, __wsum sum)
19{ 19{
20 unsigned int carry; 20 unsigned int carry;
21 21
diff --git a/arch/c6x/include/asm/checksum.h b/arch/c6x/include/asm/checksum.h
index 7246816d6e4d..249b0e421ddc 100644
--- a/arch/c6x/include/asm/checksum.h
+++ b/arch/c6x/include/asm/checksum.h
@@ -10,8 +10,8 @@
10#define _ASM_C6X_CHECKSUM_H 10#define _ASM_C6X_CHECKSUM_H
11 11
12static inline __wsum 12static inline __wsum
13csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 13csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
14 unsigned short proto, __wsum sum) 14 __u8 proto, __wsum sum)
15{ 15{
16 unsigned long long tmp; 16 unsigned long long tmp;
17 17
diff --git a/arch/cris/include/arch-v10/arch/checksum.h b/arch/cris/include/arch-v10/arch/checksum.h
index b8000c5d7fe1..d1d1bd9e1090 100644
--- a/arch/cris/include/arch-v10/arch/checksum.h
+++ b/arch/cris/include/arch-v10/arch/checksum.h
@@ -9,8 +9,8 @@
9 */ 9 */
10 10
11static inline __wsum 11static inline __wsum
12csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 12csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
13 unsigned short proto, __wsum sum) 13 __u8 proto, __wsum sum)
14{ 14{
15 __wsum res; 15 __wsum res;
16 __asm__ ("add.d %2, %0\n\t" 16 __asm__ ("add.d %2, %0\n\t"
diff --git a/arch/cris/include/arch-v32/arch/checksum.h b/arch/cris/include/arch-v32/arch/checksum.h
index e5dcfce6e0dc..65cf205b1329 100644
--- a/arch/cris/include/arch-v32/arch/checksum.h
+++ b/arch/cris/include/arch-v32/arch/checksum.h
@@ -11,7 +11,7 @@
11 */ 11 */
12static inline __wsum 12static inline __wsum
13csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 13csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
14 unsigned short len, unsigned short proto, __wsum sum) 14 __u32 len, __u8 proto, __wsum sum)
15{ 15{
16 __wsum res; 16 __wsum res;
17 17
diff --git a/arch/cris/include/asm/checksum.h b/arch/cris/include/asm/checksum.h
index 75dcb77d6cb0..ea949c60b190 100644
--- a/arch/cris/include/asm/checksum.h
+++ b/arch/cris/include/asm/checksum.h
@@ -63,9 +63,8 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
63 */ 63 */
64 64
65static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 65static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
66 unsigned short len, 66 __u32 len, __u8 proto,
67 unsigned short proto, 67 __wsum sum)
68 __wsum sum)
69{ 68{
70 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 69 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
71} 70}
diff --git a/arch/frv/include/asm/checksum.h b/arch/frv/include/asm/checksum.h
index 269da09ff637..cd59cd4fd2d9 100644
--- a/arch/frv/include/asm/checksum.h
+++ b/arch/frv/include/asm/checksum.h
@@ -105,8 +105,8 @@ static inline __sum16 csum_fold(__wsum sum)
105 * returns a 16-bit checksum, already complemented 105 * returns a 16-bit checksum, already complemented
106 */ 106 */
107static inline __wsum 107static inline __wsum
108csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 108csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
109 unsigned short proto, __wsum sum) 109 __u8 proto, __wsum sum)
110{ 110{
111 asm(" addcc %1,%0,%0,icc0 \n" 111 asm(" addcc %1,%0,%0,icc0 \n"
112 " addxcc %2,%0,%0,icc0 \n" 112 " addxcc %2,%0,%0,icc0 \n"
@@ -120,8 +120,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
120} 120}
121 121
122static inline __sum16 122static inline __sum16
123csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 123csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
124 unsigned short proto, __wsum sum) 124 __u8 proto, __wsum sum)
125{ 125{
126 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 126 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
127} 127}
diff --git a/arch/hexagon/include/asm/checksum.h b/arch/hexagon/include/asm/checksum.h
index 46ec8a7fd65f..d9f58d696238 100644
--- a/arch/hexagon/include/asm/checksum.h
+++ b/arch/hexagon/include/asm/checksum.h
@@ -38,12 +38,12 @@ __wsum csum_partial_copy_nocheck(const void *src, void *dst,
38 * returns a 16-bit checksum, already complemented 38 * returns a 16-bit checksum, already complemented
39 */ 39 */
40#define csum_tcpudp_nofold csum_tcpudp_nofold 40#define csum_tcpudp_nofold csum_tcpudp_nofold
41__wsum csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 41__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
42 unsigned short len, unsigned short proto, __wsum sum); 42 __u32 len, __u8 proto, __wsum sum);
43 43
44#define csum_tcpudp_magic csum_tcpudp_magic 44#define csum_tcpudp_magic csum_tcpudp_magic
45__sum16 csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, 45__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
46 unsigned short len, unsigned short proto, __wsum sum); 46 __u32 len, __u8 proto, __wsum sum);
47 47
48#include <asm-generic/checksum.h> 48#include <asm-generic/checksum.h>
49 49
diff --git a/arch/hexagon/lib/checksum.c b/arch/hexagon/lib/checksum.c
index 8169f78a46a7..617506d1a559 100644
--- a/arch/hexagon/lib/checksum.c
+++ b/arch/hexagon/lib/checksum.c
@@ -60,18 +60,16 @@ static inline unsigned short from64to16(u64 x)
60 * computes the checksum of the TCP/UDP pseudo-header 60 * computes the checksum of the TCP/UDP pseudo-header
61 * returns a 16-bit checksum, already complemented. 61 * returns a 16-bit checksum, already complemented.
62 */ 62 */
63__sum16 csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, 63__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
64 unsigned short len, unsigned short proto, 64 __u32 len, __u8 proto, __wsum sum)
65 __wsum sum)
66{ 65{
67 return (__force __sum16)~from64to16( 66 return (__force __sum16)~from64to16(
68 (__force u64)saddr + (__force u64)daddr + 67 (__force u64)saddr + (__force u64)daddr +
69 (__force u64)sum + ((len + proto) << 8)); 68 (__force u64)sum + ((len + proto) << 8));
70} 69}
71 70
72__wsum csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 71__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
73 unsigned short len, unsigned short proto, 72 __u32 len, __u8 proto, __wsum sum)
74 __wsum sum)
75{ 73{
76 u64 result; 74 u64 result;
77 75
diff --git a/arch/ia64/include/asm/checksum.h b/arch/ia64/include/asm/checksum.h
index 97af155057e4..ac9c687e8384 100644
--- a/arch/ia64/include/asm/checksum.h
+++ b/arch/ia64/include/asm/checksum.h
@@ -16,15 +16,11 @@ extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
16 * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit 16 * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit
17 * checksum, already complemented 17 * checksum, already complemented
18 */ 18 */
19extern __sum16 csum_tcpudp_magic (__be32 saddr, __be32 daddr, 19extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
20 unsigned short len, 20 __u32 len, __u8 proto, __wsum sum);
21 unsigned short proto,
22 __wsum sum);
23 21
24extern __wsum csum_tcpudp_nofold (__be32 saddr, __be32 daddr, 22extern __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
25 unsigned short len, 23 __u32 len, __u8 proto, __wsum sum);
26 unsigned short proto,
27 __wsum sum);
28 24
29/* 25/*
30 * Computes the checksum of a memory block at buff, length len, 26 * Computes the checksum of a memory block at buff, length len,
diff --git a/arch/ia64/lib/checksum.c b/arch/ia64/lib/checksum.c
index 9fc955026f86..2cb23cb0c2e1 100644
--- a/arch/ia64/lib/checksum.c
+++ b/arch/ia64/lib/checksum.c
@@ -34,8 +34,8 @@ from64to16 (unsigned long x)
34 * returns a 16-bit checksum, already complemented. 34 * returns a 16-bit checksum, already complemented.
35 */ 35 */
36__sum16 36__sum16
37csum_tcpudp_magic (__be32 saddr, __be32 daddr, unsigned short len, 37csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
38 unsigned short proto, __wsum sum) 38 __u8 proto, __wsum sum)
39{ 39{
40 return (__force __sum16)~from64to16( 40 return (__force __sum16)~from64to16(
41 (__force u64)saddr + (__force u64)daddr + 41 (__force u64)saddr + (__force u64)daddr +
@@ -45,8 +45,8 @@ csum_tcpudp_magic (__be32 saddr, __be32 daddr, unsigned short len,
45EXPORT_SYMBOL(csum_tcpudp_magic); 45EXPORT_SYMBOL(csum_tcpudp_magic);
46 46
47__wsum 47__wsum
48csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len, 48csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
49 unsigned short proto, __wsum sum) 49 __u8 proto, __wsum sum)
50{ 50{
51 unsigned long result; 51 unsigned long result;
52 52
diff --git a/arch/m32r/include/asm/checksum.h b/arch/m32r/include/asm/checksum.h
index a7a7c4f44abe..d68e93c9bd62 100644
--- a/arch/m32r/include/asm/checksum.h
+++ b/arch/m32r/include/asm/checksum.h
@@ -114,9 +114,8 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
114} 114}
115 115
116static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 116static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
117 unsigned short len, 117 __u32 len, __u8 proto,
118 unsigned short proto, 118 __wsum sum)
119 __wsum sum)
120{ 119{
121#if defined(__LITTLE_ENDIAN) 120#if defined(__LITTLE_ENDIAN)
122 unsigned long len_proto = (proto + len) << 8; 121 unsigned long len_proto = (proto + len) << 8;
@@ -145,9 +144,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
145 * returns a 16-bit checksum, already complemented 144 * returns a 16-bit checksum, already complemented
146 */ 145 */
147static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 146static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
148 unsigned short len, 147 __u32 len, __u8 proto,
149 unsigned short proto, 148 __wsum sum)
150 __wsum sum)
151{ 149{
152 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 150 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
153} 151}
diff --git a/arch/metag/include/asm/checksum.h b/arch/metag/include/asm/checksum.h
index 08dd1cc65799..f65fe83b1730 100644
--- a/arch/metag/include/asm/checksum.h
+++ b/arch/metag/include/asm/checksum.h
@@ -59,8 +59,7 @@ extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
59 * returns a 16-bit checksum, already complemented 59 * returns a 16-bit checksum, already complemented
60 */ 60 */
61static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 61static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
62 unsigned short len, 62 __u32 len, __u8 proto,
63 unsigned short proto,
64 __wsum sum) 63 __wsum sum)
65{ 64{
66 unsigned long len_proto = (proto + len) << 8; 65 unsigned long len_proto = (proto + len) << 8;
@@ -78,8 +77,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
78} 77}
79 78
80static inline __sum16 79static inline __sum16
81csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 80csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
82 unsigned short proto, __wsum sum) 81 __u8 proto, __wsum sum)
83{ 82{
84 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 83 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
85} 84}
diff --git a/arch/microblaze/include/asm/checksum.h b/arch/microblaze/include/asm/checksum.h
index 0185cbefdda4..adeecebbb0d1 100644
--- a/arch/microblaze/include/asm/checksum.h
+++ b/arch/microblaze/include/asm/checksum.h
@@ -16,8 +16,8 @@
16 */ 16 */
17#define csum_tcpudp_nofold csum_tcpudp_nofold 17#define csum_tcpudp_nofold csum_tcpudp_nofold
18static inline __wsum 18static inline __wsum
19csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 19csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
20 unsigned short proto, __wsum sum) 20 __u8 proto, __wsum sum)
21{ 21{
22 __asm__("add %0, %0, %1\n\t" 22 __asm__("add %0, %0, %1\n\t"
23 "addc %0, %0, %2\n\t" 23 "addc %0, %0, %2\n\t"
diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h
index 3ceacde5eb6e..c635541d40b8 100644
--- a/arch/mips/include/asm/checksum.h
+++ b/arch/mips/include/asm/checksum.h
@@ -160,9 +160,9 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
160} 160}
161#define ip_fast_csum ip_fast_csum 161#define ip_fast_csum ip_fast_csum
162 162
163static inline __wsum csum_tcpudp_nofold(__be32 saddr, 163static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
164 __be32 daddr, unsigned short len, unsigned short proto, 164 __u32 len, __u8 proto,
165 __wsum sum) 165 __wsum sum)
166{ 166{
167 __asm__( 167 __asm__(
168 " .set push # csum_tcpudp_nofold\n" 168 " .set push # csum_tcpudp_nofold\n"
diff --git a/arch/mn10300/include/asm/checksum.h b/arch/mn10300/include/asm/checksum.h
index 9fb2a8d8826a..c80df5b504ac 100644
--- a/arch/mn10300/include/asm/checksum.h
+++ b/arch/mn10300/include/asm/checksum.h
@@ -37,16 +37,11 @@ static inline __sum16 csum_fold(__wsum sum)
37 return (~sum) >> 16; 37 return (~sum) >> 16;
38} 38}
39 39
40static inline __wsum csum_tcpudp_nofold(unsigned long saddr, 40static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
41 unsigned long daddr, 41 __u32 len, __u8 proto,
42 unsigned short len,
43 unsigned short proto,
44 __wsum sum) 42 __wsum sum)
45{ 43{
46 __wsum tmp; 44 __wsum tmp = (__wsum)((len + proto) << 8);
47
48 tmp = (__wsum) ntohs(len) << 16;
49 tmp += (__wsum) proto << 8;
50 45
51 asm( 46 asm(
52 " add %1,%0 \n" 47 " add %1,%0 \n"
@@ -64,10 +59,8 @@ static inline __wsum csum_tcpudp_nofold(unsigned long saddr,
64 * computes the checksum of the TCP/UDP pseudo-header 59 * computes the checksum of the TCP/UDP pseudo-header
65 * returns a 16-bit checksum, already complemented 60 * returns a 16-bit checksum, already complemented
66 */ 61 */
67static inline __sum16 csum_tcpudp_magic(unsigned long saddr, 62static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
68 unsigned long daddr, 63 __u32 len, __u8 proto,
69 unsigned short len,
70 unsigned short proto,
71 __wsum sum) 64 __wsum sum)
72{ 65{
73 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 66 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
diff --git a/arch/nios2/include/asm/checksum.h b/arch/nios2/include/asm/checksum.h
index 6bc1f0d5df7b..703c5ee63421 100644
--- a/arch/nios2/include/asm/checksum.h
+++ b/arch/nios2/include/asm/checksum.h
@@ -45,8 +45,7 @@ static inline __sum16 csum_fold(__wsum sum)
45 */ 45 */
46#define csum_tcpudp_nofold csum_tcpudp_nofold 46#define csum_tcpudp_nofold csum_tcpudp_nofold
47static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 47static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
48 unsigned short len, 48 __u32 len, __u8 proto,
49 unsigned short proto,
50 __wsum sum) 49 __wsum sum)
51{ 50{
52 __asm__ __volatile__( 51 __asm__ __volatile__(
@@ -60,7 +59,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
60 "cmpltu r8, %0, %3\n" 59 "cmpltu r8, %0, %3\n"
61 "add %0, %0, r8\n" /* add carry */ 60 "add %0, %0, r8\n" /* add carry */
62 : "=r" (sum), "=r" (saddr) 61 : "=r" (sum), "=r" (saddr)
63 : "r" (daddr), "r" ((ntohs(len) << 16) + (proto * 256)), 62 : "r" (daddr), "r" ((len + proto) << 8),
64 "0" (sum), 63 "0" (sum),
65 "1" (saddr) 64 "1" (saddr)
66 : "r8"); 65 : "r8");
@@ -69,8 +68,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
69} 68}
70 69
71static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 70static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
72 unsigned short len, 71 __u32 len, __u8 proto,
73 unsigned short proto, __wsum sum) 72 __wsum sum)
74{ 73{
75 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 74 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
76} 75}
diff --git a/arch/parisc/include/asm/checksum.h b/arch/parisc/include/asm/checksum.h
index c84b2fcb18a9..9815ab1fc8aa 100644
--- a/arch/parisc/include/asm/checksum.h
+++ b/arch/parisc/include/asm/checksum.h
@@ -85,9 +85,8 @@ static inline __sum16 csum_fold(__wsum csum)
85} 85}
86 86
87static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 87static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
88 unsigned short len, 88 __u32 len, __u8 proto,
89 unsigned short proto, 89 __wsum sum)
90 __wsum sum)
91{ 90{
92 __asm__( 91 __asm__(
93 " add %1, %0, %0\n" 92 " add %1, %0, %0\n"
@@ -104,9 +103,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
104 * returns a 16-bit checksum, already complemented 103 * returns a 16-bit checksum, already complemented
105 */ 104 */
106static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 105static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
107 unsigned short len, 106 __u32 len, __u8 proto,
108 unsigned short proto, 107 __wsum sum)
109 __wsum sum)
110{ 108{
111 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 109 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
112} 110}
diff --git a/arch/s390/include/asm/checksum.h b/arch/s390/include/asm/checksum.h
index 740364856355..d7f100c53f07 100644
--- a/arch/s390/include/asm/checksum.h
+++ b/arch/s390/include/asm/checksum.h
@@ -91,8 +91,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
91 * returns a 32-bit checksum 91 * returns a 32-bit checksum
92 */ 92 */
93static inline __wsum 93static inline __wsum
94csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 94csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, __u8 proto,
95 unsigned short len, unsigned short proto,
96 __wsum sum) 95 __wsum sum)
97{ 96{
98 __u32 csum = (__force __u32)sum; 97 __u32 csum = (__force __u32)sum;
@@ -118,8 +117,7 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
118 */ 117 */
119 118
120static inline __sum16 119static inline __sum16
121csum_tcpudp_magic(__be32 saddr, __be32 daddr, 120csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, __u8 proto,
122 unsigned short len, unsigned short proto,
123 __wsum sum) 121 __wsum sum)
124{ 122{
125 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 123 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
diff --git a/arch/score/include/asm/checksum.h b/arch/score/include/asm/checksum.h
index 961bd64015a8..a375bc2700be 100644
--- a/arch/score/include/asm/checksum.h
+++ b/arch/score/include/asm/checksum.h
@@ -127,10 +127,10 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
127} 127}
128 128
129static inline __wsum 129static inline __wsum
130csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 130csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
131 unsigned short proto, __wsum sum) 131 __u8 proto, __wsum sum)
132{ 132{
133 unsigned long tmp = (ntohs(len) << 16) + proto * 256; 133 unsigned long tmp = (len + proto) << 8;
134 __asm__ __volatile__( 134 __asm__ __volatile__(
135 ".set volatile\n\t" 135 ".set volatile\n\t"
136 "add\t%0, %0, %2\n\t" 136 "add\t%0, %0, %2\n\t"
@@ -161,8 +161,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
161 * returns a 16-bit checksum, already complemented 161 * returns a 16-bit checksum, already complemented
162 */ 162 */
163static inline __sum16 163static inline __sum16
164csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 164csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
165 unsigned short proto, __wsum sum) 165 __u8 proto, __wsum sum)
166{ 166{
167 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 167 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
168} 168}
diff --git a/arch/sh/include/asm/checksum_32.h b/arch/sh/include/asm/checksum_32.h
index 14b7ac2f0a07..fd730f140c06 100644
--- a/arch/sh/include/asm/checksum_32.h
+++ b/arch/sh/include/asm/checksum_32.h
@@ -115,8 +115,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
115} 115}
116 116
117static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 117static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
118 unsigned short len, 118 __u32 len, __u8 proto,
119 unsigned short proto,
120 __wsum sum) 119 __wsum sum)
121{ 120{
122#ifdef __LITTLE_ENDIAN__ 121#ifdef __LITTLE_ENDIAN__
@@ -142,8 +141,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
142 * returns a 16-bit checksum, already complemented 141 * returns a 16-bit checksum, already complemented
143 */ 142 */
144static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 143static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
145 unsigned short len, 144 __u32 len, __u8 proto,
146 unsigned short proto,
147 __wsum sum) 145 __wsum sum)
148{ 146{
149 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 147 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
diff --git a/arch/sparc/include/asm/checksum_32.h b/arch/sparc/include/asm/checksum_32.h
index 426b2389a1c2..86ae655a3c0f 100644
--- a/arch/sparc/include/asm/checksum_32.h
+++ b/arch/sparc/include/asm/checksum_32.h
@@ -170,9 +170,8 @@ static inline __sum16 csum_fold(__wsum sum)
170} 170}
171 171
172static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 172static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
173 unsigned short len, 173 __u32 len, __u8 proto,
174 unsigned short proto, 174 __wsum sum)
175 __wsum sum)
176{ 175{
177 __asm__ __volatile__("addcc\t%1, %0, %0\n\t" 176 __asm__ __volatile__("addcc\t%1, %0, %0\n\t"
178 "addxcc\t%2, %0, %0\n\t" 177 "addxcc\t%2, %0, %0\n\t"
@@ -190,9 +189,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
190 * returns a 16-bit checksum, already complemented 189 * returns a 16-bit checksum, already complemented
191 */ 190 */
192static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 191static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
193 unsigned short len, 192 __u32 len, __u8 proto,
194 unsigned short proto, 193 __wsum sum)
195 __wsum sum)
196{ 194{
197 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 195 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
198} 196}
diff --git a/arch/sparc/include/asm/checksum_64.h b/arch/sparc/include/asm/checksum_64.h
index b8779a6a5911..ef0c6f48189a 100644
--- a/arch/sparc/include/asm/checksum_64.h
+++ b/arch/sparc/include/asm/checksum_64.h
@@ -96,8 +96,7 @@ static inline __sum16 csum_fold(__wsum sum)
96} 96}
97 97
98static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 98static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
99 unsigned int len, 99 __u32 len, __u8 proto,
100 unsigned short proto,
101 __wsum sum) 100 __wsum sum)
102{ 101{
103 __asm__ __volatile__( 102 __asm__ __volatile__(
@@ -116,8 +115,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
116 * returns a 16-bit checksum, already complemented 115 * returns a 16-bit checksum, already complemented
117 */ 116 */
118static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 117static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
119 unsigned short len, 118 __u32 len, __u8 proto,
120 unsigned short proto,
121 __wsum sum) 119 __wsum sum)
122{ 120{
123 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 121 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
diff --git a/arch/unicore32/include/asm/checksum.h b/arch/unicore32/include/asm/checksum.h
index f55c3f937c3e..23ceb9e3a89b 100644
--- a/arch/unicore32/include/asm/checksum.h
+++ b/arch/unicore32/include/asm/checksum.h
@@ -20,8 +20,8 @@
20 */ 20 */
21 21
22static inline __wsum 22static inline __wsum
23csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 23csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
24 unsigned short proto, __wsum sum) 24 __u8 proto, __wsum sum)
25{ 25{
26 __asm__( 26 __asm__(
27 "add.a %0, %1, %2\n" 27 "add.a %0, %1, %2\n"
diff --git a/arch/x86/include/asm/checksum_32.h b/arch/x86/include/asm/checksum_32.h
index f50de6951738..6f380605403d 100644
--- a/arch/x86/include/asm/checksum_32.h
+++ b/arch/x86/include/asm/checksum_32.h
@@ -112,8 +112,7 @@ static inline __sum16 csum_fold(__wsum sum)
112} 112}
113 113
114static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 114static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
115 unsigned short len, 115 __u32 len, __u8 proto,
116 unsigned short proto,
117 __wsum sum) 116 __wsum sum)
118{ 117{
119 asm("addl %1, %0 ;\n" 118 asm("addl %1, %0 ;\n"
@@ -131,8 +130,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
131 * returns a 16-bit checksum, already complemented 130 * returns a 16-bit checksum, already complemented
132 */ 131 */
133static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 132static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
134 unsigned short len, 133 __u32 len, __u8 proto,
135 unsigned short proto,
136 __wsum sum) 134 __wsum sum)
137{ 135{
138 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 136 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
diff --git a/arch/x86/include/asm/checksum_64.h b/arch/x86/include/asm/checksum_64.h
index cd00e1774491..97b98e2039bc 100644
--- a/arch/x86/include/asm/checksum_64.h
+++ b/arch/x86/include/asm/checksum_64.h
@@ -84,8 +84,8 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
84 * 32bit unfolded. 84 * 32bit unfolded.
85 */ 85 */
86static inline __wsum 86static inline __wsum
87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 87csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
88 unsigned short proto, __wsum sum) 88 __u8 proto, __wsum sum)
89{ 89{
90 asm(" addl %1, %0\n" 90 asm(" addl %1, %0\n"
91 " adcl %2, %0\n" 91 " adcl %2, %0\n"
@@ -110,8 +110,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
110 * complemented and ready to be filled in. 110 * complemented and ready to be filled in.
111 */ 111 */
112static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 112static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
113 unsigned short len, 113 __u32 len, __u8 proto,
114 unsigned short proto, __wsum sum) 114 __wsum sum)
115{ 115{
116 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 116 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
117} 117}
diff --git a/arch/x86/um/asm/checksum.h b/arch/x86/um/asm/checksum.h
index ee940185e89f..54d96f1e3594 100644
--- a/arch/x86/um/asm/checksum.h
+++ b/arch/x86/um/asm/checksum.h
@@ -87,8 +87,8 @@ static inline __sum16 csum_fold(__wsum sum)
87 * 32bit unfolded. 87 * 32bit unfolded.
88 */ 88 */
89static inline __wsum 89static inline __wsum
90csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 90csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
91 unsigned short proto, __wsum sum) 91 __u8 proto, __wsum sum)
92{ 92{
93 asm(" addl %1, %0\n" 93 asm(" addl %1, %0\n"
94 " adcl %2, %0\n" 94 " adcl %2, %0\n"
@@ -104,9 +104,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
104 * returns a 16-bit checksum, already complemented 104 * returns a 16-bit checksum, already complemented
105 */ 105 */
106static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 106static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
107 unsigned short len, 107 __u32 len, __u8 proto,
108 unsigned short proto, 108 __wsum sum)
109 __wsum sum)
110{ 109{
111 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 110 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
112} 111}
diff --git a/arch/xtensa/include/asm/checksum.h b/arch/xtensa/include/asm/checksum.h
index 0593de689b56..62254e6688f5 100644
--- a/arch/xtensa/include/asm/checksum.h
+++ b/arch/xtensa/include/asm/checksum.h
@@ -123,9 +123,8 @@ static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
123} 123}
124 124
125static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 125static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
126 unsigned short len, 126 __u32 len, __u8 proto,
127 unsigned short proto, 127 __wsum sum)
128 __wsum sum)
129{ 128{
130 129
131#ifdef __XTENSA_EL__ 130#ifdef __XTENSA_EL__
@@ -157,9 +156,8 @@ static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
157 * returns a 16-bit checksum, already complemented 156 * returns a 16-bit checksum, already complemented
158 */ 157 */
159static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 158static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
160 unsigned short len, 159 __u32 len, __u8 proto,
161 unsigned short proto, 160 __wsum sum)
162 __wsum sum)
163{ 161{
164 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 162 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
165} 163}
diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h
index 59811df58c5b..3150cbd8eb21 100644
--- a/include/asm-generic/checksum.h
+++ b/include/asm-generic/checksum.h
@@ -65,14 +65,14 @@ static inline __sum16 csum_fold(__wsum csum)
65 * returns a 16-bit checksum, already complemented 65 * returns a 16-bit checksum, already complemented
66 */ 66 */
67extern __wsum 67extern __wsum
68csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 68csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
69 unsigned short proto, __wsum sum); 69 __u8 proto, __wsum sum);
70#endif 70#endif
71 71
72#ifndef csum_tcpudp_magic 72#ifndef csum_tcpudp_magic
73static inline __sum16 73static inline __sum16
74csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 74csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
75 unsigned short proto, __wsum sum) 75 __u8 proto, __wsum sum)
76{ 76{
77 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 77 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
78} 78}
diff --git a/lib/checksum.c b/lib/checksum.c
index 8b39e86dbab5..d3ec93f9e5f3 100644
--- a/lib/checksum.c
+++ b/lib/checksum.c
@@ -191,9 +191,7 @@ static inline u32 from64to32(u64 x)
191} 191}
192 192
193__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 193__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
194 unsigned short len, 194 __u32 len, __u8 proto, __wsum sum)
195 unsigned short proto,
196 __wsum sum)
197{ 195{
198 unsigned long long s = (__force u32)sum; 196 unsigned long long s = (__force u32)sum;
199 197