Print this page
NEX-8705 Drivers for ATTO Celerity FC-162E Gen 5 and Celerity FC-162P Gen 6 16GB FC cards support
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-5602 cpqary3: add support for more hp gen9 smart array controllers
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
Reviewed by: Marcel Telka <marcel.telka@nexenta.com>
NEX-1533 fcinfo hba-port doesn't get correct supported speeds and connection speed for 16Gb target ports
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/fct.h
+++ new/usr/src/uts/common/sys/fct.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 23 * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25 #ifndef _FCT_H
26 26 #define _FCT_H
27 27
28 28 /*
29 29 * Definitions for common FC Target.
30 30 */
31 31 #include <sys/note.h>
32 32 #include <sys/stmf_defines.h>
33 33 #include <sys/fct_defines.h>
34 34 #include <sys/portif.h>
35 35
36 36 #ifdef __cplusplus
37 37 extern "C" {
38 38 #endif
39 39
40 40 typedef enum fct_struct_id {
41 41 FCT_STRUCT_LOCAL_PORT = 1,
42 42 FCT_STRUCT_REMOTE_PORT,
43 43 FCT_STRUCT_CMD_RCVD_ELS,
44 44 FCT_STRUCT_CMD_SOL_ELS,
45 45 FCT_STRUCT_CMD_SOL_CT,
46 46 FCT_STRUCT_CMD_RCVD_ABTS,
47 47 FCT_STRUCT_CMD_FCP_XCHG,
48 48 FCT_STRUCT_DBUF_STORE,
49 49
50 50 FCT_MAX_STRUCT_IDS
51 51 } fct_struct_id_t;
52 52
53 53 typedef struct fct_remote_port {
54 54 void *rp_fct_private;
55 55 void *rp_fca_private;
56 56
57 57 struct fct_local_port *rp_port;
58 58 char rp_nwwn_str[FC_WWN_BUFLEN];
59 59 char rp_pwwn_str[FC_WWN_BUFLEN];
60 60 uint8_t rp_nwwn[FC_WWN_LEN];
61 61 uint8_t rp_pwwn[FC_WWN_LEN];
62 62 uint32_t rp_id; /* 8 or 24 bit */
63 63 uint32_t rp_hard_address;
64 64 uint16_t rp_handle;
65 65 } fct_remote_port_t;
66 66
67 67 #define FCT_HANDLE_NONE 0xffff
68 68
69 69 typedef struct fct_cmd {
70 70 void *cmd_fct_private;
71 71 void *cmd_fca_private;
72 72 void *cmd_specific;
73 73
74 74 struct fct_local_port *cmd_port;
75 75
76 76 /* During cmd porting this can be set to NULL */
77 77 struct fct_remote_port *cmd_rp;
78 78
79 79 /* To link cmds together for handling things like ABTS. */
80 80 struct fct_cmd *cmd_link;
81 81 uint8_t cmd_type;
82 82 uint8_t cmd_rsvd1;
83 83
84 84 /* During cmd posting this can be set to FCT_HANDLE_NONE */
85 85 uint16_t cmd_rp_handle;
86 86 uint32_t cmd_handle;
87 87 uint32_t cmd_rportid;
88 88 uint32_t cmd_lportid;
89 89 uint32_t cmd_rsvd2;
90 90 uint16_t cmd_oxid;
91 91 uint16_t cmd_rxid;
92 92 fct_status_t cmd_comp_status;
93 93 } fct_cmd_t;
94 94
95 95 /*
96 96 * fcmd_cmd_handle: Bit definitions.
97 97 * 31 23 15 7 0
98 98 * +--------------+------------+------------+------------+
99 99 * | V |uniq_cntr |fca specific| cmd slot index |
100 100 * +--------------+------------+------------+------------+
101 101 * V = handle valid.
102 102 */
103 103 #define CMD_HANDLE_SLOT_INDEX(x) ((x) & 0xffff)
104 104 #define CMD_HANDLE_VALID(x) ((x) & 0x80000000)
105 105
106 106 enum fct_cmd_types {
107 107 FCT_CMD_FCP_XCHG = 0x0001,
108 108 FCT_CMD_RCVD_ELS = 0x0002,
109 109 FCT_CMD_SOL_ELS = 0x0004,
110 110 FCT_CMD_RCVD_ABTS = 0x0008,
111 111 FCT_CMD_SOL_CT = 0x0010,
112 112
113 113 FCT_CMD_TYPE_ALL = 0xffff
114 114 };
115 115
116 116 typedef struct fct_els {
117 117 uint16_t els_req_size;
118 118 uint16_t els_resp_size;
119 119 uint16_t els_req_alloc_size;
120 120 uint16_t els_resp_alloc_size;
121 121 uint8_t *els_req_payload;
122 122 uint8_t *els_resp_payload;
123 123 } fct_els_t;
124 124
125 125 typedef struct fct_sol_ct {
126 126 uint16_t ct_req_size;
127 127 uint16_t ct_resp_size;
128 128 uint16_t ct_req_alloc_size;
129 129 uint16_t ct_resp_alloc_size;
130 130 uint8_t *ct_req_payload;
131 131 uint8_t *ct_resp_payload;
132 132 } fct_sol_ct_t;
133 133
134 134 typedef struct fct_rcvd_abts {
135 135 uint8_t abts_resp_rctl; /* Can be BA_ACC or BA_RJT */
136 136 uint8_t abts_state;
137 137 uint16_t rsvd;
138 138 uint8_t abts_resp_payload[12];
139 139 } fct_rcvd_abts_t;
140 140
141 141 /*
142 142 * abts state
143 143 */
144 144 #define ABTS_STATE_RECEIVED 0
145 145 #define ABTS_STATE_RESPONDED 1
146 146 #define ABTS_STATE_COMPLETED 2
147 147 #define ABTS_STATE_ABORT_REQUESTED 3
148 148 #define ABTS_STATE_ABORT_COMPLETED 4
149 149
150 150 #define FCHBA_MANUFACTURER_LEN 64
151 151 #define FCHBA_SERIAL_NUMBER_LEN 64
152 152 #define FCHBA_MODEL_LEN 256
153 153 #define FCHBA_MODEL_DESCRIPTION_LEN 256
154 154 #define FCHBA_HARDWARE_VERSION_LEN 256
155 155 #define FCHBA_DRIVER_VERSION_LEN 256
156 156 #define FCHBA_OPTION_ROM_VERSION_LEN 256
157 157 #define FCHBA_FIRMWARE_VERSION_LEN 256
158 158 #define FCHBA_DRIVER_NAME_LEN 256
159 159 #define FCHBA_SYMB_NAME_LEN 255
160 160
161 161 #define FCT_INFO_LEN 160
162 162 #define FCT_TASKQ_NAME_LEN 24
163 163
164 164 #define FC_TGT_PORT_INFO_CMD (((uint32_t)'I') << 24)
165 165 #define FC_TGT_PORT_RLS FC_TGT_PORT_INFO_CMD + 0x1
166 166
167 167 typedef struct fct_port_attrs {
168 168 char manufacturer[FCHBA_MANUFACTURER_LEN];
169 169 char serial_number[FCHBA_SERIAL_NUMBER_LEN];
170 170 char model[FCHBA_MODEL_LEN];
171 171 char model_description[FCHBA_MODEL_DESCRIPTION_LEN];
172 172 char hardware_version[FCHBA_HARDWARE_VERSION_LEN];
173 173 char driver_version[FCHBA_DRIVER_VERSION_LEN];
174 174 char option_rom_version[FCHBA_OPTION_ROM_VERSION_LEN];
175 175 char firmware_version[FCHBA_FIRMWARE_VERSION_LEN];
176 176 char driver_name[FCHBA_DRIVER_NAME_LEN];
177 177 uint32_t vendor_specific_id;
178 178 uint32_t supported_cos;
179 179 uint32_t supported_speed;
180 180 uint32_t max_frame_size;
181 181 } fct_port_attrs_t;
182 182
183 183 typedef struct fct_port_link_status {
184 184 uint32_t LinkFailureCount;
185 185 uint32_t LossOfSyncCount;
186 186 uint32_t LossOfSignalsCount;
187 187 uint32_t PrimitiveSeqProtocolErrorCount;
188 188 uint32_t InvalidTransmissionWordCount;
189 189 uint32_t InvalidCRCCount;
190 190 } fct_port_link_status_t;
191 191
192 192 typedef struct fct_dbuf_store {
193 193 void *fds_fct_private;
194 194 void *fds_fca_private;
195 195 struct stmf_dbuf_store *fds_ds;
196 196
197 197 stmf_data_buf_t *(*fds_alloc_data_buf)(struct fct_local_port *port,
198 198 uint32_t size, uint32_t *pminsize, uint32_t flags);
199 199 void (*fds_free_data_buf)(struct fct_dbuf_store *fds,
200 200 stmf_data_buf_t *dbuf);
201 201 stmf_status_t (*fds_setup_dbuf)(struct fct_local_port *port,
202 202 stmf_data_buf_t *dbuf, uint32_t flags);
203 203 void (*fds_teardown_dbuf)(struct fct_dbuf_store *fds,
204 204 stmf_data_buf_t *dbuf);
205 205
206 206 uint32_t fds_max_sgl_xfer_len;
207 207 uint32_t fds_copy_threshold;
208 208 } fct_dbuf_store_t;
209 209
210 210 #define FCT_FCA_MODREV_1 1
211 211
212 212 typedef struct fct_local_port {
213 213 void *port_fct_private;
214 214 void *port_fca_private;
215 215 stmf_local_port_t *port_lport;
216 216
217 217 char port_nwwn_str[FC_WWN_BUFLEN];
218 218 char port_pwwn_str[FC_WWN_BUFLEN];
219 219 uint8_t port_nwwn[FC_WWN_LEN];
220 220 uint8_t port_pwwn[FC_WWN_LEN];
221 221 char *port_default_alias;
222 222 char *port_sym_node_name;
223 223 char *port_sym_port_name;
224 224
225 225 stmf_port_provider_t *port_pp;
226 226
227 227 uint32_t port_hard_address;
228 228 uint16_t port_max_logins;
229 229 uint16_t port_max_xchges;
230 230 uint32_t port_fca_fcp_cmd_size;
231 231 uint32_t port_fca_rp_private_size;
232 232 uint32_t port_fca_sol_els_private_size;
233 233 uint32_t port_fca_sol_ct_private_size;
234 234
235 235 /* in milliseconds */
236 236 uint32_t port_fca_abort_timeout;
237 237
238 238 fct_dbuf_store_t *port_fds;
239 239 fct_status_t (*port_get_link_info)(
240 240 struct fct_local_port *port, struct fct_link_info *li);
241 241 fct_status_t (*port_register_remote_port)(
242 242 struct fct_local_port *port, struct fct_remote_port *rp,
243 243 struct fct_cmd *login_els);
244 244 fct_status_t (*port_deregister_remote_port)(
245 245 struct fct_local_port *port, struct fct_remote_port *rp);
246 246 fct_status_t (*port_send_cmd)(fct_cmd_t *cmd);
247 247 fct_status_t (*port_xfer_scsi_data)(fct_cmd_t *cmd,
248 248 stmf_data_buf_t *dbuf, uint32_t flags);
249 249 fct_status_t (*port_send_cmd_response)(fct_cmd_t *cmd,
250 250 uint32_t ioflags);
251 251 fct_status_t (*port_abort_cmd)(struct fct_local_port *port,
252 252 fct_cmd_t *cmd, uint32_t flags);
253 253 void (*port_ctl)(struct fct_local_port *port,
254 254 int cmd, void *arg);
255 255 fct_status_t (*port_flogi_xchg)(struct fct_local_port *port,
256 256 struct fct_flogi_xchg *fx);
257 257 void (*port_populate_hba_details)(
258 258 struct fct_local_port *port, struct fct_port_attrs *port_attrs);
259 259 fct_status_t (*port_info)(uint32_t cmd,
260 260 struct fct_local_port *port, void *arg, uint8_t *buf,
261 261 uint32_t *bufsizep);
262 262 int port_fca_version;
263 263 } fct_local_port_t;
264 264
265 265 /*
266 266 * Common struct used during FLOGI exchange.
267 267 */
268 268 typedef struct fct_flogi_xchg {
269 269 uint8_t fx_op; /* ELS_OP_FLOGI or ELS_OP_ACC/RJT */
270 270 uint8_t fx_rjt_reason;
271 271 uint8_t fx_rjt_expl;
272 272 uint8_t fx_sec_timeout; /* Timeout in seconds */
273 273 uint32_t fx_fport:1, /* 0=N_port, 1=F_port */
274 274 rsvd2:31;
275 275 uint32_t fx_sid; /* 24 bit SID to use */
276 276 uint32_t fx_did; /* 24 bit DID to use */
277 277 uint8_t fx_pwwn[8];
278 278 uint8_t fx_nwwn[8];
279 279 } fct_flogi_xchg_t;
280 280
281 281 typedef struct fct_link_info {
282 282 uint32_t portid;
283 283 uint8_t port_topology;
284 284 uint8_t port_speed;
285 285
286 286 uint8_t rsvd:5,
287 287
288 288 /*
289 289 * FCA sets this bit to indicate that fct does not need to do FLOGI
290 290 * because either FCA did the FLOGI or it determined that its a private
291 291 * loop. Setting this bit by FCA is optional.
292 292 */
293 293 port_no_fct_flogi:1,
294 294
295 295 /* FCA sets this bit to indicate that it did FLOGI */
296 296 port_fca_flogi_done:1,
297 297
298 298 /* FCT sets this bit to indicate that it did FLOGI */
299 299 port_fct_flogi_done:1;
300 300
301 301 uint8_t rsvd1;
302 302
303 303 /* The fields below are only valid if someone did a successful flogi */
304 304 uint8_t port_rnwwn[8];
305 305 uint8_t port_rpwwn[8];
306 306 } fct_link_info_t;
307 307
308 308 typedef struct fct_port_stat {
309 309 kstat_named_t link_failure_cnt;
310 310 kstat_named_t loss_of_sync_cnt;
311 311 kstat_named_t loss_of_signals_cnt;
312 312 kstat_named_t prim_seq_protocol_err_cnt;
313 313 kstat_named_t invalid_tx_word_cnt;
314 314 kstat_named_t invalid_crc_cnt;
315 315 } fct_port_stat_t;
316 316
317 317 /*
318 318 * port topology
319 319 */
320 320 #define PORT_TOPOLOGY_UNKNOWN 0
321 321 #define PORT_TOPOLOGY_PT_TO_PT 1
322 322 #define PORT_TOPOLOGY_PRIVATE_LOOP 2
323 323 #define PORT_TOPOLOGY_PUBLIC_LOOP 6
324 324 #define PORT_TOPOLOGY_FABRIC_PT_TO_PT 5
325 325 #define PORT_TOPOLOGY_FABRIC_BIT 4
326 326
327 327 #define PORT_FLOGI_DONE(li) (((li)->port_fca_flogi_done) || \
328 328 ((li)->port_fct_flogi_done))
329 329
|
↓ open down ↓ |
329 lines elided |
↑ open up ↑ |
330 330 /*
331 331 * port speed
332 332 */
333 333 #define PORT_SPEED_UNKNOWN 0
334 334 #define PORT_SPEED_1G 1
335 335 #define PORT_SPEED_2G 2
336 336 #define PORT_SPEED_4G 4
337 337 #define PORT_SPEED_8G 8
338 338 #define PORT_SPEED_10G 16
339 339 #define PORT_SPEED_16G 32
340 +#define PORT_SPEED_32G 64
340 341
341 342 /*
342 343 * Abort commands
343 344 */
344 345 #define FCT_TERMINATE_CMD 1
345 346
346 347 /*
347 348 * FCT port states.
348 349 */
349 350 #define FCT_STATE_OFFLINE 0
350 351 #define FCT_STATE_ONLINING 1
351 352 #define FCT_STATE_ONLINE 2
352 353 #define FCT_STATE_OFFLINING 3
353 354
354 355 /*
355 356 * fct ctl commands. These should not conflict with stmf ctl commands
356 357 */
357 358 #define FCT_CMD_PORT_ONLINE (STMF_LPORT_CTL_CMDS | 0x01)
358 359 #define FCT_CMD_PORT_ONLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x02)
359 360 #define FCT_CMD_PORT_OFFLINE (STMF_LPORT_CTL_CMDS | 0x03)
360 361 #define FCT_CMD_PORT_OFFLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x04)
361 362 #define FCT_ACK_PORT_ONLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x05)
362 363 #define FCT_ACK_PORT_OFFLINE_COMPLETE (STMF_LPORT_CTL_CMDS | 0x06)
363 364 #define FCT_CMD_FORCE_LIP (STMF_LPORT_CTL_CMDS | 0x07)
364 365
365 366 /*
366 367 * IO flags for cmd flow.
367 368 */
368 369 #define FCT_IOF_FCA_DONE 0x10000
369 370 #define FCT_IOF_FORCE_FCA_DONE 0x20000
370 371
371 372 /*
372 373 * Fill CTIU preamble
373 374 */
374 375 #ifdef lint
375 376 #define FCT_FILL_CTIU_PREAMBLE(x_payload, x_ctop) _NOTE(EMPTY)
376 377 #else
377 378 #define FCT_FILL_CTIU_PREAMBLE(x_payload, x_ctop) \
378 379 do { \
379 380 x_payload[0] = 0x01; \
380 381 x_payload[4] = 0xFC; \
381 382 x_payload[5] = 0x02; \
382 383 x_payload[8] = 0xFF & (x_ctop >> 8); \
383 384 x_payload[9] = 0xFF & (x_ctop); \
384 385 } while (0)
385 386 #endif
386 387
387 388 uint64_t fct_netbuf_to_value(uint8_t *buf, uint8_t nbytes);
388 389 void fct_value_to_netbuf(uint64_t value, uint8_t *buf, uint8_t nbytes);
389 390 void *fct_alloc(fct_struct_id_t struct_id, int additional_size, int flags);
390 391 void fct_free(void *ptr);
391 392 fct_cmd_t *fct_scsi_task_alloc(struct fct_local_port *port,
392 393 uint16_t rp_handle, uint32_t rportid, uint8_t *lun,
393 394 uint16_t cdb_length, uint16_t task_ext);
394 395 fct_status_t fct_register_local_port(fct_local_port_t *port);
395 396 fct_status_t fct_deregister_local_port(fct_local_port_t *port);
396 397 void fct_handle_event(fct_local_port_t *port, int event_id,
397 398 uint32_t event_flags, caddr_t arg);
398 399 void fct_post_rcvd_cmd(fct_cmd_t *cmd, stmf_data_buf_t *dbuf);
399 400 void fct_queue_cmd_for_termination(fct_cmd_t *cmd, fct_status_t s);
400 401 void fct_queue_scsi_task_for_termination(fct_cmd_t *cmd, fct_status_t s);
401 402 fct_cmd_t *fct_handle_to_cmd(fct_local_port_t *port, uint32_t fct_handle);
402 403 void fct_ctl(struct stmf_local_port *lport, int cmd, void *arg);
403 404 void fct_cmd_fca_aborted(fct_cmd_t *cmd, fct_status_t s, uint32_t ioflags);
404 405 uint16_t fct_get_rp_handle(fct_local_port_t *port, uint32_t rportid);
405 406 void fct_send_response_done(fct_cmd_t *cmd, fct_status_t s, uint32_t ioflags);
406 407 void fct_send_cmd_done(fct_cmd_t *cmd, fct_status_t s, uint32_t ioflags);
407 408 void fct_scsi_data_xfer_done(fct_cmd_t *cmd, stmf_data_buf_t *dbuf,
408 409 uint32_t ioflags);
409 410 fct_status_t fct_port_initialize(fct_local_port_t *port, uint32_t rflags,
410 411 char *additional_info);
411 412 fct_status_t fct_port_shutdown(fct_local_port_t *port, uint32_t rflags,
412 413 char *additional_info);
413 414 fct_status_t fct_handle_rcvd_flogi(fct_local_port_t *port,
414 415 fct_flogi_xchg_t *fx);
415 416 void fct_log_local_port_event(fct_local_port_t *port, char *subclass);
416 417 void fct_log_remote_port_event(fct_local_port_t *port, char *subclass,
417 418 uint8_t *rp_pwwn, uint32_t rp_id);
418 419 void fct_wwn_to_str(char *to_ptr, const uint8_t *from_ptr);
419 420
420 421 #ifdef __cplusplus
421 422 }
422 423 #endif
423 424
424 425 #endif /* _FCT_H */
|
↓ open down ↓ |
75 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX