Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  QLogic FCoE Offload Driver
0004  *  Copyright (c) 2016-2018 Cavium Inc.
0005  */
0006 #ifndef _QEDFC_H_
0007 #define _QEDFC_H_
0008 
0009 #include <scsi/libfcoe.h>
0010 #include <scsi/libfc.h>
0011 #include <scsi/fc/fc_fip.h>
0012 #include <scsi/fc/fc_fc2.h>
0013 #include <scsi/scsi_tcq.h>
0014 
0015 /* qedf_hsi.h needs to before included any qed includes */
0016 #include "qedf_hsi.h"
0017 
0018 #include <linux/qed/qed_if.h>
0019 #include <linux/qed/qed_fcoe_if.h>
0020 #include <linux/qed/qed_ll2_if.h>
0021 #include "qedf_version.h"
0022 #include "qedf_dbg.h"
0023 #include "drv_fcoe_fw_funcs.h"
0024 
0025 /* Helpers to extract upper and lower 32-bits of pointer */
0026 #define U64_HI(val) ((u32)(((u64)(val)) >> 32))
0027 #define U64_LO(val) ((u32)(((u64)(val)) & 0xffffffff))
0028 
0029 #define QEDF_DESCR "QLogic FCoE Offload Driver"
0030 #define QEDF_MODULE_NAME "qedf"
0031 
0032 #define QEDF_FLOGI_RETRY_CNT    3
0033 #define QEDF_RPORT_RETRY_CNT    255
0034 #define QEDF_MAX_SESSIONS   1024
0035 #define QEDF_MAX_PAYLOAD    2048
0036 #define QEDF_MAX_BDS_PER_CMD    256
0037 #define QEDF_MAX_BD_LEN     0xffff
0038 #define QEDF_BD_SPLIT_SZ    0x1000
0039 #define QEDF_PAGE_SIZE      4096
0040 #define QED_HW_DMA_BOUNDARY     0xfff
0041 #define QEDF_MAX_SGLEN_FOR_CACHESGL     ((1U << 16) - 1)
0042 #define QEDF_MFS        (QEDF_MAX_PAYLOAD + \
0043     sizeof(struct fc_frame_header))
0044 #define QEDF_MAX_NPIV       64
0045 #define QEDF_TM_TIMEOUT     10
0046 #define QEDF_ABORT_TIMEOUT  (10 * 1000)
0047 #define QEDF_CLEANUP_TIMEOUT    1
0048 #define QEDF_MAX_CDB_LEN    16
0049 #define QEDF_LL2_BUF_SIZE   2500    /* Buffer size required for LL2 Rx */
0050 
0051 #define UPSTREAM_REMOVE     1
0052 #define UPSTREAM_KEEP       1
0053 
0054 struct qedf_mp_req {
0055     uint32_t req_len;
0056     void *req_buf;
0057     dma_addr_t req_buf_dma;
0058     struct scsi_sge *mp_req_bd;
0059     dma_addr_t mp_req_bd_dma;
0060     struct fc_frame_header req_fc_hdr;
0061 
0062     uint32_t resp_len;
0063     void *resp_buf;
0064     dma_addr_t resp_buf_dma;
0065     struct scsi_sge *mp_resp_bd;
0066     dma_addr_t mp_resp_bd_dma;
0067     struct fc_frame_header resp_fc_hdr;
0068 };
0069 
0070 struct qedf_els_cb_arg {
0071     struct qedf_ioreq *aborted_io_req;
0072     struct qedf_ioreq *io_req;
0073     u8 op; /* Used to keep track of ELS op */
0074     uint16_t l2_oxid;
0075     u32 offset; /* Used for sequence cleanup */
0076     u8 r_ctl; /* Used for sequence cleanup */
0077 };
0078 
0079 enum qedf_ioreq_event {
0080     QEDF_IOREQ_EV_NONE,
0081     QEDF_IOREQ_EV_ABORT_SUCCESS,
0082     QEDF_IOREQ_EV_ABORT_FAILED,
0083     QEDF_IOREQ_EV_SEND_RRQ,
0084     QEDF_IOREQ_EV_ELS_TMO,
0085     QEDF_IOREQ_EV_ELS_ERR_DETECT,
0086     QEDF_IOREQ_EV_ELS_FLUSH,
0087     QEDF_IOREQ_EV_CLEANUP_SUCCESS,
0088     QEDF_IOREQ_EV_CLEANUP_FAILED,
0089 };
0090 
0091 #define FC_GOOD     0
0092 #define FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER   (0x1<<2)
0093 #define FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER  (0x1<<3)
0094 #define FCOE_FCP_RSP_FLAGS_FCP_RSP_LEN_VALID    (0x1<<0)
0095 #define FCOE_FCP_RSP_FLAGS_FCP_SNS_LEN_VALID    (0x1<<1)
0096 struct qedf_ioreq {
0097     struct list_head link;
0098     uint16_t xid;
0099     struct scsi_cmnd *sc_cmd;
0100 #define QEDF_SCSI_CMD       1
0101 #define QEDF_TASK_MGMT_CMD  2
0102 #define QEDF_ABTS       3
0103 #define QEDF_ELS        4
0104 #define QEDF_CLEANUP        5
0105 #define QEDF_SEQ_CLEANUP    6
0106     u8 cmd_type;
0107 #define QEDF_CMD_OUTSTANDING        0x0
0108 #define QEDF_CMD_IN_ABORT       0x1
0109 #define QEDF_CMD_IN_CLEANUP     0x2
0110 #define QEDF_CMD_SRR_SENT       0x3
0111 #define QEDF_CMD_DIRTY          0x4
0112 #define QEDF_CMD_ERR_SCSI_DONE      0x5
0113     u8 io_req_flags;
0114     uint8_t tm_flags;
0115     struct qedf_rport *fcport;
0116 #define QEDF_CMD_ST_INACTIVE        0
0117 #define QEDFC_CMD_ST_IO_ACTIVE      1
0118 #define QEDFC_CMD_ST_ABORT_ACTIVE   2
0119 #define QEDFC_CMD_ST_ABORT_ACTIVE_EH    3
0120 #define QEDFC_CMD_ST_CLEANUP_ACTIVE 4
0121 #define QEDFC_CMD_ST_CLEANUP_ACTIVE_EH  5
0122 #define QEDFC_CMD_ST_RRQ_ACTIVE     6
0123 #define QEDFC_CMD_ST_RRQ_WAIT       7
0124 #define QEDFC_CMD_ST_OXID_RETIRE_WAIT   8
0125 #define QEDFC_CMD_ST_TMF_ACTIVE     9
0126 #define QEDFC_CMD_ST_DRAIN_ACTIVE   10
0127 #define QEDFC_CMD_ST_CLEANED        11
0128 #define QEDFC_CMD_ST_ELS_ACTIVE     12
0129     atomic_t state;
0130     unsigned long flags;
0131     enum qedf_ioreq_event event;
0132     size_t data_xfer_len;
0133     /* ID: 001: Alloc cmd (qedf_alloc_cmd) */
0134     /* ID: 002: Initiate ABTS (qedf_initiate_abts) */
0135     /* ID: 003: For RRQ (qedf_process_abts_compl) */
0136     struct kref refcount;
0137     struct qedf_cmd_mgr *cmd_mgr;
0138     struct io_bdt *bd_tbl;
0139     struct delayed_work timeout_work;
0140     struct completion tm_done;
0141     struct completion abts_done;
0142     struct completion cleanup_done;
0143     struct fcoe_task_context *task;
0144     struct fcoe_task_params *task_params;
0145     struct scsi_sgl_task_params *sgl_task_params;
0146     int idx;
0147     int lun;
0148 /*
0149  * Need to allocate enough room for both sense data and FCP response data
0150  * which has a max length of 8 bytes according to spec.
0151  */
0152 #define QEDF_SCSI_SENSE_BUFFERSIZE  (SCSI_SENSE_BUFFERSIZE + 8)
0153     uint8_t *sense_buffer;
0154     dma_addr_t sense_buffer_dma;
0155     u32 fcp_resid;
0156     u32 fcp_rsp_len;
0157     u32 fcp_sns_len;
0158     u8 cdb_status;
0159     u8 fcp_status;
0160     u8 fcp_rsp_code;
0161     u8 scsi_comp_flags;
0162 #define QEDF_MAX_REUSE      0xfff
0163     u16 reuse_count;
0164     struct qedf_mp_req mp_req;
0165     void (*cb_func)(struct qedf_els_cb_arg *cb_arg);
0166     struct qedf_els_cb_arg *cb_arg;
0167     int fp_idx;
0168     unsigned int cpu;
0169     unsigned int int_cpu;
0170 #define QEDF_IOREQ_UNKNOWN_SGE      1
0171 #define QEDF_IOREQ_SLOW_SGE     2
0172 #define QEDF_IOREQ_FAST_SGE     3
0173     u8 sge_type;
0174     struct delayed_work rrq_work;
0175 
0176     /* Used for sequence level recovery; i.e. REC/SRR */
0177     uint32_t rx_buf_off;
0178     uint32_t tx_buf_off;
0179     uint32_t rx_id;
0180     uint32_t task_retry_identifier;
0181 
0182     /*
0183      * Used to tell if we need to return a SCSI command
0184      * during some form of error processing.
0185      */
0186     bool return_scsi_cmd_on_abts;
0187 
0188     unsigned int alloc;
0189 };
0190 
0191 struct qedf_cmd_priv {
0192     struct qedf_ioreq *io_req;
0193 };
0194 
0195 static inline struct qedf_cmd_priv *qedf_priv(struct scsi_cmnd *cmd)
0196 {
0197     return scsi_cmd_priv(cmd);
0198 }
0199 
0200 extern struct workqueue_struct *qedf_io_wq;
0201 
0202 struct qedf_rport {
0203     spinlock_t rport_lock;
0204 #define QEDF_RPORT_SESSION_READY 1
0205 #define QEDF_RPORT_UPLOADING_CONNECTION 2
0206 #define QEDF_RPORT_IN_RESET 3
0207 #define QEDF_RPORT_IN_LUN_RESET 4
0208 #define QEDF_RPORT_IN_TARGET_RESET 5
0209     unsigned long flags;
0210     int lun_reset_lun;
0211     unsigned long retry_delay_timestamp;
0212     struct fc_rport *rport;
0213     struct fc_rport_priv *rdata;
0214     struct qedf_ctx *qedf;
0215     u32 handle; /* Handle from qed */
0216     u32 fw_cid; /* fw_cid from qed */
0217     void __iomem *p_doorbell;
0218     /* Send queue management */
0219     atomic_t free_sqes;
0220     atomic_t ios_to_queue;
0221     atomic_t num_active_ios;
0222     struct fcoe_wqe *sq;
0223     dma_addr_t sq_dma;
0224     u16 sq_prod_idx;
0225     u16 fw_sq_prod_idx;
0226     u16 sq_con_idx;
0227     u32 sq_mem_size;
0228     void *sq_pbl;
0229     dma_addr_t sq_pbl_dma;
0230     u32 sq_pbl_size;
0231     u32 sid;
0232 #define QEDF_RPORT_TYPE_DISK        0
0233 #define QEDF_RPORT_TYPE_TAPE        1
0234     uint dev_type; /* Disk or tape */
0235     struct list_head peers;
0236 };
0237 
0238 /* Used to contain LL2 skb's in ll2_skb_list */
0239 struct qedf_skb_work {
0240     struct work_struct work;
0241     struct sk_buff *skb;
0242     struct qedf_ctx *qedf;
0243 };
0244 
0245 struct qedf_fastpath {
0246 #define QEDF_SB_ID_NULL     0xffff
0247     u16     sb_id;
0248     struct qed_sb_info  *sb_info;
0249     struct qedf_ctx *qedf;
0250     /* Keep track of number of completions on this fastpath */
0251     unsigned long completions;
0252     uint32_t cq_num_entries;
0253 };
0254 
0255 /* Used to pass fastpath information needed to process CQEs */
0256 struct qedf_io_work {
0257     struct work_struct work;
0258     struct fcoe_cqe cqe;
0259     struct qedf_ctx *qedf;
0260     struct fc_frame *fp;
0261 };
0262 
0263 struct qedf_glbl_q_params {
0264     u64 hw_p_cq;    /* Completion queue PBL */
0265     u64 hw_p_rq;    /* Request queue PBL */
0266     u64 hw_p_cmdq;  /* Command queue PBL */
0267 };
0268 
0269 struct global_queue {
0270     struct fcoe_cqe *cq;
0271     dma_addr_t cq_dma;
0272     u32 cq_mem_size;
0273     u32 cq_cons_idx; /* Completion queue consumer index */
0274     u32 cq_prod_idx;
0275 
0276     void *cq_pbl;
0277     dma_addr_t cq_pbl_dma;
0278     u32 cq_pbl_size;
0279 };
0280 
0281 /* I/O tracing entry */
0282 #define QEDF_IO_TRACE_SIZE      2048
0283 struct qedf_io_log {
0284 #define QEDF_IO_TRACE_REQ       0
0285 #define QEDF_IO_TRACE_RSP       1
0286     uint8_t direction;
0287     uint16_t task_id;
0288     uint32_t port_id; /* Remote port fabric ID */
0289     int lun;
0290     unsigned char op; /* SCSI CDB */
0291     uint8_t lba[4];
0292     unsigned int bufflen; /* SCSI buffer length */
0293     unsigned int sg_count; /* Number of SG elements */
0294     int result; /* Result passed back to mid-layer */
0295     unsigned long jiffies; /* Time stamp when I/O logged */
0296     int refcount; /* Reference count for task id */
0297     unsigned int req_cpu; /* CPU that the task is queued on */
0298     unsigned int int_cpu; /* Interrupt CPU that the task is received on */
0299     unsigned int rsp_cpu; /* CPU that task is returned on */
0300     u8 sge_type; /* Did we take the slow, single or fast SGE path */
0301 };
0302 
0303 /* Number of entries in BDQ */
0304 #define QEDF_BDQ_SIZE           256
0305 #define QEDF_BDQ_BUF_SIZE       2072
0306 
0307 /* DMA coherent buffers for BDQ */
0308 struct qedf_bdq_buf {
0309     void *buf_addr;
0310     dma_addr_t buf_dma;
0311 };
0312 
0313 /* Main adapter struct */
0314 struct qedf_ctx {
0315     struct qedf_dbg_ctx dbg_ctx;
0316     struct fcoe_ctlr ctlr;
0317     struct fc_lport *lport;
0318     u8 data_src_addr[ETH_ALEN];
0319 #define QEDF_LINK_DOWN      0
0320 #define QEDF_LINK_UP        1
0321     atomic_t link_state;
0322 #define QEDF_DCBX_PENDING   0
0323 #define QEDF_DCBX_DONE      1
0324     atomic_t dcbx;
0325 #define QEDF_NULL_VLAN_ID   -1
0326 #define QEDF_FALLBACK_VLAN  1002
0327 #define QEDF_DEFAULT_PRIO   3
0328     int vlan_id;
0329     u8 prio;
0330     struct qed_dev *cdev;
0331     struct qed_dev_fcoe_info dev_info;
0332     struct qed_int_info int_info;
0333     uint16_t last_command;
0334     spinlock_t hba_lock;
0335     struct pci_dev *pdev;
0336     u64 wwnn;
0337     u64 wwpn;
0338     u8 __aligned(16) mac[ETH_ALEN];
0339     struct list_head fcports;
0340     atomic_t num_offloads;
0341     unsigned int curr_conn_id;
0342     struct workqueue_struct *ll2_recv_wq;
0343     struct workqueue_struct *link_update_wq;
0344     struct devlink *devlink;
0345     struct delayed_work link_update;
0346     struct delayed_work link_recovery;
0347     struct completion flogi_compl;
0348     struct completion fipvlan_compl;
0349 
0350     /*
0351      * Used to tell if we're in the window where we are waiting for
0352      * the link to come back up before informting fcoe that the link is
0353      * done.
0354      */
0355     atomic_t link_down_tmo_valid;
0356 #define QEDF_TIMER_INTERVAL     (1 * HZ)
0357     struct timer_list timer; /* One second book keeping timer */
0358 #define QEDF_DRAIN_ACTIVE       1
0359 #define QEDF_LL2_STARTED        2
0360 #define QEDF_UNLOADING          3
0361 #define QEDF_GRCDUMP_CAPTURE        4
0362 #define QEDF_IN_RECOVERY        5
0363 #define QEDF_DBG_STOP_IO        6
0364 #define QEDF_PROBING            8
0365     unsigned long flags; /* Miscellaneous state flags */
0366     int fipvlan_retries;
0367     u8 num_queues;
0368     struct global_queue **global_queues;
0369     /* Pointer to array of queue structures */
0370     struct qedf_glbl_q_params *p_cpuq;
0371     /* Physical address of array of queue structures */
0372     dma_addr_t hw_p_cpuq;
0373 
0374     struct qedf_bdq_buf bdq[QEDF_BDQ_SIZE];
0375     void *bdq_pbl;
0376     dma_addr_t bdq_pbl_dma;
0377     size_t bdq_pbl_mem_size;
0378     void *bdq_pbl_list;
0379     dma_addr_t bdq_pbl_list_dma;
0380     u8 bdq_pbl_list_num_entries;
0381     void __iomem *bdq_primary_prod;
0382     void __iomem *bdq_secondary_prod;
0383     uint16_t bdq_prod_idx;
0384 
0385     /* Structure for holding all the fastpath for this qedf_ctx */
0386     struct qedf_fastpath *fp_array;
0387     struct qed_fcoe_tid tasks;
0388     struct qedf_cmd_mgr *cmd_mgr;
0389     /* Holds the PF parameters we pass to qed to start he FCoE function */
0390     struct qed_pf_params pf_params;
0391     /* Used to time middle path ELS and TM commands */
0392     struct workqueue_struct *timer_work_queue;
0393 
0394 #define QEDF_IO_WORK_MIN        64
0395     mempool_t *io_mempool;
0396     struct workqueue_struct *dpc_wq;
0397     struct delayed_work recovery_work;
0398     struct delayed_work board_disable_work;
0399     struct delayed_work grcdump_work;
0400     struct delayed_work stag_work;
0401 
0402     u32 slow_sge_ios;
0403     u32 fast_sge_ios;
0404 
0405     uint8_t *grcdump;
0406     uint32_t grcdump_size;
0407 
0408     struct qedf_io_log io_trace_buf[QEDF_IO_TRACE_SIZE];
0409     spinlock_t io_trace_lock;
0410     uint16_t io_trace_idx;
0411 
0412     bool stop_io_on_error;
0413 
0414     u32 flogi_cnt;
0415     u32 flogi_failed;
0416     u32 flogi_pending;
0417 
0418     /* Used for fc statistics */
0419     struct mutex stats_mutex;
0420     u64 input_requests;
0421     u64 output_requests;
0422     u64 control_requests;
0423     u64 packet_aborts;
0424     u64 alloc_failures;
0425     u8 lun_resets;
0426     u8 target_resets;
0427     u8 task_set_fulls;
0428     u8 busy;
0429     /* Used for flush routine */
0430     struct mutex flush_mutex;
0431 };
0432 
0433 struct io_bdt {
0434     struct qedf_ioreq *io_req;
0435     struct scsi_sge *bd_tbl;
0436     dma_addr_t bd_tbl_dma;
0437     u16 bd_valid;
0438 };
0439 
0440 struct qedf_cmd_mgr {
0441     struct qedf_ctx *qedf;
0442     u16 idx;
0443     struct io_bdt **io_bdt_pool;
0444 #define FCOE_PARAMS_NUM_TASKS       2048
0445     struct qedf_ioreq cmds[FCOE_PARAMS_NUM_TASKS];
0446     spinlock_t lock;
0447     atomic_t free_list_cnt;
0448 };
0449 
0450 /* Stolen from qed_cxt_api.h and adapted for qed_fcoe_info
0451  * Usage:
0452  *
0453  * void *ptr;
0454  * ptr = qedf_get_task_mem(&qedf->tasks, 128);
0455  */
0456 static inline void *qedf_get_task_mem(struct qed_fcoe_tid *info, u32 tid)
0457 {
0458     return (void *)(info->blocks[tid / info->num_tids_per_block] +
0459             (tid % info->num_tids_per_block) * info->size);
0460 }
0461 
0462 static inline void qedf_stop_all_io(struct qedf_ctx *qedf)
0463 {
0464     set_bit(QEDF_DBG_STOP_IO, &qedf->flags);
0465 }
0466 
0467 /*
0468  * Externs
0469  */
0470 
0471 /*
0472  * (QEDF_LOG_NPIV | QEDF_LOG_SESS | QEDF_LOG_LPORT | QEDF_LOG_ELS | QEDF_LOG_MQ
0473  * | QEDF_LOG_IO | QEDF_LOG_UNSOL | QEDF_LOG_SCSI_TM | QEDF_LOG_MP_REQ |
0474  * QEDF_LOG_EVT | QEDF_LOG_CONN | QEDF_LOG_DISC | QEDF_LOG_INFO)
0475  */
0476 #define QEDF_DEFAULT_LOG_MASK       0x3CFB6
0477 extern const struct qed_fcoe_ops *qed_ops;
0478 extern uint qedf_dump_frames;
0479 extern uint qedf_io_tracing;
0480 extern uint qedf_stop_io_on_error;
0481 extern uint qedf_link_down_tmo;
0482 #define QEDF_RETRY_DELAY_MAX        600 /* 60 seconds */
0483 extern bool qedf_retry_delay;
0484 extern uint qedf_debug;
0485 
0486 extern struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf);
0487 extern void qedf_cmd_mgr_free(struct qedf_cmd_mgr *cmgr);
0488 extern int qedf_queuecommand(struct Scsi_Host *host,
0489     struct scsi_cmnd *sc_cmd);
0490 extern void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb);
0491 extern u8 *qedf_get_src_mac(struct fc_lport *lport);
0492 extern void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb);
0493 extern void qedf_fcoe_send_vlan_req(struct qedf_ctx *qedf);
0494 extern void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
0495     struct qedf_ioreq *io_req);
0496 extern void qedf_process_warning_compl(struct qedf_ctx *qedf,
0497     struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
0498 extern void qedf_process_error_detect(struct qedf_ctx *qedf,
0499     struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
0500 extern void qedf_flush_active_ios(struct qedf_rport *fcport, int lun);
0501 extern void qedf_release_cmd(struct kref *ref);
0502 extern int qedf_initiate_abts(struct qedf_ioreq *io_req,
0503     bool return_scsi_cmd_on_abts);
0504 extern void qedf_process_abts_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
0505     struct qedf_ioreq *io_req);
0506 extern struct qedf_ioreq *qedf_alloc_cmd(struct qedf_rport *fcport,
0507     u8 cmd_type);
0508 
0509 extern const struct attribute_group *qedf_host_groups[];
0510 extern void qedf_cmd_timer_set(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
0511     unsigned int timer_msec);
0512 extern int qedf_init_mp_req(struct qedf_ioreq *io_req);
0513 extern void qedf_init_mp_task(struct qedf_ioreq *io_req,
0514     struct fcoe_task_context *task_ctx, struct fcoe_wqe *sqe);
0515 extern u16 qedf_get_sqe_idx(struct qedf_rport *fcport);
0516 extern void qedf_ring_doorbell(struct qedf_rport *fcport);
0517 extern void qedf_process_els_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
0518     struct qedf_ioreq *els_req);
0519 extern int qedf_send_rrq(struct qedf_ioreq *aborted_io_req);
0520 extern int qedf_send_adisc(struct qedf_rport *fcport, struct fc_frame *fp);
0521 extern int qedf_initiate_cleanup(struct qedf_ioreq *io_req,
0522     bool return_scsi_cmd_on_abts);
0523 extern void qedf_process_cleanup_compl(struct qedf_ctx *qedf,
0524     struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
0525 extern int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags);
0526 extern void qedf_process_tmf_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
0527     struct qedf_ioreq *io_req);
0528 extern void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe);
0529 extern void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
0530     int result);
0531 extern void qedf_set_vlan_id(struct qedf_ctx *qedf, int vlan_id);
0532 extern void qedf_create_sysfs_ctx_attr(struct qedf_ctx *qedf);
0533 extern void qedf_remove_sysfs_ctx_attr(struct qedf_ctx *qedf);
0534 extern void qedf_capture_grc_dump(struct qedf_ctx *qedf);
0535 bool qedf_wait_for_upload(struct qedf_ctx *qedf);
0536 extern void qedf_process_unsol_compl(struct qedf_ctx *qedf, uint16_t que_idx,
0537     struct fcoe_cqe *cqe);
0538 extern void qedf_restart_rport(struct qedf_rport *fcport);
0539 extern int qedf_send_rec(struct qedf_ioreq *orig_io_req);
0540 extern int qedf_post_io_req(struct qedf_rport *fcport,
0541     struct qedf_ioreq *io_req);
0542 extern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf,
0543     struct fcoe_cqe *cqe, struct qedf_ioreq *io_req);
0544 extern int qedf_send_flogi(struct qedf_ctx *qedf);
0545 extern void qedf_get_protocol_tlv_data(void *dev, void *data);
0546 extern void qedf_fp_io_handler(struct work_struct *work);
0547 extern void qedf_get_generic_tlv_data(void *dev, struct qed_generic_tlvs *data);
0548 extern void qedf_wq_grcdump(struct work_struct *work);
0549 void qedf_stag_change_work(struct work_struct *work);
0550 void qedf_ctx_soft_reset(struct fc_lport *lport);
0551 extern void qedf_board_disable_work(struct work_struct *work);
0552 extern void qedf_schedule_hw_err_handler(void *dev,
0553         enum qed_hw_err_type err_type);
0554 
0555 #define FCOE_WORD_TO_BYTE  4
0556 #define QEDF_MAX_TASK_NUM   0xFFFF
0557 #define QL45xxx         0x165C
0558 #define QL41xxx         0x8080
0559 #define MAX_CT_PAYLOAD      2048
0560 #define DISCOVERED_PORTS    4
0561 #define NUMBER_OF_PORTS     1
0562 
0563 struct fip_vlan {
0564     struct ethhdr eth;
0565     struct fip_header fip;
0566     struct {
0567         struct fip_mac_desc mac;
0568         struct fip_wwn_desc wwnn;
0569     } desc;
0570 };
0571 
0572 /* SQ/CQ Sizes */
0573 #define GBL_RSVD_TASKS          16
0574 #define NUM_TASKS_PER_CONNECTION    1024
0575 #define NUM_RW_TASKS_PER_CONNECTION 512
0576 #define FCOE_PARAMS_CQ_NUM_ENTRIES  FCOE_PARAMS_NUM_TASKS
0577 
0578 #define FCOE_PARAMS_CMDQ_NUM_ENTRIES    FCOE_PARAMS_NUM_TASKS
0579 #define SQ_NUM_ENTRIES          NUM_TASKS_PER_CONNECTION
0580 
0581 #define QEDF_FCOE_PARAMS_GL_RQ_PI              0
0582 #define QEDF_FCOE_PARAMS_GL_CMD_PI             1
0583 
0584 #define QEDF_READ                     (1 << 1)
0585 #define QEDF_WRITE                    (1 << 0)
0586 #define MAX_FIBRE_LUNS          0xffffffff
0587 
0588 #define MIN_NUM_CPUS_MSIX(x)    min_t(u32, x->dev_info.num_cqs, \
0589                     num_online_cpus())
0590 
0591 /*
0592  * PCI function probe defines
0593  */
0594 /* Probe/remove called during normal PCI probe */
0595 #define QEDF_MODE_NORMAL        0
0596 /* Probe/remove called from qed error recovery */
0597 #define QEDF_MODE_RECOVERY      1
0598 
0599 #define SUPPORTED_25000baseKR_Full    (1<<27)
0600 #define SUPPORTED_50000baseKR2_Full   (1<<28)
0601 #define SUPPORTED_100000baseKR4_Full  (1<<29)
0602 #define SUPPORTED_100000baseCR4_Full  (1<<30)
0603 
0604 #endif