Initial import
[sliver-openvswitch.git] / datapath / linux-2.6 / compat-2.6 / include / linux / skbuff.h
1 #ifndef __LINUX_SKBUFF_WRAPPER_H
2 #define __LINUX_SKBUFF_WRAPPER_H 1
3
4 #include_next <linux/skbuff.h>
5
6 #include <linux/version.h>
7
8 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
9 /* Emulate Linux 2.6.17 and later behavior, in which kfree_skb silently ignores 
10  * null pointer arguments. */
11 #define kfree_skb(skb) kfree_skb_maybe_null(skb)
12 static inline void kfree_skb_maybe_null(struct sk_buff *skb)
13 {
14         if (likely(skb != NULL))
15                 (kfree_skb)(skb);
16 }
17 #endif
18
19 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
20
21 #define mac_header mac.raw
22 #define network_header nh.raw
23
24
25 /* Note that CHECKSUM_PARTIAL is not implemented, but this allows us to at
26  * least test against it: see update_csum() in forward.c. */
27 #define CHECKSUM_PARTIAL 3
28 #define CHECKSUM_COMPLETE CHECKSUM_HW
29
30 static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
31 {
32         return skb->h.raw;
33 }
34
35 static inline void skb_set_transport_header(struct sk_buff *skb,
36                         const int offset)
37 {
38         skb->h.raw = skb->data + offset;
39 }
40
41 static inline unsigned char *skb_network_header(const struct sk_buff *skb)
42 {
43         return skb->nh.raw;
44 }
45
46 static inline void skb_set_network_header(struct sk_buff *skb, const int offset)
47 {
48         skb->nh.raw = skb->data + offset;
49 }
50
51 static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
52 {
53         return skb->mac.raw;
54 }
55
56 static inline void skb_set_mac_header(struct sk_buff *skb, const int offset)
57 {
58         skb->mac.raw = skb->data + offset;
59 }
60
61 #endif /* linux kernel < 2.6.22 */
62
63 #endif