include/net/dst.h
Source file repositories/reference/linux-study-clean/include/net/dst.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/dst.h- Extension
.h- Size
- 16177 bytes
- Lines
- 622
- 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
net/dst_ops.hlinux/netdevice.hlinux/rtnetlink.hlinux/rcupdate.hlinux/bug.hlinux/jiffies.hlinux/refcount.hlinux/rcuref.hnet/neighbour.hasm/processor.hlinux/indirect_call_wrapper.h
Detected Declarations
struct sk_buffstruct dst_entrystruct dst_metricsstruct flowifunction dst_metrics_read_onlyfunction dst_destroy_metrics_genericfunction dst_init_metricsfunction dst_copy_metricsfunction dst_metric_rawfunction dst_metricfunction dst_metric_advmssfunction dst_metric_setfunction dst_featurefunction dst_mtufunction dst4_mtufunction dst_metric_rttfunction dst_metric_lockedfunction dst_holdfunction dst_use_noreffunction refdst_dropfunction skb_dst_dropfunction __skb_dst_copyfunction skb_dst_copyfunction dst_hold_safefunction skb_dst_forcefunction __skb_tunnel_rxfunction skb_tunnel_rxfunction dst_tclassidfunction dst_discardfunction dst_confirmfunction dst_confirm_neighfunction dst_link_failurefunction dst_set_expiresfunction dst_dev_overheadfunction dst_outputfunction dst_inputfunction xfrm_lookup_with_ifidfunction skb_dst_update_pmtufunction skb_dst_update_pmtu_no_confirm
Annotated Snippet
struct dst_entry {
union {
struct net_device *dev;
struct net_device __rcu *dev_rcu;
};
struct dst_ops *ops;
unsigned long _metrics;
unsigned long expires;
#ifdef CONFIG_XFRM
struct xfrm_state *xfrm;
#else
void *__pad1;
#endif
int (*input)(struct sk_buff *);
int (*output)(struct net *net, struct sock *sk, struct sk_buff *skb);
unsigned short flags;
#define DST_NOXFRM 0x0002
#define DST_NOPOLICY 0x0004
#define DST_NOCOUNT 0x0008
#define DST_FAKE_RTABLE 0x0010
#define DST_XFRM_TUNNEL 0x0020
#define DST_XFRM_QUEUE 0x0040
#define DST_METADATA 0x0080
/* A non-zero value of dst->obsolete forces by-hand validation
* of the route entry. Positive values are set by the generic
* dst layer to indicate that the entry has been forcefully
* destroyed.
*
* Negative values are used by the implementation layer code to
* force invocation of the dst_ops->check() method.
*/
short obsolete;
#define DST_OBSOLETE_NONE 0
#define DST_OBSOLETE_DEAD 2
#define DST_OBSOLETE_FORCE_CHK -1
#define DST_OBSOLETE_KILL -2
unsigned short header_len; /* more space at head required */
unsigned short trailer_len; /* space to reserve at tail */
/*
* __rcuref wants to be on a different cache line from
* input/output/ops or performance tanks badly
*/
#ifdef CONFIG_64BIT
rcuref_t __rcuref; /* 64-bit offset 64 */
#endif
int __use;
unsigned long lastuse;
struct rcu_head rcu_head;
short error;
short __pad;
__u32 tclassid;
#ifndef CONFIG_64BIT
struct lwtunnel_state *lwtstate;
rcuref_t __rcuref; /* 32-bit offset 64 */
#endif
netdevice_tracker dev_tracker;
/*
* Used by rtable and rt6_info. Moves lwtstate into the next cache
* line on 64bit so that lwtstate does not cause false sharing with
* __rcuref under contention of __rcuref. This also puts the
* frequently accessed members of rtable and rt6_info out of the
* __rcuref cache line.
*/
struct list_head rt_uncached;
struct uncached_list *rt_uncached_list;
#ifdef CONFIG_64BIT
struct lwtunnel_state *lwtstate;
#endif
};
struct dst_metrics {
u32 metrics[RTAX_MAX];
refcount_t refcnt;
} __aligned(4); /* Low pointer bits contain DST_METRICS_FLAGS */
extern const struct dst_metrics dst_default_metrics;
u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
#define DST_METRICS_READ_ONLY 0x1UL
#define DST_METRICS_REFCOUNTED 0x2UL
#define DST_METRICS_FLAGS 0x3UL
#define __DST_METRICS_PTR(Y) \
((u32 *)((Y) & ~DST_METRICS_FLAGS))
#define DST_METRICS_PTR(X) __DST_METRICS_PTR((X)->_metrics)
static inline bool dst_metrics_read_only(const struct dst_entry *dst)
Annotation
- Immediate include surface: `net/dst_ops.h`, `linux/netdevice.h`, `linux/rtnetlink.h`, `linux/rcupdate.h`, `linux/bug.h`, `linux/jiffies.h`, `linux/refcount.h`, `linux/rcuref.h`.
- Detected declarations: `struct sk_buff`, `struct dst_entry`, `struct dst_metrics`, `struct flowi`, `function dst_metrics_read_only`, `function dst_destroy_metrics_generic`, `function dst_init_metrics`, `function dst_copy_metrics`, `function dst_metric_raw`, `function dst_metric`.
- 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.