| 1 |
|
| 2 |
|
| 3 |
|
| 4 | #ifndef _IONIC_H_
|
| 5 | #define _IONIC_H_
|
| 6 |
|
| 7 | struct ionic_lif;
|
| 8 |
|
| 9 | #include "ionic_if.h"
|
| 10 | #include "ionic_dev.h"
|
| 11 | #include "ionic_devlink.h"
|
| 12 |
|
| 13 | #define IONIC_DRV_NAME "ionic"
|
| 14 | #define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver"
|
| 15 |
|
| 16 | #define PCI_VENDOR_ID_PENSANDO 0x1dd8
|
| 17 |
|
| 18 | #define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002
|
| 19 | #define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003
|
| 20 |
|
| 21 | #define DEVCMD_TIMEOUT 5
|
| 22 | #define IONIC_ADMINQ_TIME_SLICE msecs_to_jiffies(100)
|
| 23 |
|
| 24 | #define IONIC_PHC_UPDATE_NS 10000000000
|
| 25 | #define NORMAL_PPB 1000000000
|
| 26 | #define SCALED_PPM (1000000ull << 16)
|
| 27 |
|
| 28 | struct ionic_vf {
|
| 29 | u16 index;
|
| 30 | u8 macaddr[6];
|
| 31 | __le32 maxrate;
|
| 32 | __le16 vlanid;
|
| 33 | u8 spoofchk;
|
| 34 | u8 trusted;
|
| 35 | u8 linkstate;
|
| 36 | dma_addr_t stats_pa;
|
| 37 | struct ionic_lif_stats stats;
|
| 38 | };
|
| 39 |
|
| 40 | struct ionic {
|
| 41 | struct pci_dev *pdev;
|
| 42 | struct device *dev;
|
| 43 | struct devlink_port dl_port;
|
| 44 | struct ionic_dev idev;
|
| 45 | struct mutex dev_cmd_lock;
|
| 46 | struct dentry *dentry;
|
| 47 | struct ionic_dev_bar bars[IONIC_BARS_MAX];
|
| 48 | unsigned int num_bars;
|
| 49 | struct ionic_identity ident;
|
| 50 | struct workqueue_struct *wq;
|
| 51 | struct ionic_lif *lif;
|
| 52 | unsigned int nnqs_per_lif;
|
| 53 | unsigned int neqs_per_lif;
|
| 54 | unsigned int ntxqs_per_lif;
|
| 55 | unsigned int nrxqs_per_lif;
|
| 56 | unsigned int nintrs;
|
| 57 | DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX);
|
| 58 | cpumask_var_t *affinity_masks;
|
| 59 | struct delayed_work doorbell_check_dwork;
|
| 60 | struct notifier_block nb;
|
| 61 | struct rw_semaphore vf_op_lock;
|
| 62 | struct ionic_vf *vfs;
|
| 63 | int num_vfs;
|
| 64 | struct timer_list watchdog_timer;
|
| 65 | int watchdog_period;
|
| 66 | };
|
| 67 |
|
| 68 | int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
|
| 69 | int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,
|
| 70 | const int err, const bool do_msg);
|
| 71 | int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
|
| 72 | void ionic_adminq_netdev_err_print(struct ionic_lif *lif, u8 opcode,
|
| 73 | u8 status, int err);
|
| 74 | bool ionic_notifyq_service(struct ionic_cq *cq);
|
| 75 | bool ionic_adminq_service(struct ionic_cq *cq);
|
| 76 |
|
| 77 | int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
|
| 78 | int ionic_dev_cmd_wait_nomsg(struct ionic *ionic, unsigned long max_wait);
|
| 79 | void ionic_dev_cmd_dev_err_print(struct ionic *ionic, u8 opcode, u8 status,
|
| 80 | int err);
|
| 81 | int ionic_setup(struct ionic *ionic);
|
| 82 |
|
| 83 | int ionic_identify(struct ionic *ionic);
|
| 84 | int ionic_init(struct ionic *ionic);
|
| 85 | int ionic_reset(struct ionic *ionic);
|
| 86 |
|
| 87 | int ionic_port_identify(struct ionic *ionic);
|
| 88 | int ionic_port_init(struct ionic *ionic);
|
| 89 | int ionic_port_reset(struct ionic *ionic);
|
| 90 |
|
| 91 | bool ionic_doorbell_wa(struct ionic *ionic);
|
| 92 |
|
| 93 | #endif
|