net/mpls/internal.h
Source file repositories/reference/linux-study-clean/net/mpls/internal.h
File Facts
- System
- Linux kernel
- Corpus path
net/mpls/internal.h- Extension
.h- Size
- 5826 bytes
- Lines
- 216
- 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
net/mpls.h
Detected Declarations
struct mpls_entry_decodedstruct mpls_pcpu_statsstruct mpls_devstruct sk_buffstruct mpls_nhstruct mpls_routeenum mpls_payload_typeenum mpls_ttl_propagationfunction mpls_entry_decodefunction lockdep_is_held
Annotated Snippet
struct mpls_entry_decoded {
u32 label;
u8 ttl;
u8 tc;
u8 bos;
};
struct mpls_pcpu_stats {
struct mpls_link_stats stats;
struct u64_stats_sync syncp;
};
struct mpls_dev {
int input_enabled;
struct net_device *dev;
struct mpls_pcpu_stats __percpu *stats;
struct ctl_table_header *sysctl;
struct rcu_head rcu;
};
#if BITS_PER_LONG == 32
#define MPLS_INC_STATS_LEN(mdev, len, pkts_field, bytes_field) \
do { \
TYPEOF_UNQUAL(*(mdev)->stats) *ptr = \
raw_cpu_ptr((mdev)->stats); \
local_bh_disable(); \
u64_stats_update_begin(&ptr->syncp); \
ptr->stats.pkts_field++; \
ptr->stats.bytes_field += (len); \
u64_stats_update_end(&ptr->syncp); \
local_bh_enable(); \
} while (0)
#define MPLS_INC_STATS(mdev, field) \
do { \
TYPEOF_UNQUAL(*(mdev)->stats) *ptr = \
raw_cpu_ptr((mdev)->stats); \
local_bh_disable(); \
u64_stats_update_begin(&ptr->syncp); \
ptr->stats.field++; \
u64_stats_update_end(&ptr->syncp); \
local_bh_enable(); \
} while (0)
#else
#define MPLS_INC_STATS_LEN(mdev, len, pkts_field, bytes_field) \
do { \
this_cpu_inc((mdev)->stats->stats.pkts_field); \
this_cpu_add((mdev)->stats->stats.bytes_field, (len)); \
} while (0)
#define MPLS_INC_STATS(mdev, field) \
this_cpu_inc((mdev)->stats->stats.field)
#endif
struct sk_buff;
#define LABEL_NOT_SPECIFIED (1 << 20)
/* This maximum ha length copied from the definition of struct neighbour */
#define VIA_ALEN_ALIGN sizeof(unsigned long)
#define MAX_VIA_ALEN (ALIGN(MAX_ADDR_LEN, VIA_ALEN_ALIGN))
enum mpls_payload_type {
MPT_UNSPEC, /* IPv4 or IPv6 */
MPT_IPV4 = 4,
MPT_IPV6 = 6,
/* Other types not implemented:
* - Pseudo-wire with or without control word (RFC4385)
* - GAL (RFC5586)
*/
};
struct mpls_nh { /* next hop label forwarding entry */
struct net_device *nh_dev;
netdevice_tracker nh_dev_tracker;
/* nh_flags is accessed under RCU in the packet path; it is
* modified handling netdev events with rtnl lock held
*/
unsigned int nh_flags;
u8 nh_labels;
u8 nh_via_alen;
u8 nh_via_table;
u8 nh_reserved1;
Annotation
- Immediate include surface: `net/mpls.h`.
- Detected declarations: `struct mpls_entry_decoded`, `struct mpls_pcpu_stats`, `struct mpls_dev`, `struct sk_buff`, `struct mpls_nh`, `struct mpls_route`, `enum mpls_payload_type`, `enum mpls_ttl_propagation`, `function mpls_entry_decode`, `function lockdep_is_held`.
- 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.