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