diff options
Diffstat (limited to 'include/linux/if_vlan.h')
-rw-r--r-- | include/linux/if_vlan.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 494cce866564..4047781da727 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
17 | #include <linux/netdevice.h> | 17 | #include <linux/netdevice.h> |
18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
19 | #include <linux/rtnetlink.h> | ||
19 | 20 | ||
20 | #define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) | 21 | #define VLAN_HLEN 4 /* The additional bytes (on top of the Ethernet header) |
21 | * that VLAN requires. | 22 | * that VLAN requires. |
@@ -114,6 +115,18 @@ static inline void vlan_group_set_device(struct vlan_group *vg, | |||
114 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) | 115 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) |
115 | 116 | ||
116 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 117 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
118 | /* Must be invoked with rcu_read_lock or with RTNL. */ | ||
119 | static inline struct net_device *vlan_find_dev(struct net_device *real_dev, | ||
120 | u16 vlan_id) | ||
121 | { | ||
122 | struct vlan_group *grp = rcu_dereference_rtnl(real_dev->vlgrp); | ||
123 | |||
124 | if (grp) | ||
125 | return vlan_group_get_device(grp, vlan_id); | ||
126 | |||
127 | return NULL; | ||
128 | } | ||
129 | |||
117 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); | 130 | extern struct net_device *vlan_dev_real_dev(const struct net_device *dev); |
118 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); | 131 | extern u16 vlan_dev_vlan_id(const struct net_device *dev); |
119 | 132 | ||
@@ -128,6 +141,12 @@ vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, | |||
128 | unsigned int vlan_tci); | 141 | unsigned int vlan_tci); |
129 | 142 | ||
130 | #else | 143 | #else |
144 | static inline struct net_device *vlan_find_dev(struct net_device *real_dev, | ||
145 | u16 vlan_id) | ||
146 | { | ||
147 | return NULL; | ||
148 | } | ||
149 | |||
131 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) | 150 | static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev) |
132 | { | 151 | { |
133 | BUG(); | 152 | BUG(); |