include/linux/if_vlan.h
Source file repositories/reference/linux-study-clean/include/linux/if_vlan.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/if_vlan.h- Extension
.h- Size
- 22599 bytes
- Lines
- 840
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/netdevice.hlinux/etherdevice.hlinux/rtnetlink.hlinux/bug.huapi/linux/if_vlan.hlinux/skbuff.h
Detected Declarations
struct vlan_hdrstruct vlan_ethhdrstruct vlan_pcpu_statsstruct vlan_priority_tci_mappingstruct proc_dir_entrystruct netpollstruct vlan_dev_privstruct vlan_type_depthfunction skb_reset_mac_headerfunction vlan_get_rx_ctag_filter_infofunction vlan_drop_rx_ctag_filter_infofunction vlan_get_rx_stag_filter_infofunction vlan_drop_rx_stag_filter_infofunction is_vlan_devfunction vlan_dev_get_egress_qos_maskfunction is_vlan_devfunction __vlan_find_dev_deep_rcufunction vlan_for_eachfunction vlan_dev_vlan_idfunction vlan_dev_vlan_protofunction vlan_dev_get_egress_qos_maskfunction vlan_do_receivefunction vlan_vid_addfunction vlan_vid_delfunction vlan_vids_del_by_devfunction eth_type_vlanfunction vlan_hw_offload_capablefunction __vlan_insert_inner_tagfunction __vlan_insert_tagfunction skb_unsharefunction skb_unsharefunction skb_unsharefunction __vlan_hwaccel_clear_tagfunction __vlan_hwaccel_copy_tagfunction skb_unsharefunction __vlan_hwaccel_put_tagfunction __vlan_get_tagfunction __vlan_hwaccel_get_tagfunction vlan_get_tagfunction vlan_get_protocol_offset_inlinefunction __vlan_get_protocolfunction encapsulatedfunction vlan_get_protocol_and_depthfunction skb_protocolfunction vlan_set_encap_protofunction vlan_remove_tagfunction skb_vlan_taggedfunction skb_vlan_tagged_multi
Annotated Snippet
struct vlan_hdr {
__be16 h_vlan_TCI;
__be16 h_vlan_encapsulated_proto;
};
/**
* struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
* @h_dest: destination ethernet address
* @h_source: source ethernet address
* @h_vlan_proto: ethernet protocol
* @h_vlan_TCI: priority and VLAN ID
* @h_vlan_encapsulated_proto: packet type ID or len
*/
struct vlan_ethhdr {
struct_group(addrs,
unsigned char h_dest[ETH_ALEN];
unsigned char h_source[ETH_ALEN];
);
__be16 h_vlan_proto;
__be16 h_vlan_TCI;
__be16 h_vlan_encapsulated_proto;
};
#include <linux/skbuff.h>
static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
{
return (struct vlan_ethhdr *)skb_mac_header(skb);
}
/* Prefer this version in TX path, instead of
* skb_reset_mac_header() + vlan_eth_hdr()
*/
static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb)
{
return (struct vlan_ethhdr *)skb->data;
}
#define VLAN_PRIO_MASK 0xe000 /* Priority Code Point */
#define VLAN_PRIO_SHIFT 13
#define VLAN_CFI_MASK 0x1000 /* Canonical Format Indicator / Drop Eligible Indicator */
#define VLAN_VID_MASK 0x0fff /* VLAN Identifier */
#define VLAN_N_VID 4096
/* found in socket.c */
extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
#define skb_vlan_tag_present(__skb) (!!(__skb)->vlan_all)
#define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci)
#define skb_vlan_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
#define skb_vlan_tag_get_cfi(__skb) (!!((__skb)->vlan_tci & VLAN_CFI_MASK))
#define skb_vlan_tag_get_prio(__skb) (((__skb)->vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT)
static inline int vlan_get_rx_ctag_filter_info(struct net_device *dev)
{
ASSERT_RTNL();
return notifier_to_errno(call_netdevice_notifiers(NETDEV_CVLAN_FILTER_PUSH_INFO, dev));
}
static inline void vlan_drop_rx_ctag_filter_info(struct net_device *dev)
{
ASSERT_RTNL();
call_netdevice_notifiers(NETDEV_CVLAN_FILTER_DROP_INFO, dev);
}
static inline int vlan_get_rx_stag_filter_info(struct net_device *dev)
{
ASSERT_RTNL();
return notifier_to_errno(call_netdevice_notifiers(NETDEV_SVLAN_FILTER_PUSH_INFO, dev));
}
static inline void vlan_drop_rx_stag_filter_info(struct net_device *dev)
{
ASSERT_RTNL();
call_netdevice_notifiers(NETDEV_SVLAN_FILTER_DROP_INFO, dev);
}
/**
* struct vlan_pcpu_stats - VLAN percpu rx/tx stats
* @rx_packets: number of received packets
* @rx_bytes: number of received bytes
* @rx_multicast: number of received multicast packets
* @tx_packets: number of transmitted packets
* @tx_bytes: number of transmitted bytes
* @syncp: synchronization point for 64bit counters
* @rx_errors: number of rx errors
* @tx_dropped: number of tx drops
*/
struct vlan_pcpu_stats {
u64_stats_t rx_packets;
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/etherdevice.h`, `linux/rtnetlink.h`, `linux/bug.h`, `uapi/linux/if_vlan.h`, `linux/skbuff.h`.
- Detected declarations: `struct vlan_hdr`, `struct vlan_ethhdr`, `struct vlan_pcpu_stats`, `struct vlan_priority_tci_mapping`, `struct proc_dir_entry`, `struct netpoll`, `struct vlan_dev_priv`, `struct vlan_type_depth`, `function skb_reset_mac_header`, `function vlan_get_rx_ctag_filter_info`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.