aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/if_vlan.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/if_vlan.h')
-rw-r--r--include/linux/if_vlan.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index dc01681fbb42..affa27380b72 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -225,7 +225,7 @@ static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb,
225} 225}
226 226
227/** 227/**
228 * __vlan_put_tag - regular VLAN tag inserting 228 * vlan_insert_tag - regular VLAN tag inserting
229 * @skb: skbuff to tag 229 * @skb: skbuff to tag
230 * @vlan_tci: VLAN TCI to insert 230 * @vlan_tci: VLAN TCI to insert
231 * 231 *
@@ -234,8 +234,10 @@ static inline int vlan_hwaccel_receive_skb(struct sk_buff *skb,
234 * 234 *
235 * 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
236 * 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.
237 */ 239 */
238static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) 240static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci)
239{ 241{
240 struct vlan_ethhdr *veth; 242 struct vlan_ethhdr *veth;
241 243
@@ -255,8 +257,25 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
255 /* now, the TCI */ 257 /* now, the TCI */
256 veth->h_vlan_TCI = htons(vlan_tci); 258 veth->h_vlan_TCI = htons(vlan_tci);
257 259
258 skb->protocol = htons(ETH_P_8021Q); 260 return skb;
261}
259 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 */
274static 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);
260 return skb; 279 return skb;
261} 280}
262 281