aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sctp/checksum.h
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2009-02-13 03:33:42 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-16 03:03:10 -0500
commit4458f04c02a46c679a90ef71f866a415c192deb4 (patch)
treeb08aa476ab4c525ab3cb33cea6114cb262cb2941 /include/net/sctp/checksum.h
parent06e868066e3b5828383eb40ff4d1c0029100b0b5 (diff)
sctp: Clean up sctp checksumming code
The sctp crc32c checksum is always generated in little endian. So, we clean up the code to treat it as little endian and remove all the __force casts. Suggested by Herbert Xu. Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sctp/checksum.h')
-rw-r--r--include/net/sctp/checksum.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index 2fec3c366e8..befc8d2a1b9 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -46,14 +46,14 @@
46#include <net/sctp/sctp.h> 46#include <net/sctp/sctp.h>
47#include <linux/crc32c.h> 47#include <linux/crc32c.h>
48 48
49static inline __be32 sctp_crc32c(__be32 crc, u8 *buffer, u16 length) 49static inline __u32 sctp_crc32c(__u32 crc, u8 *buffer, u16 length)
50{ 50{
51 return (__force __be32)crc32c((__force u32)crc, buffer, length); 51 return crc32c(crc, buffer, length);
52} 52}
53 53
54static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length) 54static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length)
55{ 55{
56 __be32 crc = ~cpu_to_be32(0); 56 __u32 crc = ~(__u32)0;
57 __u8 zero[sizeof(__u32)] = {0}; 57 __u8 zero[sizeof(__u32)] = {0};
58 58
59 /* Optimize this routine to be SCTP specific, knowing how 59 /* Optimize this routine to be SCTP specific, knowing how
@@ -72,12 +72,12 @@ static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length)
72 return crc; 72 return crc;
73} 73}
74 74
75static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32) 75static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
76{ 76{
77 return sctp_crc32c(crc32, buffer, length); 77 return sctp_crc32c(crc32, buffer, length);
78} 78}
79 79
80static inline __be32 sctp_end_cksum(__be32 crc32) 80static inline __le32 sctp_end_cksum(__be32 crc32)
81{ 81{
82 return (__force __be32)~cpu_to_le32((__force u32)crc32); 82 return cpu_to_le32(~crc32);
83} 83}