Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexander Duyck and committed by
David S. Miller
01cfbad7 fbd40ea0

+106 -150
+3 -6
arch/alpha/include/asm/checksum.h
··· 13 13 * computes the checksum of the TCP/UDP pseudo-header 14 14 * returns a 16-bit checksum, already complemented 15 15 */ 16 - extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 17 - unsigned short len, 18 - unsigned short proto, 19 - __wsum sum); 16 + __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 17 + __u32 len, __u8 proto, __wsum sum); 20 18 21 19 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 22 - unsigned short len, unsigned short proto, 23 - __wsum sum); 20 + __u32 len, __u8 proto, __wsum sum); 24 21 25 22 /* 26 23 * computes the checksum of a memory block at buff, length len,
+2 -6
arch/alpha/lib/checksum.c
··· 42 42 * returns a 16-bit checksum, already complemented. 43 43 */ 44 44 __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 45 - unsigned short len, 46 - unsigned short proto, 47 - __wsum sum) 45 + __u32 len, __u8 proto, __wsum sum) 48 46 { 49 47 return (__force __sum16)~from64to16( 50 48 (__force u64)saddr + (__force u64)daddr + ··· 50 52 } 51 53 52 54 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 53 - unsigned short len, 54 - unsigned short proto, 55 - __wsum sum) 55 + __u32 len, __u8 proto, __wsum sum) 56 56 { 57 57 unsigned long result; 58 58
+2 -2
arch/arc/include/asm/checksum.h
··· 70 70 * SA [4], DA [4], zeroes [1], Proto[1], TCP Seg(hdr+data) Len [2] 71 71 */ 72 72 static inline __wsum 73 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 74 - unsigned short proto, __wsum sum) 73 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 74 + __u8 proto, __wsum sum) 75 75 { 76 76 __asm__ __volatile__( 77 77 " add.f %0, %0, %1 \n"
+5 -5
arch/arm/include/asm/checksum.h
··· 84 84 } 85 85 86 86 static inline __wsum 87 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 88 - unsigned short proto, __wsum sum) 87 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 88 + __u8 proto, __wsum sum) 89 89 { 90 - u32 lenprot = len | proto << 16; 90 + u32 lenprot = len + proto; 91 91 if (__builtin_constant_p(sum) && sum == 0) { 92 92 __asm__( 93 93 "adds %0, %1, %2 @ csum_tcpudp_nofold0 \n\t" ··· 121 121 * returns a 16-bit checksum, already complemented 122 122 */ 123 123 static inline __sum16 124 - csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 125 - unsigned short proto, __wsum sum) 124 + csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, 125 + __u8 proto, __wsum sum) 126 126 { 127 127 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 128 128 }
+4 -6
arch/avr32/include/asm/checksum.h
··· 111 111 } 112 112 113 113 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 114 - unsigned short len, 115 - unsigned short proto, 116 - __wsum sum) 114 + __u32 len, __u8 proto, 115 + __wsum sum) 117 116 { 118 117 asm(" add %0, %1\n" 119 118 " adc %0, %0, %2\n" ··· 131 132 * returns a 16-bit checksum, already complemented 132 133 */ 133 134 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 134 - unsigned short len, 135 - unsigned short proto, 136 - __wsum sum) 135 + __u32 len, __u8 proto, 136 + __wsum sum) 137 137 { 138 138 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 139 139 }
+2 -2
arch/blackfin/include/asm/checksum.h
··· 14 14 */ 15 15 16 16 static inline __wsum 17 - __csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 18 - unsigned short proto, __wsum sum) 17 + __csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 18 + __u8 proto, __wsum sum) 19 19 { 20 20 unsigned int carry; 21 21
+2 -2
arch/c6x/include/asm/checksum.h
··· 10 10 #define _ASM_C6X_CHECKSUM_H 11 11 12 12 static inline __wsum 13 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 14 - unsigned short proto, __wsum sum) 13 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 14 + __u8 proto, __wsum sum) 15 15 { 16 16 unsigned long long tmp; 17 17
+2 -2
arch/cris/include/arch-v10/arch/checksum.h
··· 9 9 */ 10 10 11 11 static inline __wsum 12 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 13 - unsigned short proto, __wsum sum) 12 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 13 + __u8 proto, __wsum sum) 14 14 { 15 15 __wsum res; 16 16 __asm__ ("add.d %2, %0\n\t"
+1 -1
arch/cris/include/arch-v32/arch/checksum.h
··· 11 11 */ 12 12 static inline __wsum 13 13 csum_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 16 __wsum res; 17 17
+2 -3
arch/cris/include/asm/checksum.h
··· 63 63 */ 64 64 65 65 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 66 - unsigned short len, 67 - unsigned short proto, 68 - __wsum sum) 66 + __u32 len, __u8 proto, 67 + __wsum sum) 69 68 { 70 69 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 71 70 }
+4 -4
arch/frv/include/asm/checksum.h
··· 105 105 * returns a 16-bit checksum, already complemented 106 106 */ 107 107 static inline __wsum 108 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 109 - unsigned short proto, __wsum sum) 108 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 109 + __u8 proto, __wsum sum) 110 110 { 111 111 asm(" addcc %1,%0,%0,icc0 \n" 112 112 " addxcc %2,%0,%0,icc0 \n" ··· 120 120 } 121 121 122 122 static inline __sum16 123 - csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 124 - unsigned short proto, __wsum sum) 123 + csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, 124 + __u8 proto, __wsum sum) 125 125 { 126 126 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 127 127 }
+4 -4
arch/hexagon/include/asm/checksum.h
··· 38 38 * returns a 16-bit checksum, already complemented 39 39 */ 40 40 #define csum_tcpudp_nofold csum_tcpudp_nofold 41 - __wsum csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 42 - unsigned short len, unsigned short proto, __wsum sum); 41 + __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 42 + __u32 len, __u8 proto, __wsum sum); 43 43 44 44 #define csum_tcpudp_magic csum_tcpudp_magic 45 - __sum16 csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, 46 - unsigned short len, unsigned short proto, __wsum sum); 45 + __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 46 + __u32 len, __u8 proto, __wsum sum); 47 47 48 48 #include <asm-generic/checksum.h> 49 49
+4 -6
arch/hexagon/lib/checksum.c
··· 60 60 * computes the checksum of the TCP/UDP pseudo-header 61 61 * returns a 16-bit checksum, already complemented. 62 62 */ 63 - __sum16 csum_tcpudp_magic(unsigned long saddr, unsigned long daddr, 64 - unsigned short len, unsigned short proto, 65 - __wsum sum) 63 + __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 64 + __u32 len, __u8 proto, __wsum sum) 66 65 { 67 66 return (__force __sum16)~from64to16( 68 67 (__force u64)saddr + (__force u64)daddr + 69 68 (__force u64)sum + ((len + proto) << 8)); 70 69 } 71 70 72 - __wsum csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr, 73 - unsigned short len, unsigned short proto, 74 - __wsum sum) 71 + __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 72 + __u32 len, __u8 proto, __wsum sum) 75 73 { 76 74 u64 result; 77 75
+4 -8
arch/ia64/include/asm/checksum.h
··· 16 16 * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit 17 17 * checksum, already complemented 18 18 */ 19 - extern __sum16 csum_tcpudp_magic (__be32 saddr, __be32 daddr, 20 - unsigned short len, 21 - unsigned short proto, 22 - __wsum sum); 19 + extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 20 + __u32 len, __u8 proto, __wsum sum); 23 21 24 - extern __wsum csum_tcpudp_nofold (__be32 saddr, __be32 daddr, 25 - unsigned short len, 26 - unsigned short proto, 27 - __wsum sum); 22 + extern __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 23 + __u32 len, __u8 proto, __wsum sum); 28 24 29 25 /* 30 26 * Computes the checksum of a memory block at buff, length len,
+4 -4
arch/ia64/lib/checksum.c
··· 34 34 * returns a 16-bit checksum, already complemented. 35 35 */ 36 36 __sum16 37 - csum_tcpudp_magic (__be32 saddr, __be32 daddr, unsigned short len, 38 - unsigned short proto, __wsum sum) 37 + csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, 38 + __u8 proto, __wsum sum) 39 39 { 40 40 return (__force __sum16)~from64to16( 41 41 (__force u64)saddr + (__force u64)daddr + ··· 45 45 EXPORT_SYMBOL(csum_tcpudp_magic); 46 46 47 47 __wsum 48 - csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len, 49 - unsigned short proto, __wsum sum) 48 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 49 + __u8 proto, __wsum sum) 50 50 { 51 51 unsigned long result; 52 52
+4 -6
arch/m32r/include/asm/checksum.h
··· 114 114 } 115 115 116 116 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 117 - unsigned short len, 118 - unsigned short proto, 119 - __wsum sum) 117 + __u32 len, __u8 proto, 118 + __wsum sum) 120 119 { 121 120 #if defined(__LITTLE_ENDIAN) 122 121 unsigned long len_proto = (proto + len) << 8; ··· 144 145 * returns a 16-bit checksum, already complemented 145 146 */ 146 147 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 147 - unsigned short len, 148 - unsigned short proto, 149 - __wsum sum) 148 + __u32 len, __u8 proto, 149 + __wsum sum) 150 150 { 151 151 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 152 152 }
+3 -4
arch/metag/include/asm/checksum.h
··· 59 59 * returns a 16-bit checksum, already complemented 60 60 */ 61 61 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 62 - unsigned short len, 63 - unsigned short proto, 62 + __u32 len, __u8 proto, 64 63 __wsum sum) 65 64 { 66 65 unsigned long len_proto = (proto + len) << 8; ··· 77 78 } 78 79 79 80 static inline __sum16 80 - csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 81 - unsigned short proto, __wsum sum) 81 + csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, 82 + __u8 proto, __wsum sum) 82 83 { 83 84 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 84 85 }
+2 -2
arch/microblaze/include/asm/checksum.h
··· 16 16 */ 17 17 #define csum_tcpudp_nofold csum_tcpudp_nofold 18 18 static inline __wsum 19 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 20 - unsigned short proto, __wsum sum) 19 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 20 + __u8 proto, __wsum sum) 21 21 { 22 22 __asm__("add %0, %0, %1\n\t" 23 23 "addc %0, %0, %2\n\t"
+3 -3
arch/mips/include/asm/checksum.h
··· 160 160 } 161 161 #define ip_fast_csum ip_fast_csum 162 162 163 - static inline __wsum csum_tcpudp_nofold(__be32 saddr, 164 - __be32 daddr, unsigned short len, unsigned short proto, 165 - __wsum sum) 163 + static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 164 + __u32 len, __u8 proto, 165 + __wsum sum) 166 166 { 167 167 __asm__( 168 168 " .set push # csum_tcpudp_nofold\n"
+5 -12
arch/mn10300/include/asm/checksum.h
··· 37 37 return (~sum) >> 16; 38 38 } 39 39 40 - static inline __wsum csum_tcpudp_nofold(unsigned long saddr, 41 - unsigned long daddr, 42 - unsigned short len, 43 - unsigned short proto, 40 + static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 41 + __u32 len, __u8 proto, 44 42 __wsum sum) 45 43 { 46 - __wsum tmp; 47 - 48 - tmp = (__wsum) ntohs(len) << 16; 49 - tmp += (__wsum) proto << 8; 44 + __wsum tmp = (__wsum)((len + proto) << 8); 50 45 51 46 asm( 52 47 " add %1,%0 \n" ··· 59 64 * computes the checksum of the TCP/UDP pseudo-header 60 65 * returns a 16-bit checksum, already complemented 61 66 */ 62 - static inline __sum16 csum_tcpudp_magic(unsigned long saddr, 63 - unsigned long daddr, 64 - unsigned short len, 65 - unsigned short proto, 67 + static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 68 + __u32 len, __u8 proto, 66 69 __wsum sum) 67 70 { 68 71 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
+4 -5
arch/nios2/include/asm/checksum.h
··· 45 45 */ 46 46 #define csum_tcpudp_nofold csum_tcpudp_nofold 47 47 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 48 - unsigned short len, 49 - unsigned short proto, 48 + __u32 len, __u8 proto, 50 49 __wsum sum) 51 50 { 52 51 __asm__ __volatile__( ··· 59 60 "cmpltu r8, %0, %3\n" 60 61 "add %0, %0, r8\n" /* add carry */ 61 62 : "=r" (sum), "=r" (saddr) 62 - : "r" (daddr), "r" ((ntohs(len) << 16) + (proto * 256)), 63 + : "r" (daddr), "r" ((len + proto) << 8), 63 64 "0" (sum), 64 65 "1" (saddr) 65 66 : "r8"); ··· 68 69 } 69 70 70 71 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 71 - unsigned short len, 72 - unsigned short proto, __wsum sum) 72 + __u32 len, __u8 proto, 73 + __wsum sum) 73 74 { 74 75 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 75 76 }
+4 -6
arch/parisc/include/asm/checksum.h
··· 85 85 } 86 86 87 87 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 88 - unsigned short len, 89 - unsigned short proto, 90 - __wsum sum) 88 + __u32 len, __u8 proto, 89 + __wsum sum) 91 90 { 92 91 __asm__( 93 92 " add %1, %0, %0\n" ··· 103 104 * returns a 16-bit checksum, already complemented 104 105 */ 105 106 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 106 - unsigned short len, 107 - unsigned short proto, 108 - __wsum sum) 107 + __u32 len, __u8 proto, 108 + __wsum sum) 109 109 { 110 110 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 111 111 }
+2 -4
arch/s390/include/asm/checksum.h
··· 91 91 * returns a 32-bit checksum 92 92 */ 93 93 static inline __wsum 94 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 95 - unsigned short len, unsigned short proto, 94 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, __u8 proto, 96 95 __wsum sum) 97 96 { 98 97 __u32 csum = (__force __u32)sum; ··· 117 118 */ 118 119 119 120 static inline __sum16 120 - csum_tcpudp_magic(__be32 saddr, __be32 daddr, 121 - unsigned short len, unsigned short proto, 121 + csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, __u8 proto, 122 122 __wsum sum) 123 123 { 124 124 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
+5 -5
arch/score/include/asm/checksum.h
··· 127 127 } 128 128 129 129 static inline __wsum 130 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 131 - unsigned short proto, __wsum sum) 130 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 131 + __u8 proto, __wsum sum) 132 132 { 133 - unsigned long tmp = (ntohs(len) << 16) + proto * 256; 133 + unsigned long tmp = (len + proto) << 8; 134 134 __asm__ __volatile__( 135 135 ".set volatile\n\t" 136 136 "add\t%0, %0, %2\n\t" ··· 161 161 * returns a 16-bit checksum, already complemented 162 162 */ 163 163 static inline __sum16 164 - csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 165 - unsigned short proto, __wsum sum) 164 + csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, 165 + __u8 proto, __wsum sum) 166 166 { 167 167 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 168 168 }
+2 -4
arch/sh/include/asm/checksum_32.h
··· 115 115 } 116 116 117 117 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 118 - unsigned short len, 119 - unsigned short proto, 118 + __u32 len, __u8 proto, 120 119 __wsum sum) 121 120 { 122 121 #ifdef __LITTLE_ENDIAN__ ··· 141 142 * returns a 16-bit checksum, already complemented 142 143 */ 143 144 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 144 - unsigned short len, 145 - unsigned short proto, 145 + __u32 len, __u8 proto, 146 146 __wsum sum) 147 147 { 148 148 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
+4 -6
arch/sparc/include/asm/checksum_32.h
··· 170 170 } 171 171 172 172 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 173 - unsigned short len, 174 - unsigned short proto, 175 - __wsum sum) 173 + __u32 len, __u8 proto, 174 + __wsum sum) 176 175 { 177 176 __asm__ __volatile__("addcc\t%1, %0, %0\n\t" 178 177 "addxcc\t%2, %0, %0\n\t" ··· 189 190 * returns a 16-bit checksum, already complemented 190 191 */ 191 192 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 192 - unsigned short len, 193 - unsigned short proto, 194 - __wsum sum) 193 + __u32 len, __u8 proto, 194 + __wsum sum) 195 195 { 196 196 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 197 197 }
+2 -4
arch/sparc/include/asm/checksum_64.h
··· 96 96 } 97 97 98 98 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 99 - unsigned int len, 100 - unsigned short proto, 99 + __u32 len, __u8 proto, 101 100 __wsum sum) 102 101 { 103 102 __asm__ __volatile__( ··· 115 116 * returns a 16-bit checksum, already complemented 116 117 */ 117 118 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 118 - unsigned short len, 119 - unsigned short proto, 119 + __u32 len, __u8 proto, 120 120 __wsum sum) 121 121 { 122 122 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
+2 -2
arch/unicore32/include/asm/checksum.h
··· 20 20 */ 21 21 22 22 static inline __wsum 23 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 24 - unsigned short proto, __wsum sum) 23 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 24 + __u8 proto, __wsum sum) 25 25 { 26 26 __asm__( 27 27 "add.a %0, %1, %2\n"
+2 -4
arch/x86/include/asm/checksum_32.h
··· 112 112 } 113 113 114 114 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 115 - unsigned short len, 116 - unsigned short proto, 115 + __u32 len, __u8 proto, 117 116 __wsum sum) 118 117 { 119 118 asm("addl %1, %0 ;\n" ··· 130 131 * returns a 16-bit checksum, already complemented 131 132 */ 132 133 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 133 - unsigned short len, 134 - unsigned short proto, 134 + __u32 len, __u8 proto, 135 135 __wsum sum) 136 136 { 137 137 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
+4 -4
arch/x86/include/asm/checksum_64.h
··· 84 84 * 32bit unfolded. 85 85 */ 86 86 static inline __wsum 87 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 88 - unsigned short proto, __wsum sum) 87 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 88 + __u8 proto, __wsum sum) 89 89 { 90 90 asm(" addl %1, %0\n" 91 91 " adcl %2, %0\n" ··· 110 110 * complemented and ready to be filled in. 111 111 */ 112 112 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 113 - unsigned short len, 114 - unsigned short proto, __wsum sum) 113 + __u32 len, __u8 proto, 114 + __wsum sum) 115 115 { 116 116 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 117 117 }
+4 -5
arch/x86/um/asm/checksum.h
··· 87 87 * 32bit unfolded. 88 88 */ 89 89 static inline __wsum 90 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 91 - unsigned short proto, __wsum sum) 90 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 91 + __u8 proto, __wsum sum) 92 92 { 93 93 asm(" addl %1, %0\n" 94 94 " adcl %2, %0\n" ··· 104 104 * returns a 16-bit checksum, already complemented 105 105 */ 106 106 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 107 - unsigned short len, 108 - unsigned short proto, 109 - __wsum sum) 107 + __u32 len, __u8 proto, 108 + __wsum sum) 110 109 { 111 110 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 112 111 }
+4 -6
arch/xtensa/include/asm/checksum.h
··· 123 123 } 124 124 125 125 static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 126 - unsigned short len, 127 - unsigned short proto, 128 - __wsum sum) 126 + __u32 len, __u8 proto, 127 + __wsum sum) 129 128 { 130 129 131 130 #ifdef __XTENSA_EL__ ··· 156 157 * returns a 16-bit checksum, already complemented 157 158 */ 158 159 static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, 159 - unsigned short len, 160 - unsigned short proto, 161 - __wsum sum) 160 + __u32 len, __u8 proto, 161 + __wsum sum) 162 162 { 163 163 return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); 164 164 }
+4 -4
include/asm-generic/checksum.h
··· 65 65 * returns a 16-bit checksum, already complemented 66 66 */ 67 67 extern __wsum 68 - csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, 69 - unsigned short proto, __wsum sum); 68 + csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, 69 + __u8 proto, __wsum sum); 70 70 #endif 71 71 72 72 #ifndef csum_tcpudp_magic 73 73 static inline __sum16 74 - csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, 75 - unsigned short proto, __wsum sum) 74 + csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, 75 + __u8 proto, __wsum sum) 76 76 { 77 77 return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); 78 78 }
+1 -3
lib/checksum.c
··· 191 191 } 192 192 193 193 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, 194 - unsigned short len, 195 - unsigned short proto, 196 - __wsum sum) 194 + __u32 len, __u8 proto, __wsum sum) 197 195 { 198 196 unsigned long long s = (__force u32)sum; 199 197