| .. | .. |
|---|
| 1 | 1 | /******************************************************************* |
|---|
| 2 | 2 | * This file is part of the Emulex Linux Device Driver for * |
|---|
| 3 | 3 | * Fibre Channel Host Bus Adapters. * |
|---|
| 4 | | - * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * |
|---|
| 4 | + * Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * |
|---|
| 5 | 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * |
|---|
| 6 | 6 | * Copyright (C) 2004-2016 Emulex. All rights reserved. * |
|---|
| 7 | 7 | * EMULEX and SLI are trademarks of Emulex. * |
|---|
| .. | .. |
|---|
| 20 | 20 | * included with this package. * |
|---|
| 21 | 21 | *******************************************************************/ |
|---|
| 22 | 22 | |
|---|
| 23 | +#if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_SCSI_LPFC_DEBUG_FS) |
|---|
| 24 | +#define CONFIG_SCSI_LPFC_DEBUG_FS |
|---|
| 25 | +#endif |
|---|
| 26 | + |
|---|
| 23 | 27 | /* forward declaration for LPFC_IOCB_t's use */ |
|---|
| 24 | 28 | struct lpfc_hba; |
|---|
| 25 | 29 | struct lpfc_vport; |
|---|
| .. | .. |
|---|
| 33 | 37 | |
|---|
| 34 | 38 | struct lpfc_cq_event { |
|---|
| 35 | 39 | struct list_head list; |
|---|
| 40 | + uint16_t hdwq; |
|---|
| 36 | 41 | union { |
|---|
| 37 | 42 | struct lpfc_mcqe mcqe_cmpl; |
|---|
| 38 | 43 | struct lpfc_acqe_link acqe_link; |
|---|
| .. | .. |
|---|
| 144 | 149 | MAILBOX_t mb; /* Mailbox cmd */ |
|---|
| 145 | 150 | struct lpfc_mqe mqe; |
|---|
| 146 | 151 | } u; |
|---|
| 147 | | - struct lpfc_vport *vport;/* virtual port pointer */ |
|---|
| 148 | | - void *context1; /* caller context information */ |
|---|
| 149 | | - void *context2; /* caller context information */ |
|---|
| 152 | + struct lpfc_vport *vport; /* virtual port pointer */ |
|---|
| 153 | + void *ctx_ndlp; /* caller ndlp information */ |
|---|
| 154 | + void *ctx_buf; /* caller buffer information */ |
|---|
| 150 | 155 | void *context3; |
|---|
| 151 | 156 | |
|---|
| 152 | 157 | void (*mbox_cmpl) (struct lpfc_hba *, struct lpfcMboxq *); |
|---|
| .. | .. |
|---|
| 322 | 327 | #define LPFC_SLI_ASYNC_MBX_BLK 0x2000 /* Async mailbox is blocked */ |
|---|
| 323 | 328 | #define LPFC_SLI_SUPPRESS_RSP 0x4000 /* Suppress RSP feature is supported */ |
|---|
| 324 | 329 | #define LPFC_SLI_USE_EQDR 0x8000 /* EQ Delay Register is supported */ |
|---|
| 330 | +#define LPFC_QUEUE_FREE_INIT 0x10000 /* Queue freeing is in progress */ |
|---|
| 331 | +#define LPFC_QUEUE_FREE_WAIT 0x20000 /* Hold Queue free as it is being |
|---|
| 332 | + * used outside worker thread |
|---|
| 333 | + */ |
|---|
| 325 | 334 | |
|---|
| 326 | 335 | struct lpfc_sli_ring *sli3_ring; |
|---|
| 327 | 336 | |
|---|
| .. | .. |
|---|
| 351 | 360 | #define LPFC_MBOX_SLI4_CONFIG_EXTENDED_TMO 300 |
|---|
| 352 | 361 | /* Timeout for other flash-based outstanding mbox command (Seconds) */ |
|---|
| 353 | 362 | #define LPFC_MBOX_TMO_FLASH_CMD 300 |
|---|
| 363 | + |
|---|
| 364 | +struct lpfc_io_buf { |
|---|
| 365 | + /* Common fields */ |
|---|
| 366 | + struct list_head list; |
|---|
| 367 | + void *data; |
|---|
| 368 | + |
|---|
| 369 | + dma_addr_t dma_handle; |
|---|
| 370 | + dma_addr_t dma_phys_sgl; |
|---|
| 371 | + |
|---|
| 372 | + struct sli4_sge *dma_sgl; /* initial segment chunk */ |
|---|
| 373 | + |
|---|
| 374 | + /* linked list of extra sli4_hybrid_sge */ |
|---|
| 375 | + struct list_head dma_sgl_xtra_list; |
|---|
| 376 | + |
|---|
| 377 | + /* list head for fcp_cmd_rsp buf */ |
|---|
| 378 | + struct list_head dma_cmd_rsp_list; |
|---|
| 379 | + |
|---|
| 380 | + struct lpfc_iocbq cur_iocbq; |
|---|
| 381 | + struct lpfc_sli4_hdw_queue *hdwq; |
|---|
| 382 | + uint16_t hdwq_no; |
|---|
| 383 | + uint16_t cpu; |
|---|
| 384 | + |
|---|
| 385 | + struct lpfc_nodelist *ndlp; |
|---|
| 386 | + uint32_t timeout; |
|---|
| 387 | + uint16_t flags; |
|---|
| 388 | +#define LPFC_SBUF_XBUSY 0x1 /* SLI4 hba reported XB on WCQE cmpl */ |
|---|
| 389 | +#define LPFC_SBUF_BUMP_QDEPTH 0x2 /* bumped queue depth counter */ |
|---|
| 390 | + /* External DIF device IO conversions */ |
|---|
| 391 | +#define LPFC_SBUF_NORMAL_DIF 0x4 /* normal mode to insert/strip */ |
|---|
| 392 | +#define LPFC_SBUF_PASS_DIF 0x8 /* insert/strip mode to passthru */ |
|---|
| 393 | +#define LPFC_SBUF_NOT_POSTED 0x10 /* SGL failed post to FW. */ |
|---|
| 394 | + uint16_t status; /* From IOCB Word 7- ulpStatus */ |
|---|
| 395 | + uint32_t result; /* From IOCB Word 4. */ |
|---|
| 396 | + |
|---|
| 397 | + uint32_t seg_cnt; /* Number of scatter-gather segments returned by |
|---|
| 398 | + * dma_map_sg. The driver needs this for calls |
|---|
| 399 | + * to dma_unmap_sg. |
|---|
| 400 | + */ |
|---|
| 401 | + unsigned long start_time; |
|---|
| 402 | + spinlock_t buf_lock; /* lock used in case of simultaneous abort */ |
|---|
| 403 | + bool expedite; /* this is an expedite io_buf */ |
|---|
| 404 | + |
|---|
| 405 | + union { |
|---|
| 406 | + /* SCSI specific fields */ |
|---|
| 407 | + struct { |
|---|
| 408 | + struct scsi_cmnd *pCmd; |
|---|
| 409 | + struct lpfc_rport_data *rdata; |
|---|
| 410 | + uint32_t prot_seg_cnt; /* seg_cnt's counterpart for |
|---|
| 411 | + * protection data |
|---|
| 412 | + */ |
|---|
| 413 | + |
|---|
| 414 | + /* |
|---|
| 415 | + * data and dma_handle are the kernel virtual and bus |
|---|
| 416 | + * address of the dma-able buffer containing the |
|---|
| 417 | + * fcp_cmd, fcp_rsp and a scatter gather bde list that |
|---|
| 418 | + * supports the sg_tablesize value. |
|---|
| 419 | + */ |
|---|
| 420 | + struct fcp_cmnd *fcp_cmnd; |
|---|
| 421 | + struct fcp_rsp *fcp_rsp; |
|---|
| 422 | + |
|---|
| 423 | + wait_queue_head_t *waitq; |
|---|
| 424 | + |
|---|
| 425 | +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS |
|---|
| 426 | + /* Used to restore any changes to protection data for |
|---|
| 427 | + * error injection |
|---|
| 428 | + */ |
|---|
| 429 | + void *prot_data_segment; |
|---|
| 430 | + uint32_t prot_data; |
|---|
| 431 | + uint32_t prot_data_type; |
|---|
| 432 | +#define LPFC_INJERR_REFTAG 1 |
|---|
| 433 | +#define LPFC_INJERR_APPTAG 2 |
|---|
| 434 | +#define LPFC_INJERR_GUARD 3 |
|---|
| 435 | +#endif |
|---|
| 436 | + }; |
|---|
| 437 | + |
|---|
| 438 | + /* NVME specific fields */ |
|---|
| 439 | + struct { |
|---|
| 440 | + struct nvmefc_fcp_req *nvmeCmd; |
|---|
| 441 | + uint16_t qidx; |
|---|
| 442 | + }; |
|---|
| 443 | + }; |
|---|
| 444 | +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS |
|---|
| 445 | + uint64_t ts_cmd_start; |
|---|
| 446 | + uint64_t ts_last_cmd; |
|---|
| 447 | + uint64_t ts_cmd_wqput; |
|---|
| 448 | + uint64_t ts_isr_cmpl; |
|---|
| 449 | + uint64_t ts_data_io; |
|---|
| 450 | +#endif |
|---|
| 451 | +}; |
|---|