1 #ifndef __SCTP_CHECKSUM_WRAPPER_H
2 #define __SCTP_CHECKSUM_WRAPPER_H 1
4 #include <linux/version.h>
5 #include_next <net/sctp/checksum.h>
7 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
8 static inline __le32 sctp_compute_cksum(const struct sk_buff *skb,
11 const struct sk_buff *iter;
13 __u32 crc32 = sctp_start_cksum(skb->data + offset,
14 skb_headlen(skb) - offset);
15 skb_walk_frags(skb, iter)
16 crc32 = sctp_update_cksum((__u8 *) iter->data,
17 skb_headlen(iter), crc32);
19 /* Open-code sctp_end_cksum() to avoid a sparse warning due to a bug in
20 * sparse annotations in Linux fixed in 3.10 in commit eee1d5a14 (sctp:
21 * Correct type and usage of sctp_end_cksum()). */
22 return cpu_to_le32(~crc32);