Lines Matching +full:protocol +full:- +full:id

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
32 * @h_vlan_TCI: priority and VLAN ID
33 * @h_vlan_encapsulated_proto: packet type ID or len
41 * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
44 * @h_vlan_proto: ethernet protocol
45 * @h_vlan_TCI: priority and VLAN ID
46 * @h_vlan_encapsulated_proto: packet type ID or len
74 return dev->priv_flags & IFF_802_1Q_VLAN; in is_vlan_dev()
77 #define skb_vlan_tag_present(__skb) ((__skb)->vlan_present)
78 #define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci)
79 #define skb_vlan_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
80 #define skb_vlan_tag_get_cfi(__skb) (!!((__skb)->vlan_tci & VLAN_CFI_MASK))
81 #define skb_vlan_tag_get_prio(__skb) (((__skb)->vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT)
108 * struct vlan_pcpu_stats - VLAN percpu rx/tx stats
141 * struct vlan_priority_tci_mapping - vlan egress priority mappings
143 * @vlan_qos: vlan priority: (skb->priority << 13) & 0xE000
156 * struct vlan_dev_priv - VLAN private device data
161 * @vlan_proto: VLAN encapsulation protocol
201 mp = vlan_dev_priv(dev)->egress_priority_map[(skprio & 0xF)]; in vlan_dev_get_egress_qos_mask()
203 if (mp->priority == skprio) { in vlan_dev_get_egress_qos_mask()
204 return mp->vlan_qos; /* This should already be shifted in vlan_dev_get_egress_qos_mask()
208 mp = mp->next; in vlan_dev_get_egress_qos_mask()
297 * eth_type_vlan - check for valid vlan ether type.
324 * __vlan_insert_inner_tag - inner VLAN tag inserting
326 * @vlan_proto: VLAN encapsulation protocol
333 * Does not change skb->protocol so this function can be used during receive.
342 return -ENOMEM; in __vlan_insert_inner_tag()
348 memmove(skb->data, skb->data + VLAN_HLEN, mac_len - ETH_TLEN); in __vlan_insert_inner_tag()
349 skb->mac_header -= VLAN_HLEN; in __vlan_insert_inner_tag()
351 veth = (struct vlan_ethhdr *)(skb->data + mac_len - ETH_HLEN); in __vlan_insert_inner_tag()
356 * skb->data has space for h_vlan_proto in __vlan_insert_inner_tag()
358 veth->h_vlan_proto = vlan_proto; in __vlan_insert_inner_tag()
361 * skb->data has no space for h_vlan_proto in __vlan_insert_inner_tag()
363 veth->h_vlan_encapsulated_proto = skb->protocol; in __vlan_insert_inner_tag()
367 veth->h_vlan_TCI = htons(vlan_tci); in __vlan_insert_inner_tag()
373 * __vlan_insert_tag - regular VLAN tag inserting
375 * @vlan_proto: VLAN encapsulation protocol
381 * Does not change skb->protocol so this function can be used during receive.
390 * vlan_insert_inner_tag - inner VLAN tag inserting
392 * @vlan_proto: VLAN encapsulation protocol
402 * Does not change skb->protocol so this function can be used during receive.
420 * vlan_insert_tag - regular VLAN tag inserting
422 * @vlan_proto: VLAN encapsulation protocol
431 * Does not change skb->protocol so this function can be used during receive.
440 * vlan_insert_tag_set_proto - regular VLAN tag inserting
442 * @vlan_proto: VLAN encapsulation protocol
457 skb->protocol = vlan_proto; in vlan_insert_tag_set_proto()
462 * __vlan_hwaccel_clear_tag - clear hardware accelerated VLAN info
469 skb->vlan_present = 0; in __vlan_hwaccel_clear_tag()
473 * __vlan_hwaccel_copy_tag - copy hardware accelerated VLAN info from another skb
481 dst->vlan_present = src->vlan_present; in __vlan_hwaccel_copy_tag()
482 dst->vlan_proto = src->vlan_proto; in __vlan_hwaccel_copy_tag()
483 dst->vlan_tci = src->vlan_tci; in __vlan_hwaccel_copy_tag()
487 * __vlan_hwaccel_push_inside - pushes vlan tag to the payload
490 * Pushes the VLAN tag from @skb->vlan_tci inside to the payload.
497 skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto, in __vlan_hwaccel_push_inside()
505 * __vlan_hwaccel_put_tag - hardware accelerated VLAN inserting
507 * @vlan_proto: VLAN encapsulation protocol
510 * Puts the VLAN TCI in @skb->vlan_tci and lets the device do the rest
515 skb->vlan_proto = vlan_proto; in __vlan_hwaccel_put_tag()
516 skb->vlan_tci = vlan_tci; in __vlan_hwaccel_put_tag()
517 skb->vlan_present = 1; in __vlan_hwaccel_put_tag()
521 * __vlan_get_tag - get the VLAN ID that is part of the payload
529 struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; in __vlan_get_tag()
531 if (!eth_type_vlan(veth->h_vlan_proto)) in __vlan_get_tag()
532 return -EINVAL; in __vlan_get_tag()
534 *vlan_tci = ntohs(veth->h_vlan_TCI); in __vlan_get_tag()
539 * __vlan_hwaccel_get_tag - get the VLAN ID that is in @skb->cb[]
543 * Returns error if @skb->vlan_tci is not set correctly
553 return -EINVAL; in __vlan_hwaccel_get_tag()
558 * vlan_get_tag - get the VLAN ID from the skb
566 if (skb->dev->features & NETIF_F_HW_VLAN_CTAG_TX) { in vlan_get_tag()
574 * vlan_get_protocol - get protocol EtherType.
576 * @type: first vlan protocol
585 unsigned int vlan_depth = skb->mac_len, parse_depth = VLAN_MAX_DEPTH; in __vlan_get_protocol()
588 * present at mac_len - VLAN_HLEN (if mac_len > 0), or at in __vlan_get_protocol()
595 vlan_depth -= VLAN_HLEN; in __vlan_get_protocol()
603 if (unlikely(!vh || !--parse_depth)) in __vlan_get_protocol()
606 type = vh->h_vlan_encapsulated_proto; in __vlan_get_protocol()
618 * vlan_get_protocol - get protocol EtherType.
626 return __vlan_get_protocol(skb, skb->protocol, NULL); in vlan_get_protocol()
629 /* A getter for the SKB protocol field which will handle VLAN tags consistently
636 * moves it to skb->vlan_proto in skb_protocol()
638 return skb_vlan_tag_present(skb) ? skb->vlan_proto : skb->protocol; in skb_protocol()
650 * Was a VLAN packet, grab the encapsulated protocol, which the layer in vlan_set_encap_proto()
654 proto = vhdr->h_vlan_encapsulated_proto; in vlan_set_encap_proto()
656 skb->protocol = proto; in vlan_set_encap_proto()
664 * breaks the protocol design and runs IPX over 802.3 without in vlan_set_encap_proto()
669 skb->protocol = htons(ETH_P_802_3); in vlan_set_encap_proto()
674 skb->protocol = htons(ETH_P_802_2); in vlan_set_encap_proto()
678 * skb_vlan_tagged - check if skb is vlan tagged.
687 likely(!eth_type_vlan(skb->protocol))) in skb_vlan_tagged()
694 * skb_vlan_tagged_multi - check if skb is vlan tagged with multiple headers.
702 __be16 protocol = skb->protocol; in skb_vlan_tagged_multi() local
707 if (likely(!eth_type_vlan(protocol))) in skb_vlan_tagged_multi()
713 veh = (struct vlan_ethhdr *)skb->data; in skb_vlan_tagged_multi()
714 protocol = veh->h_vlan_encapsulated_proto; in skb_vlan_tagged_multi()
717 if (!eth_type_vlan(protocol)) in skb_vlan_tagged_multi()
724 * vlan_features_check - drop unsafe features for skb with multiple tags.
734 /* In the case of multi-tagged packets, use a direct mask in vlan_features_check()
748 * compare_vlan_header - Compare two vlan headers
762 return ((__force u32)h1->h_vlan_TCI ^ (__force u32)h2->h_vlan_TCI) | in compare_vlan_header()
763 ((__force u32)h1->h_vlan_encapsulated_proto ^ in compare_vlan_header()
764 (__force u32)h2->h_vlan_encapsulated_proto); in compare_vlan_header()