xref: /linux/drivers/net/ethernet/pensando/ionic/ionic.h (revision 1a371ea1b7b6666f66cac42c655f26ad89348354)
1df69ba43SShannon Nelson /* SPDX-License-Identifier: GPL-2.0 */
2df69ba43SShannon Nelson /* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
3df69ba43SShannon Nelson 
4df69ba43SShannon Nelson #ifndef _IONIC_H_
5df69ba43SShannon Nelson #define _IONIC_H_
6df69ba43SShannon Nelson 
76461b446SShannon Nelson struct ionic_lif;
86461b446SShannon Nelson 
9fbfb8031SShannon Nelson #include "ionic_if.h"
10fbfb8031SShannon Nelson #include "ionic_dev.h"
11df69ba43SShannon Nelson #include "ionic_devlink.h"
12df69ba43SShannon Nelson 
13df69ba43SShannon Nelson #define IONIC_DRV_NAME		"ionic"
14df69ba43SShannon Nelson #define IONIC_DRV_DESCRIPTION	"Pensando Ethernet NIC Driver"
15df69ba43SShannon Nelson #define IONIC_DRV_VERSION	"0.15.0-k"
16df69ba43SShannon Nelson 
17df69ba43SShannon Nelson #define PCI_VENDOR_ID_PENSANDO			0x1dd8
18df69ba43SShannon Nelson 
19df69ba43SShannon Nelson #define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF	0x1002
20df69ba43SShannon Nelson #define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF	0x1003
21df69ba43SShannon Nelson 
22df69ba43SShannon Nelson #define IONIC_SUBDEV_ID_NAPLES_25	0x4000
23df69ba43SShannon Nelson #define IONIC_SUBDEV_ID_NAPLES_100_4	0x4001
24df69ba43SShannon Nelson #define IONIC_SUBDEV_ID_NAPLES_100_8	0x4002
25df69ba43SShannon Nelson 
26fbfb8031SShannon Nelson #define DEVCMD_TIMEOUT  10
27fbfb8031SShannon Nelson 
28df69ba43SShannon Nelson struct ionic {
29df69ba43SShannon Nelson 	struct pci_dev *pdev;
30df69ba43SShannon Nelson 	struct device *dev;
31beead698SShannon Nelson 	struct devlink_port dl_port;
32fbfb8031SShannon Nelson 	struct ionic_dev idev;
33fbfb8031SShannon Nelson 	struct mutex dev_cmd_lock;	/* lock for dev_cmd operations */
34fbfb8031SShannon Nelson 	struct dentry *dentry;
35fbfb8031SShannon Nelson 	struct ionic_dev_bar bars[IONIC_BARS_MAX];
36fbfb8031SShannon Nelson 	unsigned int num_bars;
37fbfb8031SShannon Nelson 	struct ionic_identity ident;
381a58e196SShannon Nelson 	struct list_head lifs;
39beead698SShannon Nelson 	struct ionic_lif *master_lif;
401a58e196SShannon Nelson 	unsigned int nnqs_per_lif;
411a58e196SShannon Nelson 	unsigned int neqs_per_lif;
421a58e196SShannon Nelson 	unsigned int ntxqs_per_lif;
431a58e196SShannon Nelson 	unsigned int nrxqs_per_lif;
441a58e196SShannon Nelson 	DECLARE_BITMAP(lifbits, IONIC_LIFS_MAX);
451a58e196SShannon Nelson 	unsigned int nintrs;
466461b446SShannon Nelson 	DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX);
47*1a371ea1SShannon Nelson 	struct work_struct nb_work;
48*1a371ea1SShannon Nelson 	struct notifier_block nb;
49df69ba43SShannon Nelson };
50df69ba43SShannon Nelson 
51938962d5SShannon Nelson struct ionic_admin_ctx {
52938962d5SShannon Nelson 	struct completion work;
53938962d5SShannon Nelson 	union ionic_adminq_cmd cmd;
54938962d5SShannon Nelson 	union ionic_adminq_comp comp;
55938962d5SShannon Nelson };
56938962d5SShannon Nelson 
571d062b7bSShannon Nelson int ionic_napi(struct napi_struct *napi, int budget, ionic_cq_cb cb,
581d062b7bSShannon Nelson 	       ionic_cq_done_cb done_cb, void *done_arg);
591d062b7bSShannon Nelson 
60938962d5SShannon Nelson int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
61fbfb8031SShannon Nelson int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
62fbfb8031SShannon Nelson int ionic_set_dma_mask(struct ionic *ionic);
63fbfb8031SShannon Nelson int ionic_setup(struct ionic *ionic);
64fbfb8031SShannon Nelson 
65fbfb8031SShannon Nelson int ionic_identify(struct ionic *ionic);
66fbfb8031SShannon Nelson int ionic_init(struct ionic *ionic);
67fbfb8031SShannon Nelson int ionic_reset(struct ionic *ionic);
68fbfb8031SShannon Nelson 
6904436595SShannon Nelson int ionic_port_identify(struct ionic *ionic);
7004436595SShannon Nelson int ionic_port_init(struct ionic *ionic);
7104436595SShannon Nelson int ionic_port_reset(struct ionic *ionic);
7204436595SShannon Nelson 
73df69ba43SShannon Nelson #endif /* _IONIC_H_ */
74