forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vlan.c
58 lines (49 loc) · 1.45 KB
/
vlan.c
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Copyright (c) 2007-2011 Nicira, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/if_vlan.h>
#include <linux/skbuff.h>
#include "datapath.h"
#include "vlan.h"
#ifdef NEED_VLAN_FIELD
void vlan_copy_skb_tci(struct sk_buff *skb)
{
OVS_CB(skb)->vlan_tci = 0;
}
u16 vlan_get_tci(struct sk_buff *skb)
{
return OVS_CB(skb)->vlan_tci;
}
void vlan_set_tci(struct sk_buff *skb, u16 vlan_tci)
{
OVS_CB(skb)->vlan_tci = vlan_tci;
}
bool vlan_tx_tag_present(struct sk_buff *skb)
{
return OVS_CB(skb)->vlan_tci & VLAN_TAG_PRESENT;
}
u16 vlan_tx_tag_get(struct sk_buff *skb)
{
return OVS_CB(skb)->vlan_tci & ~VLAN_TAG_PRESENT;
}
struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb, u16 vlan_tci)
{
OVS_CB(skb)->vlan_tci = vlan_tci | VLAN_TAG_PRESENT;
return skb;
}
#endif /* NEED_VLAN_FIELD */