2 * Copyright (c) 2007-2011 Nicira, Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
21 #include <linux/if_vlan.h>
22 #include <linux/skbuff.h>
27 #ifdef NEED_VLAN_FIELD
28 void vlan_copy_skb_tci(struct sk_buff *skb)
30 OVS_CB(skb)->vlan_tci = 0;
33 u16 vlan_get_tci(struct sk_buff *skb)
35 return OVS_CB(skb)->vlan_tci;
38 void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci)
40 OVS_CB(skb)->vlan_tci = vlan_tci;
43 bool vlan_tx_tag_present(struct sk_buff *skb)
45 return OVS_CB(skb)->vlan_tci & VLAN_TAG_PRESENT;
48 u16 vlan_tx_tag_get(struct sk_buff *skb)
50 return OVS_CB(skb)->vlan_tci & ~VLAN_TAG_PRESENT;
53 struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, u16 vlan_tci)
55 OVS_CB(skb)->vlan_tci = vlan_tci | VLAN_TAG_PRESENT;
58 #endif /* NEED_VLAN_FIELD */