qedf.h 16 KB

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