James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 1 | /******************************************************************* |
| 2 | * This file is part of the Emulex Linux Device Driver for * |
| 3 | * Fibre Channel Host Bus Adapters. * |
James Smart | d080abe | 2017-02-12 13:52:39 -0800 | [diff] [blame] | 4 | * Copyright (C) 2017 Broadcom. All Rights Reserved. The term * |
| 5 | * “Broadcom” refers to Broadcom Limited and/or its subsidiaries. * |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 6 | * Copyright (C) 2004-2016 Emulex. All rights reserved. * |
| 7 | * EMULEX and SLI are trademarks of Emulex. * |
James Smart | d080abe | 2017-02-12 13:52:39 -0800 | [diff] [blame] | 8 | * www.broadcom.com * |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 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 | |
James Smart | a44e4e8 | 2017-04-21 16:04:45 -0700 | [diff] [blame] | 24 | #define LPFC_NVMET_DEFAULT_SEGS (64 + 1) /* 256K IOs */ |
James Smart | 61f3d4b | 2017-05-15 15:20:41 -0700 | [diff] [blame] | 25 | #define LPFC_NVMET_RQE_DEF_COUNT 512 |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 26 | #define LPFC_NVMET_SUCCESS_LEN 12 |
| 27 | |
| 28 | /* Used for NVME Target */ |
| 29 | struct lpfc_nvmet_tgtport { |
| 30 | struct lpfc_hba *phba; |
| 31 | struct completion tport_unreg_done; |
| 32 | |
| 33 | /* Stats counters - lpfc_nvmet_unsol_ls_buffer */ |
| 34 | atomic_t rcv_ls_req_in; |
| 35 | atomic_t rcv_ls_req_out; |
| 36 | atomic_t rcv_ls_req_drop; |
| 37 | atomic_t xmt_ls_abort; |
James Smart | 547077a | 2017-05-15 15:20:40 -0700 | [diff] [blame] | 38 | atomic_t xmt_ls_abort_cmpl; |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 39 | |
| 40 | /* Stats counters - lpfc_nvmet_xmt_ls_rsp */ |
| 41 | atomic_t xmt_ls_rsp; |
| 42 | atomic_t xmt_ls_drop; |
| 43 | |
| 44 | /* Stats counters - lpfc_nvmet_xmt_ls_rsp_cmp */ |
| 45 | atomic_t xmt_ls_rsp_error; |
| 46 | atomic_t xmt_ls_rsp_cmpl; |
| 47 | |
| 48 | /* Stats counters - lpfc_nvmet_unsol_fcp_buffer */ |
| 49 | atomic_t rcv_fcp_cmd_in; |
| 50 | atomic_t rcv_fcp_cmd_out; |
| 51 | atomic_t rcv_fcp_cmd_drop; |
James Smart | 547077a | 2017-05-15 15:20:40 -0700 | [diff] [blame] | 52 | atomic_t xmt_fcp_release; |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 53 | |
| 54 | /* Stats counters - lpfc_nvmet_xmt_fcp_op */ |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 55 | atomic_t xmt_fcp_drop; |
| 56 | atomic_t xmt_fcp_read_rsp; |
| 57 | atomic_t xmt_fcp_read; |
| 58 | atomic_t xmt_fcp_write; |
| 59 | atomic_t xmt_fcp_rsp; |
| 60 | |
| 61 | /* Stats counters - lpfc_nvmet_xmt_fcp_op_cmp */ |
| 62 | atomic_t xmt_fcp_rsp_cmpl; |
| 63 | atomic_t xmt_fcp_rsp_error; |
| 64 | atomic_t xmt_fcp_rsp_drop; |
| 65 | |
| 66 | |
James Smart | 547077a | 2017-05-15 15:20:40 -0700 | [diff] [blame] | 67 | /* Stats counters - lpfc_nvmet_xmt_fcp_abort */ |
| 68 | atomic_t xmt_fcp_abort; |
| 69 | atomic_t xmt_fcp_abort_cmpl; |
| 70 | atomic_t xmt_abort_sol; |
| 71 | atomic_t xmt_abort_unsol; |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 72 | atomic_t xmt_abort_rsp; |
| 73 | atomic_t xmt_abort_rsp_error; |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | struct lpfc_nvmet_rcv_ctx { |
| 77 | union { |
| 78 | struct nvmefc_tgt_ls_req ls_req; |
| 79 | struct nvmefc_tgt_fcp_req fcp_req; |
| 80 | } ctx; |
James Smart | 86c6737 | 2017-04-21 16:05:04 -0700 | [diff] [blame] | 81 | struct list_head list; |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 82 | struct lpfc_hba *phba; |
| 83 | struct lpfc_iocbq *wqeq; |
| 84 | struct lpfc_iocbq *abort_wqeq; |
| 85 | dma_addr_t txrdy_phys; |
James Smart | 19b58d9 | 2017-04-11 11:32:29 -0700 | [diff] [blame] | 86 | spinlock_t ctxlock; /* protect flag access */ |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 87 | uint32_t *txrdy; |
| 88 | uint32_t sid; |
| 89 | uint32_t offset; |
| 90 | uint16_t oxid; |
| 91 | uint16_t size; |
| 92 | uint16_t entry_cnt; |
| 93 | uint16_t cpu; |
| 94 | uint16_t state; |
| 95 | /* States */ |
| 96 | #define LPFC_NVMET_STE_FREE 0 |
| 97 | #define LPFC_NVMET_STE_RCV 1 |
| 98 | #define LPFC_NVMET_STE_DATA 2 |
| 99 | #define LPFC_NVMET_STE_ABORT 3 |
| 100 | #define LPFC_NVMET_STE_RSP 4 |
| 101 | #define LPFC_NVMET_STE_DONE 5 |
| 102 | uint16_t flag; |
James Smart | 86c6737 | 2017-04-21 16:05:04 -0700 | [diff] [blame] | 103 | #define LPFC_NVMET_IO_INP 0x1 /* IO is in progress on exchange */ |
| 104 | #define LPFC_NVMET_ABORT_OP 0x2 /* Abort WQE issued on exchange */ |
| 105 | #define LPFC_NVMET_XBUSY 0x4 /* XB bit set on IO cmpl */ |
| 106 | #define LPFC_NVMET_CTX_RLS 0x8 /* ctx free requested */ |
| 107 | #define LPFC_NVMET_ABTS_RCV 0x10 /* ABTS received on exchange */ |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 108 | struct rqb_dmabuf *rqb_buffer; |
James Smart | 6c621a2 | 2017-05-15 15:20:45 -0700 | [diff] [blame] | 109 | struct lpfc_nvmet_ctxbuf *ctxbuf; |
James Smart | 2b65e18 | 2017-02-12 13:52:38 -0800 | [diff] [blame] | 110 | |
| 111 | #ifdef CONFIG_SCSI_LPFC_DEBUG_FS |
| 112 | uint64_t ts_isr_cmd; |
| 113 | uint64_t ts_cmd_nvme; |
| 114 | uint64_t ts_nvme_data; |
| 115 | uint64_t ts_data_wqput; |
| 116 | uint64_t ts_isr_data; |
| 117 | uint64_t ts_data_nvme; |
| 118 | uint64_t ts_nvme_status; |
| 119 | uint64_t ts_status_wqput; |
| 120 | uint64_t ts_isr_status; |
| 121 | uint64_t ts_status_nvme; |
| 122 | #endif |
James Smart | f358dd0 | 2017-02-12 13:52:34 -0800 | [diff] [blame] | 123 | }; |