linux/drivers/net/ethernet/pensando/ionic/ionic_dev.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */

#ifndef _IONIC_DEV_H_
#define _IONIC_DEV_H_

#include <linux/atomic.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>
#include <linux/skbuff.h>
#include <linux/bpf_trace.h>

#include "ionic_if.h"
#include "ionic_regs.h"

#define IONIC_MAX_TX_DESC
#define IONIC_MAX_RX_DESC
#define IONIC_MIN_TXRX_DESC
#define IONIC_DEF_TXRX_DESC
#define IONIC_RX_FILL_THRESHOLD
#define IONIC_RX_FILL_DIV
#define IONIC_TSO_DESCS_NEEDED
#define IONIC_LIFS_MAX
#define IONIC_WATCHDOG_SECS
#define IONIC_ITR_COAL_USEC_DEFAULT

#define IONIC_DEV_CMD_REG_VERSION
#define IONIC_DEV_INFO_REG_COUNT
#define IONIC_DEV_CMD_REG_COUNT

#define IONIC_NAPI_DEADLINE
#define IONIC_ADMIN_DOORBELL_DEADLINE
#define IONIC_TX_DOORBELL_DEADLINE
#define IONIC_RX_MIN_DOORBELL_DEADLINE
#define IONIC_RX_MAX_DOORBELL_DEADLINE

struct ionic_dev_bar {};

#ifndef __CHECKER__
/* Registers */
static_assert();

static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

static_assert();
static_assert();
static_assert();
static_assert();

/* Device commands */
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

/* Port commands */
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

/* LIF commands */
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

/* RDMA commands */
static_assert();
static_assert();

/* Events */
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();

/* I/O */
static_assert();
static_assert();
static_assert();
static_assert();

static_assert();
static_assert();
static_assert();
static_assert();

/* SR/IOV */
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
static_assert();
#endif /* __CHECKER__ */

struct ionic_devinfo {};

struct ionic_dev {};

struct ionic_queue;
struct ionic_qcq;

#define IONIC_MAX_BUF_LEN
#define IONIC_PAGE_SIZE
#define IONIC_PAGE_SPLIT_SZ
#define IONIC_PAGE_GFP_MASK

#define IONIC_XDP_MAX_LINEAR_MTU

struct ionic_buf_info {};

#define IONIC_TX_MAX_FRAGS
#define IONIC_RX_MAX_FRAGS

struct ionic_tx_desc_info {};

struct ionic_rx_desc_info {};

struct ionic_admin_desc_info {};

#define IONIC_QUEUE_NAME_MAX_SZ

struct ionic_queue {} ____cacheline_aligned_in_smp;

#define IONIC_INTR_INDEX_NOT_ASSIGNED
#define IONIC_INTR_NAME_MAX_SZ

struct ionic_intr_info {};

struct ionic_cq {} ____cacheline_aligned_in_smp;

struct ionic;

static inline void ionic_intr_init(struct ionic_dev *idev,
				   struct ionic_intr_info *intr,
				   unsigned long index)
{}

static inline unsigned int ionic_q_space_avail(struct ionic_queue *q)
{}

static inline bool ionic_q_has_space(struct ionic_queue *q, unsigned int want)
{}

void ionic_init_devinfo(struct ionic *ionic);
int ionic_dev_setup(struct ionic *ionic);
void ionic_dev_teardown(struct ionic *ionic);

void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd);
u8 ionic_dev_cmd_status(struct ionic_dev *idev);
bool ionic_dev_cmd_done(struct ionic_dev *idev);
void ionic_dev_cmd_comp(struct ionic_dev *idev, union ionic_dev_cmd_comp *comp);

void ionic_dev_cmd_identify(struct ionic_dev *idev, u8 ver);
void ionic_dev_cmd_init(struct ionic_dev *idev);
void ionic_dev_cmd_reset(struct ionic_dev *idev);

void ionic_dev_cmd_port_identify(struct ionic_dev *idev);
void ionic_dev_cmd_port_init(struct ionic_dev *idev);
void ionic_dev_cmd_port_reset(struct ionic_dev *idev);
void ionic_dev_cmd_port_state(struct ionic_dev *idev, u8 state);
void ionic_dev_cmd_port_speed(struct ionic_dev *idev, u32 speed);
void ionic_dev_cmd_port_autoneg(struct ionic_dev *idev, u8 an_enable);
void ionic_dev_cmd_port_fec(struct ionic_dev *idev, u8 fec_type);
void ionic_dev_cmd_port_pause(struct ionic_dev *idev, u8 pause_type);

int ionic_set_vf_config(struct ionic *ionic, int vf,
			struct ionic_vf_setattr_cmd *vfc);

void ionic_dev_cmd_queue_identify(struct ionic_dev *idev,
				  u16 lif_type, u8 qtype, u8 qver);
void ionic_vf_start(struct ionic *ionic);
void ionic_dev_cmd_lif_identify(struct ionic_dev *idev, u8 type, u8 ver);
void ionic_dev_cmd_lif_init(struct ionic_dev *idev, u16 lif_index,
			    dma_addr_t addr);
void ionic_dev_cmd_lif_reset(struct ionic_dev *idev, u16 lif_index);
void ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq,
			       u16 lif_index, u16 intr_index);

int ionic_db_page_num(struct ionic_lif *lif, int pid);

int ionic_get_cmb(struct ionic_lif *lif, u32 *pgid, phys_addr_t *pgaddr, int order);
void ionic_put_cmb(struct ionic_lif *lif, u32 pgid, int order);

int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
		  struct ionic_intr_info *intr,
		  unsigned int num_descs, size_t desc_size);
void ionic_cq_map(struct ionic_cq *cq, void *base, dma_addr_t base_pa);
void ionic_cq_bind(struct ionic_cq *cq, struct ionic_queue *q);
ionic_cq_cb;
ionic_cq_done_cb;
unsigned int ionic_cq_service(struct ionic_cq *cq, unsigned int work_to_do,
			      ionic_cq_cb cb, ionic_cq_done_cb done_cb,
			      void *done_arg);
unsigned int ionic_tx_cq_service(struct ionic_cq *cq,
				 unsigned int work_to_do,
				 bool in_napi);

int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev,
		 struct ionic_queue *q, unsigned int index, const char *name,
		 unsigned int num_descs, size_t desc_size,
		 size_t sg_desc_size, unsigned int pid);
void ionic_q_post(struct ionic_queue *q, bool ring_doorbell);
bool ionic_q_is_posted(struct ionic_queue *q, unsigned int pos);

int ionic_heartbeat_check(struct ionic *ionic);
bool ionic_is_fw_running(struct ionic_dev *idev);
void ionic_doorbell_napi_work(struct work_struct *work);
void ionic_queue_doorbell_check(struct ionic *ionic, int delay);

bool ionic_adminq_poke_doorbell(struct ionic_queue *q);
bool ionic_txq_poke_doorbell(struct ionic_queue *q);
bool ionic_rxq_poke_doorbell(struct ionic_queue *q);

#endif /* _IONIC_DEV_H_ */