1 /*******************************************************************
2  * This file is part of the Emulex Linux Device Driver for         *
3  * Fibre Channel Host Bus Adapters.                                *
4  * Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term *
5  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.  *
6  * Copyright (C) 2004-2016 Emulex.  All rights reserved.           *
7  * EMULEX and SLI are trademarks of Emulex.                        *
8  * www.broadcom.com                                                *
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_DEFAULT_SEGS		(64 + 1)	/* 256K IOs */
25 
26 #define LPFC_NVME_ERSP_LEN		0x20
27 
28 #define LPFC_NVME_WAIT_TMO              10
29 #define LPFC_NVME_EXPEDITE_XRICNT	8
30 #define LPFC_NVME_FB_SHIFT		9
31 #define LPFC_NVME_MAX_FB		(1 << 20)	/* 1M */
32 
33 #define LPFC_MAX_NVME_INFO_TMP_LEN	100
34 #define LPFC_NVME_INFO_MORE_STR		"\nCould be more info...\n"
35 
36 #define lpfc_ndlp_get_nrport(ndlp)					\
37 	((!ndlp->nrport || (ndlp->upcall_flags & NLP_WAIT_FOR_UNREG))	\
38 	? NULL : ndlp->nrport)
39 
40 struct lpfc_nvme_qhandle {
41 	uint32_t index;		/* WQ index to use */
42 	uint32_t qidx;		/* queue index passed to create */
43 	uint32_t cpu_id;	/* current cpu id at time of create */
44 };
45 
46 /* Declare nvme-based local and remote port definitions. */
47 struct lpfc_nvme_lport {
48 	struct lpfc_vport *vport;
49 	struct completion *lport_unreg_cmp;
50 	/* Add stats counters here */
51 	atomic_t fc4NvmeLsRequests;
52 	atomic_t fc4NvmeLsCmpls;
53 	atomic_t xmt_fcp_noxri;
54 	atomic_t xmt_fcp_bad_ndlp;
55 	atomic_t xmt_fcp_qdepth;
56 	atomic_t xmt_fcp_wqerr;
57 	atomic_t xmt_fcp_err;
58 	atomic_t xmt_fcp_abort;
59 	atomic_t xmt_ls_abort;
60 	atomic_t xmt_ls_err;
61 	atomic_t cmpl_fcp_xb;
62 	atomic_t cmpl_fcp_err;
63 	atomic_t cmpl_ls_xb;
64 	atomic_t cmpl_ls_err;
65 };
66 
67 struct lpfc_nvme_rport {
68 	struct lpfc_nvme_lport *lport;
69 	struct nvme_fc_remote_port *remoteport;
70 	struct lpfc_nodelist *ndlp;
71 	struct completion rport_unreg_done;
72 };
73 
74 struct lpfc_nvme_fcpreq_priv {
75 	struct lpfc_io_buf *nvme_buf;
76 };
77