Lines Matching +full:layer +full:- +full:depth

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
23 * According to 802.3ac, the packet can be 4 bytes longer. --Klika Jan
31 * struct vlan_hdr - vlan header
41 * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
70 return (struct vlan_ethhdr *)skb->data; in skb_vlan_eth_hdr()
84 return dev->priv_flags & IFF_802_1Q_VLAN; in is_vlan_dev()
87 #define skb_vlan_tag_present(__skb) (!!(__skb)->vlan_all)
88 #define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci)
89 #define skb_vlan_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
90 #define skb_vlan_tag_get_cfi(__skb) (!!((__skb)->vlan_tci & VLAN_CFI_MASK))
91 #define skb_vlan_tag_get_prio(__skb) (((__skb)->vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT)
118 * struct vlan_pcpu_stats - VLAN percpu rx/tx stats
151 * struct vlan_priority_tci_mapping - vlan egress priority mappings
153 * @vlan_qos: vlan priority: (skb->priority << 13) & 0xE000
166 * struct vlan_dev_priv - VLAN private device data
214 mp = vlan_dev_priv(dev)->egress_priority_map[(skprio & 0xF)]; in vlan_dev_get_egress_qos_mask()
216 if (mp->priority == skprio) { in vlan_dev_get_egress_qos_mask()
217 return mp->vlan_qos; /* This should already be shifted in vlan_dev_get_egress_qos_mask()
221 mp = mp->next; in vlan_dev_get_egress_qos_mask()
310 * eth_type_vlan - check for valid vlan ether type.
337 * __vlan_insert_inner_tag - inner VLAN tag inserting
346 * Does not change skb->protocol so this function can be used during receive.
355 return -ENOMEM; in __vlan_insert_inner_tag()
361 memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN); in __vlan_insert_inner_tag()
363 skb->mac_header -= VLAN_HLEN; in __vlan_insert_inner_tag()
365 veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN); in __vlan_insert_inner_tag()
370 * skb->data has space for h_vlan_proto in __vlan_insert_inner_tag()
372 veth->h_vlan_proto = vlan_proto; in __vlan_insert_inner_tag()
375 * skb->data has no space for h_vlan_proto in __vlan_insert_inner_tag()
377 veth->h_vlan_encapsulated_proto = skb->protocol; in __vlan_insert_inner_tag()
381 veth->h_vlan_TCI = htons(vlan_tci); in __vlan_insert_inner_tag()
387 * __vlan_insert_tag - regular VLAN tag inserting
395 * Does not change skb->protocol so this function can be used during receive.
404 * vlan_insert_inner_tag - inner VLAN tag inserting
411 * Returns a VLAN tagged skb. This might change skb->head.
416 * Does not change skb->protocol so this function can be used during receive.
434 * vlan_insert_tag - regular VLAN tag inserting
440 * Returns a VLAN tagged skb. This might change skb->head.
445 * Does not change skb->protocol so this function can be used during receive.
454 * vlan_insert_tag_set_proto - regular VLAN tag inserting
460 * Returns a VLAN tagged skb. This might change skb->head.
471 skb->protocol = vlan_proto; in vlan_insert_tag_set_proto()
476 * __vlan_hwaccel_clear_tag - clear hardware accelerated VLAN info
483 skb->vlan_all = 0; in __vlan_hwaccel_clear_tag()
487 * __vlan_hwaccel_copy_tag - copy hardware accelerated VLAN info from another skb
495 dst->vlan_all = src->vlan_all; in __vlan_hwaccel_copy_tag()
499 * __vlan_hwaccel_push_inside - pushes vlan tag to the payload
502 * Pushes the VLAN tag from @skb->vlan_tci inside to the payload.
509 skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto, in __vlan_hwaccel_push_inside()
517 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
522 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
527 skb->vlan_proto = vlan_proto; in __vlan_hwaccel_put_tag()
528 skb->vlan_tci = vlan_tci; in __vlan_hwaccel_put_tag()
532 * __vlan_get_tag - get the VLAN ID that is part of the payload
542 if (!eth_type_vlan(veth->h_vlan_proto)) in __vlan_get_tag()
543 return -ENODATA; in __vlan_get_tag()
545 *vlan_tci = ntohs(veth->h_vlan_TCI); in __vlan_get_tag()
550 * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[]
554 * Returns error if @skb->vlan_tci is not set correctly
564 return -ENODATA; in __vlan_hwaccel_get_tag()
569 * vlan_get_tag - get the VLAN ID from the skb
577 if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) { in vlan_get_tag()
585 * vlan_get_protocol - get protocol EtherType.
588 * @depth: buffer to store length of eth and vlan tags in bytes
594 int *depth) in __vlan_get_protocol() argument
596 unsigned int vlan_depth = skb->mac_len, parse_depth = VLAN_MAX_DEPTH; in __vlan_get_protocol()
599 * present at mac_len - VLAN_HLEN (if mac_len > 0), or at in __vlan_get_protocol()
606 vlan_depth -= VLAN_HLEN; in __vlan_get_protocol()
614 if (unlikely(!vh || !--parse_depth)) in __vlan_get_protocol()
617 type = vh->h_vlan_encapsulated_proto; in __vlan_get_protocol()
622 if (depth) in __vlan_get_protocol()
623 *depth = vlan_depth; in __vlan_get_protocol()
629 * vlan_get_protocol - get protocol EtherType.
637 return __vlan_get_protocol(skb, skb->protocol, NULL); in vlan_get_protocol()
640 /* This version of __vlan_get_protocol() also pulls mac header in skb->head */
642 __be16 type, int *depth) in vlan_get_protocol_and_depth() argument
651 else if (depth) in vlan_get_protocol_and_depth()
652 *depth = maclen; in vlan_get_protocol_and_depth()
664 * moves it to skb->vlan_proto in skb_protocol()
666 return skb_vlan_tag_present(skb) ? skb->vlan_proto : skb->protocol; in skb_protocol()
678 * Was a VLAN packet, grab the encapsulated protocol, which the layer in vlan_set_encap_proto()
682 proto = vhdr->h_vlan_encapsulated_proto; in vlan_set_encap_proto()
684 skb->protocol = proto; in vlan_set_encap_proto()
693 * an 802.2 LLC layer. We look for FFFF which isn't a used in vlan_set_encap_proto()
697 skb->protocol = htons(ETH_P_802_3); in vlan_set_encap_proto()
702 skb->protocol = htons(ETH_P_802_2); in vlan_set_encap_proto()
706 * vlan_remove_tag - remove outer VLAN tag from payload
710 * Expects the skb to contain a VLAN tag in the payload, and to have skb->data
713 * Returns a new pointer to skb->data, or NULL on failure to pull.
717 struct vlan_hdr *vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN); in vlan_remove_tag()
719 *vlan_tci = ntohs(vhdr->h_vlan_TCI); in vlan_remove_tag()
721 memmove(skb->data + VLAN_HLEN, skb->data, 2 * ETH_ALEN); in vlan_remove_tag()
727 * skb_vlan_tagged - check if skb is vlan tagged.
736 likely(!eth_type_vlan(skb->protocol))) in skb_vlan_tagged()
743 * skb_vlan_tagged_multi - check if skb is vlan tagged with multiple headers.
751 __be16 protocol = skb->protocol; in skb_vlan_tagged_multi()
763 protocol = veh->h_vlan_encapsulated_proto; in skb_vlan_tagged_multi()
773 * vlan_features_check - drop unsafe features for skb with multiple tags.
783 /* In the case of multi-tagged packets, use a direct mask in vlan_features_check()
797 * compare_vlan_header - Compare two vlan headers
811 return ((__force u32)h1->h_vlan_TCI ^ (__force u32)h2->h_vlan_TCI) | in compare_vlan_header()
812 ((__force u32)h1->h_vlan_encapsulated_proto ^ in compare_vlan_header()
813 (__force u32)h2->h_vlan_encapsulated_proto); in compare_vlan_header()