Print this page
8629 nvme: rework command abortion
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Jason King <jason.king@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/io/nvme/nvme_var.h
+++ new/usr/src/uts/common/io/nvme/nvme_var.h
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 13 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * Copyright 2016 The MathWorks, Inc. All rights reserved.
15 15 */
16 16
17 17 #ifndef _NVME_VAR_H
18 18 #define _NVME_VAR_H
19 19
20 20 #include <sys/ddi.h>
21 21 #include <sys/sunddi.h>
22 22 #include <sys/blkdev.h>
23 23 #include <sys/taskq_impl.h>
24 +#include <sys/list.h>
24 25
25 26 /*
26 27 * NVMe driver state
27 28 */
28 29
29 30 #ifdef __cplusplus
30 31 extern "C" {
31 32 #endif
32 33
33 34 #define NVME_FMA_INIT 0x1
34 35 #define NVME_REGS_MAPPED 0x2
35 36 #define NVME_ADMIN_QUEUE 0x4
36 37 #define NVME_CTRL_LIMITS 0x8
37 38 #define NVME_INTERRUPTS 0x10
38 39
39 40 #define NVME_MIN_ADMIN_QUEUE_LEN 16
40 41 #define NVME_MIN_IO_QUEUE_LEN 16
41 42 #define NVME_DEFAULT_ADMIN_QUEUE_LEN 256
42 43 #define NVME_DEFAULT_IO_QUEUE_LEN 1024
43 44 #define NVME_DEFAULT_ASYNC_EVENT_LIMIT 10
44 45 #define NVME_MIN_ASYNC_EVENT_LIMIT 1
45 46 #define NVME_DEFAULT_MIN_BLOCK_SIZE 512
46 47
47 48
48 49 typedef struct nvme nvme_t;
49 50 typedef struct nvme_namespace nvme_namespace_t;
50 51 typedef struct nvme_minor_state nvme_minor_state_t;
51 52 typedef struct nvme_dma nvme_dma_t;
52 53 typedef struct nvme_cmd nvme_cmd_t;
53 54 typedef struct nvme_qpair nvme_qpair_t;
54 55 typedef struct nvme_task_arg nvme_task_arg_t;
55 56
56 57 struct nvme_minor_state {
57 58 kmutex_t nm_mutex;
58 59 boolean_t nm_oexcl;
59 60 uint_t nm_ocnt;
60 61 };
61 62
62 63 struct nvme_dma {
↓ open down ↓ |
29 lines elided |
↑ open up ↑ |
63 64 ddi_dma_handle_t nd_dmah;
64 65 ddi_acc_handle_t nd_acch;
65 66 ddi_dma_cookie_t nd_cookie;
66 67 uint_t nd_ncookie;
67 68 caddr_t nd_memp;
68 69 size_t nd_len;
69 70 boolean_t nd_cached;
70 71 };
71 72
72 73 struct nvme_cmd {
74 + struct list_node nc_list;
75 +
73 76 nvme_sqe_t nc_sqe;
74 77 nvme_cqe_t nc_cqe;
75 78
76 79 void (*nc_callback)(void *);
77 80 bd_xfer_t *nc_xfer;
78 81 boolean_t nc_completed;
79 82 boolean_t nc_dontpanic;
80 83 uint16_t nc_sqid;
81 84
82 85 nvme_dma_t *nc_dma;
83 86
84 87 kmutex_t nc_mutex;
85 88 kcondvar_t nc_cv;
86 89
87 90 taskq_ent_t nc_tqent;
88 91 nvme_t *nc_nvme;
89 92 };
90 93
91 94 struct nvme_qpair {
92 95 size_t nq_nentry;
93 96
94 97 nvme_dma_t *nq_sqdma;
95 98 nvme_sqe_t *nq_sq;
96 99 uint_t nq_sqhead;
97 100 uint_t nq_sqtail;
98 101 uintptr_t nq_sqtdbl;
99 102
100 103 nvme_dma_t *nq_cqdma;
101 104 nvme_cqe_t *nq_cq;
102 105 uint_t nq_cqhead;
103 106 uint_t nq_cqtail;
104 107 uintptr_t nq_cqhdbl;
105 108
106 109 nvme_cmd_t **nq_cmd;
107 110 uint16_t nq_next_cmd;
108 111 uint_t nq_active_cmds;
109 112 int nq_phase;
110 113
111 114 kmutex_t nq_mutex;
112 115 ksema_t nq_sema;
113 116 };
114 117
115 118 struct nvme {
116 119 dev_info_t *n_dip;
117 120 int n_progress;
118 121
119 122 caddr_t n_regs;
120 123 ddi_acc_handle_t n_regh;
121 124
122 125 kmem_cache_t *n_cmd_cache;
123 126 kmem_cache_t *n_prp_cache;
124 127
125 128 size_t n_inth_sz;
126 129 ddi_intr_handle_t *n_inth;
127 130 int n_intr_cnt;
128 131 uint_t n_intr_pri;
129 132 int n_intr_cap;
130 133 int n_intr_type;
131 134 int n_intr_types;
132 135
133 136 char *n_product;
134 137 char *n_vendor;
135 138
136 139 nvme_version_t n_version;
137 140 boolean_t n_dead;
138 141 boolean_t n_strict_version;
139 142 boolean_t n_ignore_unknown_vendor_status;
140 143 uint32_t n_admin_queue_len;
141 144 uint32_t n_io_queue_len;
142 145 uint16_t n_async_event_limit;
143 146 uint_t n_min_block_size;
144 147 uint16_t n_abort_command_limit;
145 148 uint64_t n_max_data_transfer_size;
146 149 boolean_t n_write_cache_present;
147 150 boolean_t n_write_cache_enabled;
148 151 int n_error_log_len;
149 152 boolean_t n_lba_range_supported;
150 153 boolean_t n_auto_pst_supported;
151 154
↓ open down ↓ |
69 lines elided |
↑ open up ↑ |
152 155 int n_nssr_supported;
153 156 int n_doorbell_stride;
154 157 int n_timeout;
155 158 int n_arbitration_mechanisms;
156 159 int n_cont_queues_reqd;
157 160 int n_max_queue_entries;
158 161 int n_pageshift;
159 162 int n_pagesize;
160 163
161 164 int n_namespace_count;
162 - int n_ioq_count;
165 + uint16_t n_ioq_count;
163 166
164 167 nvme_identify_ctrl_t *n_idctl;
165 168
166 169 nvme_qpair_t *n_adminq;
167 170 nvme_qpair_t **n_ioq;
168 171
169 172 nvme_namespace_t *n_ns;
170 173
171 174 ddi_dma_attr_t n_queue_dma_attr;
172 175 ddi_dma_attr_t n_prp_dma_attr;
173 176 ddi_dma_attr_t n_sgl_dma_attr;
174 177 ddi_device_acc_attr_t n_reg_acc_attr;
175 178 ddi_iblock_cookie_t n_fm_ibc;
176 179 int n_fm_cap;
177 180
178 181 ksema_t n_abort_sema;
179 182
180 183 ddi_taskq_t *n_cmd_taskq;
181 184
182 185 /* state for devctl minor node */
183 186 nvme_minor_state_t n_minor;
184 187
185 188 /* errors detected by driver */
186 189 uint32_t n_dma_bind_err;
187 190 uint32_t n_abort_failed;
188 191 uint32_t n_cmd_timeout;
189 192 uint32_t n_cmd_aborted;
190 193 uint32_t n_wrong_logpage;
191 194 uint32_t n_unknown_logpage;
192 195 uint32_t n_too_many_cookies;
193 196
194 197 /* errors detected by hardware */
195 198 uint32_t n_data_xfr_err;
196 199 uint32_t n_internal_err;
197 200 uint32_t n_abort_rq_err;
198 201 uint32_t n_abort_sq_del;
199 202 uint32_t n_nvm_cap_exc;
200 203 uint32_t n_nvm_ns_notrdy;
201 204 uint32_t n_inv_cq_err;
202 205 uint32_t n_inv_qid_err;
203 206 uint32_t n_max_qsz_exc;
204 207 uint32_t n_inv_int_vect;
205 208 uint32_t n_inv_log_page;
206 209 uint32_t n_inv_format;
207 210 uint32_t n_inv_q_del;
208 211 uint32_t n_cnfl_attr;
209 212 uint32_t n_inv_prot;
210 213 uint32_t n_readonly;
211 214
212 215 /* errors reported by asynchronous events */
213 216 uint32_t n_diagfail_event;
214 217 uint32_t n_persistent_event;
215 218 uint32_t n_transient_event;
216 219 uint32_t n_fw_load_event;
217 220 uint32_t n_reliability_event;
218 221 uint32_t n_temperature_event;
219 222 uint32_t n_spare_event;
220 223 uint32_t n_vendor_event;
221 224 uint32_t n_unknown_event;
222 225
223 226 };
224 227
225 228 struct nvme_namespace {
226 229 nvme_t *ns_nvme;
227 230 uint8_t ns_eui64[8];
228 231 char ns_name[17];
229 232
230 233 bd_handle_t ns_bd_hdl;
231 234
232 235 uint32_t ns_id;
233 236 size_t ns_block_count;
234 237 size_t ns_block_size;
235 238 size_t ns_best_block_size;
236 239
237 240 boolean_t ns_ignore;
238 241
239 242 nvme_identify_nsid_t *ns_idns;
240 243
241 244 /* state for attachment point minor node */
242 245 nvme_minor_state_t ns_minor;
243 246
244 247 /*
245 248 * If a namespace has no EUI64, we create a devid in
246 249 * nvme_prepare_devid().
247 250 */
248 251 char *ns_devid;
249 252 };
250 253
251 254 struct nvme_task_arg {
252 255 nvme_t *nt_nvme;
253 256 nvme_cmd_t *nt_cmd;
254 257 };
255 258
256 259
257 260 #ifdef __cplusplus
258 261 }
259 262 #endif
260 263
261 264 #endif /* _NVME_VAR_H */
↓ open down ↓ |
89 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX