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.

Dependency Surface

Detected Declarations

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

Implementation Notes