blob: ec32f45daa667dfcb1876a0b41dc62362154e733 [file] [log] [blame]
James Smart895427b2017-02-12 13:52:30 -08001/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. *
James Smartd080abe2017-02-12 13:52:39 -08004 * Copyright (C) 2017 Broadcom. All Rights Reserved. The term *
5 * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. *
James Smart895427b2017-02-12 13:52:30 -08006 * Copyright (C) 2004-2016 Emulex. All rights reserved. *
7 * EMULEX and SLI are trademarks of Emulex. *
James Smartd080abe2017-02-12 13:52:39 -08008 * www.broadcom.com *
James Smart895427b2017-02-12 13:52:30 -08009 * 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
James Smarta44e4e82017-04-21 16:04:45 -070024#define LPFC_NVME_DEFAULT_SEGS (64 + 1) /* 256K IOs */
James Smart895427b2017-02-12 13:52:30 -080025#define LPFC_NVME_WQSIZE 256
26
27#define LPFC_NVME_ERSP_LEN 0x20
28
James Smart01649562017-02-12 13:52:32 -080029struct lpfc_nvme_qhandle {
30 uint32_t index; /* WQ index to use */
31 uint32_t qidx; /* queue index passed to create */
32 uint32_t cpu_id; /* current cpu id at time of create */
33};
34
James Smart895427b2017-02-12 13:52:30 -080035/* Declare nvme-based local and remote port definitions. */
36struct lpfc_nvme_lport {
37 struct lpfc_vport *vport;
38 struct list_head rport_list;
39 struct completion lport_unreg_done;
40 /* Add sttats counters here */
41};
42
43struct lpfc_nvme_rport {
44 struct list_head list;
45 struct lpfc_nvme_lport *lport;
46 struct nvme_fc_remote_port *remoteport;
47 struct lpfc_nodelist *ndlp;
48 struct completion rport_unreg_done;
49};
50
51struct lpfc_nvme_buf {
52 struct list_head list;
53 struct nvmefc_fcp_req *nvmeCmd;
54 struct lpfc_nvme_rport *nrport;
James Smart318083a2017-03-04 09:30:30 -080055 struct lpfc_nodelist *ndlp;
James Smart895427b2017-02-12 13:52:30 -080056
57 uint32_t timeout;
58
59 uint16_t flags; /* TBD convert exch_busy to flags */
60#define LPFC_SBUF_XBUSY 0x1 /* SLI4 hba reported XB on WCQE cmpl */
61 uint16_t exch_busy; /* SLI4 hba reported XB on complete WCQE */
62 uint16_t status; /* From IOCB Word 7- ulpStatus */
63 uint16_t cpu;
64 uint16_t qidx;
65 uint16_t sqid;
66 uint32_t result; /* From IOCB Word 4. */
67
68 uint32_t seg_cnt; /* Number of scatter-gather segments returned by
69 * dma_map_sg. The driver needs this for calls
70 * to dma_unmap_sg.
71 */
72 dma_addr_t nonsg_phys; /* Non scatter-gather physical address. */
73
74 /*
75 * data and dma_handle are the kernel virtual and bus address of the
76 * dma-able buffer containing the fcp_cmd, fcp_rsp and a scatter
77 * gather bde list that supports the sg_tablesize value.
78 */
79 void *data;
80 dma_addr_t dma_handle;
81
82 struct sli4_sge *nvme_sgl;
83 dma_addr_t dma_phys_sgl;
84
85 /* cur_iocbq has phys of the dma-able buffer.
86 * Iotag is in here
87 */
88 struct lpfc_iocbq cur_iocbq;
89
90 wait_queue_head_t *waitq;
91 unsigned long start_time;
James Smartbd2cdd52017-02-12 13:52:33 -080092#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
93 uint64_t ts_cmd_start;
94 uint64_t ts_last_cmd;
95 uint64_t ts_cmd_wqput;
96 uint64_t ts_isr_cmpl;
97 uint64_t ts_data_nvme;
98#endif
James Smart895427b2017-02-12 13:52:30 -080099};
James Smartbbe30122017-04-21 17:49:08 -0700100
101struct lpfc_nvme_fcpreq_priv {
102 struct lpfc_nvme_buf *nvme_buf;
103};