xref: /openbmc/linux/drivers/scsi/lpfc/lpfc_nvme.h (revision c490850a)
1895427bdSJames Smart /*******************************************************************
2895427bdSJames Smart  * This file is part of the Emulex Linux Device Driver for         *
3895427bdSJames Smart  * Fibre Channel Host Bus Adapters.                                *
4217c55cdSJames Smart  * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
53e21d1cbSJames Smart  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.  *
6895427bdSJames Smart  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
7895427bdSJames Smart  * EMULEX and SLI are trademarks of Emulex.                        *
8d080abe0SJames Smart  * www.broadcom.com                                                *
9895427bdSJames Smart  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
10895427bdSJames Smart  *                                                                 *
11895427bdSJames Smart  * This program is free software; you can redistribute it and/or   *
12895427bdSJames Smart  * modify it under the terms of version 2 of the GNU General       *
13895427bdSJames Smart  * Public License as published by the Free Software Foundation.    *
14895427bdSJames Smart  * This program is distributed in the hope that it will be useful. *
15895427bdSJames Smart  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
16895427bdSJames Smart  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
17895427bdSJames Smart  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
18895427bdSJames Smart  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
19895427bdSJames Smart  * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
20895427bdSJames Smart  * more details, a copy of which can be found in the file COPYING  *
21895427bdSJames Smart  * included with this package.                                     *
22895427bdSJames Smart  ********************************************************************/
23895427bdSJames Smart 
24a44e4e8bSJames Smart #define LPFC_NVME_DEFAULT_SEGS		(64 + 1)	/* 256K IOs */
25895427bdSJames Smart 
26895427bdSJames Smart #define LPFC_NVME_ERSP_LEN		0x20
27895427bdSJames Smart 
28add9d6beSJames Smart #define LPFC_NVME_WAIT_TMO              10
29cf1a1d3eSJames Smart #define LPFC_NVME_EXPEDITE_XRICNT	8
300709263aSJames Smart #define LPFC_NVME_FB_SHIFT		9
310709263aSJames Smart #define LPFC_NVME_MAX_FB		(1 << 20)	/* 1M */
32add9d6beSJames Smart 
334c47efc1SJames Smart #define LPFC_MAX_NVME_INFO_TMP_LEN	100
344c47efc1SJames Smart #define LPFC_NVME_INFO_MORE_STR		"\nCould be more info...\n"
354c47efc1SJames Smart 
3601466024SJames Smart #define lpfc_ndlp_get_nrport(ndlp)					\
3701466024SJames Smart 	((!ndlp->nrport || (ndlp->upcall_flags & NLP_WAIT_FOR_UNREG))	\
3801466024SJames Smart 	? NULL : ndlp->nrport)
3901466024SJames Smart 
4001649561SJames Smart struct lpfc_nvme_qhandle {
4101649561SJames Smart 	uint32_t index;		/* WQ index to use */
4201649561SJames Smart 	uint32_t qidx;		/* queue index passed to create */
4301649561SJames Smart 	uint32_t cpu_id;	/* current cpu id at time of create */
4401649561SJames Smart };
4501649561SJames Smart 
46895427bdSJames Smart /* Declare nvme-based local and remote port definitions. */
47895427bdSJames Smart struct lpfc_nvme_lport {
48895427bdSJames Smart 	struct lpfc_vport *vport;
49895427bdSJames Smart 	struct completion lport_unreg_done;
504b056682SJames Smart 	/* Add stats counters here */
5166a210ffSJames Smart 	atomic_t fc4NvmeLsRequests;
5266a210ffSJames Smart 	atomic_t fc4NvmeLsCmpls;
534b056682SJames Smart 	atomic_t xmt_fcp_noxri;
544b056682SJames Smart 	atomic_t xmt_fcp_bad_ndlp;
554b056682SJames Smart 	atomic_t xmt_fcp_qdepth;
564b056682SJames Smart 	atomic_t xmt_fcp_wqerr;
5744c2757bSJames Smart 	atomic_t xmt_fcp_err;
584b056682SJames Smart 	atomic_t xmt_fcp_abort;
594b056682SJames Smart 	atomic_t xmt_ls_abort;
604b056682SJames Smart 	atomic_t xmt_ls_err;
614b056682SJames Smart 	atomic_t cmpl_fcp_xb;
624b056682SJames Smart 	atomic_t cmpl_fcp_err;
634b056682SJames Smart 	atomic_t cmpl_ls_xb;
644b056682SJames Smart 	atomic_t cmpl_ls_err;
65895427bdSJames Smart };
66895427bdSJames Smart 
67895427bdSJames Smart struct lpfc_nvme_rport {
68895427bdSJames Smart 	struct lpfc_nvme_lport *lport;
69895427bdSJames Smart 	struct nvme_fc_remote_port *remoteport;
70895427bdSJames Smart 	struct lpfc_nodelist *ndlp;
71895427bdSJames Smart 	struct completion rport_unreg_done;
72895427bdSJames Smart };
73895427bdSJames Smart 
74bbe3012bSJames Smart struct lpfc_nvme_fcpreq_priv {
75c490850aSJames Smart 	struct lpfc_io_buf *nvme_buf;
76bbe3012bSJames Smart };
77