updated pltap&tunnel to new netdev interface
[sliver-openvswitch.git] / datapath / linux / compat / include / net / sctp / checksum.h
1 #ifndef __SCTP_CHECKSUM_WRAPPER_H
2 #define __SCTP_CHECKSUM_WRAPPER_H 1
3
4 #include <linux/version.h>
5
6 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
7 #include <net/sctp/sctp.h>
8 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) */
9 #include_next <net/sctp/checksum.h>
10 #endif
11
12 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
13 static inline __le32 sctp_compute_cksum(const struct sk_buff *skb,
14                                         unsigned int offset)
15 {
16         const struct sk_buff *iter;
17
18         __u32 crc32 = sctp_start_cksum(skb->data + offset,
19                                        skb_headlen(skb) - offset);
20         skb_walk_frags(skb, iter)
21                 crc32 = sctp_update_cksum((__u8 *) iter->data,
22                                           skb_headlen(iter), crc32);
23
24         /* Open-code sctp_end_cksum() to avoid a sparse warning due to a bug in
25          * sparse annotations in Linux fixed in 3.10 in commit eee1d5a14 (sctp:
26          * Correct type and usage of sctp_end_cksum()). */
27         return cpu_to_le32(~crc32);
28 }
29 #endif
30
31 #endif