drivers/net/ethernet/netronome/nfp/nfp_app.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfp_app.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/netronome/nfp/nfp_app.h
Extension
.h
Size
12869 bytes
Lines
449
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct nfp_app_type {
	enum nfp_app_id id;
	const char *name;

	u32 ctrl_cap_mask;
	bool ctrl_has_meta;

	int (*init)(struct nfp_app *app);
	void (*clean)(struct nfp_app *app);

	const char *(*extra_cap)(struct nfp_app *app, struct nfp_net *nn);

	int (*ndo_init)(struct nfp_app *app, struct net_device *netdev);
	void (*ndo_uninit)(struct nfp_app *app, struct net_device *netdev);

	int (*vnic_alloc)(struct nfp_app *app, struct nfp_net *nn,
			  unsigned int id);
	void (*vnic_free)(struct nfp_app *app, struct nfp_net *nn);
	int (*vnic_init)(struct nfp_app *app, struct nfp_net *nn);
	void (*vnic_clean)(struct nfp_app *app, struct nfp_net *nn);

	int (*repr_init)(struct nfp_app *app, struct net_device *netdev);
	void (*repr_preclean)(struct nfp_app *app, struct net_device *netdev);
	void (*repr_clean)(struct nfp_app *app, struct net_device *netdev);

	int (*repr_open)(struct nfp_app *app, struct nfp_repr *repr);
	int (*repr_stop)(struct nfp_app *app, struct nfp_repr *repr);

	int (*check_mtu)(struct nfp_app *app, struct net_device *netdev,
			 int new_mtu);
	int (*repr_change_mtu)(struct nfp_app *app, struct net_device *netdev,
			       int new_mtu);

	u64 *(*port_get_stats)(struct nfp_app *app,
			       struct nfp_port *port, u64 *data);
	int (*port_get_stats_count)(struct nfp_app *app, struct nfp_port *port);
	u8 *(*port_get_stats_strings)(struct nfp_app *app,
				      struct nfp_port *port, u8 *data);

	int (*start)(struct nfp_app *app);
	void (*stop)(struct nfp_app *app);

	int (*netdev_event)(struct nfp_app *app, struct net_device *netdev,
			    unsigned long event, void *ptr);

	void (*ctrl_msg_rx)(struct nfp_app *app, struct sk_buff *skb);
	void (*ctrl_msg_rx_raw)(struct nfp_app *app, const void *data,
				unsigned int len);

	int (*setup_tc)(struct nfp_app *app, struct net_device *netdev,
			enum tc_setup_type type, void *type_data);
	int (*bpf)(struct nfp_app *app, struct nfp_net *nn,
		   struct netdev_bpf *xdp);
	int (*xdp_offload)(struct nfp_app *app, struct nfp_net *nn,
			   struct bpf_prog *prog,
			   struct netlink_ext_ack *extack);

	int (*sriov_enable)(struct nfp_app *app, int num_vfs);
	void (*sriov_disable)(struct nfp_app *app);

	enum devlink_eswitch_mode (*eswitch_mode_get)(struct nfp_app *app);
	int (*eswitch_mode_set)(struct nfp_app *app, u16 mode);
	struct net_device *(*dev_get)(struct nfp_app *app, u32 id,
				      bool *redir_egress);
};

/**
 * struct nfp_app - NFP application container
 * @pdev:	backpointer to PCI device
 * @pf:		backpointer to NFP PF structure
 * @cpp:	pointer to the CPP handle
 * @ctrl:	pointer to ctrl vNIC struct
 * @reprs:	array of pointers to representors
 * @type:	pointer to const application ops and info
 * @ctrl_mtu:	MTU to set on the control vNIC (set in .init())
 * @netdev_nb:	Netdevice notifier block
 * @priv:	app-specific priv data
 */
struct nfp_app {
	struct pci_dev *pdev;
	struct nfp_pf *pf;
	struct nfp_cpp *cpp;

	struct nfp_net *ctrl;
	struct nfp_reprs __rcu *reprs[NFP_REPR_TYPE_MAX + 1];

	const struct nfp_app_type *type;
	unsigned int ctrl_mtu;

	struct notifier_block netdev_nb;

Annotation

Implementation Notes