include/net/devlink.h

Source file repositories/reference/linux-study-clean/include/net/devlink.h

File Facts

System
Linux kernel
Corpus path
include/net/devlink.h
Extension
.h
Size
78129 bytes
Lines
2172
Domain
Networking Core
Bucket
Sockets, Protocols, Packet Path, And Network Policy
Inferred role
Networking Core: operation-table or driver-model contract
Status
pattern 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

const struct device_driver *driver);
void devlink_shd_put(struct devlink *devlink);
void *devlink_shd_get_priv(struct devlink *devlink);

/**
 * struct devlink_port_ops - Port operations
 * @port_split: Callback used to split the port into multiple ones.
 * @port_unsplit: Callback used to unsplit the port group back into
 *		  a single port.
 * @port_type_set: Callback used to set a type of a port.
 * @port_del: Callback used to delete selected port along with related function.
 *	      Devlink core calls this upon user request to delete
 *	      a port previously created by devlink_ops->port_new().
 * @port_fn_hw_addr_get: Callback used to set port function's hardware address.
 *			 Should be used by device drivers to report
 *			 the hardware address of a function managed
 *			 by the devlink port.
 * @port_fn_hw_addr_set: Callback used to set port function's hardware address.
 *			 Should be used by device drivers to set the hardware
 *			 address of a function managed by the devlink port.
 * @port_fn_roce_get: Callback used to get port function's RoCE capability.
 *		      Should be used by device drivers to report
 *		      the current state of RoCE capability of a function
 *		      managed by the devlink port.
 * @port_fn_roce_set: Callback used to set port function's RoCE capability.
 *		      Should be used by device drivers to enable/disable
 *		      RoCE capability of a function managed
 *		      by the devlink port.
 * @port_fn_migratable_get: Callback used to get port function's migratable
 *			    capability. Should be used by device drivers
 *			    to report the current state of migratable capability
 *			    of a function managed by the devlink port.
 * @port_fn_migratable_set: Callback used to set port function's migratable
 *			    capability. Should be used by device drivers
 *			    to enable/disable migratable capability of
 *			    a function managed by the devlink port.
 * @port_fn_state_get: Callback used to get port function's state.
 *		       Should be used by device drivers to report
 *		       the current admin and operational state of a
 *		       function managed by the devlink port.
 * @port_fn_state_set: Callback used to get port function's state.
 *		       Should be used by device drivers set
 *		       the admin state of a function managed
 *		       by the devlink port.
 * @port_fn_ipsec_crypto_get: Callback used to get port function's ipsec_crypto
 *			      capability. Should be used by device drivers
 *			      to report the current state of ipsec_crypto
 *			      capability of a function managed by the devlink
 *			      port.
 * @port_fn_ipsec_crypto_set: Callback used to set port function's ipsec_crypto
 *			      capability. Should be used by device drivers to
 *			      enable/disable ipsec_crypto capability of a
 *			      function managed by the devlink port.
 * @port_fn_ipsec_packet_get: Callback used to get port function's ipsec_packet
 *			      capability. Should be used by device drivers
 *			      to report the current state of ipsec_packet
 *			      capability of a function managed by the devlink
 *			      port.
 * @port_fn_ipsec_packet_set: Callback used to set port function's ipsec_packet
 *			      capability. Should be used by device drivers to
 *			      enable/disable ipsec_packet capability of a
 *			      function managed by the devlink port.
 * @port_fn_max_io_eqs_get: Callback used to get port function's maximum number
 *			    of event queues. Should be used by device drivers to
 *			    report the maximum event queues of a function
 *			    managed by the devlink port.
 * @port_fn_max_io_eqs_set: Callback used to set port function's maximum number
 *			    of event queues. Should be used by device drivers to
 *			    configure maximum number of event queues
 *			    of a function managed by the devlink port.
 *
 * Note: Driver should return -EOPNOTSUPP if it doesn't support
 * port function (@port_fn_*) handling for a particular port.
 */
struct devlink_port_ops {
	int (*port_split)(struct devlink *devlink, struct devlink_port *port,
			  unsigned int count, struct netlink_ext_ack *extack);
	int (*port_unsplit)(struct devlink *devlink, struct devlink_port *port,
			    struct netlink_ext_ack *extack);
	int (*port_type_set)(struct devlink_port *devlink_port,
			     enum devlink_port_type port_type);
	int (*port_del)(struct devlink *devlink, struct devlink_port *port,
			struct netlink_ext_ack *extack);
	int (*port_fn_hw_addr_get)(struct devlink_port *port, u8 *hw_addr,
				   int *hw_addr_len,
				   struct netlink_ext_ack *extack);
	int (*port_fn_hw_addr_set)(struct devlink_port *port,
				   const u8 *hw_addr, int hw_addr_len,
				   struct netlink_ext_ack *extack);
	int (*port_fn_roce_get)(struct devlink_port *devlink_port,

Annotation

Implementation Notes