2017-02-13 05:52:30 +08:00
|
|
|
/*******************************************************************
|
|
|
|
* This file is part of the Emulex Linux Device Driver for *
|
|
|
|
* Fibre Channel Host Bus Adapters. *
|
2018-03-06 04:04:10 +08:00
|
|
|
* Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
|
2018-05-05 11:37:59 +08:00
|
|
|
* “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. *
|
2017-02-13 05:52:30 +08:00
|
|
|
* Copyright (C) 2004-2016 Emulex. All rights reserved. *
|
|
|
|
* EMULEX and SLI are trademarks of Emulex. *
|
2017-02-13 05:52:39 +08:00
|
|
|
* www.broadcom.com *
|
2017-02-13 05:52:30 +08:00
|
|
|
* Portions Copyright (C) 2004-2005 Christoph Hellwig *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of version 2 of the GNU General *
|
|
|
|
* Public License as published by the Free Software Foundation. *
|
|
|
|
* This program is distributed in the hope that it will be useful. *
|
|
|
|
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
|
|
|
|
* WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
|
|
|
|
* DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
|
|
|
|
* TO BE LEGALLY INVALID. See the GNU General Public License for *
|
|
|
|
* more details, a copy of which can be found in the file COPYING *
|
|
|
|
* included with this package. *
|
|
|
|
********************************************************************/
|
|
|
|
|
2017-04-22 07:04:45 +08:00
|
|
|
#define LPFC_NVME_DEFAULT_SEGS (64 + 1) /* 256K IOs */
|
2017-02-13 05:52:30 +08:00
|
|
|
|
|
|
|
#define LPFC_NVME_ERSP_LEN 0x20
|
|
|
|
|
2017-11-21 08:00:40 +08:00
|
|
|
#define LPFC_NVME_WAIT_TMO 10
|
2017-12-09 09:18:03 +08:00
|
|
|
#define LPFC_NVME_EXPEDITE_XRICNT 8
|
2018-03-06 04:04:02 +08:00
|
|
|
#define LPFC_NVME_FB_SHIFT 9
|
|
|
|
#define LPFC_NVME_MAX_FB (1 << 20) /* 1M */
|
2017-11-21 08:00:40 +08:00
|
|
|
|
2018-04-10 05:24:27 +08:00
|
|
|
#define lpfc_ndlp_get_nrport(ndlp) \
|
|
|
|
((!ndlp->nrport || (ndlp->upcall_flags & NLP_WAIT_FOR_UNREG)) \
|
|
|
|
? NULL : ndlp->nrport)
|
|
|
|
|
2017-02-13 05:52:32 +08:00
|
|
|
struct lpfc_nvme_qhandle {
|
|
|
|
uint32_t index; /* WQ index to use */
|
|
|
|
uint32_t qidx; /* queue index passed to create */
|
|
|
|
uint32_t cpu_id; /* current cpu id at time of create */
|
|
|
|
};
|
|
|
|
|
2018-04-10 05:24:23 +08:00
|
|
|
struct lpfc_nvme_ctrl_stat {
|
|
|
|
atomic_t fc4NvmeInputRequests;
|
|
|
|
atomic_t fc4NvmeOutputRequests;
|
|
|
|
atomic_t fc4NvmeControlRequests;
|
|
|
|
atomic_t fc4NvmeIoCmpls;
|
|
|
|
};
|
|
|
|
|
2017-02-13 05:52:30 +08:00
|
|
|
/* Declare nvme-based local and remote port definitions. */
|
|
|
|
struct lpfc_nvme_lport {
|
|
|
|
struct lpfc_vport *vport;
|
|
|
|
struct completion lport_unreg_done;
|
2017-12-09 09:18:10 +08:00
|
|
|
/* Add stats counters here */
|
2018-04-10 05:24:23 +08:00
|
|
|
struct lpfc_nvme_ctrl_stat *cstat;
|
|
|
|
atomic_t fc4NvmeLsRequests;
|
|
|
|
atomic_t fc4NvmeLsCmpls;
|
2017-12-09 09:18:10 +08:00
|
|
|
atomic_t xmt_fcp_noxri;
|
|
|
|
atomic_t xmt_fcp_bad_ndlp;
|
|
|
|
atomic_t xmt_fcp_qdepth;
|
|
|
|
atomic_t xmt_fcp_wqerr;
|
2018-05-05 11:37:56 +08:00
|
|
|
atomic_t xmt_fcp_err;
|
2017-12-09 09:18:10 +08:00
|
|
|
atomic_t xmt_fcp_abort;
|
|
|
|
atomic_t xmt_ls_abort;
|
|
|
|
atomic_t xmt_ls_err;
|
|
|
|
atomic_t cmpl_fcp_xb;
|
|
|
|
atomic_t cmpl_fcp_err;
|
|
|
|
atomic_t cmpl_ls_xb;
|
|
|
|
atomic_t cmpl_ls_err;
|
2017-02-13 05:52:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct lpfc_nvme_rport {
|
|
|
|
struct lpfc_nvme_lport *lport;
|
|
|
|
struct nvme_fc_remote_port *remoteport;
|
|
|
|
struct lpfc_nodelist *ndlp;
|
|
|
|
struct completion rport_unreg_done;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct lpfc_nvme_buf {
|
2019-01-29 03:14:19 +08:00
|
|
|
/* Common fields */
|
2017-02-13 05:52:30 +08:00
|
|
|
struct list_head list;
|
2019-01-29 03:14:19 +08:00
|
|
|
void *data;
|
|
|
|
dma_addr_t dma_handle;
|
|
|
|
dma_addr_t dma_phys_sgl;
|
|
|
|
struct sli4_sge *dma_sgl;
|
|
|
|
struct lpfc_iocbq cur_iocbq;
|
2019-01-29 03:14:22 +08:00
|
|
|
uint16_t hdwq;
|
|
|
|
uint16_t cpu;
|
2019-01-29 03:14:19 +08:00
|
|
|
|
|
|
|
/* NVME specific fields */
|
2017-02-13 05:52:30 +08:00
|
|
|
struct nvmefc_fcp_req *nvmeCmd;
|
2017-03-05 01:30:30 +08:00
|
|
|
struct lpfc_nodelist *ndlp;
|
2017-02-13 05:52:30 +08:00
|
|
|
|
|
|
|
uint32_t timeout;
|
|
|
|
|
|
|
|
uint16_t flags; /* TBD convert exch_busy to flags */
|
|
|
|
#define LPFC_SBUF_XBUSY 0x1 /* SLI4 hba reported XB on WCQE cmpl */
|
2018-08-01 08:23:22 +08:00
|
|
|
#define LPFC_BUMP_QDEPTH 0x2 /* bumped queue depth counter */
|
2017-02-13 05:52:30 +08:00
|
|
|
uint16_t exch_busy; /* SLI4 hba reported XB on complete WCQE */
|
2019-01-29 03:14:19 +08:00
|
|
|
uint16_t status; /* From IOCB Word 7- ulpStatus */
|
2017-02-13 05:52:30 +08:00
|
|
|
uint32_t result; /* From IOCB Word 4. */
|
|
|
|
|
|
|
|
uint32_t seg_cnt; /* Number of scatter-gather segments returned by
|
|
|
|
* dma_map_sg. The driver needs this for calls
|
|
|
|
* to dma_unmap_sg.
|
|
|
|
*/
|
|
|
|
wait_queue_head_t *waitq;
|
|
|
|
unsigned long start_time;
|
2019-01-29 03:14:19 +08:00
|
|
|
|
|
|
|
uint16_t qidx;
|
|
|
|
|
2017-02-13 05:52:33 +08:00
|
|
|
#ifdef CONFIG_SCSI_LPFC_DEBUG_FS
|
|
|
|
uint64_t ts_cmd_start;
|
|
|
|
uint64_t ts_last_cmd;
|
|
|
|
uint64_t ts_cmd_wqput;
|
|
|
|
uint64_t ts_isr_cmpl;
|
|
|
|
uint64_t ts_data_nvme;
|
|
|
|
#endif
|
2017-02-13 05:52:30 +08:00
|
|
|
};
|
2017-04-22 08:49:08 +08:00
|
|
|
|
|
|
|
struct lpfc_nvme_fcpreq_priv {
|
|
|
|
struct lpfc_nvme_buf *nvme_buf;
|
|
|
|
};
|