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.
9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11 #include <linux/if_vlan.h>
12 #include <linux/skbuff.h>
17 #ifdef NEED_VLAN_FIELD
18 void vlan_copy_skb_tci(struct sk_buff *skb)
20 OVS_CB(skb)->vlan_tci = 0;
23 u16 vlan_get_tci(struct sk_buff *skb)
25 return OVS_CB(skb)->vlan_tci;
28 void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci)
30 OVS_CB(skb)->vlan_tci = vlan_tci;
33 bool vlan_tx_tag_present(struct sk_buff *skb)
35 return OVS_CB(skb)->vlan_tci & VLAN_TAG_PRESENT;
38 u16 vlan_tx_tag_get(struct sk_buff *skb)
40 return OVS_CB(skb)->vlan_tci & ~VLAN_TAG_PRESENT;
43 struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, u16 vlan_tci)
45 OVS_CB(skb)->vlan_tci = vlan_tci | VLAN_TAG_PRESENT;
48 #endif /* NEED_VLAN_FIELD */