James Smart | 895427b | 2017-02-12 13:52:30 -0800 | [diff] [blame] | 1 | /******************************************************************* |
| 2 | * This file is part of the Emulex Linux Device Driver for * |
| 3 | * Fibre Channel Host Bus Adapters. * |
James Smart | d080abe | 2017-02-12 13:52:39 -0800 | [diff] [blame] | 4 | * Copyright (C) 2017 Broadcom. All Rights Reserved. The term * |
| 5 | * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. * |
James Smart | 895427b | 2017-02-12 13:52:30 -0800 | [diff] [blame] | 6 | * Copyright (C) 2004-2016 Emulex. All rights reserved. * |
| 7 | * EMULEX and SLI are trademarks of Emulex. * |
James Smart | d080abe | 2017-02-12 13:52:39 -0800 | [diff] [blame] | 8 | * www.broadcom.com * |
James Smart | 895427b | 2017-02-12 13:52:30 -0800 | [diff] [blame] | 9 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
| 10 | * * |
| 11 | * This program is free software; you can redistribute it and/or * |
| 12 | * modify it under the terms of version 2 of the GNU General * |
| 13 | * Public License as published by the Free Software Foundation. * |
| 14 | * This program is distributed in the hope that it will be useful. * |
| 15 | * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * |
| 16 | * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * |
| 18 | * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * |
| 19 | * TO BE LEGALLY INVALID. See the GNU General Public License for * |
| 20 | * more details, a copy of which can be found in the file COPYING * |
| 21 | * included with this package. * |
| 22 | ********************************************************************/ |
| 23 | |
| 24 | #define LPFC_NVME_MIN_SEGS 16 |
| 25 | #define LPFC_NVME_DEFAULT_SEGS 66 /* 256K IOs - 64 + 2 */ |
| 26 | #define LPFC_NVME_MAX_SEGS 510 |
| 27 | #define LPFC_NVMET_MIN_POSTBUF 16 |
| 28 | #define LPFC_NVMET_DEFAULT_POSTBUF 1024 |
| 29 | #define LPFC_NVMET_MAX_POSTBUF 4096 |
| 30 | #define LPFC_NVME_WQSIZE 256 |
| 31 | |
| 32 | #define LPFC_NVME_ERSP_LEN 0x20 |
| 33 | |
James Smart | 0164956 | 2017-02-12 13:52:32 -0800 | [diff] [blame] | 34 | struct lpfc_nvme_qhandle { |
| 35 | uint32_t index; /* WQ index to use */ |
| 36 | uint32_t qidx; /* queue index passed to create */ |
| 37 | uint32_t cpu_id; /* current cpu id at time of create */ |
| 38 | }; |
| 39 | |
James Smart | 895427b | 2017-02-12 13:52:30 -0800 | [diff] [blame] | 40 | /* Declare nvme-based local and remote port definitions. */ |
| 41 | struct lpfc_nvme_lport { |
| 42 | struct lpfc_vport *vport; |
| 43 | struct list_head rport_list; |
| 44 | struct completion lport_unreg_done; |
| 45 | /* Add sttats counters here */ |
| 46 | }; |
| 47 | |
| 48 | struct lpfc_nvme_rport { |
| 49 | struct list_head list; |
| 50 | struct lpfc_nvme_lport *lport; |
| 51 | struct nvme_fc_remote_port *remoteport; |
| 52 | struct lpfc_nodelist *ndlp; |
| 53 | struct completion rport_unreg_done; |
| 54 | }; |
| 55 | |
| 56 | struct lpfc_nvme_buf { |
| 57 | struct list_head list; |
| 58 | struct nvmefc_fcp_req *nvmeCmd; |
| 59 | struct lpfc_nvme_rport *nrport; |
James Smart | 318083a | 2017-03-04 09:30:30 -0800 | [diff] [blame] | 60 | struct lpfc_nodelist *ndlp; |
James Smart | 895427b | 2017-02-12 13:52:30 -0800 | [diff] [blame] | 61 | |
| 62 | uint32_t timeout; |
| 63 | |
| 64 | uint16_t flags; /* TBD convert exch_busy to flags */ |
| 65 | #define LPFC_SBUF_XBUSY 0x1 /* SLI4 hba reported XB on WCQE cmpl */ |
| 66 | uint16_t exch_busy; /* SLI4 hba reported XB on complete WCQE */ |
| 67 | uint16_t status; /* From IOCB Word 7- ulpStatus */ |
| 68 | uint16_t cpu; |
| 69 | uint16_t qidx; |
| 70 | uint16_t sqid; |
| 71 | uint32_t result; /* From IOCB Word 4. */ |
| 72 | |
| 73 | uint32_t seg_cnt; /* Number of scatter-gather segments returned by |
| 74 | * dma_map_sg. The driver needs this for calls |
| 75 | * to dma_unmap_sg. |
| 76 | */ |
| 77 | dma_addr_t nonsg_phys; /* Non scatter-gather physical address. */ |
| 78 | |
| 79 | /* |
| 80 | * data and dma_handle are the kernel virtual and bus address of the |
| 81 | * dma-able buffer containing the fcp_cmd, fcp_rsp and a scatter |
| 82 | * gather bde list that supports the sg_tablesize value. |
| 83 | */ |
| 84 | void *data; |
| 85 | dma_addr_t dma_handle; |
| 86 | |
| 87 | struct sli4_sge *nvme_sgl; |
| 88 | dma_addr_t dma_phys_sgl; |
| 89 | |
| 90 | /* cur_iocbq has phys of the dma-able buffer. |
| 91 | * Iotag is in here |
| 92 | */ |
| 93 | struct lpfc_iocbq cur_iocbq; |
| 94 | |
| 95 | wait_queue_head_t *waitq; |
| 96 | unsigned long start_time; |
James Smart | bd2cdd5 | 2017-02-12 13:52:33 -0800 | [diff] [blame] | 97 | #ifdef CONFIG_SCSI_LPFC_DEBUG_FS |
| 98 | uint64_t ts_cmd_start; |
| 99 | uint64_t ts_last_cmd; |
| 100 | uint64_t ts_cmd_wqput; |
| 101 | uint64_t ts_isr_cmpl; |
| 102 | uint64_t ts_data_nvme; |
| 103 | #endif |
James Smart | 895427b | 2017-02-12 13:52:30 -0800 | [diff] [blame] | 104 | }; |