]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/scsi/lpfc/lpfc_nvmet.h
Merge tag 'sunxi-fixes-for-4.12' of https://git.kernel.org/pub/scm/linux/kernel/git...
[karo-tx-linux.git] / drivers / scsi / lpfc / lpfc_nvmet.h
1 /*******************************************************************
2  * This file is part of the Emulex Linux Device Driver for         *
3  * Fibre Channel Host Bus Adapters.                                *
4  * Copyright (C) 2017 Broadcom. All Rights Reserved. The term      *
5  * “Broadcom” refers to Broadcom Limited 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_NVMET_DEFAULT_SEGS         (64 + 1)        /* 256K IOs */
25 #define LPFC_NVMET_SUCCESS_LEN  12
26
27 /* Used for NVME Target */
28 struct lpfc_nvmet_tgtport {
29         struct lpfc_hba *phba;
30         struct completion tport_unreg_done;
31
32         /* Stats counters - lpfc_nvmet_unsol_ls_buffer */
33         atomic_t rcv_ls_req_in;
34         atomic_t rcv_ls_req_out;
35         atomic_t rcv_ls_req_drop;
36         atomic_t xmt_ls_abort;
37
38         /* Stats counters - lpfc_nvmet_xmt_ls_rsp */
39         atomic_t xmt_ls_rsp;
40         atomic_t xmt_ls_drop;
41
42         /* Stats counters - lpfc_nvmet_xmt_ls_rsp_cmp */
43         atomic_t xmt_ls_rsp_error;
44         atomic_t xmt_ls_rsp_cmpl;
45
46         /* Stats counters - lpfc_nvmet_unsol_fcp_buffer */
47         atomic_t rcv_fcp_cmd_in;
48         atomic_t rcv_fcp_cmd_out;
49         atomic_t rcv_fcp_cmd_drop;
50
51         /* Stats counters - lpfc_nvmet_xmt_fcp_op */
52         atomic_t xmt_fcp_abort;
53         atomic_t xmt_fcp_drop;
54         atomic_t xmt_fcp_read_rsp;
55         atomic_t xmt_fcp_read;
56         atomic_t xmt_fcp_write;
57         atomic_t xmt_fcp_rsp;
58
59         /* Stats counters - lpfc_nvmet_xmt_fcp_op_cmp */
60         atomic_t xmt_fcp_rsp_cmpl;
61         atomic_t xmt_fcp_rsp_error;
62         atomic_t xmt_fcp_rsp_drop;
63
64
65         /* Stats counters - lpfc_nvmet_unsol_issue_abort */
66         atomic_t xmt_abort_rsp;
67         atomic_t xmt_abort_rsp_error;
68
69         /* Stats counters - lpfc_nvmet_xmt_abort_cmp */
70         atomic_t xmt_abort_cmpl;
71 };
72
73 struct lpfc_nvmet_rcv_ctx {
74         union {
75                 struct nvmefc_tgt_ls_req ls_req;
76                 struct nvmefc_tgt_fcp_req fcp_req;
77         } ctx;
78         struct list_head list;
79         struct lpfc_hba *phba;
80         struct lpfc_iocbq *wqeq;
81         struct lpfc_iocbq *abort_wqeq;
82         dma_addr_t txrdy_phys;
83         spinlock_t ctxlock; /* protect flag access */
84         uint32_t *txrdy;
85         uint32_t sid;
86         uint32_t offset;
87         uint16_t oxid;
88         uint16_t size;
89         uint16_t entry_cnt;
90         uint16_t cpu;
91         uint16_t state;
92         /* States */
93 #define LPFC_NVMET_STE_FREE             0
94 #define LPFC_NVMET_STE_RCV              1
95 #define LPFC_NVMET_STE_DATA             2
96 #define LPFC_NVMET_STE_ABORT            3
97 #define LPFC_NVMET_STE_RSP              4
98 #define LPFC_NVMET_STE_DONE             5
99         uint16_t flag;
100 #define LPFC_NVMET_IO_INP               0x1  /* IO is in progress on exchange */
101 #define LPFC_NVMET_ABORT_OP             0x2  /* Abort WQE issued on exchange */
102 #define LPFC_NVMET_XBUSY                0x4  /* XB bit set on IO cmpl */
103 #define LPFC_NVMET_CTX_RLS              0x8  /* ctx free requested */
104 #define LPFC_NVMET_ABTS_RCV             0x10  /* ABTS received on exchange */
105         struct rqb_dmabuf *rqb_buffer;
106
107 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
108         uint64_t ts_isr_cmd;
109         uint64_t ts_cmd_nvme;
110         uint64_t ts_nvme_data;
111         uint64_t ts_data_wqput;
112         uint64_t ts_isr_data;
113         uint64_t ts_data_nvme;
114         uint64_t ts_nvme_status;
115         uint64_t ts_status_wqput;
116         uint64_t ts_isr_status;
117         uint64_t ts_status_nvme;
118 #endif
119 };