xref: /openbmc/linux/drivers/scsi/qedf/qedf.h (revision b737eecd)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  QLogic FCoE Offload Driver
4  *  Copyright (c) 2016-2018 Cavium Inc.
5  */
6 #ifndef _QEDFC_H_
7 #define _QEDFC_H_
8 
9 #include <scsi/libfcoe.h>
10 #include <scsi/libfc.h>
11 #include <scsi/fc/fc_fip.h>
12 #include <scsi/fc/fc_fc2.h>
13 #include <scsi/scsi_tcq.h>
14 #include <linux/version.h>
15 
16 
17 /* qedf_hsi.h needs to before included any qed includes */
18 #include "qedf_hsi.h"
19 
20 #include <linux/qed/qed_if.h>
21 #include <linux/qed/qed_fcoe_if.h>
22 #include <linux/qed/qed_ll2_if.h>
23 #include "qedf_version.h"
24 #include "qedf_dbg.h"
25 #include "drv_fcoe_fw_funcs.h"
26 
27 /* Helpers to extract upper and lower 32-bits of pointer */
28 #define U64_HI(val) ((u32)(((u64)(val)) >> 32))
29 #define U64_LO(val) ((u32)(((u64)(val)) & 0xffffffff))
30 
31 #define QEDF_DESCR "QLogic FCoE Offload Driver"
32 #define QEDF_MODULE_NAME "qedf"
33 
34 #define QEDF_FLOGI_RETRY_CNT	3
35 #define QEDF_RPORT_RETRY_CNT	255
36 #define QEDF_MAX_SESSIONS	1024
37 #define QEDF_MAX_PAYLOAD	2048
38 #define QEDF_MAX_BDS_PER_CMD	256
39 #define QEDF_MAX_BD_LEN		0xffff
40 #define QEDF_BD_SPLIT_SZ	0x1000
41 #define QEDF_PAGE_SIZE		4096
42 #define QED_HW_DMA_BOUNDARY     0xfff
43 #define QEDF_MAX_SGLEN_FOR_CACHESGL		((1U << 16) - 1)
44 #define QEDF_MFS		(QEDF_MAX_PAYLOAD + \
45 	sizeof(struct fc_frame_header))
46 #define QEDF_MAX_NPIV		64
47 #define QEDF_TM_TIMEOUT		10
48 #define QEDF_ABORT_TIMEOUT	(10 * 1000)
49 #define QEDF_CLEANUP_TIMEOUT	1
50 #define QEDF_MAX_CDB_LEN	16
51 #define QEDF_LL2_BUF_SIZE	2500	/* Buffer size required for LL2 Rx */
52 
53 #define UPSTREAM_REMOVE		1
54 #define UPSTREAM_KEEP		1
55 
56 struct qedf_mp_req {
57 	uint32_t req_len;
58 	void *req_buf;
59 	dma_addr_t req_buf_dma;
60 	struct scsi_sge *mp_req_bd;
61 	dma_addr_t mp_req_bd_dma;
62 	struct fc_frame_header req_fc_hdr;
63 
64 	uint32_t resp_len;
65 	void *resp_buf;
66 	dma_addr_t resp_buf_dma;
67 	struct scsi_sge *mp_resp_bd;
68 	dma_addr_t mp_resp_bd_dma;
69 	struct fc_frame_header resp_fc_hdr;
70 };
71 
72 struct qedf_els_cb_arg {
73 	struct qedf_ioreq *aborted_io_req;
74 	struct qedf_ioreq *io_req;
75 	u8 op; /* Used to keep track of ELS op */
76 	uint16_t l2_oxid;
77 	u32 offset; /* Used for sequence cleanup */
78 	u8 r_ctl; /* Used for sequence cleanup */
79 };
80 
81 enum qedf_ioreq_event {
82 	QEDF_IOREQ_EV_NONE,
83 	QEDF_IOREQ_EV_ABORT_SUCCESS,
84 	QEDF_IOREQ_EV_ABORT_FAILED,
85 	QEDF_IOREQ_EV_SEND_RRQ,
86 	QEDF_IOREQ_EV_ELS_TMO,
87 	QEDF_IOREQ_EV_ELS_ERR_DETECT,
88 	QEDF_IOREQ_EV_ELS_FLUSH,
89 	QEDF_IOREQ_EV_CLEANUP_SUCCESS,
90 	QEDF_IOREQ_EV_CLEANUP_FAILED,
91 };
92 
93 #define FC_GOOD		0
94 #define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER	(0x1<<2)
95 #define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER	(0x1<<3)
96 #define CMD_SCSI_STATUS(Cmnd)			((Cmnd)->SCp.Status)
97 #define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID	(0x1<<0)
98 #define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID	(0x1<<1)
99 struct qedf_ioreq {
100 	struct list_head link;
101 	uint16_t xid;
102 	struct scsi_cmnd *sc_cmd;
103 #define QEDF_SCSI_CMD		1
104 #define QEDF_TASK_MGMT_CMD	2
105 #define QEDF_ABTS		3
106 #define QEDF_ELS		4
107 #define QEDF_CLEANUP		5
108 #define QEDF_SEQ_CLEANUP	6
109 	u8 cmd_type;
110 #define QEDF_CMD_OUTSTANDING		0x0
111 #define QEDF_CMD_IN_ABORT		0x1
112 #define QEDF_CMD_IN_CLEANUP		0x2
113 #define QEDF_CMD_SRR_SENT		0x3
114 #define QEDF_CMD_DIRTY			0x4
115 #define QEDF_CMD_ERR_SCSI_DONE		0x5
116 	u8 io_req_flags;
117 	uint8_t tm_flags;
118 	struct qedf_rport *fcport;
119 #define	QEDF_CMD_ST_INACTIVE		0
120 #define	QEDFC_CMD_ST_IO_ACTIVE		1
121 #define	QEDFC_CMD_ST_ABORT_ACTIVE	2
122 #define	QEDFC_CMD_ST_ABORT_ACTIVE_EH	3
123 #define	QEDFC_CMD_ST_CLEANUP_ACTIVE	4
124 #define	QEDFC_CMD_ST_CLEANUP_ACTIVE_EH	5
125 #define	QEDFC_CMD_ST_RRQ_ACTIVE		6
126 #define	QEDFC_CMD_ST_RRQ_WAIT		7
127 #define	QEDFC_CMD_ST_OXID_RETIRE_WAIT	8
128 #define	QEDFC_CMD_ST_TMF_ACTIVE		9
129 #define	QEDFC_CMD_ST_DRAIN_ACTIVE	10
130 #define	QEDFC_CMD_ST_CLEANED		11
131 #define	QEDFC_CMD_ST_ELS_ACTIVE		12
132 	atomic_t state;
133 	unsigned long flags;
134 	enum qedf_ioreq_event event;
135 	size_t data_xfer_len;
136 	/* ID: 001: Alloc cmd (qedf_alloc_cmd) */
137 	/* ID: 002: Initiate ABTS (qedf_initiate_abts) */
138 	/* ID: 003: For RRQ (qedf_process_abts_compl) */
139 	struct kref refcount;
140 	struct qedf_cmd_mgr *cmd_mgr;
141 	struct io_bdt *bd_tbl;
142 	struct delayed_work timeout_work;
143 	struct completion tm_done;
144 	struct completion abts_done;
145 	struct completion cleanup_done;
146 	struct e4_fcoe_task_context *task;
147 	struct fcoe_task_params *task_params;
148 	struct scsi_sgl_task_params *sgl_task_params;
149 	int idx;
150 	int lun;
151 /*
152  * Need to allocate enough room for both sense data and FCP response data
153  * which has a max length of 8 bytes according to spec.
154  */
155 #define QEDF_SCSI_SENSE_BUFFERSIZE	(SCSI_SENSE_BUFFERSIZE + 8)
156 	uint8_t *sense_buffer;
157 	dma_addr_t sense_buffer_dma;
158 	u32 fcp_resid;
159 	u32 fcp_rsp_len;
160 	u32 fcp_sns_len;
161 	u8 cdb_status;
162 	u8 fcp_status;
163 	u8 fcp_rsp_code;
164 	u8 scsi_comp_flags;
165 #define QEDF_MAX_REUSE		0xfff
166 	u16 reuse_count;
167 	struct qedf_mp_req mp_req;
168 	void (*cb_func)(struct qedf_els_cb_arg *cb_arg);
169 	struct qedf_els_cb_arg *cb_arg;
170 	int fp_idx;
171 	unsigned int cpu;
172 	unsigned int int_cpu;
173 #define QEDF_IOREQ_UNKNOWN_SGE		1
174 #define QEDF_IOREQ_SLOW_SGE		2
175 #define QEDF_IOREQ_FAST_SGE		3
176 	u8 sge_type;
177 	struct delayed_work rrq_work;
178 
179 	/* Used for sequence level recovery; i.e. REC/SRR */
180 	uint32_t rx_buf_off;
181 	uint32_t tx_buf_off;
182 	uint32_t rx_id;
183 	uint32_t task_retry_identifier;
184 
185 	/*
186 	 * Used to tell if we need to return a SCSI command
187 	 * during some form of error processing.
188 	 */
189 	bool return_scsi_cmd_on_abts;
190 
191 	unsigned int alloc;
192 };
193 
194 extern struct workqueue_struct *qedf_io_wq;
195 
196 struct qedf_rport {
197 	spinlock_t rport_lock;
198 #define QEDF_RPORT_SESSION_READY 1
199 #define QEDF_RPORT_UPLOADING_CONNECTION	2
200 #define QEDF_RPORT_IN_RESET 3
201 #define QEDF_RPORT_IN_LUN_RESET 4
202 #define QEDF_RPORT_IN_TARGET_RESET 5
203 	unsigned long flags;
204 	int lun_reset_lun;
205 	unsigned long retry_delay_timestamp;
206 	struct fc_rport *rport;
207 	struct fc_rport_priv *rdata;
208 	struct qedf_ctx *qedf;
209 	u32 handle; /* Handle from qed */
210 	u32 fw_cid; /* fw_cid from qed */
211 	void __iomem *p_doorbell;
212 	/* Send queue management */
213 	atomic_t free_sqes;
214 	atomic_t ios_to_queue;
215 	atomic_t num_active_ios;
216 	struct fcoe_wqe *sq;
217 	dma_addr_t sq_dma;
218 	u16 sq_prod_idx;
219 	u16 fw_sq_prod_idx;
220 	u16 sq_con_idx;
221 	u32 sq_mem_size;
222 	void *sq_pbl;
223 	dma_addr_t sq_pbl_dma;
224 	u32 sq_pbl_size;
225 	u32 sid;
226 #define	QEDF_RPORT_TYPE_DISK		0
227 #define	QEDF_RPORT_TYPE_TAPE		1
228 	uint dev_type; /* Disk or tape */
229 	struct list_head peers;
230 };
231 
232 /* Used to contain LL2 skb's in ll2_skb_list */
233 struct qedf_skb_work {
234 	struct work_struct work;
235 	struct sk_buff *skb;
236 	struct qedf_ctx *qedf;
237 };
238 
239 struct qedf_fastpath {
240 #define	QEDF_SB_ID_NULL		0xffff
241 	u16		sb_id;
242 	struct qed_sb_info	*sb_info;
243 	struct qedf_ctx *qedf;
244 	/* Keep track of number of completions on this fastpath */
245 	unsigned long completions;
246 	uint32_t cq_num_entries;
247 };
248 
249 /* Used to pass fastpath information needed to process CQEs */
250 struct qedf_io_work {
251 	struct work_struct work;
252 	struct fcoe_cqe cqe;
253 	struct qedf_ctx *qedf;
254 	struct fc_frame *fp;
255 };
256 
257 struct qedf_glbl_q_params {
258 	u64	hw_p_cq;	/* Completion queue PBL */
259 	u64	hw_p_rq;	/* Request queue PBL */
260 	u64	hw_p_cmdq;	/* Command queue PBL */
261 };
262 
263 struct global_queue {
264 	struct fcoe_cqe *cq;
265 	dma_addr_t cq_dma;
266 	u32 cq_mem_size;
267 	u32 cq_cons_idx; /* Completion queue consumer index */
268 	u32 cq_prod_idx;
269 
270 	void *cq_pbl;
271 	dma_addr_t cq_pbl_dma;
272 	u32 cq_pbl_size;
273 };
274 
275 /* I/O tracing entry */
276 #define QEDF_IO_TRACE_SIZE		2048
277 struct qedf_io_log {
278 #define QEDF_IO_TRACE_REQ		0
279 #define QEDF_IO_TRACE_RSP		1
280 	uint8_t direction;
281 	uint16_t task_id;
282 	uint32_t port_id; /* Remote port fabric ID */
283 	int lun;
284 	unsigned char op; /* SCSI CDB */
285 	uint8_t lba[4];
286 	unsigned int bufflen; /* SCSI buffer length */
287 	unsigned int sg_count; /* Number of SG elements */
288 	int result; /* Result passed back to mid-layer */
289 	unsigned long jiffies; /* Time stamp when I/O logged */
290 	int refcount; /* Reference count for task id */
291 	unsigned int req_cpu; /* CPU that the task is queued on */
292 	unsigned int int_cpu; /* Interrupt CPU that the task is received on */
293 	unsigned int rsp_cpu; /* CPU that task is returned on */
294 	u8 sge_type; /* Did we take the slow, single or fast SGE path */
295 };
296 
297 /* Number of entries in BDQ */
298 #define QEDF_BDQ_SIZE			256
299 #define QEDF_BDQ_BUF_SIZE		2072
300 
301 /* DMA coherent buffers for BDQ */
302 struct qedf_bdq_buf {
303 	void *buf_addr;
304 	dma_addr_t buf_dma;
305 };
306 
307 /* Main adapter struct */
308 struct qedf_ctx {
309 	struct qedf_dbg_ctx dbg_ctx;
310 	struct fcoe_ctlr ctlr;
311 	struct fc_lport *lport;
312 	u8 data_src_addr[ETH_ALEN];
313 #define QEDF_LINK_DOWN		0
314 #define QEDF_LINK_UP		1
315 	atomic_t link_state;
316 #define QEDF_DCBX_PENDING	0
317 #define QEDF_DCBX_DONE		1
318 	atomic_t dcbx;
319 #define QEDF_NULL_VLAN_ID	-1
320 #define QEDF_FALLBACK_VLAN	1002
321 #define QEDF_DEFAULT_PRIO	3
322 	int vlan_id;
323 	u8 prio;
324 	struct qed_dev *cdev;
325 	struct qed_dev_fcoe_info dev_info;
326 	struct qed_int_info int_info;
327 	uint16_t last_command;
328 	spinlock_t hba_lock;
329 	struct pci_dev *pdev;
330 	u64 wwnn;
331 	u64 wwpn;
332 	u8 __aligned(16) mac[ETH_ALEN];
333 	struct list_head fcports;
334 	atomic_t num_offloads;
335 	unsigned int curr_conn_id;
336 	struct workqueue_struct *ll2_recv_wq;
337 	struct workqueue_struct *link_update_wq;
338 	struct delayed_work link_update;
339 	struct delayed_work link_recovery;
340 	struct completion flogi_compl;
341 	struct completion fipvlan_compl;
342 
343 	/*
344 	 * Used to tell if we're in the window where we are waiting for
345 	 * the link to come back up before informting fcoe that the link is
346 	 * done.
347 	 */
348 	atomic_t link_down_tmo_valid;
349 #define QEDF_TIMER_INTERVAL		(1 * HZ)
350 	struct timer_list timer; /* One second book keeping timer */
351 #define QEDF_DRAIN_ACTIVE		1
352 #define QEDF_LL2_STARTED		2
353 #define QEDF_UNLOADING			3
354 #define QEDF_GRCDUMP_CAPTURE		4
355 #define QEDF_IN_RECOVERY		5
356 #define QEDF_DBG_STOP_IO		6
357 #define QEDF_PROBING			8
358 	unsigned long flags; /* Miscellaneous state flags */
359 	int fipvlan_retries;
360 	u8 num_queues;
361 	struct global_queue **global_queues;
362 	/* Pointer to array of queue structures */
363 	struct qedf_glbl_q_params *p_cpuq;
364 	/* Physical address of array of queue structures */
365 	dma_addr_t hw_p_cpuq;
366 
367 	struct qedf_bdq_buf bdq[QEDF_BDQ_SIZE];
368 	void *bdq_pbl;
369 	dma_addr_t bdq_pbl_dma;
370 	size_t bdq_pbl_mem_size;
371 	void *bdq_pbl_list;
372 	dma_addr_t bdq_pbl_list_dma;
373 	u8 bdq_pbl_list_num_entries;
374 	void __iomem *bdq_primary_prod;
375 	void __iomem *bdq_secondary_prod;
376 	uint16_t bdq_prod_idx;
377 
378 	/* Structure for holding all the fastpath for this qedf_ctx */
379 	struct qedf_fastpath *fp_array;
380 	struct qed_fcoe_tid tasks;
381 	struct qedf_cmd_mgr *cmd_mgr;
382 	/* Holds the PF parameters we pass to qed to start he FCoE function */
383 	struct qed_pf_params pf_params;
384 	/* Used to time middle path ELS and TM commands */
385 	struct workqueue_struct *timer_work_queue;
386 
387 #define QEDF_IO_WORK_MIN		64
388 	mempool_t *io_mempool;
389 	struct workqueue_struct *dpc_wq;
390 	struct delayed_work recovery_work;
391 	struct delayed_work board_disable_work;
392 	struct delayed_work grcdump_work;
393 	struct delayed_work stag_work;
394 
395 	u32 slow_sge_ios;
396 	u32 fast_sge_ios;
397 
398 	uint8_t	*grcdump;
399 	uint32_t grcdump_size;
400 
401 	struct qedf_io_log io_trace_buf[QEDF_IO_TRACE_SIZE];
402 	spinlock_t io_trace_lock;
403 	uint16_t io_trace_idx;
404 
405 	bool stop_io_on_error;
406 
407 	u32 flogi_cnt;
408 	u32 flogi_failed;
409 	u32 flogi_pending;
410 
411 	/* Used for fc statistics */
412 	struct mutex stats_mutex;
413 	u64 input_requests;
414 	u64 output_requests;
415 	u64 control_requests;
416 	u64 packet_aborts;
417 	u64 alloc_failures;
418 	u8 lun_resets;
419 	u8 target_resets;
420 	u8 task_set_fulls;
421 	u8 busy;
422 	/* Used for flush routine */
423 	struct mutex flush_mutex;
424 };
425 
426 struct io_bdt {
427 	struct qedf_ioreq *io_req;
428 	struct scsi_sge *bd_tbl;
429 	dma_addr_t bd_tbl_dma;
430 	u16 bd_valid;
431 };
432 
433 struct qedf_cmd_mgr {
434 	struct qedf_ctx *qedf;
435 	u16 idx;
436 	struct io_bdt **io_bdt_pool;
437 #define FCOE_PARAMS_NUM_TASKS		2048
438 	struct qedf_ioreq cmds[FCOE_PARAMS_NUM_TASKS];
439 	spinlock_t lock;
440 	atomic_t free_list_cnt;
441 };
442 
443 /* Stolen from qed_cxt_api.h and adapted for qed_fcoe_info
444  * Usage:
445  *
446  * void *ptr;
447  * ptr = qedf_get_task_mem(&qedf->tasks, 128);
448  */
449 static inline void *qedf_get_task_mem(struct qed_fcoe_tid *info, u32 tid)
450 {
451 	return (void *)(info->blocks[tid / info->num_tids_per_block] +
452 			(tid % info->num_tids_per_block) * info->size);
453 }
454 
455 static inline void qedf_stop_all_io(struct qedf_ctx *qedf)
456 {
457 	set_bit(QEDF_DBG_STOP_IO, &qedf->flags);
458 }
459 
460 /*
461  * Externs
462  */
463 
464 /*
465  * (QEDF_LOG_NPIV | QEDF_LOG_SESS | QEDF_LOG_LPORT | QEDF_LOG_ELS | QEDF_LOG_MQ
466  * | QEDF_LOG_IO | QEDF_LOG_UNSOL | QEDF_LOG_SCSI_TM | QEDF_LOG_MP_REQ |
467  * QEDF_LOG_EVT | QEDF_LOG_CONN | QEDF_LOG_DISC | QEDF_LOG_INFO)
468  */
469 #define QEDF_DEFAULT_LOG_MASK		0x3CFB6
470 extern const struct qed_fcoe_ops *qed_ops;
471 extern uint qedf_dump_frames;
472 extern uint qedf_io_tracing;
473 extern uint qedf_stop_io_on_error;
474 extern uint qedf_link_down_tmo;
475 #define QEDF_RETRY_DELAY_MAX		600 /* 60 seconds */
476 extern bool qedf_retry_delay;
477 extern uint qedf_debug;
478 
479 extern struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf);
480 extern void qedf_cmd_mgr_free(struct qedf_cmd_mgr *cmgr);
481 extern int qedf_queuecommand(struct Scsi_Host *host,
482 	struct scsi_cmnd *sc_cmd);
483 extern void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb);
484 extern u8 *qedf_get_src_mac(struct fc_lport *lport);
485 extern void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb);
486 extern void qedf_fcoe_send_vlan_req(struct qedf_ctx *qedf);
487 extern void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
488 	struct qedf_ioreq *io_req);
489 extern void qedf_process_warning_compl(struct qedf_ctx *qedf,
490 	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
491 extern void qedf_process_error_detect(struct qedf_ctx *qedf,
492 	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
493 extern void qedf_flush_active_ios(struct qedf_rport *fcport, int lun);
494 extern void qedf_release_cmd(struct kref *ref);
495 extern int qedf_initiate_abts(struct qedf_ioreq *io_req,
496 	bool return_scsi_cmd_on_abts);
497 extern void qedf_process_abts_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
498 	struct qedf_ioreq *io_req);
499 extern struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport,
500 	u8 cmd_type);
501 
502 extern struct device_attribute *qedf_host_attrs[];
503 extern void qedf_cmd_timer_set(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
504 	unsigned int timer_msec);
505 extern int qedf_init_mp_req(struct qedf_ioreq *io_req);
506 extern void qedf_init_mp_task(struct qedf_ioreq *io_req,
507 	struct e4_fcoe_task_context *task_ctx, struct fcoe_wqe *sqe);
508 extern u16 qedf_get_sqe_idx(struct qedf_rport *fcport);
509 extern void qedf_ring_doorbell(struct qedf_rport *fcport);
510 extern void qedf_process_els_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
511 	struct qedf_ioreq *els_req);
512 extern int qedf_send_rrq(struct qedf_ioreq *aborted_io_req);
513 extern int qedf_send_adisc(struct qedf_rport *fcport, struct fc_frame *fp);
514 extern int qedf_initiate_cleanup(struct qedf_ioreq *io_req,
515 	bool return_scsi_cmd_on_abts);
516 extern void qedf_process_cleanup_compl(struct qedf_ctx *qedf,
517 	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
518 extern int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags);
519 extern void qedf_process_tmf_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
520 	struct qedf_ioreq *io_req);
521 extern void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe);
522 extern void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
523 	int result);
524 extern void qedf_set_vlan_id(struct qedf_ctx *qedf, int vlan_id);
525 extern void qedf_create_sysfs_ctx_attr(struct qedf_ctx *qedf);
526 extern void qedf_remove_sysfs_ctx_attr(struct qedf_ctx *qedf);
527 extern void qedf_capture_grc_dump(struct qedf_ctx *qedf);
528 bool qedf_wait_for_upload(struct qedf_ctx *qedf);
529 extern void qedf_process_unsol_compl(struct qedf_ctx *qedf, uint16_t que_idx,
530 	struct fcoe_cqe *cqe);
531 extern void qedf_restart_rport(struct qedf_rport *fcport);
532 extern int qedf_send_rec(struct qedf_ioreq *orig_io_req);
533 extern int qedf_post_io_req(struct qedf_rport *fcport,
534 	struct qedf_ioreq *io_req);
535 extern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf,
536 	struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
537 extern int qedf_send_flogi(struct qedf_ctx *qedf);
538 extern void qedf_get_protocol_tlv_data(void *dev, void *data);
539 extern void qedf_fp_io_handler(struct work_struct *work);
540 extern void qedf_get_generic_tlv_data(void *dev, struct qed_generic_tlvs *data);
541 extern void qedf_wq_grcdump(struct work_struct *work);
542 void qedf_stag_change_work(struct work_struct *work);
543 void qedf_ctx_soft_reset(struct fc_lport *lport);
544 extern void qedf_board_disable_work(struct work_struct *work);
545 extern void qedf_schedule_hw_err_handler(void *dev,
546 		enum qed_hw_err_type err_type);
547 
548 #define FCOE_WORD_TO_BYTE  4
549 #define QEDF_MAX_TASK_NUM	0xFFFF
550 #define QL45xxx			0x165C
551 #define QL41xxx			0x8080
552 #define MAX_CT_PAYLOAD		2048
553 #define DISCOVERED_PORTS	4
554 #define NUMBER_OF_PORTS		1
555 
556 struct fip_vlan {
557 	struct ethhdr eth;
558 	struct fip_header fip;
559 	struct {
560 		struct fip_mac_desc mac;
561 		struct fip_wwn_desc wwnn;
562 	} desc;
563 };
564 
565 /* SQ/CQ Sizes */
566 #define GBL_RSVD_TASKS			16
567 #define NUM_TASKS_PER_CONNECTION	1024
568 #define NUM_RW_TASKS_PER_CONNECTION	512
569 #define FCOE_PARAMS_CQ_NUM_ENTRIES	FCOE_PARAMS_NUM_TASKS
570 
571 #define FCOE_PARAMS_CMDQ_NUM_ENTRIES	FCOE_PARAMS_NUM_TASKS
572 #define SQ_NUM_ENTRIES			NUM_TASKS_PER_CONNECTION
573 
574 #define QEDF_FCOE_PARAMS_GL_RQ_PI              0
575 #define QEDF_FCOE_PARAMS_GL_CMD_PI             1
576 
577 #define QEDF_READ                     (1 << 1)
578 #define QEDF_WRITE                    (1 << 0)
579 #define MAX_FIBRE_LUNS			0xffffffff
580 
581 #define MIN_NUM_CPUS_MSIX(x)	min_t(u32, x->dev_info.num_cqs, \
582 					num_online_cpus())
583 
584 /*
585  * PCI function probe defines
586  */
587 /* Probe/remove called during normal PCI probe */
588 #define	QEDF_MODE_NORMAL		0
589 /* Probe/remove called from qed error recovery */
590 #define QEDF_MODE_RECOVERY		1
591 
592 #define SUPPORTED_25000baseKR_Full    (1<<27)
593 #define SUPPORTED_50000baseKR2_Full   (1<<28)
594 #define SUPPORTED_100000baseKR4_Full  (1<<29)
595 #define SUPPORTED_100000baseCR4_Full  (1<<30)
596 
597 #endif
598