diff options
Diffstat (limited to 'include/linux/if_vlan.h')
-rw-r--r-- | include/linux/if_vlan.h | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 635e1faec412..affa27380b72 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -86,7 +86,6 @@ struct vlan_group { | |||
86 | * the vlan is attached to. | 86 | * the vlan is attached to. |
87 | */ | 87 | */ |
88 | unsigned int nr_vlans; | 88 | unsigned int nr_vlans; |
89 | int killall; | ||
90 | struct hlist_node hlist; /* linked list */ | 89 | struct hlist_node hlist; /* linked list */ |
91 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; | 90 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; |
92 | struct rcu_head rcu; | 91 | struct rcu_head rcu; |
@@ -111,6 +110,11 @@ static inline void vlan_group_set_device(struct vlan_group *vg, | |||
111 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; | 110 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; |
112 | } | 111 | } |
113 | 112 | ||
113 | static inline int is_vlan_dev(struct net_device *dev) | ||
114 | { | ||
115 | return dev->priv_flags & IFF_802_1Q_VLAN; | ||
116 | } | ||
117 | |||
114 | #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) | 118 | #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT) |
115 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) | 119 | #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT) |
116 | 120 | ||
@@ -132,7 +136,8 @@ extern u16 vlan_dev_vlan_id(const struct net_device *dev); | |||
132 | 136 | ||
133 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | 137 | extern int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, |
134 | u16 vlan_tci, int polling); | 138 | u16 vlan_tci, int polling); |
135 | extern bool vlan_hwaccel_do_receive(struct sk_buff **skb); | 139 | extern bool vlan_do_receive(struct sk_buff **skb); |
140 | extern struct sk_buff *vlan_untag(struct sk_buff *skb); | ||
136 | extern gro_result_t | 141 | extern gro_result_t |
137 | vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, | 142 | vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, |
138 | unsigned int vlan_tci, struct sk_buff *skb); | 143 | unsigned int vlan_tci, struct sk_buff *skb); |
@@ -166,13 +171,18 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, struct vlan_group *grp, | |||
166 | return NET_XMIT_SUCCESS; | 171 | return NET_XMIT_SUCCESS; |
167 | } | 172 | } |
168 | 173 | ||
169 | static inline bool vlan_hwaccel_do_receive(struct sk_buff **skb) | 174 | static inline bool vlan_do_receive(struct sk_buff **skb) |
170 | { | 175 | { |
171 | if ((*skb)->vlan_tci & VLAN_VID_MASK) | 176 | if ((*skb)->vlan_tci & VLAN_VID_MASK) |
172 | (*skb)->pkt_type = PACKET_OTHERHOST; | 177 | (*skb)->pkt_type = PACKET_OTHERHOST; |
173 | return false; | 178 | return false; |
174 | } | 179 | } |
175 | 180 | ||
181 | static inline struct sk_buff *vlan_untag(struct sk_buff *skb) | ||
182 | { | ||
183 | return skb; | ||
184 | } | ||
185 | |||
176 | static inline gro_result_t | 186 | static inline gro_result_t |
177 | vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, | 187 | vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp, |
178 | unsigned int vlan_tci, struct sk_buff *skb) | 188 | unsigned int vlan_tci, struct sk_buff *skb) |
@@ -215,7 +225,7 @@ static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb, | |||
215 | } | 225 | } |
216 | 226 | ||
217 | /** | 227 | /** |
218 | * __vlan_put_tag - regular VLAN tag inserting | 228 | * vlan_insert_tag - regular VLAN tag inserting |
219 | * @skb: skbuff to tag | 229 | * @skb: skbuff to tag |
220 | * @vlan_tci: VLAN TCI to insert | 230 | * @vlan_tci: VLAN TCI to insert |
221 | * | 231 | * |
@@ -224,8 +234,10 @@ static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb, | |||
224 | * | 234 | * |
225 | * Following the skb_unshare() example, in case of error, the calling function | 235 | * Following the skb_unshare() example, in case of error, the calling function |
226 | * doesn't have to worry about freeing the original skb. | 236 | * doesn't have to worry about freeing the original skb. |
237 | * | ||
238 | * Does not change skb->protocol so this function can be used during receive. | ||
227 | */ | 239 | */ |
228 | static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | 240 | static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) |
229 | { | 241 | { |
230 | struct vlan_ethhdr *veth; | 242 | struct vlan_ethhdr *veth; |
231 | 243 | ||
@@ -245,8 +257,25 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | |||
245 | /* now, the TCI */ | 257 | /* now, the TCI */ |
246 | veth->h_vlan_TCI = htons(vlan_tci); | 258 | veth->h_vlan_TCI = htons(vlan_tci); |
247 | 259 | ||
248 | skb->protocol = htons(ETH_P_8021Q); | 260 | return skb; |
261 | } | ||
249 | 262 | ||
263 | /** | ||
264 | * __vlan_put_tag - regular VLAN tag inserting | ||
265 | * @skb: skbuff to tag | ||
266 | * @vlan_tci: VLAN TCI to insert | ||
267 | * | ||
268 | * Inserts the VLAN tag into @skb as part of the payload | ||
269 | * Returns a VLAN tagged skb. If a new skb is created, @skb is freed. | ||
270 | * | ||
271 | * Following the skb_unshare() example, in case of error, the calling function | ||
272 | * doesn't have to worry about freeing the original skb. | ||
273 | */ | ||
274 | static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) | ||
275 | { | ||
276 | skb = vlan_insert_tag(skb, vlan_tci); | ||
277 | if (skb) | ||
278 | skb->protocol = htons(ETH_P_8021Q); | ||
250 | return skb; | 279 | return skb; |
251 | } | 280 | } |
252 | 281 | ||