2019-09-03 15:28:04 -07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
|
|
|
|
|
|
|
|
#ifndef _IONIC_H_
|
|
|
|
#define _IONIC_H_
|
|
|
|
|
2019-09-03 15:28:08 -07:00
|
|
|
struct ionic_lif;
|
|
|
|
|
2019-09-03 15:28:05 -07:00
|
|
|
#include "ionic_if.h"
|
|
|
|
#include "ionic_dev.h"
|
2019-09-03 15:28:04 -07:00
|
|
|
#include "ionic_devlink.h"
|
|
|
|
|
|
|
|
#define IONIC_DRV_NAME "ionic"
|
|
|
|
#define IONIC_DRV_DESCRIPTION "Pensando Ethernet NIC Driver"
|
|
|
|
|
|
|
|
#define PCI_VENDOR_ID_PENSANDO 0x1dd8
|
|
|
|
|
|
|
|
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_PF 0x1002
|
|
|
|
#define PCI_DEVICE_ID_PENSANDO_IONIC_ETH_VF 0x1003
|
|
|
|
|
2022-01-24 10:53:11 -08:00
|
|
|
#define DEVCMD_TIMEOUT 5
|
2021-10-01 11:05:55 -07:00
|
|
|
#define IONIC_ADMINQ_TIME_SLICE msecs_to_jiffies(100)
|
2019-09-03 15:28:05 -07:00
|
|
|
|
2021-04-01 10:56:04 -07:00
|
|
|
#define IONIC_PHC_UPDATE_NS 10000000000 /* 10s in nanoseconds */
|
|
|
|
#define NORMAL_PPB 1000000000 /* one billion parts per billion */
|
|
|
|
#define SCALED_PPM (1000000ull << 16) /* 2^16 million parts per 2^16 million */
|
|
|
|
|
2020-01-03 09:55:08 -08:00
|
|
|
struct ionic_vf {
|
|
|
|
u16 index;
|
|
|
|
u8 macaddr[6];
|
|
|
|
__le32 maxrate;
|
|
|
|
__le16 vlanid;
|
|
|
|
u8 spoofchk;
|
|
|
|
u8 trusted;
|
|
|
|
u8 linkstate;
|
|
|
|
dma_addr_t stats_pa;
|
|
|
|
struct ionic_lif_stats stats;
|
|
|
|
};
|
|
|
|
|
2019-09-03 15:28:04 -07:00
|
|
|
struct ionic {
|
|
|
|
struct pci_dev *pdev;
|
|
|
|
struct device *dev;
|
2019-09-03 15:28:12 -07:00
|
|
|
struct devlink_port dl_port;
|
2019-09-03 15:28:05 -07:00
|
|
|
struct ionic_dev idev;
|
|
|
|
struct mutex dev_cmd_lock; /* lock for dev_cmd operations */
|
|
|
|
struct dentry *dentry;
|
|
|
|
struct ionic_dev_bar bars[IONIC_BARS_MAX];
|
|
|
|
unsigned int num_bars;
|
|
|
|
struct ionic_identity ident;
|
2024-06-18 17:32:52 -07:00
|
|
|
struct workqueue_struct *wq;
|
2020-08-27 16:00:22 -07:00
|
|
|
struct ionic_lif *lif;
|
2019-09-03 15:28:07 -07:00
|
|
|
unsigned int nnqs_per_lif;
|
|
|
|
unsigned int neqs_per_lif;
|
|
|
|
unsigned int ntxqs_per_lif;
|
|
|
|
unsigned int nrxqs_per_lif;
|
|
|
|
unsigned int nintrs;
|
2019-09-03 15:28:08 -07:00
|
|
|
DECLARE_BITMAP(intrs, IONIC_INTR_CTRL_REGS_MAX);
|
2024-06-18 17:32:51 -07:00
|
|
|
cpumask_var_t *affinity_masks;
|
2024-06-18 17:32:53 -07:00
|
|
|
struct delayed_work doorbell_check_dwork;
|
2019-09-03 15:28:18 -07:00
|
|
|
struct notifier_block nb;
|
2020-01-03 09:55:08 -08:00
|
|
|
struct rw_semaphore vf_op_lock; /* lock for VF operations */
|
|
|
|
struct ionic_vf *vfs;
|
|
|
|
int num_vfs;
|
2019-10-23 17:48:58 -07:00
|
|
|
struct timer_list watchdog_timer;
|
|
|
|
int watchdog_period;
|
2019-09-03 15:28:04 -07:00
|
|
|
};
|
|
|
|
|
2019-09-03 15:28:10 -07:00
|
|
|
struct ionic_admin_ctx {
|
|
|
|
struct completion work;
|
|
|
|
union ionic_adminq_cmd cmd;
|
|
|
|
union ionic_adminq_comp comp;
|
|
|
|
};
|
|
|
|
|
2021-04-01 10:56:02 -07:00
|
|
|
int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
|
2021-10-09 11:45:22 -07:00
|
|
|
int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,
|
|
|
|
const int err, const bool do_msg);
|
2019-09-03 15:28:10 -07:00
|
|
|
int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
|
2021-10-09 11:45:22 -07:00
|
|
|
int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *ctx);
|
|
|
|
void ionic_adminq_netdev_err_print(struct ionic_lif *lif, u8 opcode,
|
|
|
|
u8 status, int err);
|
2024-03-06 15:29:50 -08:00
|
|
|
bool ionic_notifyq_service(struct ionic_cq *cq);
|
|
|
|
bool ionic_adminq_service(struct ionic_cq *cq);
|
2021-10-09 11:45:22 -07:00
|
|
|
|
2019-09-03 15:28:05 -07:00
|
|
|
int ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_wait);
|
2022-01-24 10:53:05 -08:00
|
|
|
int ionic_dev_cmd_wait_nomsg(struct ionic *ionic, unsigned long max_wait);
|
|
|
|
void ionic_dev_cmd_dev_err_print(struct ionic *ionic, u8 opcode, u8 status,
|
|
|
|
int err);
|
2019-09-03 15:28:05 -07:00
|
|
|
int ionic_setup(struct ionic *ionic);
|
|
|
|
|
|
|
|
int ionic_identify(struct ionic *ionic);
|
|
|
|
int ionic_init(struct ionic *ionic);
|
|
|
|
int ionic_reset(struct ionic *ionic);
|
|
|
|
|
2019-09-03 15:28:06 -07:00
|
|
|
int ionic_port_identify(struct ionic *ionic);
|
|
|
|
int ionic_port_init(struct ionic *ionic);
|
|
|
|
int ionic_port_reset(struct ionic *ionic);
|
|
|
|
|
2024-06-18 17:32:57 -07:00
|
|
|
bool ionic_doorbell_wa(struct ionic *ionic);
|
|
|
|
|
2019-09-03 15:28:04 -07:00
|
|
|
#endif /* _IONIC_H_ */
|