Skip to content

Commit

Permalink
vlan: make a new function vlan_dev_vlan_proto() and export
Browse files Browse the repository at this point in the history
The vlan support 2 proto: 802.1q and 802.1ad, so make a new function
called vlan_dev_vlan_proto() which could return the vlan proto for
input dev.

Signed-off-by: Ding Tianhong <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
dingtianhong authored and davem330 committed Mar 26, 2014
1 parent 5a6b991 commit 71e415e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/linux/if_vlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
__be16 vlan_proto, u16 vlan_id);
extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
extern u16 vlan_dev_vlan_id(const struct net_device *dev);
extern __be16 vlan_dev_vlan_proto(const struct net_device *dev);

/**
* struct vlan_priority_tci_mapping - vlan egress priority mappings
Expand Down Expand Up @@ -216,6 +217,12 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
return 0;
}

static inline __be16 vlan_dev_vlan_proto(const struct net_device *dev)
{
BUG();
return 0;
}

static inline u16 vlan_dev_get_egress_qos_mask(struct net_device *dev,
u32 skprio)
{
Expand Down
6 changes: 6 additions & 0 deletions net/8021q/vlan_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ u16 vlan_dev_vlan_id(const struct net_device *dev)
}
EXPORT_SYMBOL(vlan_dev_vlan_id);

__be16 vlan_dev_vlan_proto(const struct net_device *dev)
{
return vlan_dev_priv(dev)->vlan_proto;
}
EXPORT_SYMBOL(vlan_dev_vlan_proto);

static struct sk_buff *vlan_reorder_header(struct sk_buff *skb)
{
if (skb_cow(skb, skb_headroom(skb)) < 0)
Expand Down

0 comments on commit 71e415e

Please sign in to comment.