0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_SCSI_LPFC_DEBUG_FS)
0024 #define CONFIG_SCSI_LPFC_DEBUG_FS
0025 #endif
0026
0027
0028 struct lpfc_hba;
0029 struct lpfc_vport;
0030
0031
0032 typedef enum _lpfc_ctx_cmd {
0033 LPFC_CTX_LUN,
0034 LPFC_CTX_TGT,
0035 LPFC_CTX_HOST
0036 } lpfc_ctx_cmd;
0037
0038
0039 enum lpfc_mbox_ctx {
0040 MBOX_THD_UNLOCKED,
0041 MBOX_THD_LOCKED
0042 };
0043
0044 union lpfc_vmid_tag {
0045 uint32_t app_id;
0046 uint8_t cs_ctl_vmid;
0047 struct lpfc_vmid_context *vmid_context;
0048 };
0049
0050 struct lpfc_cq_event {
0051 struct list_head list;
0052 uint16_t hdwq;
0053 union {
0054 struct lpfc_mcqe mcqe_cmpl;
0055 struct lpfc_acqe_link acqe_link;
0056 struct lpfc_acqe_fip acqe_fip;
0057 struct lpfc_acqe_dcbx acqe_dcbx;
0058 struct lpfc_acqe_grp5 acqe_grp5;
0059 struct lpfc_acqe_fc_la acqe_fc;
0060 struct lpfc_acqe_sli acqe_sli;
0061 struct lpfc_rcqe rcqe_cmpl;
0062 struct sli4_wcqe_xri_aborted wcqe_axri;
0063 struct lpfc_wcqe_complete wcqe_cmpl;
0064 } cqe;
0065 };
0066
0067
0068 struct lpfc_iocbq {
0069
0070 struct list_head list;
0071 struct list_head clist;
0072 struct list_head dlist;
0073 uint16_t iotag;
0074 uint16_t sli4_lxritag;
0075 uint16_t sli4_xritag;
0076 uint16_t hba_wqidx;
0077 struct lpfc_cq_event cq_event;
0078 uint64_t isr_timestamp;
0079
0080 union lpfc_wqe128 wqe;
0081 IOCB_t iocb;
0082 struct lpfc_wcqe_complete wcqe_cmpl;
0083
0084 u32 unsol_rcv_len;
0085
0086
0087 u8 num_bdes;
0088 u8 abort_bls;
0089 u8 abort_rctl;
0090 u8 priority;
0091 u8 retry;
0092 u8 rsvd1;
0093 u8 rsvd2;
0094 u8 rsvd3;
0095
0096 u32 cmd_flag;
0097 #define LPFC_IO_LIBDFC 1
0098 #define LPFC_IO_WAKE 2
0099 #define LPFC_IO_WAKE_TMO LPFC_IO_WAKE
0100 #define LPFC_IO_FCP 4
0101 #define LPFC_DRIVER_ABORTED 8
0102 #define LPFC_IO_FABRIC 0x10
0103 #define LPFC_DELAY_MEM_FREE 0x20
0104 #define LPFC_EXCHANGE_BUSY 0x40
0105 #define LPFC_USE_FCPWQIDX 0x80
0106 #define DSS_SECURITY_OP 0x100
0107 #define LPFC_IO_ON_TXCMPLQ 0x200
0108 #define LPFC_IO_DIF_PASS 0x400
0109 #define LPFC_IO_DIF_STRIP 0x800
0110 #define LPFC_IO_DIF_INSERT 0x1000
0111 #define LPFC_IO_CMD_OUTSTANDING 0x2000
0112
0113 #define LPFC_FIP_ELS_ID_MASK 0xc000
0114 #define LPFC_FIP_ELS_ID_SHIFT 14
0115
0116 #define LPFC_IO_OAS 0x10000
0117 #define LPFC_IO_FOF 0x20000
0118 #define LPFC_IO_LOOPBACK 0x40000
0119 #define LPFC_PRLI_NVME_REQ 0x80000
0120 #define LPFC_PRLI_FCP_REQ 0x100000
0121 #define LPFC_IO_NVME 0x200000
0122 #define LPFC_IO_NVME_LS 0x400000
0123 #define LPFC_IO_NVMET 0x800000
0124 #define LPFC_IO_VMID 0x1000000
0125 #define LPFC_IO_CMF 0x4000000
0126
0127 uint32_t drvrTimeout;
0128 struct lpfc_vport *vport;
0129 struct lpfc_dmabuf *cmd_dmabuf;
0130 struct lpfc_dmabuf *rsp_dmabuf;
0131 struct lpfc_dmabuf *bpl_dmabuf;
0132 uint32_t event_tag;
0133 union {
0134 wait_queue_head_t *wait_queue;
0135 struct lpfcMboxq *mbox;
0136 struct lpfc_node_rrq *rrq;
0137 struct nvmefc_ls_req *nvme_lsreq;
0138 struct lpfc_async_xchg_ctx *axchg;
0139 struct bsg_job_data *dd_data;
0140 } context_un;
0141
0142 struct lpfc_io_buf *io_buf;
0143 struct lpfc_iocbq *rsp_iocb;
0144 struct lpfc_nodelist *ndlp;
0145 union lpfc_vmid_tag vmid_tag;
0146 void (*fabric_cmd_cmpl)(struct lpfc_hba *phba, struct lpfc_iocbq *cmd,
0147 struct lpfc_iocbq *rsp);
0148 void (*wait_cmd_cmpl)(struct lpfc_hba *phba, struct lpfc_iocbq *cmd,
0149 struct lpfc_iocbq *rsp);
0150 void (*cmd_cmpl)(struct lpfc_hba *phba, struct lpfc_iocbq *cmd,
0151 struct lpfc_iocbq *rsp);
0152 };
0153
0154 #define SLI_IOCB_RET_IOCB 1
0155
0156 #define IOCB_SUCCESS 0
0157 #define IOCB_BUSY 1
0158 #define IOCB_ERROR 2
0159 #define IOCB_TIMEDOUT 3
0160 #define IOCB_ABORTED 4
0161 #define IOCB_ABORTING 5
0162 #define IOCB_NORESOURCE 6
0163
0164 #define SLI_WQE_RET_WQE 1
0165
0166 #define WQE_SUCCESS 0
0167 #define WQE_BUSY 1
0168 #define WQE_ERROR 2
0169 #define WQE_TIMEDOUT 3
0170 #define WQE_ABORTED 4
0171 #define WQE_ABORTING 5
0172 #define WQE_NORESOURCE 6
0173
0174 #define LPFC_MBX_WAKE 1
0175 #define LPFC_MBX_IMED_UNREG 2
0176
0177 typedef struct lpfcMboxq {
0178
0179 struct list_head list;
0180 union {
0181 MAILBOX_t mb;
0182 struct lpfc_mqe mqe;
0183 } u;
0184 struct lpfc_vport *vport;
0185 void *ctx_ndlp;
0186 void *ctx_buf;
0187 void *context3;
0188
0189 void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *);
0190 uint8_t mbox_flag;
0191 uint16_t in_ext_byte_len;
0192 uint16_t out_ext_byte_len;
0193 uint8_t mbox_offset_word;
0194 struct lpfc_mcqe mcqe;
0195 struct lpfc_mbx_nembed_sge_virt *sge_array;
0196 } LPFC_MBOXQ_t;
0197
0198 #define MBX_POLL 1
0199
0200 #define MBX_NOWAIT 2
0201
0202 #define LPFC_MAX_RING_MASK 5
0203
0204 #define LPFC_SLI3_MAX_RING 4
0205
0206
0207
0208 struct lpfc_sli_ring;
0209
0210 struct lpfc_sli_ring_mask {
0211 uint8_t profile;
0212 uint8_t rctl;
0213 uint8_t type;
0214 uint8_t rsvd;
0215
0216 void (*lpfc_sli_rcv_unsol_event) (struct lpfc_hba *,
0217 struct lpfc_sli_ring *,
0218 struct lpfc_iocbq *);
0219 };
0220
0221
0222
0223 struct lpfc_sli_ring_stat {
0224 uint64_t iocb_event;
0225 uint64_t iocb_cmd;
0226 uint64_t iocb_rsp;
0227 uint64_t iocb_cmd_delay;
0228 uint64_t iocb_cmd_full;
0229 uint64_t iocb_cmd_empty;
0230 uint64_t iocb_rsp_full;
0231 };
0232
0233 struct lpfc_sli3_ring {
0234 uint32_t local_getidx;
0235 uint32_t next_cmdidx;
0236 uint32_t rspidx;
0237 uint32_t cmdidx;
0238 uint16_t numCiocb;
0239 uint16_t numRiocb;
0240 uint16_t sizeCiocb;
0241 uint16_t sizeRiocb;
0242 uint32_t *cmdringaddr;
0243 uint32_t *rspringaddr;
0244 };
0245
0246 struct lpfc_sli4_ring {
0247 struct lpfc_queue *wqp;
0248 };
0249
0250
0251
0252 struct lpfc_sli_ring {
0253 uint16_t flag;
0254 #define LPFC_DEFERRED_RING_EVENT 0x001
0255 #define LPFC_CALL_RING_AVAILABLE 0x002
0256 #define LPFC_STOP_IOCB_EVENT 0x020
0257 uint16_t abtsiotag;
0258
0259 uint8_t rsvd;
0260 uint8_t ringno;
0261
0262 spinlock_t ring_lock;
0263
0264 uint32_t fast_iotag;
0265 uint32_t iotag_ctr;
0266 uint32_t iotag_max;
0267 struct list_head txq;
0268 uint16_t txq_cnt;
0269 uint16_t txq_max;
0270 struct list_head txcmplq;
0271 uint16_t txcmplq_cnt;
0272 uint16_t txcmplq_max;
0273 uint32_t missbufcnt;
0274 struct list_head postbufq;
0275 uint16_t postbufq_cnt;
0276 uint16_t postbufq_max;
0277 struct list_head iocb_continueq;
0278 uint16_t iocb_continueq_cnt;
0279 uint16_t iocb_continueq_max;
0280 struct list_head iocb_continue_saveq;
0281
0282 struct lpfc_sli_ring_mask prt[LPFC_MAX_RING_MASK];
0283 uint32_t num_mask;
0284 void (*lpfc_sli_rcv_async_status) (struct lpfc_hba *,
0285 struct lpfc_sli_ring *, struct lpfc_iocbq *);
0286
0287 struct lpfc_sli_ring_stat stats;
0288
0289
0290 void (*lpfc_sli_cmd_available) (struct lpfc_hba *,
0291 struct lpfc_sli_ring *);
0292 union {
0293 struct lpfc_sli3_ring sli3;
0294 struct lpfc_sli4_ring sli4;
0295 } sli;
0296 };
0297
0298
0299 struct lpfc_hbq_init {
0300 uint32_t rn;
0301 uint32_t entry_count;
0302 uint32_t headerLen;
0303 uint32_t logEntry;
0304 uint32_t profile;
0305 uint32_t ring_mask;
0306
0307 uint32_t hbq_index;
0308
0309 uint32_t seqlenoff;
0310 uint32_t maxlen;
0311 uint32_t seqlenbcnt;
0312 uint32_t cmdcodeoff;
0313 uint32_t cmdmatch[8];
0314 uint32_t mask_count;
0315 struct hbq_mask hbqMasks[6];
0316
0317
0318 uint32_t buffer_count;
0319 uint32_t init_count;
0320 uint32_t add_count;
0321 } ;
0322
0323
0324 struct lpfc_sli_stat {
0325 uint64_t mbox_stat_err;
0326 uint64_t mbox_cmd;
0327 uint64_t sli_intr;
0328 uint64_t sli_prev_intr;
0329 uint64_t sli_ips;
0330 uint32_t err_attn_event;
0331 uint32_t link_event;
0332 uint32_t mbox_event;
0333 uint32_t mbox_busy;
0334 };
0335
0336
0337 struct lpfc_lnk_stat {
0338 uint32_t link_failure_count;
0339 uint32_t loss_of_sync_count;
0340 uint32_t loss_of_signal_count;
0341 uint32_t prim_seq_protocol_err_count;
0342 uint32_t invalid_tx_word_count;
0343 uint32_t invalid_crc_count;
0344 uint32_t error_frames;
0345 uint32_t link_events;
0346 };
0347
0348
0349 struct lpfc_sli {
0350 uint32_t num_rings;
0351 uint32_t sli_flag;
0352
0353
0354 #define LPFC_SLI_MBOX_ACTIVE 0x100
0355 #define LPFC_SLI_ACTIVE 0x200
0356 #define LPFC_PROCESS_LA 0x400
0357 #define LPFC_BLOCK_MGMT_IO 0x800
0358 #define LPFC_SLI_ASYNC_MBX_BLK 0x2000
0359 #define LPFC_SLI_SUPPRESS_RSP 0x4000
0360 #define LPFC_SLI_USE_EQDR 0x8000
0361 #define LPFC_QUEUE_FREE_INIT 0x10000
0362 #define LPFC_QUEUE_FREE_WAIT 0x20000
0363
0364
0365
0366 struct lpfc_sli_ring *sli3_ring;
0367
0368 struct lpfc_sli_stat slistat;
0369 struct list_head mboxq;
0370 uint16_t mboxq_cnt;
0371 uint16_t mboxq_max;
0372 LPFC_MBOXQ_t *mbox_active;
0373 struct list_head mboxq_cmpl;
0374
0375 struct timer_list mbox_tmo;
0376
0377
0378 #define LPFC_IOCBQ_LOOKUP_INCREMENT 1024
0379 struct lpfc_iocbq ** iocbq_lookup;
0380 size_t iocbq_lookup_len;
0381 uint16_t last_iotag;
0382 time64_t stats_start;
0383 struct lpfc_lnk_stat lnk_stat_offsets;
0384 };
0385
0386
0387 #define LPFC_MBOX_TMO 30
0388
0389 #define LPFC_MBOX_SLI4_CONFIG_TMO 60
0390
0391 #define LPFC_MBOX_SLI4_CONFIG_EXTENDED_TMO 300
0392
0393 #define LPFC_MBOX_TMO_FLASH_CMD 300
0394
0395 struct lpfc_io_buf {
0396
0397 struct list_head list;
0398 void *data;
0399
0400 dma_addr_t dma_handle;
0401 dma_addr_t dma_phys_sgl;
0402
0403 struct sli4_sge *dma_sgl;
0404
0405
0406 struct list_head dma_sgl_xtra_list;
0407
0408
0409 struct list_head dma_cmd_rsp_list;
0410
0411 struct lpfc_iocbq cur_iocbq;
0412 struct lpfc_sli4_hdw_queue *hdwq;
0413 uint16_t hdwq_no;
0414 uint16_t cpu;
0415
0416 struct lpfc_nodelist *ndlp;
0417 uint32_t timeout;
0418 uint16_t flags;
0419 #define LPFC_SBUF_XBUSY 0x1
0420 #define LPFC_SBUF_BUMP_QDEPTH 0x2
0421
0422 #define LPFC_SBUF_NORMAL_DIF 0x4
0423 #define LPFC_SBUF_PASS_DIF 0x8
0424 #define LPFC_SBUF_NOT_POSTED 0x10
0425 uint16_t status;
0426 uint32_t result;
0427
0428 uint32_t seg_cnt;
0429
0430
0431
0432 unsigned long start_time;
0433 spinlock_t buf_lock;
0434 bool expedite;
0435
0436 union {
0437
0438 struct {
0439 struct scsi_cmnd *pCmd;
0440 struct lpfc_rport_data *rdata;
0441 uint32_t prot_seg_cnt;
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451 struct fcp_cmnd *fcp_cmnd;
0452 struct fcp_rsp *fcp_rsp;
0453
0454 wait_queue_head_t *waitq;
0455
0456 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
0457
0458
0459
0460 void *prot_data_segment;
0461 uint32_t prot_data;
0462 uint32_t prot_data_type;
0463 #define LPFC_INJERR_REFTAG 1
0464 #define LPFC_INJERR_APPTAG 2
0465 #define LPFC_INJERR_GUARD 3
0466 #endif
0467 };
0468
0469
0470 struct {
0471 struct nvmefc_fcp_req *nvmeCmd;
0472 uint16_t qidx;
0473 };
0474 };
0475 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
0476 uint64_t ts_cmd_start;
0477 uint64_t ts_last_cmd;
0478 uint64_t ts_cmd_wqput;
0479 uint64_t ts_isr_cmpl;
0480 uint64_t ts_data_io;
0481 #endif
0482 uint64_t rx_cmd_start;
0483 };