include/net/snmp.h
Source file repositories/reference/linux-study-clean/include/net/snmp.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/snmp.h- Extension
.h- Size
- 5191 bytes
- Lines
- 197
- 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.
- 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/cache.hlinux/snmp.hlinux/smp.hlinux/u64_stats_sync.h
Detected Declarations
struct snmp_mibstruct ipstats_mibstruct icmp_mibstruct icmpmsg_mibstruct icmpv6_mibstruct icmpv6_mib_devicestruct icmpv6msg_mibstruct icmpv6msg_mib_devicestruct tcp_mibstruct udp_mibstruct linux_mibstruct linux_xfrm_mibstruct linux_tls_mib
Annotated Snippet
struct snmp_mib {
const char *name;
int entry;
};
#define SNMP_MIB_ITEM(_name,_entry) { \
.name = _name, \
.entry = _entry, \
}
/*
* We use unsigned longs for most mibs but u64 for ipstats.
*/
#include <linux/u64_stats_sync.h>
/* IPstats */
#define IPSTATS_MIB_MAX __IPSTATS_MIB_MAX
struct ipstats_mib {
/* mibs[] must be first field of struct ipstats_mib */
u64 mibs[IPSTATS_MIB_MAX];
struct u64_stats_sync syncp;
};
/* ICMP */
#define ICMP_MIB_MAX __ICMP_MIB_MAX
struct icmp_mib {
unsigned long mibs[ICMP_MIB_MAX];
};
#define ICMPMSG_MIB_MAX __ICMPMSG_MIB_MAX
struct icmpmsg_mib {
atomic_long_t mibs[ICMPMSG_MIB_MAX];
};
/* ICMP6 (IPv6-ICMP) */
#define ICMP6_MIB_MAX __ICMP6_MIB_MAX
/* per network ns counters */
struct icmpv6_mib {
unsigned long mibs[ICMP6_MIB_MAX];
};
/* per device counters, (shared on all cpus) */
struct icmpv6_mib_device {
atomic_long_t mibs[ICMP6_MIB_MAX];
};
#define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX
/* per network ns counters */
struct icmpv6msg_mib {
atomic_long_t mibs[ICMP6MSG_MIB_MAX];
};
/* per device counters, (shared on all cpus) */
struct icmpv6msg_mib_device {
atomic_long_t mibs[ICMP6MSG_MIB_MAX];
};
/* TCP */
#define TCP_MIB_MAX __TCP_MIB_MAX
struct tcp_mib {
unsigned long mibs[TCP_MIB_MAX];
};
/* UDP */
#define UDP_MIB_MAX __UDP_MIB_MAX
struct udp_mib {
unsigned long mibs[UDP_MIB_MAX];
};
/* Linux */
#define LINUX_MIB_MAX __LINUX_MIB_MAX
struct linux_mib {
unsigned long mibs[LINUX_MIB_MAX];
};
/* Linux Xfrm */
#define LINUX_MIB_XFRMMAX __LINUX_MIB_XFRMMAX
struct linux_xfrm_mib {
unsigned long mibs[LINUX_MIB_XFRMMAX];
};
/* Linux TLS */
#define LINUX_MIB_TLSMAX __LINUX_MIB_TLSMAX
struct linux_tls_mib {
unsigned long mibs[LINUX_MIB_TLSMAX];
};
#define DEFINE_SNMP_STAT(type, name) \
__typeof__(type) __percpu *name
#define DEFINE_SNMP_STAT_ATOMIC(type, name) \
__typeof__(type) *name
Annotation
- Immediate include surface: `linux/cache.h`, `linux/snmp.h`, `linux/smp.h`, `linux/u64_stats_sync.h`.
- Detected declarations: `struct snmp_mib`, `struct ipstats_mib`, `struct icmp_mib`, `struct icmpmsg_mib`, `struct icmpv6_mib`, `struct icmpv6_mib_device`, `struct icmpv6msg_mib`, `struct icmpv6msg_mib_device`, `struct tcp_mib`, `struct udp_mib`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- 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.