Commit | Line | Data |
---|---|---|
e84067d7 DG |
1 | /* |
2 | * QLogic Fibre Channel HBA Driver | |
3 | * Copyright (c) 2003-2017 QLogic Corporation | |
4 | * | |
5 | * See LICENSE.qla2xxx for copyright and licensing details. | |
6 | */ | |
7 | #ifndef __QLA_NVME_H | |
8 | #define __QLA_NVME_H | |
9 | ||
10 | #include <linux/blk-mq.h> | |
11 | #include <uapi/scsi/fc/fc_fs.h> | |
12 | #include <uapi/scsi/fc/fc_els.h> | |
13 | #include <linux/nvme-fc-driver.h> | |
14 | ||
0f7e51f6 | 15 | #include "qla_def.h" |
15b7a68c | 16 | #include "qla_dsd.h" |
0f7e51f6 | 17 | |
9dd9686b DT |
18 | /* default dev loss time (seconds) before transport tears down ctrl */ |
19 | #define NVME_FC_DEV_LOSS_TMO 30 | |
20 | ||
e84067d7 DG |
21 | #define NVME_ATIO_CMD_OFF 32 |
22 | #define NVME_FIRST_PACKET_CMDLEN (64 - NVME_ATIO_CMD_OFF) | |
23 | #define Q2T_NVME_NUM_TAGS 2048 | |
24 | #define QLA_MAX_FC_SEGMENTS 64 | |
25 | ||
0f7e51f6 | 26 | struct scsi_qla_host; |
27 | struct qla_hw_data; | |
28 | struct req_que; | |
e84067d7 | 29 | struct srb; |
0f7e51f6 | 30 | |
e84067d7 DG |
31 | struct nvme_private { |
32 | struct srb *sp; | |
33 | struct nvmefc_ls_req *fd; | |
34 | struct work_struct ls_work; | |
e473b307 | 35 | struct work_struct abort_work; |
e84067d7 | 36 | int comp_status; |
4c2a2d01 | 37 | spinlock_t cmd_lock; |
e84067d7 DG |
38 | }; |
39 | ||
9dd9686b | 40 | struct qla_nvme_rport { |
e84067d7 DG |
41 | struct fc_port *fcport; |
42 | }; | |
43 | ||
44 | #define COMMAND_NVME 0x88 /* Command Type FC-NVMe IOCB */ | |
45 | struct cmd_nvme { | |
46 | uint8_t entry_type; /* Entry type. */ | |
47 | uint8_t entry_count; /* Entry count. */ | |
48 | uint8_t sys_define; /* System defined. */ | |
49 | uint8_t entry_status; /* Entry Status. */ | |
50 | ||
51 | uint32_t handle; /* System handle. */ | |
52 | uint16_t nport_handle; /* N_PORT handle. */ | |
53 | uint16_t timeout; /* Command timeout. */ | |
54 | ||
55 | uint16_t dseg_count; /* Data segment count. */ | |
56 | uint16_t nvme_rsp_dsd_len; /* NVMe RSP DSD length */ | |
57 | ||
58 | uint64_t rsvd; | |
59 | ||
60 | uint16_t control_flags; /* Control Flags */ | |
03aaa89f | 61 | #define CF_NVME_FIRST_BURST_ENABLE BIT_11 |
e84067d7 DG |
62 | #define CF_DIF_SEG_DESCR_ENABLE BIT_3 |
63 | #define CF_DATA_SEG_DESCR_ENABLE BIT_2 | |
64 | #define CF_READ_DATA BIT_1 | |
65 | #define CF_WRITE_DATA BIT_0 | |
66 | ||
67 | uint16_t nvme_cmnd_dseg_len; /* Data segment length. */ | |
d4556a49 BVA |
68 | __le64 nvme_cmnd_dseg_address __packed;/* Data segment address. */ |
69 | __le64 nvme_rsp_dseg_address __packed; /* Data segment address. */ | |
e84067d7 DG |
70 | |
71 | uint32_t byte_count; /* Total byte count. */ | |
72 | ||
73 | uint8_t port_id[3]; /* PortID of destination port. */ | |
74 | uint8_t vp_index; | |
75 | ||
15b7a68c | 76 | struct dsd64 nvme_dsd; |
e84067d7 DG |
77 | }; |
78 | ||
79 | #define PT_LS4_REQUEST 0x89 /* Link Service pass-through IOCB (request) */ | |
80 | struct pt_ls4_request { | |
81 | uint8_t entry_type; | |
82 | uint8_t entry_count; | |
83 | uint8_t sys_define; | |
84 | uint8_t entry_status; | |
85 | uint32_t handle; | |
86 | uint16_t status; | |
87 | uint16_t nport_handle; | |
88 | uint16_t tx_dseg_count; | |
89 | uint8_t vp_index; | |
90 | uint8_t rsvd; | |
91 | uint16_t timeout; | |
92 | uint16_t control_flags; | |
93 | #define CF_LS4_SHIFT 13 | |
94 | #define CF_LS4_ORIGINATOR 0 | |
95 | #define CF_LS4_RESPONDER 1 | |
96 | #define CF_LS4_RESPONDER_TERM 2 | |
97 | ||
98 | uint16_t rx_dseg_count; | |
99 | uint16_t rsvd2; | |
100 | uint32_t exchange_address; | |
101 | uint32_t rsvd3; | |
102 | uint32_t rx_byte_count; | |
103 | uint32_t tx_byte_count; | |
15b7a68c | 104 | struct dsd64 dsd[2]; |
e84067d7 DG |
105 | }; |
106 | ||
107 | #define PT_LS4_UNSOL 0x56 /* pass-up unsolicited rec FC-NVMe request */ | |
108 | struct pt_ls4_rx_unsol { | |
109 | uint8_t entry_type; | |
110 | uint8_t entry_count; | |
111 | uint16_t rsvd0; | |
112 | uint16_t rsvd1; | |
113 | uint8_t vp_index; | |
114 | uint8_t rsvd2; | |
115 | uint16_t rsvd3; | |
116 | uint16_t nport_handle; | |
117 | uint16_t frame_size; | |
118 | uint16_t rsvd4; | |
119 | uint32_t exchange_address; | |
120 | uint8_t d_id[3]; | |
121 | uint8_t r_ctl; | |
df95f39a | 122 | be_id_t s_id; |
e84067d7 DG |
123 | uint8_t cs_ctl; |
124 | uint8_t f_ctl[3]; | |
125 | uint8_t type; | |
126 | uint16_t seq_cnt; | |
127 | uint8_t df_ctl; | |
128 | uint8_t seq_id; | |
129 | uint16_t rx_id; | |
130 | uint16_t ox_id; | |
131 | uint32_t param; | |
132 | uint32_t desc0; | |
133 | #define PT_LS4_PAYLOAD_OFFSET 0x2c | |
134 | #define PT_LS4_FIRST_PACKET_LEN 20 | |
135 | uint32_t desc_len; | |
136 | uint32_t payload[3]; | |
137 | }; | |
0f7e51f6 | 138 | |
139 | /* | |
140 | * Global functions prototype in qla_nvme.c source file. | |
141 | */ | |
8777e431 | 142 | int qla_nvme_register_hba(struct scsi_qla_host *); |
0f7e51f6 | 143 | int qla_nvme_register_remote(struct scsi_qla_host *, struct fc_port *); |
144 | void qla_nvme_delete(struct scsi_qla_host *); | |
0f7e51f6 | 145 | void qla24xx_nvme_ls4_iocb(struct scsi_qla_host *, struct pt_ls4_request *, |
146 | struct req_que *); | |
6c18a43e | 147 | void qla24xx_async_gffid_sp_done(struct srb *sp, int); |
e84067d7 | 148 | #endif |