include/net/nexthop.h
Source file repositories/reference/linux-study-clean/include/net/nexthop.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/nexthop.h- Extension
.h- Size
- 13056 bytes
- Lines
- 589
- 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/netdevice.hlinux/notifier.hlinux/route.hlinux/types.hnet/ip_fib.hnet/ip6_fib.hnet/netlink.h
Detected Declarations
struct nexthopstruct nh_configstruct nh_infostruct nh_res_bucketstruct nh_res_tablestruct nh_grp_entry_statsstruct nh_grp_entrystruct nh_groupstruct nexthopstruct nh_notifier_single_infostruct nh_notifier_grp_entry_infostruct nh_notifier_grp_infostruct nh_notifier_res_bucket_infostruct nh_notifier_res_table_infostruct nh_notifier_grp_hw_stats_entry_infostruct nh_notifier_grp_hw_stats_infostruct nh_notifier_infoenum nexthop_event_typeenum nh_notifier_info_typefunction nexthop_getfunction nexthop_putfunction nexthop_cmpfunction nexthop_is_fdbfunction nexthop_has_v4function nexthop_is_multipathfunction nexthop_num_pathfunction nexthop_mpath_fill_nodefunction nexthop_is_blackholefunction nexthop_path_fib_resultfunction nexthop_uses_devfunction fib_info_num_pathfunction nexthop_path_fib6_resultfunction nexthop_get_family
Annotated Snippet
struct nh_config {
u32 nh_id;
u8 nh_family;
u8 nh_protocol;
u8 nh_blackhole;
u8 nh_fdb;
u32 nh_flags;
int nh_ifindex;
struct net_device *dev;
union {
__be32 ipv4;
struct in6_addr ipv6;
} gw;
struct nlattr *nh_grp;
u16 nh_grp_type;
u16 nh_grp_res_num_buckets;
unsigned long nh_grp_res_idle_timer;
unsigned long nh_grp_res_unbalanced_timer;
bool nh_grp_res_has_num_buckets;
bool nh_grp_res_has_idle_timer;
bool nh_grp_res_has_unbalanced_timer;
bool nh_hw_stats;
struct nlattr *nh_encap;
u16 nh_encap_type;
u32 nlflags;
struct nl_info nlinfo;
};
struct nh_info {
struct hlist_node dev_hash; /* entry on netns devhash */
struct nexthop *nh_parent;
u8 family;
bool reject_nh;
bool fdb_nh;
union {
struct fib_nh_common fib_nhc;
struct fib_nh fib_nh;
struct fib6_nh fib6_nh;
};
};
struct nh_res_bucket {
struct nh_grp_entry __rcu *nh_entry;
atomic_long_t used_time;
unsigned long migrated_time;
bool occupied;
u8 nh_flags;
};
struct nh_res_table {
struct net *net;
u32 nhg_id;
struct delayed_work upkeep_dw;
/* List of NHGEs that have too few buckets ("uw" for underweight).
* Reclaimed buckets will be given to entries in this list.
*/
struct list_head uw_nh_entries;
unsigned long unbalanced_since;
u32 idle_timer;
u32 unbalanced_timer;
u16 num_nh_buckets;
struct nh_res_bucket nh_buckets[] __counted_by(num_nh_buckets);
};
struct nh_grp_entry_stats {
u64_stats_t packets;
struct u64_stats_sync syncp;
};
struct nh_grp_entry {
struct nexthop *nh;
struct nh_grp_entry_stats __percpu *stats;
u16 weight;
union {
struct {
atomic_t upper_bound;
} hthr;
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/notifier.h`, `linux/route.h`, `linux/types.h`, `net/ip_fib.h`, `net/ip6_fib.h`, `net/netlink.h`.
- Detected declarations: `struct nexthop`, `struct nh_config`, `struct nh_info`, `struct nh_res_bucket`, `struct nh_res_table`, `struct nh_grp_entry_stats`, `struct nh_grp_entry`, `struct nh_group`, `struct nexthop`, `struct nh_notifier_single_info`.
- 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.