linux/drivers/scsi/qedf/qedf.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 *  QLogic FCoE Offload Driver
 *  Copyright (c) 2016-2018 Cavium Inc.
 */
#ifndef _QEDFC_H_
#define _QEDFC_H_

#include <scsi/libfcoe.h>
#include <scsi/libfc.h>
#include <scsi/fc/fc_fip.h>
#include <scsi/fc/fc_fc2.h>
#include <scsi/scsi_tcq.h>

/* qedf_hsi.h needs to before included any qed includes */
#include "qedf_hsi.h"

#include <linux/qed/qed_if.h>
#include <linux/qed/qed_fcoe_if.h>
#include <linux/qed/qed_ll2_if.h>
#include "qedf_version.h"
#include "qedf_dbg.h"
#include "drv_fcoe_fw_funcs.h"

/* Helpers to extract upper and lower 32-bits of pointer */
#define U64_HI(val)
#define U64_LO(val)

#define QEDF_DESCR
#define QEDF_MODULE_NAME

#define QEDF_FLOGI_RETRY_CNT
#define QEDF_RPORT_RETRY_CNT
#define QEDF_MAX_SESSIONS
#define QEDF_MAX_PAYLOAD
#define QEDF_MAX_BDS_PER_CMD
#define QEDF_MAX_BD_LEN
#define QEDF_BD_SPLIT_SZ
#define QEDF_PAGE_SIZE
#define QED_HW_DMA_BOUNDARY
#define QEDF_MAX_SGLEN_FOR_CACHESGL
#define QEDF_MFS
#define QEDF_MAX_NPIV
#define QEDF_TM_TIMEOUT
#define QEDF_ABORT_TIMEOUT
#define QEDF_CLEANUP_TIMEOUT
#define QEDF_MAX_CDB_LEN
#define QEDF_LL2_BUF_SIZE

#define UPSTREAM_REMOVE
#define UPSTREAM_KEEP

struct qedf_mp_req {};

struct qedf_els_cb_arg {};

enum qedf_ioreq_event {};

#define FC_GOOD
#define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER
#define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER
#define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID
#define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID
struct qedf_ioreq {};

struct qedf_cmd_priv {};

static inline struct qedf_cmd_priv *qedf_priv(struct scsi_cmnd *cmd)
{}

extern struct workqueue_struct *qedf_io_wq;

struct qedf_rport {};

/* Used to contain LL2 skb's in ll2_skb_list */
struct qedf_skb_work {};

struct qedf_fastpath {};

/* Used to pass fastpath information needed to process CQEs */
struct qedf_io_work {};

struct qedf_glbl_q_params {};

struct global_queue {};

/* I/O tracing entry */
#define QEDF_IO_TRACE_SIZE
struct qedf_io_log {};

/* Number of entries in BDQ */
#define QEDF_BDQ_SIZE
#define QEDF_BDQ_BUF_SIZE

/* DMA coherent buffers for BDQ */
struct qedf_bdq_buf {};

/* Main adapter struct */
struct qedf_ctx {};

struct io_bdt {};

struct qedf_cmd_mgr {};

/* Stolen from qed_cxt_api.h and adapted for qed_fcoe_info
 * Usage:
 *
 * void *ptr;
 * ptr = qedf_get_task_mem(&qedf->tasks, 128);
 */
static inline void *qedf_get_task_mem(struct qed_fcoe_tid *info, u32 tid)
{}

static inline void qedf_stop_all_io(struct qedf_ctx *qedf)
{}

/*
 * Externs
 */

/*
 * (QEDF_LOG_NPIV | QEDF_LOG_SESS | QEDF_LOG_LPORT | QEDF_LOG_ELS | QEDF_LOG_MQ
 * | QEDF_LOG_IO | QEDF_LOG_UNSOL | QEDF_LOG_SCSI_TM | QEDF_LOG_MP_REQ |
 * QEDF_LOG_EVT | QEDF_LOG_CONN | QEDF_LOG_DISC | QEDF_LOG_INFO)
 */
#define QEDF_DEFAULT_LOG_MASK
extern const struct qed_fcoe_ops *qed_ops;
extern uint qedf_dump_frames;
extern uint qedf_io_tracing;
extern uint qedf_stop_io_on_error;
extern uint qedf_link_down_tmo;
#define QEDF_RETRY_DELAY_MAX
extern bool qedf_retry_delay;
extern uint qedf_debug;

extern struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf);
extern void qedf_cmd_mgr_free(struct qedf_cmd_mgr *cmgr);
extern int qedf_queuecommand(struct Scsi_Host *host,
	struct scsi_cmnd *sc_cmd);
extern void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb);
extern u8 *qedf_get_src_mac(struct fc_lport *lport);
extern void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb);
extern void qedf_fcoe_send_vlan_req(struct qedf_ctx *qedf);
extern void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
	struct qedf_ioreq *io_req);
extern void qedf_process_warning_compl(struct qedf_ctx *qedf,
	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
extern void qedf_process_error_detect(struct qedf_ctx *qedf,
	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
extern void qedf_flush_active_ios(struct qedf_rport *fcport, u64 lun);
extern void qedf_release_cmd(struct kref *ref);
extern int qedf_initiate_abts(struct qedf_ioreq *io_req,
	bool return_scsi_cmd_on_abts);
extern void qedf_process_abts_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
	struct qedf_ioreq *io_req);
extern struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport,
	u8 cmd_type);

extern const struct attribute_group *qedf_host_groups[];
extern void qedf_cmd_timer_set(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
	unsigned int timer_msec);
extern int qedf_init_mp_req(struct qedf_ioreq *io_req);
extern void qedf_init_mp_task(struct qedf_ioreq *io_req,
	struct fcoe_task_context *task_ctx, struct fcoe_wqe *sqe);
extern u16 qedf_get_sqe_idx(struct qedf_rport *fcport);
extern void qedf_ring_doorbell(struct qedf_rport *fcport);
extern void qedf_process_els_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
	struct qedf_ioreq *els_req);
extern int qedf_send_rrq(struct qedf_ioreq *aborted_io_req);
extern int qedf_send_adisc(struct qedf_rport *fcport, struct fc_frame *fp);
extern int qedf_initiate_cleanup(struct qedf_ioreq *io_req,
	bool return_scsi_cmd_on_abts);
extern void qedf_process_cleanup_compl(struct qedf_ctx *qedf,
	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
extern int qedf_initiate_tmf(struct fc_rport *rport, u64 lun, u8 tm_flags);
extern void qedf_process_tmf_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
	struct qedf_ioreq *io_req);
extern void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe);
extern void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
	int result);
extern void qedf_set_vlan_id(struct qedf_ctx *qedf, int vlan_id);
extern void qedf_create_sysfs_ctx_attr(struct qedf_ctx *qedf);
extern void qedf_remove_sysfs_ctx_attr(struct qedf_ctx *qedf);
extern void qedf_capture_grc_dump(struct qedf_ctx *qedf);
bool qedf_wait_for_upload(struct qedf_ctx *qedf);
extern void qedf_process_unsol_compl(struct qedf_ctx *qedf, uint16_t que_idx,
	struct fcoe_cqe *cqe);
extern void qedf_restart_rport(struct qedf_rport *fcport);
extern int qedf_send_rec(struct qedf_ioreq *orig_io_req);
extern int qedf_post_io_req(struct qedf_rport *fcport,
	struct qedf_ioreq *io_req);
extern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf,
	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
extern int qedf_send_flogi(struct qedf_ctx *qedf);
extern void qedf_get_protocol_tlv_data(void *dev, void *data);
extern void qedf_fp_io_handler(struct work_struct *work);
extern void qedf_get_generic_tlv_data(void *dev, struct qed_generic_tlvs *data);
extern void qedf_wq_grcdump(struct work_struct *work);
void qedf_stag_change_work(struct work_struct *work);
void qedf_ctx_soft_reset(struct fc_lport *lport);
extern void qedf_schedule_hw_err_handler(void *dev,
		enum qed_hw_err_type err_type);

#define FCOE_WORD_TO_BYTE
#define QEDF_MAX_TASK_NUM
#define QL45xxx
#define QL41xxx
#define MAX_CT_PAYLOAD
#define DISCOVERED_PORTS
#define NUMBER_OF_PORTS

struct fip_vlan {};

/* SQ/CQ Sizes */
#define GBL_RSVD_TASKS
#define NUM_TASKS_PER_CONNECTION
#define NUM_RW_TASKS_PER_CONNECTION
#define FCOE_PARAMS_CQ_NUM_ENTRIES

#define FCOE_PARAMS_CMDQ_NUM_ENTRIES
#define SQ_NUM_ENTRIES

#define QEDF_FCOE_PARAMS_GL_RQ_PI
#define QEDF_FCOE_PARAMS_GL_CMD_PI

#define QEDF_READ
#define QEDF_WRITE
#define MAX_FIBRE_LUNS

#define MIN_NUM_CPUS_MSIX(x)

/*
 * PCI function probe defines
 */
/* Probe/remove called during normal PCI probe */
#define QEDF_MODE_NORMAL
/* Probe/remove called from qed error recovery */
#define QEDF_MODE_RECOVERY

#define SUPPORTED_25000baseKR_Full
#define SUPPORTED_50000baseKR2_Full
#define SUPPORTED_100000baseKR4_Full
#define SUPPORTED_100000baseCR4_Full

#endif