include/net/vxlan.h
Source file repositories/reference/linux-study-clean/include/net/vxlan.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/vxlan.h- Extension
.h- Size
- 16324 bytes
- Lines
- 609
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/if_vlan.hlinux/rhashtable-types.hnet/udp_tunnel.hnet/dst_metadata.hnet/rtnetlink.hnet/switchdev.hnet/nexthop.h
Detected Declarations
struct vxlanhdrstruct vxlanhdr_gbpstruct vxlanhdr_gpestruct vxlan_metadatastruct vxlan_sockstruct vxlan_rdststruct vxlan_configstruct vxlan_vni_statsstruct vxlan_vni_stats_pcpustruct vxlan_dev_nodestruct vxlan_vni_nodestruct vxlan_vni_groupstruct vxlan_devstruct switchdev_notifier_vxlan_fdb_infofunction vxlan_features_checkfunction vxlan_headroomfunction vxlan_vnifunction vxlan_vni_fieldfunction vxlan_rco_startfunction vxlan_rco_offsetfunction vxlan_compute_rcofunction vxlan_get_sk_familyfunction vxlan_addr_anyfunction vxlan_addr_multicastfunction vxlan_addr_anyfunction vxlan_addr_multicastfunction netif_is_vxlanfunction vxlan_fdb_find_ucfunction vxlan_fdb_replayfunction vxlan_fdb_clear_offloadfunction vxlan_fdb_nh_path_selectfunction vxlan_build_gbp_hdr
Annotated Snippet
struct vxlanhdr {
__be32 vx_flags;
__be32 vx_vni;
};
/* VXLAN header flags. */
#define VXLAN_HF_VNI cpu_to_be32(BIT(27))
#define VXLAN_N_VID (1u << 24)
#define VXLAN_VID_MASK (VXLAN_N_VID - 1)
#define VXLAN_VNI_MASK cpu_to_be32(VXLAN_VID_MASK << 8)
#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
#define VNI_HASH_BITS 10
#define VNI_HASH_SIZE (1<<VNI_HASH_BITS)
#define FDB_HASH_BITS 8
#define FDB_HASH_SIZE (1<<FDB_HASH_BITS)
/* Remote checksum offload for VXLAN (VXLAN_F_REMCSUM_[RT]X):
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |R|R|R|R|I|R|R|R|R|R|C| Reserved |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | VXLAN Network Identifier (VNI) |O| Csum start |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* C = Remote checksum offload bit. When set indicates that the
* remote checksum offload data is present.
*
* O = Offset bit. Indicates the checksum offset relative to
* checksum start.
*
* Csum start = Checksum start divided by two.
*
* http://tools.ietf.org/html/draft-herbert-vxlan-rco
*/
/* VXLAN-RCO header flags. */
#define VXLAN_HF_RCO cpu_to_be32(BIT(21))
/* Remote checksum offload header option */
#define VXLAN_RCO_MASK cpu_to_be32(0x7f) /* Last byte of vni field */
#define VXLAN_RCO_UDP cpu_to_be32(0x80) /* Indicate UDP RCO (TCP when not set *) */
#define VXLAN_RCO_SHIFT 1 /* Left shift of start */
#define VXLAN_RCO_SHIFT_MASK ((1 << VXLAN_RCO_SHIFT) - 1)
#define VXLAN_MAX_REMCSUM_START (0x7f << VXLAN_RCO_SHIFT)
/*
* VXLAN Group Based Policy Extension (VXLAN_F_GBP):
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |G|R|R|R|I|R|R|R|R|D|R|R|A|R|R|R| Group Policy ID |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | VXLAN Network Identifier (VNI) | Reserved |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* G = Group Policy ID present.
*
* D = Don't Learn bit. When set, this bit indicates that the egress
* VTEP MUST NOT learn the source address of the encapsulated frame.
*
* A = Indicates that the group policy has already been applied to
* this packet. Policies MUST NOT be applied by devices when the
* A bit is set.
*
* https://tools.ietf.org/html/draft-smith-vxlan-group-policy
*/
struct vxlanhdr_gbp {
u8 vx_flags;
#ifdef __LITTLE_ENDIAN_BITFIELD
u8 reserved_flags1:3,
policy_applied:1,
reserved_flags2:2,
dont_learn:1,
reserved_flags3:1;
#elif defined(__BIG_ENDIAN_BITFIELD)
u8 reserved_flags1:1,
dont_learn:1,
reserved_flags2:2,
policy_applied:1,
reserved_flags3:3;
#else
#error "Please fix <asm/byteorder.h>"
#endif
__be16 policy_id;
__be32 vx_vni;
};
/* VXLAN-GBP header flags. */
#define VXLAN_HF_GBP cpu_to_be32(BIT(31))
#define VXLAN_GBP_USED_BITS (VXLAN_HF_GBP | cpu_to_be32(0xFFFFFF))
Annotation
- Immediate include surface: `linux/if_vlan.h`, `linux/rhashtable-types.h`, `net/udp_tunnel.h`, `net/dst_metadata.h`, `net/rtnetlink.h`, `net/switchdev.h`, `net/nexthop.h`.
- Detected declarations: `struct vxlanhdr`, `struct vxlanhdr_gbp`, `struct vxlanhdr_gpe`, `struct vxlan_metadata`, `struct vxlan_sock`, `struct vxlan_rdst`, `struct vxlan_config`, `struct vxlan_vni_stats`, `struct vxlan_vni_stats_pcpu`, `struct vxlan_dev_node`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
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.