xref: /kernel/linux/linux-5.10/drivers/scsi/qedf/qedf.h (revision 8c2ecf20)
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  QLogic FCoE Offload Driver
48c2ecf20Sopenharmony_ci *  Copyright (c) 2016-2018 Cavium Inc.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef _QEDFC_H_
78c2ecf20Sopenharmony_ci#define _QEDFC_H_
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <scsi/libfcoe.h>
108c2ecf20Sopenharmony_ci#include <scsi/libfc.h>
118c2ecf20Sopenharmony_ci#include <scsi/fc/fc_fip.h>
128c2ecf20Sopenharmony_ci#include <scsi/fc/fc_fc2.h>
138c2ecf20Sopenharmony_ci#include <scsi/scsi_tcq.h>
148c2ecf20Sopenharmony_ci#include <scsi/fc_encode.h>
158c2ecf20Sopenharmony_ci#include <linux/version.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci/* qedf_hsi.h needs to before included any qed includes */
198c2ecf20Sopenharmony_ci#include "qedf_hsi.h"
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include <linux/qed/qed_if.h>
228c2ecf20Sopenharmony_ci#include <linux/qed/qed_fcoe_if.h>
238c2ecf20Sopenharmony_ci#include <linux/qed/qed_ll2_if.h>
248c2ecf20Sopenharmony_ci#include "qedf_version.h"
258c2ecf20Sopenharmony_ci#include "qedf_dbg.h"
268c2ecf20Sopenharmony_ci#include "drv_fcoe_fw_funcs.h"
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* Helpers to extract upper and lower 32-bits of pointer */
298c2ecf20Sopenharmony_ci#define U64_HI(val) ((u32)(((u64)(val)) >> 32))
308c2ecf20Sopenharmony_ci#define U64_LO(val) ((u32)(((u64)(val)) & 0xffffffff))
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define QEDF_DESCR "QLogic FCoE Offload Driver"
338c2ecf20Sopenharmony_ci#define QEDF_MODULE_NAME "qedf"
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define QEDF_FLOGI_RETRY_CNT	3
368c2ecf20Sopenharmony_ci#define QEDF_RPORT_RETRY_CNT	255
378c2ecf20Sopenharmony_ci#define QEDF_MAX_SESSIONS	1024
388c2ecf20Sopenharmony_ci#define QEDF_MAX_PAYLOAD	2048
398c2ecf20Sopenharmony_ci#define QEDF_MAX_BDS_PER_CMD	256
408c2ecf20Sopenharmony_ci#define QEDF_MAX_BD_LEN		0xffff
418c2ecf20Sopenharmony_ci#define QEDF_BD_SPLIT_SZ	0x1000
428c2ecf20Sopenharmony_ci#define QEDF_PAGE_SIZE		4096
438c2ecf20Sopenharmony_ci#define QED_HW_DMA_BOUNDARY     0xfff
448c2ecf20Sopenharmony_ci#define QEDF_MAX_SGLEN_FOR_CACHESGL		((1U << 16) - 1)
458c2ecf20Sopenharmony_ci#define QEDF_MFS		(QEDF_MAX_PAYLOAD + \
468c2ecf20Sopenharmony_ci	sizeof(struct fc_frame_header))
478c2ecf20Sopenharmony_ci#define QEDF_MAX_NPIV		64
488c2ecf20Sopenharmony_ci#define QEDF_TM_TIMEOUT		10
498c2ecf20Sopenharmony_ci#define QEDF_ABORT_TIMEOUT	(10 * 1000)
508c2ecf20Sopenharmony_ci#define QEDF_CLEANUP_TIMEOUT	1
518c2ecf20Sopenharmony_ci#define QEDF_MAX_CDB_LEN	16
528c2ecf20Sopenharmony_ci#define QEDF_LL2_BUF_SIZE	2500	/* Buffer size required for LL2 Rx */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define UPSTREAM_REMOVE		1
558c2ecf20Sopenharmony_ci#define UPSTREAM_KEEP		1
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_cistruct qedf_mp_req {
588c2ecf20Sopenharmony_ci	uint32_t req_len;
598c2ecf20Sopenharmony_ci	void *req_buf;
608c2ecf20Sopenharmony_ci	dma_addr_t req_buf_dma;
618c2ecf20Sopenharmony_ci	struct scsi_sge *mp_req_bd;
628c2ecf20Sopenharmony_ci	dma_addr_t mp_req_bd_dma;
638c2ecf20Sopenharmony_ci	struct fc_frame_header req_fc_hdr;
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	uint32_t resp_len;
668c2ecf20Sopenharmony_ci	void *resp_buf;
678c2ecf20Sopenharmony_ci	dma_addr_t resp_buf_dma;
688c2ecf20Sopenharmony_ci	struct scsi_sge *mp_resp_bd;
698c2ecf20Sopenharmony_ci	dma_addr_t mp_resp_bd_dma;
708c2ecf20Sopenharmony_ci	struct fc_frame_header resp_fc_hdr;
718c2ecf20Sopenharmony_ci};
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cistruct qedf_els_cb_arg {
748c2ecf20Sopenharmony_ci	struct qedf_ioreq *aborted_io_req;
758c2ecf20Sopenharmony_ci	struct qedf_ioreq *io_req;
768c2ecf20Sopenharmony_ci	u8 op; /* Used to keep track of ELS op */
778c2ecf20Sopenharmony_ci	uint16_t l2_oxid;
788c2ecf20Sopenharmony_ci	u32 offset; /* Used for sequence cleanup */
798c2ecf20Sopenharmony_ci	u8 r_ctl; /* Used for sequence cleanup */
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cienum qedf_ioreq_event {
838c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_NONE,
848c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_ABORT_SUCCESS,
858c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_ABORT_FAILED,
868c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_SEND_RRQ,
878c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_ELS_TMO,
888c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_ELS_ERR_DETECT,
898c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_ELS_FLUSH,
908c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_CLEANUP_SUCCESS,
918c2ecf20Sopenharmony_ci	QEDF_IOREQ_EV_CLEANUP_FAILED,
928c2ecf20Sopenharmony_ci};
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define FC_GOOD		0
958c2ecf20Sopenharmony_ci#define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER	(0x1<<2)
968c2ecf20Sopenharmony_ci#define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER	(0x1<<3)
978c2ecf20Sopenharmony_ci#define CMD_SCSI_STATUS(Cmnd)			((Cmnd)->SCp.Status)
988c2ecf20Sopenharmony_ci#define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID	(0x1<<0)
998c2ecf20Sopenharmony_ci#define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID	(0x1<<1)
1008c2ecf20Sopenharmony_cistruct qedf_ioreq {
1018c2ecf20Sopenharmony_ci	struct list_head link;
1028c2ecf20Sopenharmony_ci	uint16_t xid;
1038c2ecf20Sopenharmony_ci	struct scsi_cmnd *sc_cmd;
1048c2ecf20Sopenharmony_ci#define QEDF_SCSI_CMD		1
1058c2ecf20Sopenharmony_ci#define QEDF_TASK_MGMT_CMD	2
1068c2ecf20Sopenharmony_ci#define QEDF_ABTS		3
1078c2ecf20Sopenharmony_ci#define QEDF_ELS		4
1088c2ecf20Sopenharmony_ci#define QEDF_CLEANUP		5
1098c2ecf20Sopenharmony_ci#define QEDF_SEQ_CLEANUP	6
1108c2ecf20Sopenharmony_ci	u8 cmd_type;
1118c2ecf20Sopenharmony_ci#define QEDF_CMD_OUTSTANDING		0x0
1128c2ecf20Sopenharmony_ci#define QEDF_CMD_IN_ABORT		0x1
1138c2ecf20Sopenharmony_ci#define QEDF_CMD_IN_CLEANUP		0x2
1148c2ecf20Sopenharmony_ci#define QEDF_CMD_SRR_SENT		0x3
1158c2ecf20Sopenharmony_ci#define QEDF_CMD_DIRTY			0x4
1168c2ecf20Sopenharmony_ci#define QEDF_CMD_ERR_SCSI_DONE		0x5
1178c2ecf20Sopenharmony_ci	u8 io_req_flags;
1188c2ecf20Sopenharmony_ci	uint8_t tm_flags;
1198c2ecf20Sopenharmony_ci	struct qedf_rport *fcport;
1208c2ecf20Sopenharmony_ci#define	QEDF_CMD_ST_INACTIVE		0
1218c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_IO_ACTIVE		1
1228c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_ABORT_ACTIVE	2
1238c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_ABORT_ACTIVE_EH	3
1248c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_CLEANUP_ACTIVE	4
1258c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_CLEANUP_ACTIVE_EH	5
1268c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_RRQ_ACTIVE		6
1278c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_RRQ_WAIT		7
1288c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_OXID_RETIRE_WAIT	8
1298c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_TMF_ACTIVE		9
1308c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_DRAIN_ACTIVE	10
1318c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_CLEANED		11
1328c2ecf20Sopenharmony_ci#define	QEDFC_CMD_ST_ELS_ACTIVE		12
1338c2ecf20Sopenharmony_ci	atomic_t state;
1348c2ecf20Sopenharmony_ci	unsigned long flags;
1358c2ecf20Sopenharmony_ci	enum qedf_ioreq_event event;
1368c2ecf20Sopenharmony_ci	size_t data_xfer_len;
1378c2ecf20Sopenharmony_ci	/* ID: 001: Alloc cmd (qedf_alloc_cmd) */
1388c2ecf20Sopenharmony_ci	/* ID: 002: Initiate ABTS (qedf_initiate_abts) */
1398c2ecf20Sopenharmony_ci	/* ID: 003: For RRQ (qedf_process_abts_compl) */
1408c2ecf20Sopenharmony_ci	struct kref refcount;
1418c2ecf20Sopenharmony_ci	struct qedf_cmd_mgr *cmd_mgr;
1428c2ecf20Sopenharmony_ci	struct io_bdt *bd_tbl;
1438c2ecf20Sopenharmony_ci	struct delayed_work timeout_work;
1448c2ecf20Sopenharmony_ci	struct completion tm_done;
1458c2ecf20Sopenharmony_ci	struct completion abts_done;
1468c2ecf20Sopenharmony_ci	struct completion cleanup_done;
1478c2ecf20Sopenharmony_ci	struct e4_fcoe_task_context *task;
1488c2ecf20Sopenharmony_ci	struct fcoe_task_params *task_params;
1498c2ecf20Sopenharmony_ci	struct scsi_sgl_task_params *sgl_task_params;
1508c2ecf20Sopenharmony_ci	int idx;
1518c2ecf20Sopenharmony_ci	int lun;
1528c2ecf20Sopenharmony_ci/*
1538c2ecf20Sopenharmony_ci * Need to allocate enough room for both sense data and FCP response data
1548c2ecf20Sopenharmony_ci * which has a max length of 8 bytes according to spec.
1558c2ecf20Sopenharmony_ci */
1568c2ecf20Sopenharmony_ci#define QEDF_SCSI_SENSE_BUFFERSIZE	(SCSI_SENSE_BUFFERSIZE + 8)
1578c2ecf20Sopenharmony_ci	uint8_t *sense_buffer;
1588c2ecf20Sopenharmony_ci	dma_addr_t sense_buffer_dma;
1598c2ecf20Sopenharmony_ci	u32 fcp_resid;
1608c2ecf20Sopenharmony_ci	u32 fcp_rsp_len;
1618c2ecf20Sopenharmony_ci	u32 fcp_sns_len;
1628c2ecf20Sopenharmony_ci	u8 cdb_status;
1638c2ecf20Sopenharmony_ci	u8 fcp_status;
1648c2ecf20Sopenharmony_ci	u8 fcp_rsp_code;
1658c2ecf20Sopenharmony_ci	u8 scsi_comp_flags;
1668c2ecf20Sopenharmony_ci#define QEDF_MAX_REUSE		0xfff
1678c2ecf20Sopenharmony_ci	u16 reuse_count;
1688c2ecf20Sopenharmony_ci	struct qedf_mp_req mp_req;
1698c2ecf20Sopenharmony_ci	void (*cb_func)(struct qedf_els_cb_arg *cb_arg);
1708c2ecf20Sopenharmony_ci	struct qedf_els_cb_arg *cb_arg;
1718c2ecf20Sopenharmony_ci	int fp_idx;
1728c2ecf20Sopenharmony_ci	unsigned int cpu;
1738c2ecf20Sopenharmony_ci	unsigned int int_cpu;
1748c2ecf20Sopenharmony_ci#define QEDF_IOREQ_UNKNOWN_SGE		1
1758c2ecf20Sopenharmony_ci#define QEDF_IOREQ_SLOW_SGE		2
1768c2ecf20Sopenharmony_ci#define QEDF_IOREQ_FAST_SGE		3
1778c2ecf20Sopenharmony_ci	u8 sge_type;
1788c2ecf20Sopenharmony_ci	struct delayed_work rrq_work;
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci	/* Used for sequence level recovery; i.e. REC/SRR */
1818c2ecf20Sopenharmony_ci	uint32_t rx_buf_off;
1828c2ecf20Sopenharmony_ci	uint32_t tx_buf_off;
1838c2ecf20Sopenharmony_ci	uint32_t rx_id;
1848c2ecf20Sopenharmony_ci	uint32_t task_retry_identifier;
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci	/*
1878c2ecf20Sopenharmony_ci	 * Used to tell if we need to return a SCSI command
1888c2ecf20Sopenharmony_ci	 * during some form of error processing.
1898c2ecf20Sopenharmony_ci	 */
1908c2ecf20Sopenharmony_ci	bool return_scsi_cmd_on_abts;
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci	unsigned int alloc;
1938c2ecf20Sopenharmony_ci};
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ciextern struct workqueue_struct *qedf_io_wq;
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_cistruct qedf_rport {
1988c2ecf20Sopenharmony_ci	spinlock_t rport_lock;
1998c2ecf20Sopenharmony_ci#define QEDF_RPORT_SESSION_READY 1
2008c2ecf20Sopenharmony_ci#define QEDF_RPORT_UPLOADING_CONNECTION	2
2018c2ecf20Sopenharmony_ci#define QEDF_RPORT_IN_RESET 3
2028c2ecf20Sopenharmony_ci#define QEDF_RPORT_IN_LUN_RESET 4
2038c2ecf20Sopenharmony_ci#define QEDF_RPORT_IN_TARGET_RESET 5
2048c2ecf20Sopenharmony_ci	unsigned long flags;
2058c2ecf20Sopenharmony_ci	int lun_reset_lun;
2068c2ecf20Sopenharmony_ci	unsigned long retry_delay_timestamp;
2078c2ecf20Sopenharmony_ci	struct fc_rport *rport;
2088c2ecf20Sopenharmony_ci	struct fc_rport_priv *rdata;
2098c2ecf20Sopenharmony_ci	struct qedf_ctx *qedf;
2108c2ecf20Sopenharmony_ci	u32 handle; /* Handle from qed */
2118c2ecf20Sopenharmony_ci	u32 fw_cid; /* fw_cid from qed */
2128c2ecf20Sopenharmony_ci	void __iomem *p_doorbell;
2138c2ecf20Sopenharmony_ci	/* Send queue management */
2148c2ecf20Sopenharmony_ci	atomic_t free_sqes;
2158c2ecf20Sopenharmony_ci	atomic_t ios_to_queue;
2168c2ecf20Sopenharmony_ci	atomic_t num_active_ios;
2178c2ecf20Sopenharmony_ci	struct fcoe_wqe *sq;
2188c2ecf20Sopenharmony_ci	dma_addr_t sq_dma;
2198c2ecf20Sopenharmony_ci	u16 sq_prod_idx;
2208c2ecf20Sopenharmony_ci	u16 fw_sq_prod_idx;
2218c2ecf20Sopenharmony_ci	u16 sq_con_idx;
2228c2ecf20Sopenharmony_ci	u32 sq_mem_size;
2238c2ecf20Sopenharmony_ci	void *sq_pbl;
2248c2ecf20Sopenharmony_ci	dma_addr_t sq_pbl_dma;
2258c2ecf20Sopenharmony_ci	u32 sq_pbl_size;
2268c2ecf20Sopenharmony_ci	u32 sid;
2278c2ecf20Sopenharmony_ci#define	QEDF_RPORT_TYPE_DISK		0
2288c2ecf20Sopenharmony_ci#define	QEDF_RPORT_TYPE_TAPE		1
2298c2ecf20Sopenharmony_ci	uint dev_type; /* Disk or tape */
2308c2ecf20Sopenharmony_ci	struct list_head peers;
2318c2ecf20Sopenharmony_ci};
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci/* Used to contain LL2 skb's in ll2_skb_list */
2348c2ecf20Sopenharmony_cistruct qedf_skb_work {
2358c2ecf20Sopenharmony_ci	struct work_struct work;
2368c2ecf20Sopenharmony_ci	struct sk_buff *skb;
2378c2ecf20Sopenharmony_ci	struct qedf_ctx *qedf;
2388c2ecf20Sopenharmony_ci};
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_cistruct qedf_fastpath {
2418c2ecf20Sopenharmony_ci#define	QEDF_SB_ID_NULL		0xffff
2428c2ecf20Sopenharmony_ci	u16		sb_id;
2438c2ecf20Sopenharmony_ci	struct qed_sb_info	*sb_info;
2448c2ecf20Sopenharmony_ci	struct qedf_ctx *qedf;
2458c2ecf20Sopenharmony_ci	/* Keep track of number of completions on this fastpath */
2468c2ecf20Sopenharmony_ci	unsigned long completions;
2478c2ecf20Sopenharmony_ci	uint32_t cq_num_entries;
2488c2ecf20Sopenharmony_ci};
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci/* Used to pass fastpath information needed to process CQEs */
2518c2ecf20Sopenharmony_cistruct qedf_io_work {
2528c2ecf20Sopenharmony_ci	struct work_struct work;
2538c2ecf20Sopenharmony_ci	struct fcoe_cqe cqe;
2548c2ecf20Sopenharmony_ci	struct qedf_ctx *qedf;
2558c2ecf20Sopenharmony_ci	struct fc_frame *fp;
2568c2ecf20Sopenharmony_ci};
2578c2ecf20Sopenharmony_ci
2588c2ecf20Sopenharmony_cistruct qedf_glbl_q_params {
2598c2ecf20Sopenharmony_ci	u64	hw_p_cq;	/* Completion queue PBL */
2608c2ecf20Sopenharmony_ci	u64	hw_p_rq;	/* Request queue PBL */
2618c2ecf20Sopenharmony_ci	u64	hw_p_cmdq;	/* Command queue PBL */
2628c2ecf20Sopenharmony_ci};
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_cistruct global_queue {
2658c2ecf20Sopenharmony_ci	struct fcoe_cqe *cq;
2668c2ecf20Sopenharmony_ci	dma_addr_t cq_dma;
2678c2ecf20Sopenharmony_ci	u32 cq_mem_size;
2688c2ecf20Sopenharmony_ci	u32 cq_cons_idx; /* Completion queue consumer index */
2698c2ecf20Sopenharmony_ci	u32 cq_prod_idx;
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	void *cq_pbl;
2728c2ecf20Sopenharmony_ci	dma_addr_t cq_pbl_dma;
2738c2ecf20Sopenharmony_ci	u32 cq_pbl_size;
2748c2ecf20Sopenharmony_ci};
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci/* I/O tracing entry */
2778c2ecf20Sopenharmony_ci#define QEDF_IO_TRACE_SIZE		2048
2788c2ecf20Sopenharmony_cistruct qedf_io_log {
2798c2ecf20Sopenharmony_ci#define QEDF_IO_TRACE_REQ		0
2808c2ecf20Sopenharmony_ci#define QEDF_IO_TRACE_RSP		1
2818c2ecf20Sopenharmony_ci	uint8_t direction;
2828c2ecf20Sopenharmony_ci	uint16_t task_id;
2838c2ecf20Sopenharmony_ci	uint32_t port_id; /* Remote port fabric ID */
2848c2ecf20Sopenharmony_ci	int lun;
2858c2ecf20Sopenharmony_ci	unsigned char op; /* SCSI CDB */
2868c2ecf20Sopenharmony_ci	uint8_t lba[4];
2878c2ecf20Sopenharmony_ci	unsigned int bufflen; /* SCSI buffer length */
2888c2ecf20Sopenharmony_ci	unsigned int sg_count; /* Number of SG elements */
2898c2ecf20Sopenharmony_ci	int result; /* Result passed back to mid-layer */
2908c2ecf20Sopenharmony_ci	unsigned long jiffies; /* Time stamp when I/O logged */
2918c2ecf20Sopenharmony_ci	int refcount; /* Reference count for task id */
2928c2ecf20Sopenharmony_ci	unsigned int req_cpu; /* CPU that the task is queued on */
2938c2ecf20Sopenharmony_ci	unsigned int int_cpu; /* Interrupt CPU that the task is received on */
2948c2ecf20Sopenharmony_ci	unsigned int rsp_cpu; /* CPU that task is returned on */
2958c2ecf20Sopenharmony_ci	u8 sge_type; /* Did we take the slow, single or fast SGE path */
2968c2ecf20Sopenharmony_ci};
2978c2ecf20Sopenharmony_ci
2988c2ecf20Sopenharmony_ci/* Number of entries in BDQ */
2998c2ecf20Sopenharmony_ci#define QEDF_BDQ_SIZE			256
3008c2ecf20Sopenharmony_ci#define QEDF_BDQ_BUF_SIZE		2072
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci/* DMA coherent buffers for BDQ */
3038c2ecf20Sopenharmony_cistruct qedf_bdq_buf {
3048c2ecf20Sopenharmony_ci	void *buf_addr;
3058c2ecf20Sopenharmony_ci	dma_addr_t buf_dma;
3068c2ecf20Sopenharmony_ci};
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci/* Main adapter struct */
3098c2ecf20Sopenharmony_cistruct qedf_ctx {
3108c2ecf20Sopenharmony_ci	struct qedf_dbg_ctx dbg_ctx;
3118c2ecf20Sopenharmony_ci	struct fcoe_ctlr ctlr;
3128c2ecf20Sopenharmony_ci	struct fc_lport *lport;
3138c2ecf20Sopenharmony_ci	u8 data_src_addr[ETH_ALEN];
3148c2ecf20Sopenharmony_ci#define QEDF_LINK_DOWN		0
3158c2ecf20Sopenharmony_ci#define QEDF_LINK_UP		1
3168c2ecf20Sopenharmony_ci	atomic_t link_state;
3178c2ecf20Sopenharmony_ci#define QEDF_DCBX_PENDING	0
3188c2ecf20Sopenharmony_ci#define QEDF_DCBX_DONE		1
3198c2ecf20Sopenharmony_ci	atomic_t dcbx;
3208c2ecf20Sopenharmony_ci#define QEDF_NULL_VLAN_ID	-1
3218c2ecf20Sopenharmony_ci#define QEDF_FALLBACK_VLAN	1002
3228c2ecf20Sopenharmony_ci#define QEDF_DEFAULT_PRIO	3
3238c2ecf20Sopenharmony_ci	int vlan_id;
3248c2ecf20Sopenharmony_ci	u8 prio;
3258c2ecf20Sopenharmony_ci	struct qed_dev *cdev;
3268c2ecf20Sopenharmony_ci	struct qed_dev_fcoe_info dev_info;
3278c2ecf20Sopenharmony_ci	struct qed_int_info int_info;
3288c2ecf20Sopenharmony_ci	uint16_t last_command;
3298c2ecf20Sopenharmony_ci	spinlock_t hba_lock;
3308c2ecf20Sopenharmony_ci	struct pci_dev *pdev;
3318c2ecf20Sopenharmony_ci	u64 wwnn;
3328c2ecf20Sopenharmony_ci	u64 wwpn;
3338c2ecf20Sopenharmony_ci	u8 __aligned(16) mac[ETH_ALEN];
3348c2ecf20Sopenharmony_ci	struct list_head fcports;
3358c2ecf20Sopenharmony_ci	atomic_t num_offloads;
3368c2ecf20Sopenharmony_ci	unsigned int curr_conn_id;
3378c2ecf20Sopenharmony_ci	struct workqueue_struct *ll2_recv_wq;
3388c2ecf20Sopenharmony_ci	struct workqueue_struct *link_update_wq;
3398c2ecf20Sopenharmony_ci	struct delayed_work link_update;
3408c2ecf20Sopenharmony_ci	struct delayed_work link_recovery;
3418c2ecf20Sopenharmony_ci	struct completion flogi_compl;
3428c2ecf20Sopenharmony_ci	struct completion fipvlan_compl;
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci	/*
3458c2ecf20Sopenharmony_ci	 * Used to tell if we're in the window where we are waiting for
3468c2ecf20Sopenharmony_ci	 * the link to come back up before informting fcoe that the link is
3478c2ecf20Sopenharmony_ci	 * done.
3488c2ecf20Sopenharmony_ci	 */
3498c2ecf20Sopenharmony_ci	atomic_t link_down_tmo_valid;
3508c2ecf20Sopenharmony_ci#define QEDF_TIMER_INTERVAL		(1 * HZ)
3518c2ecf20Sopenharmony_ci	struct timer_list timer; /* One second book keeping timer */
3528c2ecf20Sopenharmony_ci#define QEDF_DRAIN_ACTIVE		1
3538c2ecf20Sopenharmony_ci#define QEDF_LL2_STARTED		2
3548c2ecf20Sopenharmony_ci#define QEDF_UNLOADING			3
3558c2ecf20Sopenharmony_ci#define QEDF_GRCDUMP_CAPTURE		4
3568c2ecf20Sopenharmony_ci#define QEDF_IN_RECOVERY		5
3578c2ecf20Sopenharmony_ci#define QEDF_DBG_STOP_IO		6
3588c2ecf20Sopenharmony_ci#define QEDF_PROBING			8
3598c2ecf20Sopenharmony_ci	unsigned long flags; /* Miscellaneous state flags */
3608c2ecf20Sopenharmony_ci	int fipvlan_retries;
3618c2ecf20Sopenharmony_ci	u8 num_queues;
3628c2ecf20Sopenharmony_ci	struct global_queue **global_queues;
3638c2ecf20Sopenharmony_ci	/* Pointer to array of queue structures */
3648c2ecf20Sopenharmony_ci	struct qedf_glbl_q_params *p_cpuq;
3658c2ecf20Sopenharmony_ci	/* Physical address of array of queue structures */
3668c2ecf20Sopenharmony_ci	dma_addr_t hw_p_cpuq;
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci	struct qedf_bdq_buf bdq[QEDF_BDQ_SIZE];
3698c2ecf20Sopenharmony_ci	void *bdq_pbl;
3708c2ecf20Sopenharmony_ci	dma_addr_t bdq_pbl_dma;
3718c2ecf20Sopenharmony_ci	size_t bdq_pbl_mem_size;
3728c2ecf20Sopenharmony_ci	void *bdq_pbl_list;
3738c2ecf20Sopenharmony_ci	dma_addr_t bdq_pbl_list_dma;
3748c2ecf20Sopenharmony_ci	u8 bdq_pbl_list_num_entries;
3758c2ecf20Sopenharmony_ci	void __iomem *bdq_primary_prod;
3768c2ecf20Sopenharmony_ci	void __iomem *bdq_secondary_prod;
3778c2ecf20Sopenharmony_ci	uint16_t bdq_prod_idx;
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci	/* Structure for holding all the fastpath for this qedf_ctx */
3808c2ecf20Sopenharmony_ci	struct qedf_fastpath *fp_array;
3818c2ecf20Sopenharmony_ci	struct qed_fcoe_tid tasks;
3828c2ecf20Sopenharmony_ci	struct qedf_cmd_mgr *cmd_mgr;
3838c2ecf20Sopenharmony_ci	/* Holds the PF parameters we pass to qed to start he FCoE function */
3848c2ecf20Sopenharmony_ci	struct qed_pf_params pf_params;
3858c2ecf20Sopenharmony_ci	/* Used to time middle path ELS and TM commands */
3868c2ecf20Sopenharmony_ci	struct workqueue_struct *timer_work_queue;
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci#define QEDF_IO_WORK_MIN		64
3898c2ecf20Sopenharmony_ci	mempool_t *io_mempool;
3908c2ecf20Sopenharmony_ci	struct workqueue_struct *dpc_wq;
3918c2ecf20Sopenharmony_ci	struct delayed_work recovery_work;
3928c2ecf20Sopenharmony_ci	struct delayed_work board_disable_work;
3938c2ecf20Sopenharmony_ci	struct delayed_work grcdump_work;
3948c2ecf20Sopenharmony_ci	struct delayed_work stag_work;
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ci	u32 slow_sge_ios;
3978c2ecf20Sopenharmony_ci	u32 fast_sge_ios;
3988c2ecf20Sopenharmony_ci
3998c2ecf20Sopenharmony_ci	uint8_t	*grcdump;
4008c2ecf20Sopenharmony_ci	uint32_t grcdump_size;
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci	struct qedf_io_log io_trace_buf[QEDF_IO_TRACE_SIZE];
4038c2ecf20Sopenharmony_ci	spinlock_t io_trace_lock;
4048c2ecf20Sopenharmony_ci	uint16_t io_trace_idx;
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci	bool stop_io_on_error;
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_ci	u32 flogi_cnt;
4098c2ecf20Sopenharmony_ci	u32 flogi_failed;
4108c2ecf20Sopenharmony_ci	u32 flogi_pending;
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci	/* Used for fc statistics */
4138c2ecf20Sopenharmony_ci	struct mutex stats_mutex;
4148c2ecf20Sopenharmony_ci	u64 input_requests;
4158c2ecf20Sopenharmony_ci	u64 output_requests;
4168c2ecf20Sopenharmony_ci	u64 control_requests;
4178c2ecf20Sopenharmony_ci	u64 packet_aborts;
4188c2ecf20Sopenharmony_ci	u64 alloc_failures;
4198c2ecf20Sopenharmony_ci	u8 lun_resets;
4208c2ecf20Sopenharmony_ci	u8 target_resets;
4218c2ecf20Sopenharmony_ci	u8 task_set_fulls;
4228c2ecf20Sopenharmony_ci	u8 busy;
4238c2ecf20Sopenharmony_ci	/* Used for flush routine */
4248c2ecf20Sopenharmony_ci	struct mutex flush_mutex;
4258c2ecf20Sopenharmony_ci};
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_cistruct io_bdt {
4288c2ecf20Sopenharmony_ci	struct qedf_ioreq *io_req;
4298c2ecf20Sopenharmony_ci	struct scsi_sge *bd_tbl;
4308c2ecf20Sopenharmony_ci	dma_addr_t bd_tbl_dma;
4318c2ecf20Sopenharmony_ci	u16 bd_valid;
4328c2ecf20Sopenharmony_ci};
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_cistruct qedf_cmd_mgr {
4358c2ecf20Sopenharmony_ci	struct qedf_ctx *qedf;
4368c2ecf20Sopenharmony_ci	u16 idx;
4378c2ecf20Sopenharmony_ci	struct io_bdt **io_bdt_pool;
4388c2ecf20Sopenharmony_ci#define FCOE_PARAMS_NUM_TASKS		2048
4398c2ecf20Sopenharmony_ci	struct qedf_ioreq cmds[FCOE_PARAMS_NUM_TASKS];
4408c2ecf20Sopenharmony_ci	spinlock_t lock;
4418c2ecf20Sopenharmony_ci	atomic_t free_list_cnt;
4428c2ecf20Sopenharmony_ci};
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci/* Stolen from qed_cxt_api.h and adapted for qed_fcoe_info
4458c2ecf20Sopenharmony_ci * Usage:
4468c2ecf20Sopenharmony_ci *
4478c2ecf20Sopenharmony_ci * void *ptr;
4488c2ecf20Sopenharmony_ci * ptr = qedf_get_task_mem(&qedf->tasks, 128);
4498c2ecf20Sopenharmony_ci */
4508c2ecf20Sopenharmony_cistatic inline void *qedf_get_task_mem(struct qed_fcoe_tid *info, u32 tid)
4518c2ecf20Sopenharmony_ci{
4528c2ecf20Sopenharmony_ci	return (void *)(info->blocks[tid / info->num_tids_per_block] +
4538c2ecf20Sopenharmony_ci			(tid % info->num_tids_per_block) * info->size);
4548c2ecf20Sopenharmony_ci}
4558c2ecf20Sopenharmony_ci
4568c2ecf20Sopenharmony_cistatic inline void qedf_stop_all_io(struct qedf_ctx *qedf)
4578c2ecf20Sopenharmony_ci{
4588c2ecf20Sopenharmony_ci	set_bit(QEDF_DBG_STOP_IO, &qedf->flags);
4598c2ecf20Sopenharmony_ci}
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci/*
4628c2ecf20Sopenharmony_ci * Externs
4638c2ecf20Sopenharmony_ci */
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci/*
4668c2ecf20Sopenharmony_ci * (QEDF_LOG_NPIV | QEDF_LOG_SESS | QEDF_LOG_LPORT | QEDF_LOG_ELS | QEDF_LOG_MQ
4678c2ecf20Sopenharmony_ci * | QEDF_LOG_IO | QEDF_LOG_UNSOL | QEDF_LOG_SCSI_TM | QEDF_LOG_MP_REQ |
4688c2ecf20Sopenharmony_ci * QEDF_LOG_EVT | QEDF_LOG_CONN | QEDF_LOG_DISC | QEDF_LOG_INFO)
4698c2ecf20Sopenharmony_ci */
4708c2ecf20Sopenharmony_ci#define QEDF_DEFAULT_LOG_MASK		0x3CFB6
4718c2ecf20Sopenharmony_ciextern const struct qed_fcoe_ops *qed_ops;
4728c2ecf20Sopenharmony_ciextern uint qedf_dump_frames;
4738c2ecf20Sopenharmony_ciextern uint qedf_io_tracing;
4748c2ecf20Sopenharmony_ciextern uint qedf_stop_io_on_error;
4758c2ecf20Sopenharmony_ciextern uint qedf_link_down_tmo;
4768c2ecf20Sopenharmony_ci#define QEDF_RETRY_DELAY_MAX		600 /* 60 seconds */
4778c2ecf20Sopenharmony_ciextern bool qedf_retry_delay;
4788c2ecf20Sopenharmony_ciextern uint qedf_debug;
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ciextern struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf);
4818c2ecf20Sopenharmony_ciextern void qedf_cmd_mgr_free(struct qedf_cmd_mgr *cmgr);
4828c2ecf20Sopenharmony_ciextern int qedf_queuecommand(struct Scsi_Host *host,
4838c2ecf20Sopenharmony_ci	struct scsi_cmnd *sc_cmd);
4848c2ecf20Sopenharmony_ciextern void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb);
4858c2ecf20Sopenharmony_ciextern u8 *qedf_get_src_mac(struct fc_lport *lport);
4868c2ecf20Sopenharmony_ciextern void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb);
4878c2ecf20Sopenharmony_ciextern void qedf_fcoe_send_vlan_req(struct qedf_ctx *qedf);
4888c2ecf20Sopenharmony_ciextern void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
4898c2ecf20Sopenharmony_ci	struct qedf_ioreq *io_req);
4908c2ecf20Sopenharmony_ciextern void qedf_process_warning_compl(struct qedf_ctx *qedf,
4918c2ecf20Sopenharmony_ci	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
4928c2ecf20Sopenharmony_ciextern void qedf_process_error_detect(struct qedf_ctx *qedf,
4938c2ecf20Sopenharmony_ci	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
4948c2ecf20Sopenharmony_ciextern void qedf_flush_active_ios(struct qedf_rport *fcport, int lun);
4958c2ecf20Sopenharmony_ciextern void qedf_release_cmd(struct kref *ref);
4968c2ecf20Sopenharmony_ciextern int qedf_initiate_abts(struct qedf_ioreq *io_req,
4978c2ecf20Sopenharmony_ci	bool return_scsi_cmd_on_abts);
4988c2ecf20Sopenharmony_ciextern void qedf_process_abts_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
4998c2ecf20Sopenharmony_ci	struct qedf_ioreq *io_req);
5008c2ecf20Sopenharmony_ciextern struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport,
5018c2ecf20Sopenharmony_ci	u8 cmd_type);
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ciextern struct device_attribute *qedf_host_attrs[];
5048c2ecf20Sopenharmony_ciextern void qedf_cmd_timer_set(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
5058c2ecf20Sopenharmony_ci	unsigned int timer_msec);
5068c2ecf20Sopenharmony_ciextern int qedf_init_mp_req(struct qedf_ioreq *io_req);
5078c2ecf20Sopenharmony_ciextern void qedf_init_mp_task(struct qedf_ioreq *io_req,
5088c2ecf20Sopenharmony_ci	struct e4_fcoe_task_context *task_ctx, struct fcoe_wqe *sqe);
5098c2ecf20Sopenharmony_ciextern u16 qedf_get_sqe_idx(struct qedf_rport *fcport);
5108c2ecf20Sopenharmony_ciextern void qedf_ring_doorbell(struct qedf_rport *fcport);
5118c2ecf20Sopenharmony_ciextern void qedf_process_els_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
5128c2ecf20Sopenharmony_ci	struct qedf_ioreq *els_req);
5138c2ecf20Sopenharmony_ciextern int qedf_send_rrq(struct qedf_ioreq *aborted_io_req);
5148c2ecf20Sopenharmony_ciextern int qedf_send_adisc(struct qedf_rport *fcport, struct fc_frame *fp);
5158c2ecf20Sopenharmony_ciextern int qedf_initiate_cleanup(struct qedf_ioreq *io_req,
5168c2ecf20Sopenharmony_ci	bool return_scsi_cmd_on_abts);
5178c2ecf20Sopenharmony_ciextern void qedf_process_cleanup_compl(struct qedf_ctx *qedf,
5188c2ecf20Sopenharmony_ci	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
5198c2ecf20Sopenharmony_ciextern int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags);
5208c2ecf20Sopenharmony_ciextern void qedf_process_tmf_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
5218c2ecf20Sopenharmony_ci	struct qedf_ioreq *io_req);
5228c2ecf20Sopenharmony_ciextern void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe);
5238c2ecf20Sopenharmony_ciextern void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
5248c2ecf20Sopenharmony_ci	int result);
5258c2ecf20Sopenharmony_ciextern void qedf_set_vlan_id(struct qedf_ctx *qedf, int vlan_id);
5268c2ecf20Sopenharmony_ciextern void qedf_create_sysfs_ctx_attr(struct qedf_ctx *qedf);
5278c2ecf20Sopenharmony_ciextern void qedf_remove_sysfs_ctx_attr(struct qedf_ctx *qedf);
5288c2ecf20Sopenharmony_ciextern void qedf_capture_grc_dump(struct qedf_ctx *qedf);
5298c2ecf20Sopenharmony_cibool qedf_wait_for_upload(struct qedf_ctx *qedf);
5308c2ecf20Sopenharmony_ciextern void qedf_process_unsol_compl(struct qedf_ctx *qedf, uint16_t que_idx,
5318c2ecf20Sopenharmony_ci	struct fcoe_cqe *cqe);
5328c2ecf20Sopenharmony_ciextern void qedf_restart_rport(struct qedf_rport *fcport);
5338c2ecf20Sopenharmony_ciextern int qedf_send_rec(struct qedf_ioreq *orig_io_req);
5348c2ecf20Sopenharmony_ciextern int qedf_post_io_req(struct qedf_rport *fcport,
5358c2ecf20Sopenharmony_ci	struct qedf_ioreq *io_req);
5368c2ecf20Sopenharmony_ciextern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf,
5378c2ecf20Sopenharmony_ci	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
5388c2ecf20Sopenharmony_ciextern int qedf_send_flogi(struct qedf_ctx *qedf);
5398c2ecf20Sopenharmony_ciextern void qedf_get_protocol_tlv_data(void *dev, void *data);
5408c2ecf20Sopenharmony_ciextern void qedf_fp_io_handler(struct work_struct *work);
5418c2ecf20Sopenharmony_ciextern void qedf_get_generic_tlv_data(void *dev, struct qed_generic_tlvs *data);
5428c2ecf20Sopenharmony_ciextern void qedf_wq_grcdump(struct work_struct *work);
5438c2ecf20Sopenharmony_civoid qedf_stag_change_work(struct work_struct *work);
5448c2ecf20Sopenharmony_civoid qedf_ctx_soft_reset(struct fc_lport *lport);
5458c2ecf20Sopenharmony_ciextern void qedf_board_disable_work(struct work_struct *work);
5468c2ecf20Sopenharmony_ciextern void qedf_schedule_hw_err_handler(void *dev,
5478c2ecf20Sopenharmony_ci		enum qed_hw_err_type err_type);
5488c2ecf20Sopenharmony_ci
5498c2ecf20Sopenharmony_ci#define FCOE_WORD_TO_BYTE  4
5508c2ecf20Sopenharmony_ci#define QEDF_MAX_TASK_NUM	0xFFFF
5518c2ecf20Sopenharmony_ci#define QL45xxx			0x165C
5528c2ecf20Sopenharmony_ci#define QL41xxx			0x8080
5538c2ecf20Sopenharmony_ci#define MAX_CT_PAYLOAD		2048
5548c2ecf20Sopenharmony_ci#define DISCOVERED_PORTS	4
5558c2ecf20Sopenharmony_ci#define NUMBER_OF_PORTS		1
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_cistruct fip_vlan {
5588c2ecf20Sopenharmony_ci	struct ethhdr eth;
5598c2ecf20Sopenharmony_ci	struct fip_header fip;
5608c2ecf20Sopenharmony_ci	struct {
5618c2ecf20Sopenharmony_ci		struct fip_mac_desc mac;
5628c2ecf20Sopenharmony_ci		struct fip_wwn_desc wwnn;
5638c2ecf20Sopenharmony_ci	} desc;
5648c2ecf20Sopenharmony_ci};
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci/* SQ/CQ Sizes */
5678c2ecf20Sopenharmony_ci#define GBL_RSVD_TASKS			16
5688c2ecf20Sopenharmony_ci#define NUM_TASKS_PER_CONNECTION	1024
5698c2ecf20Sopenharmony_ci#define NUM_RW_TASKS_PER_CONNECTION	512
5708c2ecf20Sopenharmony_ci#define FCOE_PARAMS_CQ_NUM_ENTRIES	FCOE_PARAMS_NUM_TASKS
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci#define FCOE_PARAMS_CMDQ_NUM_ENTRIES	FCOE_PARAMS_NUM_TASKS
5738c2ecf20Sopenharmony_ci#define SQ_NUM_ENTRIES			NUM_TASKS_PER_CONNECTION
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ci#define QEDF_FCOE_PARAMS_GL_RQ_PI              0
5768c2ecf20Sopenharmony_ci#define QEDF_FCOE_PARAMS_GL_CMD_PI             1
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci#define QEDF_READ                     (1 << 1)
5798c2ecf20Sopenharmony_ci#define QEDF_WRITE                    (1 << 0)
5808c2ecf20Sopenharmony_ci#define MAX_FIBRE_LUNS			0xffffffff
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ci#define MIN_NUM_CPUS_MSIX(x)	min_t(u32, x->dev_info.num_cqs, \
5838c2ecf20Sopenharmony_ci					num_online_cpus())
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci/*
5868c2ecf20Sopenharmony_ci * PCI function probe defines
5878c2ecf20Sopenharmony_ci */
5888c2ecf20Sopenharmony_ci/* Probe/remove called during normal PCI probe */
5898c2ecf20Sopenharmony_ci#define	QEDF_MODE_NORMAL		0
5908c2ecf20Sopenharmony_ci/* Probe/remove called from qed error recovery */
5918c2ecf20Sopenharmony_ci#define QEDF_MODE_RECOVERY		1
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci#define SUPPORTED_25000baseKR_Full    (1<<27)
5948c2ecf20Sopenharmony_ci#define SUPPORTED_50000baseKR2_Full   (1<<28)
5958c2ecf20Sopenharmony_ci#define SUPPORTED_100000baseKR4_Full  (1<<29)
5968c2ecf20Sopenharmony_ci#define SUPPORTED_100000baseCR4_Full  (1<<30)
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ci#endif
599