ipv4: Update parameters for csum_tcpudp_magic to their original types
authorAlexander Duyck <aduyck@mirantis.com>
Fri, 11 Mar 2016 22:05:34 +0000 (14:05 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 14 Mar 2016 03:55:13 +0000 (23:55 -0400)
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>
34 files changed:
arch/alpha/include/asm/checksum.h
arch/alpha/lib/checksum.c
arch/arc/include/asm/checksum.h
arch/arm/include/asm/checksum.h
arch/avr32/include/asm/checksum.h
arch/blackfin/include/asm/checksum.h
arch/c6x/include/asm/checksum.h
arch/cris/include/arch-v10/arch/checksum.h
arch/cris/include/arch-v32/arch/checksum.h
arch/cris/include/asm/checksum.h
arch/frv/include/asm/checksum.h
arch/hexagon/include/asm/checksum.h
arch/hexagon/lib/checksum.c
arch/ia64/include/asm/checksum.h
arch/ia64/lib/checksum.c
arch/m32r/include/asm/checksum.h
arch/metag/include/asm/checksum.h
arch/microblaze/include/asm/checksum.h
arch/mips/include/asm/checksum.h
arch/mn10300/include/asm/checksum.h
arch/nios2/include/asm/checksum.h
arch/parisc/include/asm/checksum.h
arch/s390/include/asm/checksum.h
arch/score/include/asm/checksum.h
arch/sh/include/asm/checksum_32.h
arch/sparc/include/asm/checksum_32.h
arch/sparc/include/asm/checksum_64.h
arch/unicore32/include/asm/checksum.h
arch/x86/include/asm/checksum_32.h
arch/x86/include/asm/checksum_64.h
arch/x86/um/asm/checksum.h
arch/xtensa/include/asm/checksum.h
include/asm-generic/checksum.h
lib/checksum.c

index d3854bbf0a9e6ab0bf430b96d48008d2d69f24ae..cba34b1c738ccb59fc77ac9a995efd3cc65b2663 100644 (file)
@@ -13,14 +13,11 @@ extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
  * computes the checksum of the TCP/UDP pseudo-header
  * returns a 16-bit checksum, already complemented
  */
-extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                          unsigned short len,
-                                          unsigned short proto,
-                                          __wsum sum);
+__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
+                         __u32 len, __u8 proto, __wsum sum);
 
 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                               unsigned short len, unsigned short proto,
-                               __wsum sum);
+                         __u32 len, __u8 proto, __wsum sum);
 
 /*
  * computes the checksum of a memory block at buff, length len,
index 199f6efa83faa9d809faec8aab319672dc4eed4f..377f9e34eb9709631e50aa20ce87417ebdeac3a8 100644 (file)
@@ -42,9 +42,7 @@ static inline unsigned short from64to16(unsigned long x)
  * returns a 16-bit checksum, already complemented.
  */
 __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                  unsigned short len,
-                                  unsigned short proto,
-                                  __wsum sum)
+                         __u32 len, __u8 proto, __wsum sum)
 {
        return (__force __sum16)~from64to16(
                (__force u64)saddr + (__force u64)daddr +
@@ -52,9 +50,7 @@ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
 }
 
 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                  unsigned short len,
-                                  unsigned short proto,
-                                  __wsum sum)
+                         __u32 len, __u8 proto, __wsum sum)
 {
        unsigned long result;
 
index 10957298b7a3b3a8ff0d31cae7dc959fddcd938b..913eb4aab05bd518d2ec002ff307d37dee4eb87b 100644 (file)
@@ -70,8 +70,8 @@ ip_fast_csum(const void *iph, unsigned int ihl)
  * SA [4], DA [4], zeroes [1], Proto[1], TCP Seg(hdr+data) Len [2]
  */
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
        __asm__ __volatile__(
        "       add.f %0, %0, %1        \n"
index 523315115478960a2e433a66276fea007b120cda..42d020b7dfbaca99e930aa7600a564702512c113 100644 (file)
@@ -84,10 +84,10 @@ ip_fast_csum(const void *iph, unsigned int ihl)
 }
 
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
-       u32 lenprot = len | proto << 16;
+       u32 lenprot = len + proto;
        if (__builtin_constant_p(sum) && sum == 0) {
                __asm__(
                "adds   %0, %1, %2      @ csum_tcpudp_nofold0   \n\t"
@@ -121,8 +121,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16
-csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
-                 unsigned short proto, __wsum sum)
+csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
+                 __u8 proto, __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
 }
index 4ddbfd2486af06412b32e7cf66af54ce1942d9e8..4ab7d5bdaf53a43c33eec7072be41685e7f9edfd 100644 (file)
@@ -111,9 +111,8 @@ static inline __sum16 csum_fold(__wsum sum)
 }
 
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                              unsigned short len,
-                                              unsigned short proto,
-                                              __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        asm("   add     %0, %1\n"
            "   adc     %0, %0, %2\n"
@@ -132,9 +131,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                                  unsigned short len,
-                                                  unsigned short proto,
-                                                  __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
index 623cc7fb00bc0602871c905c5e14b164b726d4e2..e7134bf94e3c48502d861166dd42fabf1f2b5ee5 100644 (file)
@@ -14,8 +14,8 @@
  */
 
 static inline __wsum
-__csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+__csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                    __u8 proto, __wsum sum)
 {
        unsigned int carry;
 
index 7246816d6e4dfa997aab7179ac2505201f8531df..249b0e421ddcb1ebb9807ada0a642b9b8d1e0cae 100644 (file)
@@ -10,8 +10,8 @@
 #define _ASM_C6X_CHECKSUM_H
 
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
        unsigned long long tmp;
 
index b8000c5d7fe106f0f78170f482df2c6602486a73..d1d1bd9e1090118906145490f5c6a721e3d24412 100644 (file)
@@ -9,8 +9,8 @@
  */
 
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
        __wsum res;
        __asm__ ("add.d %2, %0\n\t"
index e5dcfce6e0dc1a5267739b67d9c8bab4233fb777..65cf205b13294ba4fa0c618620233b33cebc091d 100644 (file)
@@ -11,7 +11,7 @@
  */
 static inline __wsum
 csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                  unsigned short len, unsigned short proto, __wsum sum)
+                  __u32 len, __u8 proto, __wsum sum)
 {
        __wsum res;
 
index 75dcb77d6cb024c28b3c18ed3b742f74a3a3097c..ea949c60b1905df4349dc009117fa53259277cd3 100644 (file)
@@ -63,9 +63,8 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
  */
 
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                                  unsigned short len,
-                                                  unsigned short proto,
-                                                  __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
index 269da09ff637f5f1a3bfb6b5ef55e8002bae3f16..cd59cd4fd2d95565682ae4db70e0583e28767fb6 100644 (file)
@@ -105,8 +105,8 @@ static inline __sum16 csum_fold(__wsum sum)
  * returns a 16-bit checksum, already complemented
  */
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                 unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
        asm("   addcc           %1,%0,%0,icc0   \n"
            "   addxcc          %2,%0,%0,icc0   \n"
@@ -120,8 +120,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
 }
 
 static inline __sum16
-csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
-                 unsigned short proto, __wsum sum)
+csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
+                 __u8 proto, __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
index 46ec8a7fd65f876a0de86d36abd5392bf505c1c2..d9f58d696238b491e3d3b0e87d76f02d89ad3963 100644 (file)
@@ -38,12 +38,12 @@ __wsum csum_partial_copy_nocheck(const void *src, void *dst,
  * returns a 16-bit checksum, already complemented
  */
 #define csum_tcpudp_nofold csum_tcpudp_nofold
-__wsum csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
-       unsigned short len, unsigned short proto, __wsum sum);
+__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
+                         __u32 len, __u8 proto, __wsum sum);
 
 #define csum_tcpudp_magic csum_tcpudp_magic
-__sum16 csum_tcpudp_magic(unsigned long saddr, unsigned long daddr,
-       unsigned short len, unsigned short proto, __wsum sum);
+__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
+                         __u32 len, __u8 proto, __wsum sum);
 
 #include <asm-generic/checksum.h>
 
index 8169f78a46a70f5bc0359b4fa006070772116d59..617506d1a5596679b19b27af252c3199e61ab1f1 100644 (file)
@@ -60,18 +60,16 @@ static inline unsigned short from64to16(u64 x)
  * computes the checksum of the TCP/UDP pseudo-header
  * returns a 16-bit checksum, already complemented.
  */
-__sum16 csum_tcpudp_magic(unsigned long saddr, unsigned long daddr,
-                         unsigned short len, unsigned short proto,
-                         __wsum sum)
+__sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
+                         __u32 len, __u8 proto, __wsum sum)
 {
        return (__force __sum16)~from64to16(
                (__force u64)saddr + (__force u64)daddr +
                (__force u64)sum + ((len + proto) << 8));
 }
 
-__wsum csum_tcpudp_nofold(unsigned long saddr, unsigned long daddr,
-                         unsigned short len, unsigned short proto,
-                         __wsum sum)
+__wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
+                         __u32 len, __u8 proto, __wsum sum)
 {
        u64 result;
 
index 97af155057e4bcfa668eb006c935e68b1436dbca..ac9c687e8384cb9b0dbcf225c6b71442276a9049 100644 (file)
@@ -16,15 +16,11 @@ extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
  * Computes the checksum of the TCP/UDP pseudo-header returns a 16-bit
  * checksum, already complemented
  */
-extern __sum16 csum_tcpudp_magic (__be32 saddr, __be32 daddr,
-                                            unsigned short len,
-                                            unsigned short proto,
-                                            __wsum sum);
+extern __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
+                                __u32 len, __u8 proto, __wsum sum);
 
-extern __wsum csum_tcpudp_nofold (__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
-                                       __wsum sum);
+extern __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
+                                __u32 len, __u8 proto, __wsum sum);
 
 /*
  * Computes the checksum of a memory block at buff, length len,
index 9fc955026f866b5fda8fb196fb72311fbcc7f0dc..2cb23cb0c2e1d1a98bb5a4db9d6e6407555c17e7 100644 (file)
@@ -34,8 +34,8 @@ from64to16 (unsigned long x)
  * returns a 16-bit checksum, already complemented.
  */
 __sum16
-csum_tcpudp_magic (__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
+                 __u8 proto, __wsum sum)
 {
        return (__force __sum16)~from64to16(
                (__force u64)saddr + (__force u64)daddr +
@@ -45,8 +45,8 @@ csum_tcpudp_magic (__be32 saddr, __be32 daddr, unsigned short len,
 EXPORT_SYMBOL(csum_tcpudp_magic);
 
 __wsum
-csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
-                   unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
        unsigned long result;
 
index a7a7c4f44abec1cbf27768d6121cb06d80ec63fe..d68e93c9bd62d99cd740aa3f9a79bc35f8fad2b4 100644 (file)
@@ -114,9 +114,8 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
 }
 
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                              unsigned short len,
-                                              unsigned short proto,
-                                              __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
 #if defined(__LITTLE_ENDIAN)
        unsigned long len_proto = (proto + len) << 8;
@@ -145,9 +144,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                                  unsigned short len,
-                                                  unsigned short proto,
-                                                  __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
index 08dd1cc65799a5f9aadcb515a332ab6ec611b7d6..f65fe83b17305b4e38db043b8d00590d8db07786 100644 (file)
@@ -59,8 +59,7 @@ extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
  * returns a 16-bit checksum, already complemented
  */
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
        unsigned long len_proto = (proto + len) << 8;
@@ -78,8 +77,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
 }
 
 static inline __sum16
-csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
-                 unsigned short proto, __wsum sum)
+csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
+                 __u8 proto, __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
 }
index 0185cbefdda48a2770703709ed1d9701208362a0..adeecebbb0d1383506f912d7732e726c0190fe3b 100644 (file)
@@ -16,8 +16,8 @@
  */
 #define csum_tcpudp_nofold     csum_tcpudp_nofold
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
        __asm__("add %0, %0, %1\n\t"
                "addc %0, %0, %2\n\t"
index 3ceacde5eb6e4fd3a7b05906ce3fe153b57c8e5c..c635541d40b8786de63eb42bf6dd796c3edbd91c 100644 (file)
@@ -160,9 +160,9 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
 }
 #define ip_fast_csum ip_fast_csum
 
-static inline __wsum csum_tcpudp_nofold(__be32 saddr,
-       __be32 daddr, unsigned short len, unsigned short proto,
-       __wsum sum)
+static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        __asm__(
        "       .set    push            # csum_tcpudp_nofold\n"
index 9fb2a8d8826a78d5e507325da5cde69d412349ac..c80df5b504acabc57c2bd5529e613f54cb4c7942 100644 (file)
@@ -37,16 +37,11 @@ static inline __sum16 csum_fold(__wsum sum)
        return (~sum) >> 16;
 }
 
-static inline __wsum csum_tcpudp_nofold(unsigned long saddr,
-                                       unsigned long daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
-       __wsum tmp;
-
-       tmp = (__wsum) ntohs(len) << 16;
-       tmp += (__wsum) proto << 8;
+       __wsum tmp = (__wsum)((len + proto) << 8);
 
        asm(
                "       add     %1,%0           \n"
@@ -64,10 +59,8 @@ static inline __wsum csum_tcpudp_nofold(unsigned long saddr,
  * computes the checksum of the TCP/UDP pseudo-header
  * returns a 16-bit checksum, already complemented
  */
-static inline __sum16 csum_tcpudp_magic(unsigned long saddr,
-                                       unsigned long daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
index 6bc1f0d5df7be0568a1db4e66226a09e0a7f65b8..703c5ee634218914bd0fb87d7138c6a6c9d61713 100644 (file)
@@ -45,8 +45,7 @@ static inline __sum16 csum_fold(__wsum sum)
  */
 #define csum_tcpudp_nofold csum_tcpudp_nofold
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
        __asm__ __volatile__(
@@ -60,7 +59,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
                "cmpltu r8, %0, %3\n"
                "add    %0, %0, r8\n"   /* add carry */
                : "=r" (sum), "=r" (saddr)
-               : "r" (daddr), "r" ((ntohs(len) << 16) + (proto * 256)),
+               : "r" (daddr), "r" ((len + proto) << 8),
                  "0" (sum),
                  "1" (saddr)
                : "r8");
@@ -69,8 +68,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
 }
 
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto, __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
 }
index c84b2fcb18a95ea1c643a6aea3595f2615721925..9815ab1fc8aad92a49547d296b4da9dafb964f20 100644 (file)
@@ -85,9 +85,8 @@ static inline __sum16 csum_fold(__wsum csum)
 }
  
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                              unsigned short len,
-                                              unsigned short proto,
-                                              __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        __asm__(
        "       add  %1, %0, %0\n"
@@ -104,9 +103,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                                  unsigned short len,
-                                                  unsigned short proto,
-                                                  __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
index 7403648563554604e19b6cfbd0873bee868c7644..d7f100c53f07fd483a39cd6e00315e460455c19b 100644 (file)
@@ -91,8 +91,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
  * returns a 32-bit checksum
  */
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                   unsigned short len, unsigned short proto,
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, __u8 proto,
                    __wsum sum)
 {
        __u32 csum = (__force __u32)sum;
@@ -118,8 +117,7 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  */
 
 static inline __sum16
-csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                  unsigned short len, unsigned short proto,
+csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, __u8 proto,
                   __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
index 961bd64015a817b50452499d992ce23f14291247..a375bc2700be8739d636586ebd9b43b515c73165 100644 (file)
@@ -127,10 +127,10 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
 }
 
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-               unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
-       unsigned long tmp = (ntohs(len) << 16) + proto * 256;
+       unsigned long tmp = (len + proto) << 8;
        __asm__ __volatile__(
                ".set volatile\n\t"
                "add\t%0, %0, %2\n\t"
@@ -161,8 +161,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16
-csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
-               unsigned short proto, __wsum sum)
+csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
+                 __u8 proto, __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
 }
index 14b7ac2f0a07a7e187fed823712ac74319785a65..fd730f140c06e8b0e7be0d950034f65187b46443 100644 (file)
@@ -115,8 +115,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
 }
 
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
 #ifdef __LITTLE_ENDIAN__
@@ -142,8 +141,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
index 426b2389a1c29fe83b16a0a84b7f262f055a2c74..86ae655a3c0fcb7ec36cc39ae8c18295ac8b41c0 100644 (file)
@@ -170,9 +170,8 @@ static inline __sum16 csum_fold(__wsum sum)
 }
 
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                              unsigned short len,
-                                              unsigned short proto,
-                                              __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        __asm__ __volatile__("addcc\t%1, %0, %0\n\t"
                             "addxcc\t%2, %0, %0\n\t"
@@ -190,9 +189,8 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                                  unsigned short len,
-                                                  unsigned short proto,
-                                                  __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
index b8779a6a59117d13c51eeb0965e78f6a635299a8..ef0c6f48189ac5fc3990fe21d751f228ff9e67fa 100644 (file)
@@ -96,8 +96,7 @@ static inline __sum16 csum_fold(__wsum sum)
 }
 
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                       unsigned int len,
-                                       unsigned short proto,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
        __asm__ __volatile__(
@@ -116,8 +115,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
index f55c3f937c3ed78132d43befd00efa86c915e1d7..23ceb9e3a89bf1d9bca440700d19f8e9caaba82a 100644 (file)
@@ -20,8 +20,8 @@
  */
 
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
        __asm__(
        "add.a  %0, %1, %2\n"
index f50de69517384b712c1266a3c98626b888d6953a..6f380605403d14799c340a4d32983877623a13ce 100644 (file)
@@ -112,8 +112,7 @@ static inline __sum16 csum_fold(__wsum sum)
 }
 
 static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
        asm("addl %1, %0        ;\n"
@@ -131,8 +130,7 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto,
+                                       __u32 len, __u8 proto,
                                        __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
index cd00e17744914c5b2e1d7d16da887a2809ebb5b5..97b98e2039bcb66db099b45790e267588f176779 100644 (file)
@@ -84,8 +84,8 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
  * 32bit unfolded.
  */
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum)
 {
        asm("  addl %1, %0\n"
            "  adcl %2, %0\n"
@@ -110,8 +110,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
  * complemented and ready to be filled in.
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                       unsigned short len,
-                                       unsigned short proto, __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
 }
index ee940185e89f28c9d7553f4f6d15e057eadc7883..54d96f1e35943c227fa998f7d6c5120417df9956 100644 (file)
@@ -87,8 +87,8 @@ static inline __sum16 csum_fold(__wsum sum)
  * 32bit unfolded.
  */
 static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                 __u8 proto, __wsum sum)
 {
        asm("  addl %1, %0\n"
            "  adcl %2, %0\n"
@@ -104,9 +104,8 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
  * returns a 16-bit checksum, already complemented
  */
 static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                          unsigned short len,
-                                          unsigned short proto,
-                                          __wsum sum)
+                                       __u32 len, __u8 proto,
+                                       __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
index 0593de689b565131c9b0cd53081b6d2c245718f3..62254e6688f5773d91438e48b6a08928ac966f23 100644 (file)
@@ -123,9 +123,8 @@ static __inline__ __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
 }
 
 static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                                                  unsigned short len,
-                                                  unsigned short proto,
-                                                  __wsum sum)
+                                           __u32 len, __u8 proto,
+                                           __wsum sum)
 {
 
 #ifdef __XTENSA_EL__
@@ -157,9 +156,8 @@ static __inline__ __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
  * returns a 16-bit checksum, already complemented
  */
 static __inline__ __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
-                                                      unsigned short len,
-                                                      unsigned short proto,
-                                                      __wsum sum)
+                                           __u32 len, __u8 proto,
+                                           __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
 }
index 59811df58c5b4575298a568319f960cf21291d45..3150cbd8eb212d1b3a92615342196ec23408629d 100644 (file)
@@ -65,14 +65,14 @@ static inline __sum16 csum_fold(__wsum csum)
  * returns a 16-bit checksum, already complemented
  */
 extern __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-               unsigned short proto, __wsum sum);
+csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len,
+                  __u8 proto, __wsum sum);
 #endif
 
 #ifndef csum_tcpudp_magic
 static inline __sum16
-csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
-                 unsigned short proto, __wsum sum)
+csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len,
+                 __u8 proto, __wsum sum)
 {
        return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum));
 }
index 8b39e86dbab5ea2a1afad17f6a15368f846916d6..d3ec93f9e5f3e61900c8268c883010433a08f567 100644 (file)
@@ -191,9 +191,7 @@ static inline u32 from64to32(u64 x)
 }
 
 __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
-                       unsigned short len,
-                       unsigned short proto,
-                       __wsum sum)
+                         __u32 len, __u8 proto, __wsum sum)
 {
        unsigned long long s = (__force u32)sum;
 
This page took 0.048497 seconds and 5 git commands to generate.