File: checksum.h

package info (click to toggle)
openvswitch 2.3.0%2Bgit20140819-3
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 24,156 kB
  • sloc: sh: 223,720; ansic: 153,459; python: 13,272; xml: 12,432; perl: 408; makefile: 382
file content (25 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef __SCTP_CHECKSUM_WRAPPER_H
#define __SCTP_CHECKSUM_WRAPPER_H 1

#include_next <net/sctp/checksum.h>

#ifndef HAVE_SCTP_COMPUTE_CKSUM
static inline __le32 sctp_compute_cksum(const struct sk_buff *skb,
					unsigned int offset)
{
	const struct sk_buff *iter;

	__u32 crc32 = sctp_start_cksum(skb->data + offset,
				       skb_headlen(skb) - offset);
	skb_walk_frags(skb, iter)
		crc32 = sctp_update_cksum((__u8 *) iter->data,
					  skb_headlen(iter), crc32);

	/* Open-code sctp_end_cksum() to avoid a sparse warning due to a bug in
	 * sparse annotations in Linux fixed in 3.10 in commit eee1d5a14 (sctp:
	 * Correct type and usage of sctp_end_cksum()). */
	return cpu_to_le32(~crc32);
}
#endif

#endif