net/openvswitch/datapath.h
Source file repositories/reference/linux-study-clean/net/openvswitch/datapath.h
File Facts
- System
- Linux kernel
- Corpus path
net/openvswitch/datapath.h- Extension
.h- Size
- 10205 bytes
- Lines
- 347
- 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
asm/page.hlinux/kernel.hlinux/mutex.hlinux/netdevice.hlinux/skbuff.hlinux/u64_stats_sync.hnet/ip_tunnels.hnet/mpls.hconntrack.hflow.hflow_table.hmeter.hvport-internal_dev.h
Detected Declarations
struct dp_stats_percpustruct dp_nlsk_pidsstruct datapathstruct ovs_skb_cbstruct dp_upcall_infostruct ovs_netstruct ovs_frag_datastruct deferred_actionstruct action_fifostruct action_flow_keysstruct ovs_pcpu_storageenum ovs_pkt_hash_typesfunction ovs_dp_set_net
Annotated Snippet
struct dp_stats_percpu {
u64 n_hit;
u64 n_missed;
u64 n_lost;
u64 n_mask_hit;
u64 n_cache_hit;
struct u64_stats_sync syncp;
};
/**
* struct dp_nlsk_pids - array of netlink portids of for a datapath.
* This is used when OVS_DP_F_DISPATCH_UPCALL_PER_CPU
* is enabled and must be protected by rcu.
* @rcu: RCU callback head for deferred destruction.
* @n_pids: Size of @pids array.
* @pids: Array storing the Netlink socket PIDs indexed by CPU ID for packets
* that miss the flow table.
*/
struct dp_nlsk_pids {
struct rcu_head rcu;
u32 n_pids;
u32 pids[];
};
/**
* struct datapath - datapath for flow-based packet switching
* @rcu: RCU callback head for deferred destruction.
* @list_node: Element in global 'dps' list.
* @table: flow table.
* @ports: Hash table for ports. %OVSP_LOCAL port always exists. Protected by
* ovs_mutex and RCU.
* @stats_percpu: Per-CPU datapath statistics.
* @net: Reference to net namespace.
* @user_features: Bitmap of enabled %OVS_DP_F_* features.
* @max_headroom: The maximum headroom of all vports in this datapath; it will
* be used by all the internal vports in this dp.
* @meter_tbl: Meter table.
* @upcall_portids: RCU protected 'struct dp_nlsk_pids'.
*
* Context: See the comment on locking at the top of datapath.c for additional
* locking information.
*/
struct datapath {
struct rcu_head rcu;
struct list_head list_node;
/* Flow table. */
struct flow_table table;
/* Switch ports. */
struct hlist_head *ports;
/* Stats. */
struct dp_stats_percpu __percpu *stats_percpu;
/* Network namespace ref. */
possible_net_t net;
u32 user_features;
u32 max_headroom;
/* Switch meters. */
struct dp_meter_table meter_tbl;
struct dp_nlsk_pids __rcu *upcall_portids;
};
/**
* struct ovs_skb_cb - OVS data in skb CB
* @input_vport: The original vport packet came in on. This value is cached
* when a packet is received by OVS.
* @mru: The maximum received fragement size; 0 if the packet is not
* fragmented.
* @acts_origlen: The netlink size of the flow actions applied to this skb.
* @cutlen: The number of bytes from the packet end to be removed.
* @probability: The sampling probability that was applied to this skb; 0 means
* no sampling has occurred; U32_MAX means 100% probability.
* @upcall_pid: Netlink socket PID to use for sending this packet to userspace;
* 0 means "not set" and default per-CPU or per-vport dispatch should be used.
*/
struct ovs_skb_cb {
struct vport *input_vport;
u16 mru;
u16 acts_origlen;
u32 cutlen;
u32 probability;
u32 upcall_pid;
};
#define OVS_CB(skb) ((struct ovs_skb_cb *)(skb)->cb)
Annotation
- Immediate include surface: `asm/page.h`, `linux/kernel.h`, `linux/mutex.h`, `linux/netdevice.h`, `linux/skbuff.h`, `linux/u64_stats_sync.h`, `net/ip_tunnels.h`, `net/mpls.h`.
- Detected declarations: `struct dp_stats_percpu`, `struct dp_nlsk_pids`, `struct datapath`, `struct ovs_skb_cb`, `struct dp_upcall_info`, `struct ovs_net`, `struct ovs_frag_data`, `struct deferred_action`, `struct action_fifo`, `struct action_flow_keys`.
- 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.