Lines Matching refs:skb

61 static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
63 return (struct vlan_ethhdr *)skb_mac_header(skb);
117 * @priority: skb priority
118 * @vlan_qos: vlan priority: (skb->priority << 13) & 0xE000
189 extern bool vlan_do_receive(struct sk_buff **skb);
238 static inline bool vlan_do_receive(struct sk_buff **skb)
286 * @skb: skbuff to tag
290 * Inserts the VLAN tag into @skb as part of the payload
291 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed.
294 * doesn't have to worry about freeing the original skb.
296 * Does not change skb->protocol so this function can be used during receive.
298 static inline struct sk_buff *vlan_insert_tag(struct sk_buff *skb,
303 if (skb_cow_head(skb, VLAN_HLEN) < 0) {
304 dev_kfree_skb_any(skb);
307 veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
310 memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
311 skb->mac_header -= VLAN_HLEN;
319 return skb;
324 * @skb: skbuff to tag
327 * Inserts the VLAN tag into @skb as part of the payload
328 * Returns a VLAN tagged skb. If a new skb is created, @skb is freed.
331 * doesn't have to worry about freeing the original skb.
333 static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb,
336 skb = vlan_insert_tag(skb, vlan_proto, vlan_tci);
337 if (skb)
338 skb->protocol = vlan_proto;
339 return skb;
344 * @skb: skbuff to tag
348 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
350 static inline struct sk_buff *__vlan_hwaccel_put_tag(struct sk_buff *skb,
354 skb->vlan_proto = vlan_proto;
355 skb->vlan_tci = VLAN_TAG_PRESENT | vlan_tci;
356 return skb;
361 * @skb: skbuff to tag
364 * Assumes skb->dev is the target that will xmit this frame.
365 * Returns a VLAN tagged skb.
367 static inline struct sk_buff *vlan_put_tag(struct sk_buff *skb,
370 if (vlan_hw_offload_capable(skb->dev->features, vlan_proto)) {
371 return __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci);
373 return __vlan_put_tag(skb, vlan_proto, vlan_tci);
379 * @skb: skbuff to query
382 * Returns error if the skb is not of VLAN type
384 static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
386 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data;
397 * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[]
398 * @skb: skbuff to query
401 * Returns error if @skb->vlan_tci is not set correctly
403 static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
406 if (vlan_tx_tag_present(skb)) {
407 *vlan_tci = vlan_tx_tag_get(skb);
418 * vlan_get_tag - get the VLAN ID from the skb
419 * @skb: skbuff to query
422 * Returns error if the skb is not VLAN tagged
424 static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
426 if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
427 return __vlan_hwaccel_get_tag(skb, vlan_tci);
429 return __vlan_get_tag(skb, vlan_tci);
435 * @skb: skbuff to query
440 static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
444 if (vlan_tx_tag_present(skb) ||
445 skb->protocol != cpu_to_be16(ETH_P_8021Q))
446 protocol = skb->protocol;
449 protop = skb_header_pointer(skb, offsetof(struct vlan_ethhdr,
459 static inline void vlan_set_encap_proto(struct sk_buff *skb,
472 skb->protocol = proto;
485 skb->protocol = htons(ETH_P_802_3);
490 skb->protocol = htons(ETH_P_802_2);