2 * Copyright (c) 2011 Nicira Networks.
3 * Distributed under the terms of the GNU GPL version 2.
5 * Significant portions of this file may be copied from parts of the Linux
6 * kernel, by Linus Torvalds and others.
12 #include <linux/if_vlan.h>
13 #include <linux/skbuff.h>
14 #include <linux/version.h>
16 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
17 #define NEED_VLAN_FIELD
20 #ifndef NEED_VLAN_FIELD
21 static inline void vlan_copy_skb_tci(struct sk_buff *skb) { }
23 static inline u16 vlan_get_tci(struct sk_buff *skb)
28 static inline void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci)
30 skb->vlan_tci = vlan_tci;
33 void vlan_copy_skb_tci(struct sk_buff *skb);
34 u16 vlan_get_tci(struct sk_buff *skb);
35 void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci);
37 #undef vlan_tx_tag_present
38 bool vlan_tx_tag_present(struct sk_buff *skb);
40 #undef vlan_tx_tag_get
41 u16 vlan_tx_tag_get(struct sk_buff *skb);
43 #define __vlan_hwaccel_put_tag rpl__vlan_hwaccel_put_tag
44 struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, u16 vlan_tci);
45 #endif /* NEED_VLAN_FIELD */
47 static inline int vlan_deaccel_tag(struct sk_buff *skb)
49 if (!vlan_tx_tag_present(skb))
52 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));