net/openvswitch/vport.h
Source file repositories/reference/linux-study-clean/net/openvswitch/vport.h
File Facts
- System
- Linux kernel
- Corpus path
net/openvswitch/vport.h- Extension
.h- Size
- 6781 bytes
- Lines
- 219
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/if_tunnel.hlinux/list.hlinux/netlink.hlinux/openvswitch.hlinux/reciprocal_div.hlinux/skbuff.hlinux/spinlock.hlinux/u64_stats_sync.hdatapath.h
Detected Declarations
struct vportstruct vport_parmsstruct vport_portidsstruct vportstruct vport_parmsstruct vport_opsstruct vport_upcall_stats_percpufunction vport_alloc
Annotated Snippet
struct vport_portids {
struct reciprocal_value rn_ids;
struct rcu_head rcu;
u32 n_ids;
u32 ids[];
};
/**
* struct vport - one port within a datapath
* @dev: Pointer to net_device.
* @dev_tracker: refcount tracker for @dev reference
* @dp: Datapath to which this port belongs.
* @upcall_portids: RCU protected 'struct vport_portids'.
* @port_no: Index into @dp's @ports array.
* @hash_node: Element in @dev_table hash table in vport.c.
* @dp_hash_node: Element in @datapath->ports hash table in datapath.c.
* @ops: Class structure.
* @upcall_stats: Upcall stats of every ports.
* @detach_list: list used for detaching vport in net-exit call.
* @rcu: RCU callback head for deferred destruction.
*/
struct vport {
struct net_device *dev;
netdevice_tracker dev_tracker;
struct datapath *dp;
struct vport_portids __rcu *upcall_portids;
u16 port_no;
struct hlist_node hash_node;
struct hlist_node dp_hash_node;
const struct vport_ops *ops;
struct vport_upcall_stats_percpu __percpu *upcall_stats;
struct list_head detach_list;
struct rcu_head rcu;
};
/**
* struct vport_parms - parameters for creating a new vport
*
* @name: New vport's name.
* @type: New vport's type.
* @options: %OVS_VPORT_ATTR_OPTIONS attribute from Netlink message, %NULL if
* none was supplied.
* @desired_ifindex: New vport's ifindex.
* @dp: New vport's datapath.
* @port_no: New vport's port number.
* @upcall_portids: %OVS_VPORT_ATTR_UPCALL_PID attribute from Netlink message,
* %NULL if none was supplied.
*/
struct vport_parms {
const char *name;
enum ovs_vport_type type;
int desired_ifindex;
struct nlattr *options;
/* For ovs_vport_alloc(). */
struct datapath *dp;
u16 port_no;
struct nlattr *upcall_portids;
};
/**
* struct vport_ops - definition of a type of virtual port
*
* @type: %OVS_VPORT_TYPE_* value for this type of virtual port.
* @create: Create a new vport configured as specified. On success returns
* a new vport allocated with ovs_vport_alloc(), otherwise an ERR_PTR() value.
* @destroy: Destroys a vport. Must call vport_free() on the vport but not
* before an RCU grace period has elapsed.
* @set_options: Modify the configuration of an existing vport. May be %NULL
* if modification is not supported.
* @get_options: Appends vport-specific attributes for the configuration of an
* existing vport to a &struct sk_buff. May be %NULL for a vport that does not
* have any configuration.
* @send: Send a packet on the device.
* zero for dropped packets or negative for error.
* @owner: Module that implements this vport type.
* @list: List entry in the global list of vport types.
*/
struct vport_ops {
enum ovs_vport_type type;
/* Called with ovs_mutex. */
struct vport *(*create)(const struct vport_parms *);
void (*destroy)(struct vport *);
int (*set_options)(struct vport *, struct nlattr *);
int (*get_options)(const struct vport *, struct sk_buff *);
Annotation
- Immediate include surface: `linux/if_tunnel.h`, `linux/list.h`, `linux/netlink.h`, `linux/openvswitch.h`, `linux/reciprocal_div.h`, `linux/skbuff.h`, `linux/spinlock.h`, `linux/u64_stats_sync.h`.
- Detected declarations: `struct vport`, `struct vport_parms`, `struct vport_portids`, `struct vport`, `struct vport_parms`, `struct vport_ops`, `struct vport_upcall_stats_percpu`, `function vport_alloc`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
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.