Loading...
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
4 * Copyright (c) 2014- QLogic Corporation.
5 * All rights reserved
6 * www.qlogic.com
7 *
8 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
9 */
10
11#ifndef __BFA_FC_H__
12#define __BFA_FC_H__
13
14#include "bfad_drv.h"
15
16typedef u64 wwn_t;
17
18#define WWN_NULL (0)
19#define FC_SYMNAME_MAX 256 /* max name server symbolic name size */
20#define FC_ALPA_MAX 128
21
22#pragma pack(1)
23
24#define MAC_ADDRLEN (6)
25struct mac_s { u8 mac[MAC_ADDRLEN]; };
26#define mac_t struct mac_s
27
28/*
29 * generic SCSI cdb definition
30 */
31#define SCSI_MAX_CDBLEN 16
32struct scsi_cdb_s {
33 u8 scsi_cdb[SCSI_MAX_CDBLEN];
34};
35
36#define SCSI_MAX_ALLOC_LEN 0xFF /* maximum allocarion length */
37
38/*
39 * Fibre Channel Header Structure (FCHS) definition
40 */
41struct fchs_s {
42#ifdef __BIG_ENDIAN
43 u32 routing:4; /* routing bits */
44 u32 cat_info:4; /* category info */
45#else
46 u32 cat_info:4; /* category info */
47 u32 routing:4; /* routing bits */
48#endif
49 u32 d_id:24; /* destination identifier */
50
51 u32 cs_ctl:8; /* class specific control */
52 u32 s_id:24; /* source identifier */
53
54 u32 type:8; /* data structure type */
55 u32 f_ctl:24; /* initial frame control */
56
57 u8 seq_id; /* sequence identifier */
58 u8 df_ctl; /* data field control */
59 u16 seq_cnt; /* sequence count */
60
61 __be16 ox_id; /* originator exchange ID */
62 u16 rx_id; /* responder exchange ID */
63
64 u32 ro; /* relative offset */
65};
66
67/*
68 * routing bit definitions
69 */
70enum {
71 FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
72 FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
73 FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
74 FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
75 FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
76 FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
77 FC_RTG_LINK_CTRL = 0xC, /* Link Control */
78};
79
80/*
81 * information category for extended link data and FC-4 Link Data
82 */
83enum {
84 FC_CAT_LD_REQUEST = 0x2, /* Request */
85 FC_CAT_LD_REPLY = 0x3, /* Reply */
86 FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
87};
88
89/*
90 * information category for extended headers (VFT, IFR or encapsulation)
91 */
92enum {
93 FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
94 FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
95 FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
96};
97
98/*
99 * information category for FC-4 device data
100 */
101enum {
102 FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
103 FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
104 FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
105 FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
106 FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
107 FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
108 FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
109 FC_CAT_CMD_STATUS = 0x7, /* Command Status */
110};
111
112/*
113 * Type Field Definitions. FC-PH Section 18.5 pg. 165
114 */
115enum {
116 FC_TYPE_BLS = 0x0, /* Basic Link Service */
117 FC_TYPE_ELS = 0x1, /* Extended Link Service */
118 FC_TYPE_IP = 0x5, /* IP */
119 FC_TYPE_FCP = 0x8, /* SCSI-FCP */
120 FC_TYPE_GPP = 0x9, /* SCSI_GPP */
121 FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
122 FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
123 FC_TYPE_FC_AL = 0x23, /* FC-AL */
124 FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
125 FC_TYPE_FC_SPINFAB = 0xEE, /* SPINFAB */
126 FC_TYPE_FC_DIAG = 0xEF, /* DIAG */
127 FC_TYPE_MAX = 256, /* 256 FC-4 types */
128};
129
130/*
131 * Frame Control Definitions. FC-PH Table-45. pg. 168
132 */
133enum {
134 FCTL_EC_ORIG = 0x000000, /* exchange originator */
135 FCTL_EC_RESP = 0x800000, /* exchange responder */
136 FCTL_SEQ_INI = 0x000000, /* sequence initiator */
137 FCTL_SEQ_REC = 0x400000, /* sequence recipient */
138 FCTL_FS_EXCH = 0x200000, /* first sequence of xchg */
139 FCTL_LS_EXCH = 0x100000, /* last sequence of xchg */
140 FCTL_END_SEQ = 0x080000, /* last frame of sequence */
141 FCTL_SI_XFER = 0x010000, /* seq initiative transfer */
142 FCTL_RO_PRESENT = 0x000008, /* relative offset present */
143 FCTL_FILLBYTE_MASK = 0x000003 /* , fill byte mask */
144};
145
146/*
147 * Fabric Well Known Addresses
148 */
149enum {
150 FC_MIN_WELL_KNOWN_ADDR = 0xFFFFF0,
151 FC_DOMAIN_CONTROLLER_MASK = 0xFFFC00,
152 FC_ALIAS_SERVER = 0xFFFFF8,
153 FC_MGMT_SERVER = 0xFFFFFA,
154 FC_TIME_SERVER = 0xFFFFFB,
155 FC_NAME_SERVER = 0xFFFFFC,
156 FC_FABRIC_CONTROLLER = 0xFFFFFD,
157 FC_FABRIC_PORT = 0xFFFFFE,
158 FC_BROADCAST_SERVER = 0xFFFFFF
159};
160
161/*
162 * domain/area/port defines
163 */
164#define FC_DOMAIN_MASK 0xFF0000
165#define FC_DOMAIN_SHIFT 16
166#define FC_AREA_MASK 0x00FF00
167#define FC_AREA_SHIFT 8
168#define FC_PORT_MASK 0x0000FF
169#define FC_PORT_SHIFT 0
170
171#define FC_GET_DOMAIN(p) (((p) & FC_DOMAIN_MASK) >> FC_DOMAIN_SHIFT)
172#define FC_GET_AREA(p) (((p) & FC_AREA_MASK) >> FC_AREA_SHIFT)
173#define FC_GET_PORT(p) (((p) & FC_PORT_MASK) >> FC_PORT_SHIFT)
174
175#define FC_DOMAIN_CTRLR(p) (FC_DOMAIN_CONTROLLER_MASK | (FC_GET_DOMAIN(p)))
176
177enum {
178 FC_RXID_ANY = 0xFFFFU,
179};
180
181/*
182 * generic ELS command
183 */
184struct fc_els_cmd_s {
185 u32 els_code:8; /* ELS Command Code */
186 u32 reserved:24;
187};
188
189/*
190 * ELS Command Codes. FC-PH Table-75. pg. 223
191 */
192enum {
193 FC_ELS_LS_RJT = 0x1, /* Link Service Reject. */
194 FC_ELS_ACC = 0x02, /* Accept */
195 FC_ELS_PLOGI = 0x03, /* N_Port Login. */
196 FC_ELS_FLOGI = 0x04, /* F_Port Login. */
197 FC_ELS_LOGO = 0x05, /* Logout. */
198 FC_ELS_ABTX = 0x06, /* Abort Exchange */
199 FC_ELS_RES = 0x08, /* Read Exchange status */
200 FC_ELS_RSS = 0x09, /* Read sequence status block */
201 FC_ELS_RSI = 0x0A, /* Request Sequence Initiative */
202 FC_ELS_ESTC = 0x0C, /* Estimate Credit. */
203 FC_ELS_RTV = 0x0E, /* Read Timeout Value. */
204 FC_ELS_RLS = 0x0F, /* Read Link Status. */
205 FC_ELS_ECHO = 0x10, /* Echo */
206 FC_ELS_TEST = 0x11, /* Test */
207 FC_ELS_RRQ = 0x12, /* Reinstate Recovery Qualifier. */
208 FC_ELS_REC = 0x13, /* Add this for TAPE support in FCR */
209 FC_ELS_PRLI = 0x20, /* Process Login */
210 FC_ELS_PRLO = 0x21, /* Process Logout. */
211 FC_ELS_SCN = 0x22, /* State Change Notification. */
212 FC_ELS_TPRLO = 0x24, /* Third Party Process Logout. */
213 FC_ELS_PDISC = 0x50, /* Discover N_Port Parameters. */
214 FC_ELS_FDISC = 0x51, /* Discover F_Port Parameters. */
215 FC_ELS_ADISC = 0x52, /* Discover Address. */
216 FC_ELS_FARP_REQ = 0x54, /* FARP Request. */
217 FC_ELS_FARP_REP = 0x55, /* FARP Reply. */
218 FC_ELS_FAN = 0x60, /* Fabric Address Notification */
219 FC_ELS_RSCN = 0x61, /* Reg State Change Notification */
220 FC_ELS_SCR = 0x62, /* State Change Registration. */
221 FC_ELS_RTIN = 0x77, /* Mangement server request */
222 FC_ELS_RNID = 0x78, /* Mangement server request */
223 FC_ELS_RLIR = 0x79, /* Registered Link Incident Record */
224
225 FC_ELS_RPSC = 0x7D, /* Report Port Speed Capabilities */
226 FC_ELS_QSA = 0x7E, /* Query Security Attributes. Ref FC-SP */
227 FC_ELS_E2E_LBEACON = 0x81,
228 /* End-to-End Link Beacon */
229 FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */
230 FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref
231 *FC-SP */
232};
233
234/*
235 * Version numbers for FC-PH standards,
236 * used in login to indicate what port
237 * supports. See FC-PH-X table 158.
238 */
239enum {
240 FC_PH_VER_4_3 = 0x09,
241 FC_PH_VER_PH_3 = 0x20,
242};
243
244/*
245 * PDU size defines
246 */
247enum {
248 FC_MIN_PDUSZ = 512,
249 FC_MAX_PDUSZ = 2112,
250};
251
252/*
253 * N_Port PLOGI Common Service Parameters.
254 * FC-PH-x. Figure-76. pg. 308.
255 */
256struct fc_plogi_csp_s {
257 u8 verhi; /* FC-PH high version */
258 u8 verlo; /* FC-PH low version */
259 __be16 bbcred; /* BB_Credit */
260
261#ifdef __BIG_ENDIAN
262 u8 ciro:1, /* continuously increasing RO */
263 rro:1, /* random relative offset */
264 npiv_supp:1, /* NPIV supported */
265 port_type:1, /* N_Port/F_port */
266 altbbcred:1, /* alternate BB_Credit */
267 resolution:1, /* ms/ns ED_TOV resolution */
268 vvl_info:1, /* VVL Info included */
269 reserved1:1;
270
271 u8 hg_supp:1,
272 query_dbc:1,
273 security:1,
274 sync_cap:1,
275 r_t_tov:1,
276 dh_dup_supp:1,
277 cisc:1, /* continuously increasing seq count */
278 payload:1;
279#else
280 u8 reserved2:2,
281 resolution:1, /* ms/ns ED_TOV resolution */
282 altbbcred:1, /* alternate BB_Credit */
283 port_type:1, /* N_Port/F_port */
284 npiv_supp:1, /* NPIV supported */
285 rro:1, /* random relative offset */
286 ciro:1; /* continuously increasing RO */
287
288 u8 payload:1,
289 cisc:1, /* continuously increasing seq count */
290 dh_dup_supp:1,
291 r_t_tov:1,
292 sync_cap:1,
293 security:1,
294 query_dbc:1,
295 hg_supp:1;
296#endif
297 __be16 rxsz; /* receive data_field size */
298 __be16 conseq;
299 __be16 ro_bitmap;
300 __be32 e_d_tov;
301};
302
303/*
304 * N_Port PLOGI Class Specific Parameters.
305 * FC-PH-x. Figure 78. pg. 318.
306 */
307struct fc_plogi_clp_s {
308#ifdef __BIG_ENDIAN
309 u32 class_valid:1;
310 u32 intermix:1; /* class intermix supported if set =1.
311 * valid only for class1. Reserved for
312 * class2 & class3 */
313 u32 reserved1:2;
314 u32 sequential:1;
315 u32 reserved2:3;
316#else
317 u32 reserved2:3;
318 u32 sequential:1;
319 u32 reserved1:2;
320 u32 intermix:1; /* class intermix supported if set =1.
321 * valid only for class1. Reserved for
322 * class2 & class3 */
323 u32 class_valid:1;
324#endif
325 u32 reserved3:24;
326
327 u32 reserved4:16;
328 u32 rxsz:16; /* Receive data_field size */
329
330 u32 reserved5:8;
331 u32 conseq:8;
332 u32 e2e_credit:16; /* end to end credit */
333
334 u32 reserved7:8;
335 u32 ospx:8;
336 u32 reserved8:16;
337};
338
339/* ASCII value for each character in string "BRCD" */
340#define FLOGI_VVL_BRCD 0x42524344
341
342/*
343 * PLOGI els command and reply payload
344 */
345struct fc_logi_s {
346 struct fc_els_cmd_s els_cmd; /* ELS command code */
347 struct fc_plogi_csp_s csp; /* common service params */
348 wwn_t port_name;
349 wwn_t node_name;
350 struct fc_plogi_clp_s class1; /* class 1 service parameters */
351 struct fc_plogi_clp_s class2; /* class 2 service parameters */
352 struct fc_plogi_clp_s class3; /* class 3 service parameters */
353 struct fc_plogi_clp_s class4; /* class 4 service parameters */
354 u8 vvl[16]; /* vendor version level */
355};
356
357/*
358 * LOGO els command payload
359 */
360struct fc_logo_s {
361 struct fc_els_cmd_s els_cmd; /* ELS command code */
362 u32 res1:8;
363 u32 nport_id:24; /* N_Port identifier of source */
364 wwn_t orig_port_name; /* Port name of the LOGO originator */
365};
366
367/*
368 * ADISC els command payload
369 */
370struct fc_adisc_s {
371 struct fc_els_cmd_s els_cmd; /* ELS command code */
372 u32 res1:8;
373 u32 orig_HA:24; /* originator hard address */
374 wwn_t orig_port_name; /* originator port name */
375 wwn_t orig_node_name; /* originator node name */
376 u32 res2:8;
377 u32 nport_id:24; /* originator NPortID */
378};
379
380/*
381 * Exchange status block
382 */
383struct fc_exch_status_blk_s {
384 u32 oxid:16;
385 u32 rxid:16;
386 u32 res1:8;
387 u32 orig_np:24; /* originator NPortID */
388 u32 res2:8;
389 u32 resp_np:24; /* responder NPortID */
390 u32 es_bits;
391 u32 res3;
392 /*
393 * un modified section of the fields
394 */
395};
396
397/*
398 * RES els command payload
399 */
400struct fc_res_s {
401 struct fc_els_cmd_s els_cmd; /* ELS command code */
402 u32 res1:8;
403 u32 nport_id:24; /* N_Port identifier of source */
404 u32 oxid:16;
405 u32 rxid:16;
406 u8 assoc_hdr[32];
407};
408
409/*
410 * RES els accept payload
411 */
412struct fc_res_acc_s {
413 struct fc_els_cmd_s els_cmd; /* ELS command code */
414 struct fc_exch_status_blk_s fc_exch_blk; /* Exchange status block */
415};
416
417/*
418 * REC els command payload
419 */
420struct fc_rec_s {
421 struct fc_els_cmd_s els_cmd; /* ELS command code */
422 u32 res1:8;
423 u32 nport_id:24; /* N_Port identifier of source */
424 u32 oxid:16;
425 u32 rxid:16;
426};
427
428#define FC_REC_ESB_OWN_RSP 0x80000000 /* responder owns */
429#define FC_REC_ESB_SI 0x40000000 /* SI is owned */
430#define FC_REC_ESB_COMP 0x20000000 /* exchange is complete */
431#define FC_REC_ESB_ENDCOND_ABN 0x10000000 /* abnormal ending */
432#define FC_REC_ESB_RQACT 0x04000000 /* recovery qual active */
433#define FC_REC_ESB_ERRP_MSK 0x03000000
434#define FC_REC_ESB_OXID_INV 0x00800000 /* invalid OXID */
435#define FC_REC_ESB_RXID_INV 0x00400000 /* invalid RXID */
436#define FC_REC_ESB_PRIO_INUSE 0x00200000
437
438/*
439 * REC els accept payload
440 */
441struct fc_rec_acc_s {
442 struct fc_els_cmd_s els_cmd; /* ELS command code */
443 u32 oxid:16;
444 u32 rxid:16;
445 u32 res1:8;
446 u32 orig_id:24; /* N_Port id of exchange originator */
447 u32 res2:8;
448 u32 resp_id:24; /* N_Port id of exchange responder */
449 u32 count; /* data transfer count */
450 u32 e_stat; /* exchange status */
451};
452
453/*
454 * RSI els payload
455 */
456struct fc_rsi_s {
457 struct fc_els_cmd_s els_cmd;
458 u32 res1:8;
459 u32 orig_sid:24;
460 u32 oxid:16;
461 u32 rxid:16;
462};
463
464/*
465 * structure for PRLI paramater pages, both request & response
466 * see FC-PH-X table 113 & 115 for explanation also FCP table 8
467 */
468struct fc_prli_params_s {
469 u32 reserved:16;
470#ifdef __BIG_ENDIAN
471 u32 reserved1:5;
472 u32 rec_support:1;
473 u32 task_retry_id:1;
474 u32 retry:1;
475
476 u32 confirm:1;
477 u32 doverlay:1;
478 u32 initiator:1;
479 u32 target:1;
480 u32 cdmix:1;
481 u32 drmix:1;
482 u32 rxrdisab:1;
483 u32 wxrdisab:1;
484#else
485 u32 retry:1;
486 u32 task_retry_id:1;
487 u32 rec_support:1;
488 u32 reserved1:5;
489
490 u32 wxrdisab:1;
491 u32 rxrdisab:1;
492 u32 drmix:1;
493 u32 cdmix:1;
494 u32 target:1;
495 u32 initiator:1;
496 u32 doverlay:1;
497 u32 confirm:1;
498#endif
499};
500
501/*
502 * valid values for rspcode in PRLI ACC payload
503 */
504enum {
505 FC_PRLI_ACC_XQTD = 0x1, /* request executed */
506 FC_PRLI_ACC_PREDEF_IMG = 0x5, /* predefined image - no prli needed */
507};
508
509struct fc_prli_params_page_s {
510 u32 type:8;
511 u32 codext:8;
512#ifdef __BIG_ENDIAN
513 u32 origprocasv:1;
514 u32 rsppav:1;
515 u32 imagepair:1;
516 u32 reserved1:1;
517 u32 rspcode:4;
518#else
519 u32 rspcode:4;
520 u32 reserved1:1;
521 u32 imagepair:1;
522 u32 rsppav:1;
523 u32 origprocasv:1;
524#endif
525 u32 reserved2:8;
526
527 u32 origprocas;
528 u32 rspprocas;
529 struct fc_prli_params_s servparams;
530};
531
532/*
533 * PRLI request and accept payload, FC-PH-X tables 112 & 114
534 */
535struct fc_prli_s {
536 u32 command:8;
537 u32 pglen:8;
538 u32 pagebytes:16;
539 struct fc_prli_params_page_s parampage;
540};
541
542/*
543 * PRLO logout params page
544 */
545struct fc_prlo_params_page_s {
546 u32 type:8;
547 u32 type_ext:8;
548#ifdef __BIG_ENDIAN
549 u32 opa_valid:1; /* originator process associator valid */
550 u32 rpa_valid:1; /* responder process associator valid */
551 u32 res1:14;
552#else
553 u32 res1:14;
554 u32 rpa_valid:1; /* responder process associator valid */
555 u32 opa_valid:1; /* originator process associator valid */
556#endif
557 u32 orig_process_assc;
558 u32 resp_process_assc;
559
560 u32 res2;
561};
562
563/*
564 * PRLO els command payload
565 */
566struct fc_prlo_s {
567 u32 command:8;
568 u32 page_len:8;
569 u32 payload_len:16;
570 struct fc_prlo_params_page_s prlo_params[1];
571};
572
573/*
574 * PRLO Logout response parameter page
575 */
576struct fc_prlo_acc_params_page_s {
577 u32 type:8;
578 u32 type_ext:8;
579
580#ifdef __BIG_ENDIAN
581 u32 opa_valid:1; /* originator process associator valid */
582 u32 rpa_valid:1; /* responder process associator valid */
583 u32 res1:14;
584#else
585 u32 res1:14;
586 u32 rpa_valid:1; /* responder process associator valid */
587 u32 opa_valid:1; /* originator process associator valid */
588#endif
589 u32 orig_process_assc;
590 u32 resp_process_assc;
591
592 u32 fc4type_csp;
593};
594
595/*
596 * PRLO els command ACC payload
597 */
598struct fc_prlo_acc_s {
599 u32 command:8;
600 u32 page_len:8;
601 u32 payload_len:16;
602 struct fc_prlo_acc_params_page_s prlo_acc_params[1];
603};
604
605/*
606 * SCR els command payload
607 */
608enum {
609 FC_SCR_REG_FUNC_FABRIC_DETECTED = 0x01,
610 FC_SCR_REG_FUNC_N_PORT_DETECTED = 0x02,
611 FC_SCR_REG_FUNC_FULL = 0x03,
612 FC_SCR_REG_FUNC_CLEAR_REG = 0xFF,
613};
614
615/* SCR VU registrations */
616enum {
617 FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE = 0x01
618};
619
620struct fc_scr_s {
621 u32 command:8;
622 u32 res:24;
623 u32 vu_reg_func:8; /* Vendor Unique Registrations */
624 u32 res1:16;
625 u32 reg_func:8;
626};
627
628/*
629 * Information category for Basic link data
630 */
631enum {
632 FC_CAT_NOP = 0x0,
633 FC_CAT_ABTS = 0x1,
634 FC_CAT_RMC = 0x2,
635 FC_CAT_BA_ACC = 0x4,
636 FC_CAT_BA_RJT = 0x5,
637 FC_CAT_PRMT = 0x6,
638};
639
640/*
641 * LS_RJT els reply payload
642 */
643struct fc_ls_rjt_s {
644 struct fc_els_cmd_s els_cmd; /* ELS command code */
645 u32 res1:8;
646 u32 reason_code:8; /* Reason code for reject */
647 u32 reason_code_expl:8; /* Reason code explanation */
648 u32 vendor_unique:8; /* Vendor specific */
649};
650
651/*
652 * LS_RJT reason codes
653 */
654enum {
655 FC_LS_RJT_RSN_INV_CMD_CODE = 0x01,
656 FC_LS_RJT_RSN_LOGICAL_ERROR = 0x03,
657 FC_LS_RJT_RSN_LOGICAL_BUSY = 0x05,
658 FC_LS_RJT_RSN_PROTOCOL_ERROR = 0x07,
659 FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD = 0x09,
660 FC_LS_RJT_RSN_CMD_NOT_SUPP = 0x0B,
661};
662
663/*
664 * LS_RJT reason code explanation
665 */
666enum {
667 FC_LS_RJT_EXP_NO_ADDL_INFO = 0x00,
668 FC_LS_RJT_EXP_SPARMS_ERR_OPTIONS = 0x01,
669 FC_LS_RJT_EXP_SPARMS_ERR_INI_CTL = 0x03,
670 FC_LS_RJT_EXP_SPARMS_ERR_REC_CTL = 0x05,
671 FC_LS_RJT_EXP_SPARMS_ERR_RXSZ = 0x07,
672 FC_LS_RJT_EXP_SPARMS_ERR_CONSEQ = 0x09,
673 FC_LS_RJT_EXP_SPARMS_ERR_CREDIT = 0x0B,
674 FC_LS_RJT_EXP_INV_PORT_NAME = 0x0D,
675 FC_LS_RJT_EXP_INV_NODE_FABRIC_NAME = 0x0E,
676 FC_LS_RJT_EXP_INV_CSP = 0x0F,
677 FC_LS_RJT_EXP_INV_ASSOC_HDR = 0x11,
678 FC_LS_RJT_EXP_ASSOC_HDR_REQD = 0x13,
679 FC_LS_RJT_EXP_INV_ORIG_S_ID = 0x15,
680 FC_LS_RJT_EXP_INV_OXID_RXID_COMB = 0x17,
681 FC_LS_RJT_EXP_CMD_ALREADY_IN_PROG = 0x19,
682 FC_LS_RJT_EXP_LOGIN_REQUIRED = 0x1E,
683 FC_LS_RJT_EXP_INVALID_NPORT_ID = 0x1F,
684 FC_LS_RJT_EXP_INSUFF_RES = 0x29,
685 FC_LS_RJT_EXP_CMD_NOT_SUPP = 0x2C,
686 FC_LS_RJT_EXP_INV_PAYLOAD_LEN = 0x2D,
687};
688
689/*
690 * RRQ els command payload
691 */
692struct fc_rrq_s {
693 struct fc_els_cmd_s els_cmd; /* ELS command code */
694 u32 res1:8;
695 u32 s_id:24; /* exchange originator S_ID */
696
697 u32 ox_id:16; /* originator exchange ID */
698 u32 rx_id:16; /* responder exchange ID */
699
700 u32 res2[8]; /* optional association header */
701};
702
703/*
704 * ABTS BA_ACC reply payload
705 */
706struct fc_ba_acc_s {
707 u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */
708 u32 seq_id:8; /* invalid for Abort Exchange */
709 u32 res2:16;
710 u32 ox_id:16; /* OX_ID from ABTS frame */
711 u32 rx_id:16; /* RX_ID from ABTS frame */
712 u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */
713 u32 high_seq_cnt:16; /* set to 0xFFFF for Abort Exchange */
714};
715
716/*
717 * ABTS BA_RJT reject payload
718 */
719struct fc_ba_rjt_s {
720 u32 res1:8; /* Reserved */
721 u32 reason_code:8; /* reason code for reject */
722 u32 reason_expl:8; /* reason code explanation */
723 u32 vendor_unique:8; /* vendor unique reason code,set to 0 */
724};
725
726/*
727 * TPRLO logout parameter page
728 */
729struct fc_tprlo_params_page_s {
730 u32 type:8;
731 u32 type_ext:8;
732
733#ifdef __BIG_ENDIAN
734 u32 opa_valid:1;
735 u32 rpa_valid:1;
736 u32 tpo_nport_valid:1;
737 u32 global_process_logout:1;
738 u32 res1:12;
739#else
740 u32 res1:12;
741 u32 global_process_logout:1;
742 u32 tpo_nport_valid:1;
743 u32 rpa_valid:1;
744 u32 opa_valid:1;
745#endif
746
747 u32 orig_process_assc;
748 u32 resp_process_assc;
749
750 u32 res2:8;
751 u32 tpo_nport_id;
752};
753
754/*
755 * TPRLO ELS command payload
756 */
757struct fc_tprlo_s {
758 u32 command:8;
759 u32 page_len:8;
760 u32 payload_len:16;
761
762 struct fc_tprlo_params_page_s tprlo_params[1];
763};
764
765enum fc_tprlo_type {
766 FC_GLOBAL_LOGO = 1,
767 FC_TPR_LOGO
768};
769
770/*
771 * TPRLO els command ACC payload
772 */
773struct fc_tprlo_acc_s {
774 u32 command:8;
775 u32 page_len:8;
776 u32 payload_len:16;
777 struct fc_prlo_acc_params_page_s tprlo_acc_params[1];
778};
779
780/*
781 * RSCN els command req payload
782 */
783#define FC_RSCN_PGLEN 0x4
784
785enum fc_rscn_format {
786 FC_RSCN_FORMAT_PORTID = 0x0,
787 FC_RSCN_FORMAT_AREA = 0x1,
788 FC_RSCN_FORMAT_DOMAIN = 0x2,
789 FC_RSCN_FORMAT_FABRIC = 0x3,
790};
791
792struct fc_rscn_event_s {
793 u32 format:2;
794 u32 qualifier:4;
795 u32 resvd:2;
796 u32 portid:24;
797};
798
799struct fc_rscn_pl_s {
800 u8 command;
801 u8 pagelen;
802 __be16 payldlen;
803 struct fc_rscn_event_s event[];
804};
805
806/*
807 * ECHO els command req payload
808 */
809struct fc_echo_s {
810 struct fc_els_cmd_s els_cmd;
811};
812
813/*
814 * RNID els command
815 */
816#define RNID_NODEID_DATA_FORMAT_COMMON 0x00
817#define RNID_NODEID_DATA_FORMAT_FCP3 0x08
818#define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF
819
820#define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
821#define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
822#define RNID_ASSOCIATED_TYPE_HUB 0x00000003
823#define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
824#define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
825#define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
826#define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
827#define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
828#define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
829#define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
830#define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
831#define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
832#define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
833
834/*
835 * RNID els command payload
836 */
837struct fc_rnid_cmd_s {
838 struct fc_els_cmd_s els_cmd;
839 u32 node_id_data_format:8;
840 u32 reserved:24;
841};
842
843/*
844 * RNID els response payload
845 */
846
847struct fc_rnid_common_id_data_s {
848 wwn_t port_name;
849 wwn_t node_name;
850};
851
852struct fc_rnid_general_topology_data_s {
853 u32 vendor_unique[4];
854 __be32 asso_type;
855 u32 phy_port_num;
856 __be32 num_attached_nodes;
857 u32 node_mgmt:8;
858 u32 ip_version:8;
859 u32 udp_tcp_port_num:16;
860 u32 ip_address[4];
861 u32 reserved:16;
862 u32 vendor_specific:16;
863};
864
865struct fc_rnid_acc_s {
866 struct fc_els_cmd_s els_cmd;
867 u32 node_id_data_format:8;
868 u32 common_id_data_length:8;
869 u32 reserved:8;
870 u32 specific_id_data_length:8;
871 struct fc_rnid_common_id_data_s common_id_data;
872 struct fc_rnid_general_topology_data_s gen_topology_data;
873};
874
875#define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
876#define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
877#define RNID_ASSOCIATED_TYPE_HUB 0x00000003
878#define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
879#define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
880#define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
881#define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
882#define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
883#define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
884#define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
885#define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
886#define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
887#define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
888
889enum fc_rpsc_speed_cap {
890 RPSC_SPEED_CAP_1G = 0x8000,
891 RPSC_SPEED_CAP_2G = 0x4000,
892 RPSC_SPEED_CAP_4G = 0x2000,
893 RPSC_SPEED_CAP_10G = 0x1000,
894 RPSC_SPEED_CAP_8G = 0x0800,
895 RPSC_SPEED_CAP_16G = 0x0400,
896
897 RPSC_SPEED_CAP_UNKNOWN = 0x0001,
898};
899
900enum fc_rpsc_op_speed {
901 RPSC_OP_SPEED_1G = 0x8000,
902 RPSC_OP_SPEED_2G = 0x4000,
903 RPSC_OP_SPEED_4G = 0x2000,
904 RPSC_OP_SPEED_10G = 0x1000,
905 RPSC_OP_SPEED_8G = 0x0800,
906 RPSC_OP_SPEED_16G = 0x0400,
907
908 RPSC_OP_SPEED_NOT_EST = 0x0001, /* speed not established */
909};
910
911struct fc_rpsc_speed_info_s {
912 __be16 port_speed_cap; /* see enum fc_rpsc_speed_cap */
913 __be16 port_op_speed; /* see enum fc_rpsc_op_speed */
914};
915
916/*
917 * If RPSC request is sent to the Domain Controller, the request is for
918 * all the ports within that domain.
919 */
920struct fc_rpsc_cmd_s {
921 struct fc_els_cmd_s els_cmd;
922};
923
924/*
925 * RPSC Acc
926 */
927struct fc_rpsc_acc_s {
928 u32 command:8;
929 u32 rsvd:8;
930 u32 num_entries:16;
931
932 struct fc_rpsc_speed_info_s speed_info[1];
933};
934
935/*
936 * If RPSC2 request is sent to the Domain Controller,
937 */
938#define FC_BRCD_TOKEN 0x42524344
939
940struct fc_rpsc2_cmd_s {
941 struct fc_els_cmd_s els_cmd;
942 __be32 token;
943 u16 resvd;
944 __be16 num_pids; /* Number of pids in the request */
945 struct {
946 u32 rsvd1:8;
947 u32 pid:24; /* port identifier */
948 } pid_list[1];
949};
950
951enum fc_rpsc2_port_type {
952 RPSC2_PORT_TYPE_UNKNOWN = 0,
953 RPSC2_PORT_TYPE_NPORT = 1,
954 RPSC2_PORT_TYPE_NLPORT = 2,
955 RPSC2_PORT_TYPE_NPIV_PORT = 0x5f,
956 RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f,
957};
958
959/*
960 * RPSC2 portInfo entry structure
961 */
962struct fc_rpsc2_port_info_s {
963 __be32 pid; /* PID */
964 u16 resvd1;
965 __be16 index; /* port number / index */
966 u8 resvd2;
967 u8 type; /* port type N/NL/... */
968 __be16 speed; /* port Operating Speed */
969};
970
971/*
972 * RPSC2 Accept payload
973 */
974struct fc_rpsc2_acc_s {
975 u8 els_cmd;
976 u8 resvd;
977 __be16 num_pids; /* Number of pids in the request */
978 struct fc_rpsc2_port_info_s port_info[1]; /* port information */
979};
980
981/*
982 * bit fields so that multiple classes can be specified
983 */
984enum fc_cos {
985 FC_CLASS_2 = 0x04,
986 FC_CLASS_3 = 0x08,
987 FC_CLASS_2_3 = 0x0C,
988};
989
990/*
991 * symbolic name
992 */
993struct fc_symname_s {
994 u8 symname[FC_SYMNAME_MAX];
995};
996
997struct fc_alpabm_s {
998 u8 alpa_bm[FC_ALPA_MAX / 8];
999};
1000
1001/*
1002 * protocol default timeout values
1003 */
1004#define FC_ED_TOV 2
1005#define FC_REC_TOV (FC_ED_TOV + 1)
1006#define FC_RA_TOV 10
1007#define FC_ELS_TOV (2 * FC_RA_TOV)
1008#define FC_FCCT_TOV (3 * FC_RA_TOV)
1009
1010/*
1011 * virtual fabric related defines
1012 */
1013#define FC_VF_ID_NULL 0 /* must not be used as VF_ID */
1014#define FC_VF_ID_MIN 1
1015#define FC_VF_ID_MAX 0xEFF
1016#define FC_VF_ID_CTL 0xFEF /* control VF_ID */
1017
1018/*
1019 * Virtual Fabric Tagging header format
1020 * @caution This is defined only in BIG ENDIAN format.
1021 */
1022struct fc_vft_s {
1023 u32 r_ctl:8;
1024 u32 ver:2;
1025 u32 type:4;
1026 u32 res_a:2;
1027 u32 priority:3;
1028 u32 vf_id:12;
1029 u32 res_b:1;
1030 u32 hopct:8;
1031 u32 res_c:24;
1032};
1033
1034/*
1035 * FCP_CMND definitions
1036 */
1037#define FCP_CMND_CDB_LEN 16
1038#define FCP_CMND_LUN_LEN 8
1039
1040struct fcp_cmnd_s {
1041 struct scsi_lun lun; /* 64-bit LU number */
1042 u8 crn; /* command reference number */
1043#ifdef __BIG_ENDIAN
1044 u8 resvd:1,
1045 priority:4, /* FCP-3: SAM-3 priority */
1046 taskattr:3; /* scsi task attribute */
1047#else
1048 u8 taskattr:3, /* scsi task attribute */
1049 priority:4, /* FCP-3: SAM-3 priority */
1050 resvd:1;
1051#endif
1052 u8 tm_flags; /* task management flags */
1053#ifdef __BIG_ENDIAN
1054 u8 addl_cdb_len:6, /* additional CDB length words */
1055 iodir:2; /* read/write FCP_DATA IUs */
1056#else
1057 u8 iodir:2, /* read/write FCP_DATA IUs */
1058 addl_cdb_len:6; /* additional CDB length */
1059#endif
1060 struct scsi_cdb_s cdb;
1061
1062 __be32 fcp_dl; /* bytes to be transferred */
1063};
1064
1065#define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN)
1066#define fcp_cmnd_fcpdl(_cmnd) ((&(_cmnd)->fcp_dl)[(_cmnd)->addl_cdb_len])
1067
1068/*
1069 * struct fcp_cmnd_s .iodir field values
1070 */
1071enum fcp_iodir {
1072 FCP_IODIR_NONE = 0,
1073 FCP_IODIR_WRITE = 1,
1074 FCP_IODIR_READ = 2,
1075 FCP_IODIR_RW = 3,
1076};
1077
1078/*
1079 * Task management flags field - only one bit shall be set
1080 */
1081enum fcp_tm_cmnd {
1082 FCP_TM_ABORT_TASK_SET = BIT(1),
1083 FCP_TM_CLEAR_TASK_SET = BIT(2),
1084 FCP_TM_LUN_RESET = BIT(4),
1085 FCP_TM_TARGET_RESET = BIT(5), /* obsolete in FCP-3 */
1086 FCP_TM_CLEAR_ACA = BIT(6),
1087};
1088
1089/*
1090 * FCP_RSP residue flags
1091 */
1092enum fcp_residue {
1093 FCP_NO_RESIDUE = 0, /* no residue */
1094 FCP_RESID_OVER = 1, /* more data left that was not sent */
1095 FCP_RESID_UNDER = 2, /* less data than requested */
1096};
1097
1098struct fcp_rspinfo_s {
1099 u32 res0:24;
1100 u32 rsp_code:8; /* response code (as above) */
1101 u32 res1;
1102};
1103
1104struct fcp_resp_s {
1105 u32 reserved[2]; /* 2 words reserved */
1106 u16 reserved2;
1107#ifdef __BIG_ENDIAN
1108 u8 reserved3:3;
1109 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1110 u8 resid_flags:2; /* underflow/overflow */
1111 u8 sns_len_valid:1; /* sense len is valid */
1112 u8 rsp_len_valid:1; /* response len is valid */
1113#else
1114 u8 rsp_len_valid:1; /* response len is valid */
1115 u8 sns_len_valid:1; /* sense len is valid */
1116 u8 resid_flags:2; /* underflow/overflow */
1117 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1118 u8 reserved3:3;
1119#endif
1120 u8 scsi_status; /* one byte SCSI status */
1121 u32 residue; /* residual data bytes */
1122 u32 sns_len; /* length od sense info */
1123 u32 rsp_len; /* length of response info */
1124};
1125
1126#define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \
1127 (__fcprsp)->sns_len : 0)
1128#define fcp_rsplen(__fcprsp) ((__fcprsp)->rsp_len_valid ? \
1129 (__fcprsp)->rsp_len : 0)
1130#define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1))
1131#define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \
1132 fcp_rsplen(__fcprsp))
1133/*
1134 * CT
1135 */
1136struct ct_hdr_s {
1137 u32 rev_id:8; /* Revision of the CT */
1138 u32 in_id:24; /* Initiator Id */
1139 u32 gs_type:8; /* Generic service Type */
1140 u32 gs_sub_type:8; /* Generic service sub type */
1141 u32 options:8; /* options */
1142 u32 rsvrd:8; /* reserved */
1143 u32 cmd_rsp_code:16;/* ct command/response code */
1144 u32 max_res_size:16;/* maximum/residual size */
1145 u32 frag_id:8; /* fragment ID */
1146 u32 reason_code:8; /* reason code */
1147 u32 exp_code:8; /* explanation code */
1148 u32 vendor_unq:8; /* vendor unique */
1149};
1150
1151/*
1152 * defines for the Revision
1153 */
1154enum {
1155 CT_GS3_REVISION = 0x01,
1156};
1157
1158/*
1159 * defines for gs_type
1160 */
1161enum {
1162 CT_GSTYPE_KEYSERVICE = 0xF7,
1163 CT_GSTYPE_ALIASSERVICE = 0xF8,
1164 CT_GSTYPE_MGMTSERVICE = 0xFA,
1165 CT_GSTYPE_TIMESERVICE = 0xFB,
1166 CT_GSTYPE_DIRSERVICE = 0xFC,
1167};
1168
1169/*
1170 * defines for gs_sub_type for gs type directory service
1171 */
1172enum {
1173 CT_GSSUBTYPE_NAMESERVER = 0x02,
1174};
1175
1176/*
1177 * defines for gs_sub_type for gs type management service
1178 */
1179enum {
1180 CT_GSSUBTYPE_CFGSERVER = 0x01,
1181 CT_GSSUBTYPE_UNZONED_NS = 0x02,
1182 CT_GSSUBTYPE_ZONESERVER = 0x03,
1183 CT_GSSUBTYPE_LOCKSERVER = 0x04,
1184 CT_GSSUBTYPE_HBA_MGMTSERVER = 0x10, /* for FDMI */
1185};
1186
1187/*
1188 * defines for CT response code field
1189 */
1190enum {
1191 CT_RSP_REJECT = 0x8001,
1192 CT_RSP_ACCEPT = 0x8002,
1193};
1194
1195/*
1196 * definitions for CT reason code
1197 */
1198enum {
1199 CT_RSN_INV_CMD = 0x01,
1200 CT_RSN_INV_VER = 0x02,
1201 CT_RSN_LOGIC_ERR = 0x03,
1202 CT_RSN_INV_SIZE = 0x04,
1203 CT_RSN_LOGICAL_BUSY = 0x05,
1204 CT_RSN_PROTO_ERR = 0x07,
1205 CT_RSN_UNABLE_TO_PERF = 0x09,
1206 CT_RSN_NOT_SUPP = 0x0B,
1207 CT_RSN_SERVER_NOT_AVBL = 0x0D,
1208 CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E,
1209 CT_RSN_VENDOR_SPECIFIC = 0xFF,
1210
1211};
1212
1213/*
1214 * definitions for explanations code for Name server
1215 */
1216enum {
1217 CT_NS_EXP_NOADDITIONAL = 0x00,
1218 CT_NS_EXP_ID_NOT_REG = 0x01,
1219 CT_NS_EXP_PN_NOT_REG = 0x02,
1220 CT_NS_EXP_NN_NOT_REG = 0x03,
1221 CT_NS_EXP_CS_NOT_REG = 0x04,
1222 CT_NS_EXP_IPN_NOT_REG = 0x05,
1223 CT_NS_EXP_IPA_NOT_REG = 0x06,
1224 CT_NS_EXP_FT_NOT_REG = 0x07,
1225 CT_NS_EXP_SPN_NOT_REG = 0x08,
1226 CT_NS_EXP_SNN_NOT_REG = 0x09,
1227 CT_NS_EXP_PT_NOT_REG = 0x0A,
1228 CT_NS_EXP_IPP_NOT_REG = 0x0B,
1229 CT_NS_EXP_FPN_NOT_REG = 0x0C,
1230 CT_NS_EXP_HA_NOT_REG = 0x0D,
1231 CT_NS_EXP_FD_NOT_REG = 0x0E,
1232 CT_NS_EXP_FF_NOT_REG = 0x0F,
1233 CT_NS_EXP_ACCESSDENIED = 0x10,
1234 CT_NS_EXP_UNACCEPTABLE_ID = 0x11,
1235 CT_NS_EXP_DATABASEEMPTY = 0x12,
1236 CT_NS_EXP_NOT_REG_IN_SCOPE = 0x13,
1237 CT_NS_EXP_DOM_ID_NOT_PRESENT = 0x14,
1238 CT_NS_EXP_PORT_NUM_NOT_PRESENT = 0x15,
1239 CT_NS_EXP_NO_DEVICE_ATTACHED = 0x16
1240};
1241
1242/*
1243 * definitions for the explanation code for all servers
1244 */
1245enum {
1246 CT_EXP_AUTH_EXCEPTION = 0xF1,
1247 CT_EXP_DB_FULL = 0xF2,
1248 CT_EXP_DB_EMPTY = 0xF3,
1249 CT_EXP_PROCESSING_REQ = 0xF4,
1250 CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5,
1251 CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6
1252};
1253
1254/*
1255 * Command codes for Name server
1256 */
1257enum {
1258 GS_GID_PN = 0x0121, /* Get Id on port name */
1259 GS_GPN_ID = 0x0112, /* Get port name on ID */
1260 GS_GNN_ID = 0x0113, /* Get node name on ID */
1261 GS_GID_FT = 0x0171, /* Get Id on FC4 type */
1262 GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */
1263 GS_RFT_ID = 0x0217, /* Register fc4type on ID */
1264 GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */
1265 GS_RSNN_NN = 0x0239, /* Register symbolic NN on NN */
1266 GS_RPN_ID = 0x0212, /* Register port name */
1267 GS_RNN_ID = 0x0213, /* Register node name */
1268 GS_RCS_ID = 0x0214, /* Register class of service */
1269 GS_RPT_ID = 0x021A, /* Register port type */
1270 GS_GA_NXT = 0x0100, /* Get all next */
1271 GS_RFF_ID = 0x021F, /* Register FC4 Feature */
1272};
1273
1274struct fcgs_id_req_s {
1275 u32 rsvd:8;
1276 u32 dap:24; /* port identifier */
1277};
1278#define fcgs_gpnid_req_t struct fcgs_id_req_s
1279#define fcgs_gnnid_req_t struct fcgs_id_req_s
1280#define fcgs_gspnid_req_t struct fcgs_id_req_s
1281
1282struct fcgs_gidpn_req_s {
1283 wwn_t port_name; /* port wwn */
1284};
1285
1286struct fcgs_gidpn_resp_s {
1287 u32 rsvd:8;
1288 u32 dap:24; /* port identifier */
1289};
1290
1291/*
1292 * RFT_ID
1293 */
1294struct fcgs_rftid_req_s {
1295 u32 rsvd:8;
1296 u32 dap:24; /* port identifier */
1297 __be32 fc4_type[8]; /* fc4 types */
1298};
1299
1300/*
1301 * RFF_ID : Register FC4 features.
1302 */
1303#define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02
1304#define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
1305
1306struct fcgs_rffid_req_s {
1307 u32 rsvd:8;
1308 u32 dap:24; /* port identifier */
1309 u32 rsvd1:16;
1310 u32 fc4ftr_bits:8; /* fc4 feature bits */
1311 u32 fc4_type:8; /* corresponding FC4 Type */
1312};
1313
1314/*
1315 * GID_FT Request
1316 */
1317struct fcgs_gidft_req_s {
1318 u8 reserved;
1319 u8 domain_id; /* domain, 0 - all fabric */
1320 u8 area_id; /* area, 0 - whole domain */
1321 u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */
1322};
1323
1324/*
1325 * GID_FT Response
1326 */
1327struct fcgs_gidft_resp_s {
1328 u8 last:1; /* last port identifier flag */
1329 u8 reserved:7;
1330 u32 pid:24; /* port identifier */
1331};
1332
1333/*
1334 * RSPN_ID
1335 */
1336struct fcgs_rspnid_req_s {
1337 u32 rsvd:8;
1338 u32 dap:24; /* port identifier */
1339 u8 spn_len; /* symbolic port name length */
1340 u8 spn[256]; /* symbolic port name */
1341};
1342
1343/*
1344 * RSNN_NN
1345 */
1346struct fcgs_rsnn_nn_req_s {
1347 wwn_t node_name; /* Node name */
1348 u8 snn_len; /* symbolic node name length */
1349 u8 snn[256]; /* symbolic node name */
1350};
1351
1352/*
1353 * RPN_ID
1354 */
1355struct fcgs_rpnid_req_s {
1356 u32 rsvd:8;
1357 u32 port_id:24;
1358 wwn_t port_name;
1359};
1360
1361/*
1362 * RNN_ID
1363 */
1364struct fcgs_rnnid_req_s {
1365 u32 rsvd:8;
1366 u32 port_id:24;
1367 wwn_t node_name;
1368};
1369
1370/*
1371 * RCS_ID
1372 */
1373struct fcgs_rcsid_req_s {
1374 u32 rsvd:8;
1375 u32 port_id:24;
1376 u32 cos;
1377};
1378
1379/*
1380 * RPT_ID
1381 */
1382struct fcgs_rptid_req_s {
1383 u32 rsvd:8;
1384 u32 port_id:24;
1385 u32 port_type:8;
1386 u32 rsvd1:24;
1387};
1388
1389/*
1390 * GA_NXT Request
1391 */
1392struct fcgs_ganxt_req_s {
1393 u32 rsvd:8;
1394 u32 port_id:24;
1395};
1396
1397/*
1398 * GA_NXT Response
1399 */
1400struct fcgs_ganxt_rsp_s {
1401 u32 port_type:8; /* Port Type */
1402 u32 port_id:24; /* Port Identifier */
1403 wwn_t port_name; /* Port Name */
1404 u8 spn_len; /* Length of Symbolic Port Name */
1405 char spn[255]; /* Symbolic Port Name */
1406 wwn_t node_name; /* Node Name */
1407 u8 snn_len; /* Length of Symbolic Node Name */
1408 char snn[255]; /* Symbolic Node Name */
1409 u8 ipa[8]; /* Initial Process Associator */
1410 u8 ip[16]; /* IP Address */
1411 u32 cos; /* Class of Service */
1412 u32 fc4types[8]; /* FC-4 TYPEs */
1413 wwn_t fabric_port_name; /* Fabric Port Name */
1414 u32 rsvd:8; /* Reserved */
1415 u32 hard_addr:24; /* Hard Address */
1416};
1417
1418/*
1419 * Command codes for Fabric Configuration Server
1420 */
1421enum {
1422 GS_FC_GFN_CMD = 0x0114, /* GS FC Get Fabric Name */
1423 GS_FC_GMAL_CMD = 0x0116, /* GS FC GMAL */
1424 GS_FC_TRACE_CMD = 0x0400, /* GS FC Trace Route */
1425 GS_FC_PING_CMD = 0x0401, /* GS FC Ping */
1426};
1427
1428/*
1429 * GMAL Command ( Get ( interconnect Element) Management Address List)
1430 * To retrieve the IP Address of a Switch.
1431 */
1432#define CT_GMAL_RESP_PREFIX_TELNET "telnet://"
1433#define CT_GMAL_RESP_PREFIX_HTTP "http://"
1434
1435/* GMAL/GFN request */
1436struct fcgs_req_s {
1437 wwn_t wwn; /* PWWN/NWWN */
1438};
1439
1440#define fcgs_gmal_req_t struct fcgs_req_s
1441#define fcgs_gfn_req_t struct fcgs_req_s
1442
1443/* Accept Response to GMAL */
1444struct fcgs_gmal_resp_s {
1445 __be32 ms_len; /* Num of entries */
1446 u8 ms_ma[256];
1447};
1448
1449struct fcgs_gmal_entry_s {
1450 u8 len;
1451 u8 prefix[7]; /* like "http://" */
1452 u8 ip_addr[248];
1453};
1454
1455/*
1456 * FDMI Command Codes
1457 */
1458#define FDMI_GRHL 0x0100
1459#define FDMI_GHAT 0x0101
1460#define FDMI_GRPL 0x0102
1461#define FDMI_GPAT 0x0110
1462#define FDMI_RHBA 0x0200
1463#define FDMI_RHAT 0x0201
1464#define FDMI_RPRT 0x0210
1465#define FDMI_RPA 0x0211
1466#define FDMI_DHBA 0x0300
1467#define FDMI_DPRT 0x0310
1468
1469/*
1470 * FDMI reason codes
1471 */
1472#define FDMI_NO_ADDITIONAL_EXP 0x00
1473#define FDMI_HBA_ALREADY_REG 0x10
1474#define FDMI_HBA_ATTRIB_NOT_REG 0x11
1475#define FDMI_HBA_ATTRIB_MULTIPLE 0x12
1476#define FDMI_HBA_ATTRIB_LENGTH_INVALID 0x13
1477#define FDMI_HBA_ATTRIB_NOT_PRESENT 0x14
1478#define FDMI_PORT_ORIG_NOT_IN_LIST 0x15
1479#define FDMI_PORT_HBA_NOT_IN_LIST 0x16
1480#define FDMI_PORT_ATTRIB_NOT_REG 0x20
1481#define FDMI_PORT_NOT_REG 0x21
1482#define FDMI_PORT_ATTRIB_MULTIPLE 0x22
1483#define FDMI_PORT_ATTRIB_LENGTH_INVALID 0x23
1484#define FDMI_PORT_ALREADY_REGISTEREED 0x24
1485
1486/*
1487 * FDMI Transmission Speed Mask values
1488 */
1489#define FDMI_TRANS_SPEED_1G 0x00000001
1490#define FDMI_TRANS_SPEED_2G 0x00000002
1491#define FDMI_TRANS_SPEED_10G 0x00000004
1492#define FDMI_TRANS_SPEED_4G 0x00000008
1493#define FDMI_TRANS_SPEED_8G 0x00000010
1494#define FDMI_TRANS_SPEED_16G 0x00000020
1495#define FDMI_TRANS_SPEED_UNKNOWN 0x00008000
1496
1497/*
1498 * FDMI HBA attribute types
1499 */
1500enum fdmi_hba_attribute_type {
1501 FDMI_HBA_ATTRIB_NODENAME = 1, /* 0x0001 */
1502 FDMI_HBA_ATTRIB_MANUFACTURER, /* 0x0002 */
1503 FDMI_HBA_ATTRIB_SERIALNUM, /* 0x0003 */
1504 FDMI_HBA_ATTRIB_MODEL, /* 0x0004 */
1505 FDMI_HBA_ATTRIB_MODEL_DESC, /* 0x0005 */
1506 FDMI_HBA_ATTRIB_HW_VERSION, /* 0x0006 */
1507 FDMI_HBA_ATTRIB_DRIVER_VERSION, /* 0x0007 */
1508 FDMI_HBA_ATTRIB_ROM_VERSION, /* 0x0008 */
1509 FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */
1510 FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */
1511 FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */
1512 FDMI_HBA_ATTRIB_NODE_SYM_NAME, /* 0x000C */
1513 FDMI_HBA_ATTRIB_VENDOR_INFO, /* 0x000D */
1514 FDMI_HBA_ATTRIB_NUM_PORTS, /* 0x000E */
1515 FDMI_HBA_ATTRIB_FABRIC_NAME, /* 0x000F */
1516 FDMI_HBA_ATTRIB_BIOS_VER, /* 0x0010 */
1517 FDMI_HBA_ATTRIB_VENDOR_ID = 0x00E0,
1518
1519 FDMI_HBA_ATTRIB_MAX_TYPE
1520};
1521
1522/*
1523 * FDMI Port attribute types
1524 */
1525enum fdmi_port_attribute_type {
1526 FDMI_PORT_ATTRIB_FC4_TYPES = 1, /* 0x0001 */
1527 FDMI_PORT_ATTRIB_SUPP_SPEED, /* 0x0002 */
1528 FDMI_PORT_ATTRIB_PORT_SPEED, /* 0x0003 */
1529 FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */
1530 FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */
1531 FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */
1532 FDMI_PORT_ATTRIB_NODE_NAME, /* 0x0007 */
1533 FDMI_PORT_ATTRIB_PORT_NAME, /* 0x0008 */
1534 FDMI_PORT_ATTRIB_PORT_SYM_NAME, /* 0x0009 */
1535 FDMI_PORT_ATTRIB_PORT_TYPE, /* 0x000A */
1536 FDMI_PORT_ATTRIB_SUPP_COS, /* 0x000B */
1537 FDMI_PORT_ATTRIB_PORT_FAB_NAME, /* 0x000C */
1538 FDMI_PORT_ATTRIB_PORT_FC4_TYPE, /* 0x000D */
1539 FDMI_PORT_ATTRIB_PORT_STATE = 0x101, /* 0x0101 */
1540 FDMI_PORT_ATTRIB_PORT_NUM_RPRT = 0x102, /* 0x0102 */
1541
1542 FDMI_PORT_ATTR_MAX_TYPE
1543};
1544
1545/*
1546 * FDMI attribute
1547 */
1548struct fdmi_attr_s {
1549 __be16 type;
1550 __be16 len;
1551 u8 value[];
1552};
1553
1554/*
1555 * HBA Attribute Block
1556 */
1557struct fdmi_hba_attr_s {
1558 __be32 attr_count; /* # of attributes */
1559 struct fdmi_attr_s hba_attr; /* n attributes */
1560};
1561
1562/*
1563 * Registered Port List
1564 */
1565struct fdmi_port_list_s {
1566 __be32 num_ports; /* number Of Port Entries */
1567 wwn_t port_entry; /* one or more */
1568};
1569
1570/*
1571 * Port Attribute Block
1572 */
1573struct fdmi_port_attr_s {
1574 __be32 attr_count; /* # of attributes */
1575 struct fdmi_attr_s port_attr; /* n attributes */
1576};
1577
1578/*
1579 * FDMI Register HBA Attributes
1580 */
1581struct fdmi_rhba_s {
1582 wwn_t hba_id; /* HBA Identifier */
1583 struct fdmi_port_list_s port_list; /* Registered Port List */
1584 struct fdmi_hba_attr_s hba_attr_blk; /* HBA attribute block */
1585};
1586
1587/*
1588 * FDMI Register Port
1589 */
1590struct fdmi_rprt_s {
1591 wwn_t hba_id; /* HBA Identifier */
1592 wwn_t port_name; /* Port wwn */
1593 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1594};
1595
1596/*
1597 * FDMI Register Port Attributes
1598 */
1599struct fdmi_rpa_s {
1600 wwn_t port_name; /* port wwn */
1601 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1602};
1603
1604#pragma pack()
1605
1606#endif /* __BFA_FC_H__ */
1/*
2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
5 *
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef __BFA_FC_H__
19#define __BFA_FC_H__
20
21#include "bfad_drv.h"
22
23typedef u64 wwn_t;
24
25#define WWN_NULL (0)
26#define FC_SYMNAME_MAX 256 /* max name server symbolic name size */
27
28#pragma pack(1)
29
30#define MAC_ADDRLEN (6)
31struct mac_s { u8 mac[MAC_ADDRLEN]; };
32#define mac_t struct mac_s
33
34/*
35 * generic SCSI cdb definition
36 */
37#define SCSI_MAX_CDBLEN 16
38struct scsi_cdb_s {
39 u8 scsi_cdb[SCSI_MAX_CDBLEN];
40};
41
42/* ------------------------------------------------------------
43 * SCSI status byte values
44 * ------------------------------------------------------------
45 */
46#define SCSI_STATUS_GOOD 0x00
47#define SCSI_STATUS_CHECK_CONDITION 0x02
48#define SCSI_STATUS_CONDITION_MET 0x04
49#define SCSI_STATUS_BUSY 0x08
50#define SCSI_STATUS_INTERMEDIATE 0x10
51#define SCSI_STATUS_ICM 0x14 /* intermediate condition met */
52#define SCSI_STATUS_RESERVATION_CONFLICT 0x18
53#define SCSI_STATUS_COMMAND_TERMINATED 0x22
54#define SCSI_STATUS_QUEUE_FULL 0x28
55#define SCSI_STATUS_ACA_ACTIVE 0x30
56
57#define SCSI_MAX_ALLOC_LEN 0xFF /* maximum allocarion length */
58
59#define SCSI_SENSE_CUR_ERR 0x70
60#define SCSI_SENSE_DEF_ERR 0x71
61
62/*
63 * SCSI additional sense codes
64 */
65#define SCSI_ASC_LUN_NOT_READY 0x04
66#define SCSI_ASC_LUN_NOT_SUPPORTED 0x25
67#define SCSI_ASC_TOCC 0x3F
68
69/*
70 * SCSI additional sense code qualifiers
71 */
72#define SCSI_ASCQ_MAN_INTR_REQ 0x03 /* manual intervention req */
73#define SCSI_ASCQ_RL_DATA_CHANGED 0x0E /* report luns data changed */
74
75/*
76 * Methods of reporting informational exceptions
77 */
78#define SCSI_MP_IEC_UNIT_ATTN 0x2 /* generate unit attention */
79
80struct scsi_report_luns_data_s {
81 u32 lun_list_length; /* length of LUN list length */
82 u32 reserved;
83 struct scsi_lun lun[1]; /* first LUN in lun list */
84};
85
86struct scsi_inquiry_vendor_s {
87 u8 vendor_id[8];
88};
89
90struct scsi_inquiry_prodid_s {
91 u8 product_id[16];
92};
93
94struct scsi_inquiry_prodrev_s {
95 u8 product_rev[4];
96};
97
98struct scsi_inquiry_data_s {
99#ifdef __BIG_ENDIAN
100 u8 peripheral_qual:3; /* peripheral qualifier */
101 u8 device_type:5; /* peripheral device type */
102 u8 rmb:1; /* removable medium bit */
103 u8 device_type_mod:7; /* device type modifier */
104 u8 version;
105 u8 aenc:1; /* async evt notification capability */
106 u8 trm_iop:1; /* terminate I/O process */
107 u8 norm_aca:1; /* normal ACA supported */
108 u8 hi_support:1; /* SCSI-3: supports REPORT LUNS */
109 u8 rsp_data_format:4;
110 u8 additional_len;
111 u8 sccs:1;
112 u8 reserved1:7;
113 u8 reserved2:1;
114 u8 enc_serv:1; /* enclosure service component */
115 u8 reserved3:1;
116 u8 multi_port:1; /* multi-port device */
117 u8 m_chngr:1; /* device in medium transport element */
118 u8 ack_req_q:1; /* SIP specific bit */
119 u8 addr32:1; /* SIP specific bit */
120 u8 addr16:1; /* SIP specific bit */
121 u8 rel_adr:1; /* relative address */
122 u8 w_bus32:1;
123 u8 w_bus16:1;
124 u8 synchronous:1;
125 u8 linked_commands:1;
126 u8 trans_dis:1;
127 u8 cmd_queue:1; /* command queueing supported */
128 u8 soft_reset:1; /* soft reset alternative (VS) */
129#else
130 u8 device_type:5; /* peripheral device type */
131 u8 peripheral_qual:3; /* peripheral qualifier */
132 u8 device_type_mod:7; /* device type modifier */
133 u8 rmb:1; /* removable medium bit */
134 u8 version;
135 u8 rsp_data_format:4;
136 u8 hi_support:1; /* SCSI-3: supports REPORT LUNS */
137 u8 norm_aca:1; /* normal ACA supported */
138 u8 terminate_iop:1;/* terminate I/O process */
139 u8 aenc:1; /* async evt notification capability */
140 u8 additional_len;
141 u8 reserved1:7;
142 u8 sccs:1;
143 u8 addr16:1; /* SIP specific bit */
144 u8 addr32:1; /* SIP specific bit */
145 u8 ack_req_q:1; /* SIP specific bit */
146 u8 m_chngr:1; /* device in medium transport element */
147 u8 multi_port:1; /* multi-port device */
148 u8 reserved3:1; /* TBD - Vendor Specific */
149 u8 enc_serv:1; /* enclosure service component */
150 u8 reserved2:1;
151 u8 soft_seset:1; /* soft reset alternative (VS) */
152 u8 cmd_queue:1; /* command queueing supported */
153 u8 trans_dis:1;
154 u8 linked_commands:1;
155 u8 synchronous:1;
156 u8 w_bus16:1;
157 u8 w_bus32:1;
158 u8 rel_adr:1; /* relative address */
159#endif
160 struct scsi_inquiry_vendor_s vendor_id;
161 struct scsi_inquiry_prodid_s product_id;
162 struct scsi_inquiry_prodrev_s product_rev;
163 u8 vendor_specific[20];
164 u8 reserved4[40];
165};
166
167/*
168 * SCSI sense data format
169 */
170struct scsi_sense_s {
171#ifdef __BIG_ENDIAN
172 u8 valid:1;
173 u8 rsp_code:7;
174#else
175 u8 rsp_code:7;
176 u8 valid:1;
177#endif
178 u8 seg_num;
179#ifdef __BIG_ENDIAN
180 u8 file_mark:1;
181 u8 eom:1; /* end of media */
182 u8 ili:1; /* incorrect length indicator */
183 u8 reserved:1;
184 u8 sense_key:4;
185#else
186 u8 sense_key:4;
187 u8 reserved:1;
188 u8 ili:1; /* incorrect length indicator */
189 u8 eom:1; /* end of media */
190 u8 file_mark:1;
191#endif
192 u8 information[4]; /* device-type or cmd specific info */
193 u8 add_sense_length; /* additional sense length */
194 u8 command_info[4];/* command specific information */
195 u8 asc; /* additional sense code */
196 u8 ascq; /* additional sense code qualifier */
197 u8 fru_code; /* field replaceable unit code */
198#ifdef __BIG_ENDIAN
199 u8 sksv:1; /* sense key specific valid */
200 u8 c_d:1; /* command/data bit */
201 u8 res1:2;
202 u8 bpv:1; /* bit pointer valid */
203 u8 bpointer:3; /* bit pointer */
204#else
205 u8 bpointer:3; /* bit pointer */
206 u8 bpv:1; /* bit pointer valid */
207 u8 res1:2;
208 u8 c_d:1; /* command/data bit */
209 u8 sksv:1; /* sense key specific valid */
210#endif
211 u8 fpointer[2]; /* field pointer */
212};
213
214/*
215 * Fibre Channel Header Structure (FCHS) definition
216 */
217struct fchs_s {
218#ifdef __BIG_ENDIAN
219 u32 routing:4; /* routing bits */
220 u32 cat_info:4; /* category info */
221#else
222 u32 cat_info:4; /* category info */
223 u32 routing:4; /* routing bits */
224#endif
225 u32 d_id:24; /* destination identifier */
226
227 u32 cs_ctl:8; /* class specific control */
228 u32 s_id:24; /* source identifier */
229
230 u32 type:8; /* data structure type */
231 u32 f_ctl:24; /* initial frame control */
232
233 u8 seq_id; /* sequence identifier */
234 u8 df_ctl; /* data field control */
235 u16 seq_cnt; /* sequence count */
236
237 __be16 ox_id; /* originator exchange ID */
238 u16 rx_id; /* responder exchange ID */
239
240 u32 ro; /* relative offset */
241};
242
243/*
244 * routing bit definitions
245 */
246enum {
247 FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
248 FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
249 FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
250 FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
251 FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
252 FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
253 FC_RTG_LINK_CTRL = 0xC, /* Link Control */
254};
255
256/*
257 * information category for extended link data and FC-4 Link Data
258 */
259enum {
260 FC_CAT_LD_REQUEST = 0x2, /* Request */
261 FC_CAT_LD_REPLY = 0x3, /* Reply */
262 FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
263};
264
265/*
266 * information category for extended headers (VFT, IFR or encapsulation)
267 */
268enum {
269 FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
270 FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
271 FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
272};
273
274/*
275 * information category for FC-4 device data
276 */
277enum {
278 FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
279 FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
280 FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
281 FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
282 FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
283 FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
284 FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
285 FC_CAT_CMD_STATUS = 0x7, /* Command Status */
286};
287
288/*
289 * Type Field Definitions. FC-PH Section 18.5 pg. 165
290 */
291enum {
292 FC_TYPE_BLS = 0x0, /* Basic Link Service */
293 FC_TYPE_ELS = 0x1, /* Extended Link Service */
294 FC_TYPE_IP = 0x5, /* IP */
295 FC_TYPE_FCP = 0x8, /* SCSI-FCP */
296 FC_TYPE_GPP = 0x9, /* SCSI_GPP */
297 FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
298 FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
299 FC_TYPE_FC_AL = 0x23, /* FC-AL */
300 FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
301 FC_TYPE_FC_SPINFAB = 0xEE, /* SPINFAB */
302 FC_TYPE_FC_DIAG = 0xEF, /* DIAG */
303 FC_TYPE_MAX = 256, /* 256 FC-4 types */
304};
305
306/*
307 * Frame Control Definitions. FC-PH Table-45. pg. 168
308 */
309enum {
310 FCTL_EC_ORIG = 0x000000, /* exchange originator */
311 FCTL_EC_RESP = 0x800000, /* exchange responder */
312 FCTL_SEQ_INI = 0x000000, /* sequence initiator */
313 FCTL_SEQ_REC = 0x400000, /* sequence recipient */
314 FCTL_FS_EXCH = 0x200000, /* first sequence of xchg */
315 FCTL_LS_EXCH = 0x100000, /* last sequence of xchg */
316 FCTL_END_SEQ = 0x080000, /* last frame of sequence */
317 FCTL_SI_XFER = 0x010000, /* seq initiative transfer */
318 FCTL_RO_PRESENT = 0x000008, /* relative offset present */
319 FCTL_FILLBYTE_MASK = 0x000003 /* , fill byte mask */
320};
321
322/*
323 * Fabric Well Known Addresses
324 */
325enum {
326 FC_MIN_WELL_KNOWN_ADDR = 0xFFFFF0,
327 FC_DOMAIN_CONTROLLER_MASK = 0xFFFC00,
328 FC_ALIAS_SERVER = 0xFFFFF8,
329 FC_MGMT_SERVER = 0xFFFFFA,
330 FC_TIME_SERVER = 0xFFFFFB,
331 FC_NAME_SERVER = 0xFFFFFC,
332 FC_FABRIC_CONTROLLER = 0xFFFFFD,
333 FC_FABRIC_PORT = 0xFFFFFE,
334 FC_BROADCAST_SERVER = 0xFFFFFF
335};
336
337/*
338 * domain/area/port defines
339 */
340#define FC_DOMAIN_MASK 0xFF0000
341#define FC_DOMAIN_SHIFT 16
342#define FC_AREA_MASK 0x00FF00
343#define FC_AREA_SHIFT 8
344#define FC_PORT_MASK 0x0000FF
345#define FC_PORT_SHIFT 0
346
347#define FC_GET_DOMAIN(p) (((p) & FC_DOMAIN_MASK) >> FC_DOMAIN_SHIFT)
348#define FC_GET_AREA(p) (((p) & FC_AREA_MASK) >> FC_AREA_SHIFT)
349#define FC_GET_PORT(p) (((p) & FC_PORT_MASK) >> FC_PORT_SHIFT)
350
351#define FC_DOMAIN_CTRLR(p) (FC_DOMAIN_CONTROLLER_MASK | (FC_GET_DOMAIN(p)))
352
353enum {
354 FC_RXID_ANY = 0xFFFFU,
355};
356
357/*
358 * generic ELS command
359 */
360struct fc_els_cmd_s {
361 u32 els_code:8; /* ELS Command Code */
362 u32 reserved:24;
363};
364
365/*
366 * ELS Command Codes. FC-PH Table-75. pg. 223
367 */
368enum {
369 FC_ELS_LS_RJT = 0x1, /* Link Service Reject. */
370 FC_ELS_ACC = 0x02, /* Accept */
371 FC_ELS_PLOGI = 0x03, /* N_Port Login. */
372 FC_ELS_FLOGI = 0x04, /* F_Port Login. */
373 FC_ELS_LOGO = 0x05, /* Logout. */
374 FC_ELS_ABTX = 0x06, /* Abort Exchange */
375 FC_ELS_RES = 0x08, /* Read Exchange status */
376 FC_ELS_RSS = 0x09, /* Read sequence status block */
377 FC_ELS_RSI = 0x0A, /* Request Sequence Initiative */
378 FC_ELS_ESTC = 0x0C, /* Estimate Credit. */
379 FC_ELS_RTV = 0x0E, /* Read Timeout Value. */
380 FC_ELS_RLS = 0x0F, /* Read Link Status. */
381 FC_ELS_ECHO = 0x10, /* Echo */
382 FC_ELS_TEST = 0x11, /* Test */
383 FC_ELS_RRQ = 0x12, /* Reinstate Recovery Qualifier. */
384 FC_ELS_REC = 0x13, /* Add this for TAPE support in FCR */
385 FC_ELS_PRLI = 0x20, /* Process Login */
386 FC_ELS_PRLO = 0x21, /* Process Logout. */
387 FC_ELS_SCN = 0x22, /* State Change Notification. */
388 FC_ELS_TPRLO = 0x24, /* Third Party Process Logout. */
389 FC_ELS_PDISC = 0x50, /* Discover N_Port Parameters. */
390 FC_ELS_FDISC = 0x51, /* Discover F_Port Parameters. */
391 FC_ELS_ADISC = 0x52, /* Discover Address. */
392 FC_ELS_FARP_REQ = 0x54, /* FARP Request. */
393 FC_ELS_FARP_REP = 0x55, /* FARP Reply. */
394 FC_ELS_FAN = 0x60, /* Fabric Address Notification */
395 FC_ELS_RSCN = 0x61, /* Reg State Change Notification */
396 FC_ELS_SCR = 0x62, /* State Change Registration. */
397 FC_ELS_RTIN = 0x77, /* Mangement server request */
398 FC_ELS_RNID = 0x78, /* Mangement server request */
399 FC_ELS_RLIR = 0x79, /* Registered Link Incident Record */
400
401 FC_ELS_RPSC = 0x7D, /* Report Port Speed Capabilities */
402 FC_ELS_QSA = 0x7E, /* Query Security Attributes. Ref FC-SP */
403 FC_ELS_E2E_LBEACON = 0x81,
404 /* End-to-End Link Beacon */
405 FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */
406 FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref
407 *FC-SP */
408};
409
410/*
411 * Version numbers for FC-PH standards,
412 * used in login to indicate what port
413 * supports. See FC-PH-X table 158.
414 */
415enum {
416 FC_PH_VER_4_3 = 0x09,
417 FC_PH_VER_PH_3 = 0x20,
418};
419
420/*
421 * PDU size defines
422 */
423enum {
424 FC_MIN_PDUSZ = 512,
425 FC_MAX_PDUSZ = 2112,
426};
427
428/*
429 * N_Port PLOGI Common Service Parameters.
430 * FC-PH-x. Figure-76. pg. 308.
431 */
432struct fc_plogi_csp_s {
433 u8 verhi; /* FC-PH high version */
434 u8 verlo; /* FC-PH low version */
435 __be16 bbcred; /* BB_Credit */
436
437#ifdef __BIG_ENDIAN
438 u8 ciro:1, /* continuously increasing RO */
439 rro:1, /* random relative offset */
440 npiv_supp:1, /* NPIV supported */
441 port_type:1, /* N_Port/F_port */
442 altbbcred:1, /* alternate BB_Credit */
443 resolution:1, /* ms/ns ED_TOV resolution */
444 vvl_info:1, /* VVL Info included */
445 reserved1:1;
446
447 u8 hg_supp:1,
448 query_dbc:1,
449 security:1,
450 sync_cap:1,
451 r_t_tov:1,
452 dh_dup_supp:1,
453 cisc:1, /* continuously increasing seq count */
454 payload:1;
455#else
456 u8 reserved2:2,
457 resolution:1, /* ms/ns ED_TOV resolution */
458 altbbcred:1, /* alternate BB_Credit */
459 port_type:1, /* N_Port/F_port */
460 npiv_supp:1, /* NPIV supported */
461 rro:1, /* random relative offset */
462 ciro:1; /* continuously increasing RO */
463
464 u8 payload:1,
465 cisc:1, /* continuously increasing seq count */
466 dh_dup_supp:1,
467 r_t_tov:1,
468 sync_cap:1,
469 security:1,
470 query_dbc:1,
471 hg_supp:1;
472#endif
473 __be16 rxsz; /* receive data_field size */
474 __be16 conseq;
475 __be16 ro_bitmap;
476 __be32 e_d_tov;
477};
478
479/*
480 * N_Port PLOGI Class Specific Parameters.
481 * FC-PH-x. Figure 78. pg. 318.
482 */
483struct fc_plogi_clp_s {
484#ifdef __BIG_ENDIAN
485 u32 class_valid:1;
486 u32 intermix:1; /* class intermix supported if set =1.
487 * valid only for class1. Reserved for
488 * class2 & class3 */
489 u32 reserved1:2;
490 u32 sequential:1;
491 u32 reserved2:3;
492#else
493 u32 reserved2:3;
494 u32 sequential:1;
495 u32 reserved1:2;
496 u32 intermix:1; /* class intermix supported if set =1.
497 * valid only for class1. Reserved for
498 * class2 & class3 */
499 u32 class_valid:1;
500#endif
501 u32 reserved3:24;
502
503 u32 reserved4:16;
504 u32 rxsz:16; /* Receive data_field size */
505
506 u32 reserved5:8;
507 u32 conseq:8;
508 u32 e2e_credit:16; /* end to end credit */
509
510 u32 reserved7:8;
511 u32 ospx:8;
512 u32 reserved8:16;
513};
514
515/* ASCII value for each character in string "BRCD" */
516#define FLOGI_VVL_BRCD 0x42524344
517
518/*
519 * PLOGI els command and reply payload
520 */
521struct fc_logi_s {
522 struct fc_els_cmd_s els_cmd; /* ELS command code */
523 struct fc_plogi_csp_s csp; /* common service params */
524 wwn_t port_name;
525 wwn_t node_name;
526 struct fc_plogi_clp_s class1; /* class 1 service parameters */
527 struct fc_plogi_clp_s class2; /* class 2 service parameters */
528 struct fc_plogi_clp_s class3; /* class 3 service parameters */
529 struct fc_plogi_clp_s class4; /* class 4 service parameters */
530 u8 vvl[16]; /* vendor version level */
531};
532
533/*
534 * LOGO els command payload
535 */
536struct fc_logo_s {
537 struct fc_els_cmd_s els_cmd; /* ELS command code */
538 u32 res1:8;
539 u32 nport_id:24; /* N_Port identifier of source */
540 wwn_t orig_port_name; /* Port name of the LOGO originator */
541};
542
543/*
544 * ADISC els command payload
545 */
546struct fc_adisc_s {
547 struct fc_els_cmd_s els_cmd; /* ELS command code */
548 u32 res1:8;
549 u32 orig_HA:24; /* originator hard address */
550 wwn_t orig_port_name; /* originator port name */
551 wwn_t orig_node_name; /* originator node name */
552 u32 res2:8;
553 u32 nport_id:24; /* originator NPortID */
554};
555
556/*
557 * Exchange status block
558 */
559struct fc_exch_status_blk_s {
560 u32 oxid:16;
561 u32 rxid:16;
562 u32 res1:8;
563 u32 orig_np:24; /* originator NPortID */
564 u32 res2:8;
565 u32 resp_np:24; /* responder NPortID */
566 u32 es_bits;
567 u32 res3;
568 /*
569 * un modified section of the fields
570 */
571};
572
573/*
574 * RES els command payload
575 */
576struct fc_res_s {
577 struct fc_els_cmd_s els_cmd; /* ELS command code */
578 u32 res1:8;
579 u32 nport_id:24; /* N_Port identifier of source */
580 u32 oxid:16;
581 u32 rxid:16;
582 u8 assoc_hdr[32];
583};
584
585/*
586 * RES els accept payload
587 */
588struct fc_res_acc_s {
589 struct fc_els_cmd_s els_cmd; /* ELS command code */
590 struct fc_exch_status_blk_s fc_exch_blk; /* Exchange status block */
591};
592
593/*
594 * REC els command payload
595 */
596struct fc_rec_s {
597 struct fc_els_cmd_s els_cmd; /* ELS command code */
598 u32 res1:8;
599 u32 nport_id:24; /* N_Port identifier of source */
600 u32 oxid:16;
601 u32 rxid:16;
602};
603
604#define FC_REC_ESB_OWN_RSP 0x80000000 /* responder owns */
605#define FC_REC_ESB_SI 0x40000000 /* SI is owned */
606#define FC_REC_ESB_COMP 0x20000000 /* exchange is complete */
607#define FC_REC_ESB_ENDCOND_ABN 0x10000000 /* abnormal ending */
608#define FC_REC_ESB_RQACT 0x04000000 /* recovery qual active */
609#define FC_REC_ESB_ERRP_MSK 0x03000000
610#define FC_REC_ESB_OXID_INV 0x00800000 /* invalid OXID */
611#define FC_REC_ESB_RXID_INV 0x00400000 /* invalid RXID */
612#define FC_REC_ESB_PRIO_INUSE 0x00200000
613
614/*
615 * REC els accept payload
616 */
617struct fc_rec_acc_s {
618 struct fc_els_cmd_s els_cmd; /* ELS command code */
619 u32 oxid:16;
620 u32 rxid:16;
621 u32 res1:8;
622 u32 orig_id:24; /* N_Port id of exchange originator */
623 u32 res2:8;
624 u32 resp_id:24; /* N_Port id of exchange responder */
625 u32 count; /* data transfer count */
626 u32 e_stat; /* exchange status */
627};
628
629/*
630 * RSI els payload
631 */
632struct fc_rsi_s {
633 struct fc_els_cmd_s els_cmd;
634 u32 res1:8;
635 u32 orig_sid:24;
636 u32 oxid:16;
637 u32 rxid:16;
638};
639
640/*
641 * structure for PRLI paramater pages, both request & response
642 * see FC-PH-X table 113 & 115 for explanation also FCP table 8
643 */
644struct fc_prli_params_s {
645 u32 reserved:16;
646#ifdef __BIG_ENDIAN
647 u32 reserved1:5;
648 u32 rec_support:1;
649 u32 task_retry_id:1;
650 u32 retry:1;
651
652 u32 confirm:1;
653 u32 doverlay:1;
654 u32 initiator:1;
655 u32 target:1;
656 u32 cdmix:1;
657 u32 drmix:1;
658 u32 rxrdisab:1;
659 u32 wxrdisab:1;
660#else
661 u32 retry:1;
662 u32 task_retry_id:1;
663 u32 rec_support:1;
664 u32 reserved1:5;
665
666 u32 wxrdisab:1;
667 u32 rxrdisab:1;
668 u32 drmix:1;
669 u32 cdmix:1;
670 u32 target:1;
671 u32 initiator:1;
672 u32 doverlay:1;
673 u32 confirm:1;
674#endif
675};
676
677/*
678 * valid values for rspcode in PRLI ACC payload
679 */
680enum {
681 FC_PRLI_ACC_XQTD = 0x1, /* request executed */
682 FC_PRLI_ACC_PREDEF_IMG = 0x5, /* predefined image - no prli needed */
683};
684
685struct fc_prli_params_page_s {
686 u32 type:8;
687 u32 codext:8;
688#ifdef __BIG_ENDIAN
689 u32 origprocasv:1;
690 u32 rsppav:1;
691 u32 imagepair:1;
692 u32 reserved1:1;
693 u32 rspcode:4;
694#else
695 u32 rspcode:4;
696 u32 reserved1:1;
697 u32 imagepair:1;
698 u32 rsppav:1;
699 u32 origprocasv:1;
700#endif
701 u32 reserved2:8;
702
703 u32 origprocas;
704 u32 rspprocas;
705 struct fc_prli_params_s servparams;
706};
707
708/*
709 * PRLI request and accept payload, FC-PH-X tables 112 & 114
710 */
711struct fc_prli_s {
712 u32 command:8;
713 u32 pglen:8;
714 u32 pagebytes:16;
715 struct fc_prli_params_page_s parampage;
716};
717
718/*
719 * PRLO logout params page
720 */
721struct fc_prlo_params_page_s {
722 u32 type:8;
723 u32 type_ext:8;
724#ifdef __BIG_ENDIAN
725 u32 opa_valid:1; /* originator process associator valid */
726 u32 rpa_valid:1; /* responder process associator valid */
727 u32 res1:14;
728#else
729 u32 res1:14;
730 u32 rpa_valid:1; /* responder process associator valid */
731 u32 opa_valid:1; /* originator process associator valid */
732#endif
733 u32 orig_process_assc;
734 u32 resp_process_assc;
735
736 u32 res2;
737};
738
739/*
740 * PRLO els command payload
741 */
742struct fc_prlo_s {
743 u32 command:8;
744 u32 page_len:8;
745 u32 payload_len:16;
746 struct fc_prlo_params_page_s prlo_params[1];
747};
748
749/*
750 * PRLO Logout response parameter page
751 */
752struct fc_prlo_acc_params_page_s {
753 u32 type:8;
754 u32 type_ext:8;
755
756#ifdef __BIG_ENDIAN
757 u32 opa_valid:1; /* originator process associator valid */
758 u32 rpa_valid:1; /* responder process associator valid */
759 u32 res1:14;
760#else
761 u32 res1:14;
762 u32 rpa_valid:1; /* responder process associator valid */
763 u32 opa_valid:1; /* originator process associator valid */
764#endif
765 u32 orig_process_assc;
766 u32 resp_process_assc;
767
768 u32 fc4type_csp;
769};
770
771/*
772 * PRLO els command ACC payload
773 */
774struct fc_prlo_acc_s {
775 u32 command:8;
776 u32 page_len:8;
777 u32 payload_len:16;
778 struct fc_prlo_acc_params_page_s prlo_acc_params[1];
779};
780
781/*
782 * SCR els command payload
783 */
784enum {
785 FC_SCR_REG_FUNC_FABRIC_DETECTED = 0x01,
786 FC_SCR_REG_FUNC_N_PORT_DETECTED = 0x02,
787 FC_SCR_REG_FUNC_FULL = 0x03,
788 FC_SCR_REG_FUNC_CLEAR_REG = 0xFF,
789};
790
791/* SCR VU registrations */
792enum {
793 FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE = 0x01
794};
795
796struct fc_scr_s {
797 u32 command:8;
798 u32 res:24;
799 u32 vu_reg_func:8; /* Vendor Unique Registrations */
800 u32 res1:16;
801 u32 reg_func:8;
802};
803
804/*
805 * Information category for Basic link data
806 */
807enum {
808 FC_CAT_NOP = 0x0,
809 FC_CAT_ABTS = 0x1,
810 FC_CAT_RMC = 0x2,
811 FC_CAT_BA_ACC = 0x4,
812 FC_CAT_BA_RJT = 0x5,
813 FC_CAT_PRMT = 0x6,
814};
815
816/*
817 * LS_RJT els reply payload
818 */
819struct fc_ls_rjt_s {
820 struct fc_els_cmd_s els_cmd; /* ELS command code */
821 u32 res1:8;
822 u32 reason_code:8; /* Reason code for reject */
823 u32 reason_code_expl:8; /* Reason code explanation */
824 u32 vendor_unique:8; /* Vendor specific */
825};
826
827/*
828 * LS_RJT reason codes
829 */
830enum {
831 FC_LS_RJT_RSN_INV_CMD_CODE = 0x01,
832 FC_LS_RJT_RSN_LOGICAL_ERROR = 0x03,
833 FC_LS_RJT_RSN_LOGICAL_BUSY = 0x05,
834 FC_LS_RJT_RSN_PROTOCOL_ERROR = 0x07,
835 FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD = 0x09,
836 FC_LS_RJT_RSN_CMD_NOT_SUPP = 0x0B,
837};
838
839/*
840 * LS_RJT reason code explanation
841 */
842enum {
843 FC_LS_RJT_EXP_NO_ADDL_INFO = 0x00,
844 FC_LS_RJT_EXP_SPARMS_ERR_OPTIONS = 0x01,
845 FC_LS_RJT_EXP_SPARMS_ERR_INI_CTL = 0x03,
846 FC_LS_RJT_EXP_SPARMS_ERR_REC_CTL = 0x05,
847 FC_LS_RJT_EXP_SPARMS_ERR_RXSZ = 0x07,
848 FC_LS_RJT_EXP_SPARMS_ERR_CONSEQ = 0x09,
849 FC_LS_RJT_EXP_SPARMS_ERR_CREDIT = 0x0B,
850 FC_LS_RJT_EXP_INV_PORT_NAME = 0x0D,
851 FC_LS_RJT_EXP_INV_NODE_FABRIC_NAME = 0x0E,
852 FC_LS_RJT_EXP_INV_CSP = 0x0F,
853 FC_LS_RJT_EXP_INV_ASSOC_HDR = 0x11,
854 FC_LS_RJT_EXP_ASSOC_HDR_REQD = 0x13,
855 FC_LS_RJT_EXP_INV_ORIG_S_ID = 0x15,
856 FC_LS_RJT_EXP_INV_OXID_RXID_COMB = 0x17,
857 FC_LS_RJT_EXP_CMD_ALREADY_IN_PROG = 0x19,
858 FC_LS_RJT_EXP_LOGIN_REQUIRED = 0x1E,
859 FC_LS_RJT_EXP_INVALID_NPORT_ID = 0x1F,
860 FC_LS_RJT_EXP_INSUFF_RES = 0x29,
861 FC_LS_RJT_EXP_CMD_NOT_SUPP = 0x2C,
862 FC_LS_RJT_EXP_INV_PAYLOAD_LEN = 0x2D,
863};
864
865/*
866 * RRQ els command payload
867 */
868struct fc_rrq_s {
869 struct fc_els_cmd_s els_cmd; /* ELS command code */
870 u32 res1:8;
871 u32 s_id:24; /* exchange originator S_ID */
872
873 u32 ox_id:16; /* originator exchange ID */
874 u32 rx_id:16; /* responder exchange ID */
875
876 u32 res2[8]; /* optional association header */
877};
878
879/*
880 * ABTS BA_ACC reply payload
881 */
882struct fc_ba_acc_s {
883 u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */
884 u32 seq_id:8; /* invalid for Abort Exchange */
885 u32 res2:16;
886 u32 ox_id:16; /* OX_ID from ABTS frame */
887 u32 rx_id:16; /* RX_ID from ABTS frame */
888 u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */
889 u32 high_seq_cnt:16; /* set to 0xFFFF for Abort Exchange */
890};
891
892/*
893 * ABTS BA_RJT reject payload
894 */
895struct fc_ba_rjt_s {
896 u32 res1:8; /* Reserved */
897 u32 reason_code:8; /* reason code for reject */
898 u32 reason_expl:8; /* reason code explanation */
899 u32 vendor_unique:8; /* vendor unique reason code,set to 0 */
900};
901
902/*
903 * TPRLO logout parameter page
904 */
905struct fc_tprlo_params_page_s {
906 u32 type:8;
907 u32 type_ext:8;
908
909#ifdef __BIG_ENDIAN
910 u32 opa_valid:1;
911 u32 rpa_valid:1;
912 u32 tpo_nport_valid:1;
913 u32 global_process_logout:1;
914 u32 res1:12;
915#else
916 u32 res1:12;
917 u32 global_process_logout:1;
918 u32 tpo_nport_valid:1;
919 u32 rpa_valid:1;
920 u32 opa_valid:1;
921#endif
922
923 u32 orig_process_assc;
924 u32 resp_process_assc;
925
926 u32 res2:8;
927 u32 tpo_nport_id;
928};
929
930/*
931 * TPRLO ELS command payload
932 */
933struct fc_tprlo_s {
934 u32 command:8;
935 u32 page_len:8;
936 u32 payload_len:16;
937
938 struct fc_tprlo_params_page_s tprlo_params[1];
939};
940
941enum fc_tprlo_type {
942 FC_GLOBAL_LOGO = 1,
943 FC_TPR_LOGO
944};
945
946/*
947 * TPRLO els command ACC payload
948 */
949struct fc_tprlo_acc_s {
950 u32 command:8;
951 u32 page_len:8;
952 u32 payload_len:16;
953 struct fc_prlo_acc_params_page_s tprlo_acc_params[1];
954};
955
956/*
957 * RSCN els command req payload
958 */
959#define FC_RSCN_PGLEN 0x4
960
961enum fc_rscn_format {
962 FC_RSCN_FORMAT_PORTID = 0x0,
963 FC_RSCN_FORMAT_AREA = 0x1,
964 FC_RSCN_FORMAT_DOMAIN = 0x2,
965 FC_RSCN_FORMAT_FABRIC = 0x3,
966};
967
968struct fc_rscn_event_s {
969 u32 format:2;
970 u32 qualifier:4;
971 u32 resvd:2;
972 u32 portid:24;
973};
974
975struct fc_rscn_pl_s {
976 u8 command;
977 u8 pagelen;
978 __be16 payldlen;
979 struct fc_rscn_event_s event[1];
980};
981
982/*
983 * ECHO els command req payload
984 */
985struct fc_echo_s {
986 struct fc_els_cmd_s els_cmd;
987};
988
989/*
990 * RNID els command
991 */
992#define RNID_NODEID_DATA_FORMAT_COMMON 0x00
993#define RNID_NODEID_DATA_FORMAT_FCP3 0x08
994#define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF
995
996#define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
997#define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
998#define RNID_ASSOCIATED_TYPE_HUB 0x00000003
999#define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
1000#define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
1001#define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
1002#define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
1003#define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
1004#define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
1005#define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
1006#define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
1007#define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
1008#define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
1009
1010/*
1011 * RNID els command payload
1012 */
1013struct fc_rnid_cmd_s {
1014 struct fc_els_cmd_s els_cmd;
1015 u32 node_id_data_format:8;
1016 u32 reserved:24;
1017};
1018
1019/*
1020 * RNID els response payload
1021 */
1022
1023struct fc_rnid_common_id_data_s {
1024 wwn_t port_name;
1025 wwn_t node_name;
1026};
1027
1028struct fc_rnid_general_topology_data_s {
1029 u32 vendor_unique[4];
1030 __be32 asso_type;
1031 u32 phy_port_num;
1032 __be32 num_attached_nodes;
1033 u32 node_mgmt:8;
1034 u32 ip_version:8;
1035 u32 udp_tcp_port_num:16;
1036 u32 ip_address[4];
1037 u32 reserved:16;
1038 u32 vendor_specific:16;
1039};
1040
1041struct fc_rnid_acc_s {
1042 struct fc_els_cmd_s els_cmd;
1043 u32 node_id_data_format:8;
1044 u32 common_id_data_length:8;
1045 u32 reserved:8;
1046 u32 specific_id_data_length:8;
1047 struct fc_rnid_common_id_data_s common_id_data;
1048 struct fc_rnid_general_topology_data_s gen_topology_data;
1049};
1050
1051#define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
1052#define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
1053#define RNID_ASSOCIATED_TYPE_HUB 0x00000003
1054#define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
1055#define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
1056#define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
1057#define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
1058#define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
1059#define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
1060#define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
1061#define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
1062#define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
1063#define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
1064
1065enum fc_rpsc_speed_cap {
1066 RPSC_SPEED_CAP_1G = 0x8000,
1067 RPSC_SPEED_CAP_2G = 0x4000,
1068 RPSC_SPEED_CAP_4G = 0x2000,
1069 RPSC_SPEED_CAP_10G = 0x1000,
1070 RPSC_SPEED_CAP_8G = 0x0800,
1071 RPSC_SPEED_CAP_16G = 0x0400,
1072
1073 RPSC_SPEED_CAP_UNKNOWN = 0x0001,
1074};
1075
1076enum fc_rpsc_op_speed {
1077 RPSC_OP_SPEED_1G = 0x8000,
1078 RPSC_OP_SPEED_2G = 0x4000,
1079 RPSC_OP_SPEED_4G = 0x2000,
1080 RPSC_OP_SPEED_10G = 0x1000,
1081 RPSC_OP_SPEED_8G = 0x0800,
1082 RPSC_OP_SPEED_16G = 0x0400,
1083
1084 RPSC_OP_SPEED_NOT_EST = 0x0001, /* speed not established */
1085};
1086
1087struct fc_rpsc_speed_info_s {
1088 __be16 port_speed_cap; /* see enum fc_rpsc_speed_cap */
1089 __be16 port_op_speed; /* see enum fc_rpsc_op_speed */
1090};
1091
1092/*
1093 * If RPSC request is sent to the Domain Controller, the request is for
1094 * all the ports within that domain.
1095 */
1096struct fc_rpsc_cmd_s {
1097 struct fc_els_cmd_s els_cmd;
1098};
1099
1100/*
1101 * RPSC Acc
1102 */
1103struct fc_rpsc_acc_s {
1104 u32 command:8;
1105 u32 rsvd:8;
1106 u32 num_entries:16;
1107
1108 struct fc_rpsc_speed_info_s speed_info[1];
1109};
1110
1111/*
1112 * If RPSC2 request is sent to the Domain Controller,
1113 */
1114#define FC_BRCD_TOKEN 0x42524344
1115
1116struct fc_rpsc2_cmd_s {
1117 struct fc_els_cmd_s els_cmd;
1118 __be32 token;
1119 u16 resvd;
1120 __be16 num_pids; /* Number of pids in the request */
1121 struct {
1122 u32 rsvd1:8;
1123 u32 pid:24; /* port identifier */
1124 } pid_list[1];
1125};
1126
1127enum fc_rpsc2_port_type {
1128 RPSC2_PORT_TYPE_UNKNOWN = 0,
1129 RPSC2_PORT_TYPE_NPORT = 1,
1130 RPSC2_PORT_TYPE_NLPORT = 2,
1131 RPSC2_PORT_TYPE_NPIV_PORT = 0x5f,
1132 RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f,
1133};
1134
1135/*
1136 * RPSC2 portInfo entry structure
1137 */
1138struct fc_rpsc2_port_info_s {
1139 __be32 pid; /* PID */
1140 u16 resvd1;
1141 __be16 index; /* port number / index */
1142 u8 resvd2;
1143 u8 type; /* port type N/NL/... */
1144 __be16 speed; /* port Operating Speed */
1145};
1146
1147/*
1148 * RPSC2 Accept payload
1149 */
1150struct fc_rpsc2_acc_s {
1151 u8 els_cmd;
1152 u8 resvd;
1153 __be16 num_pids; /* Number of pids in the request */
1154 struct fc_rpsc2_port_info_s port_info[1]; /* port information */
1155};
1156
1157/*
1158 * bit fields so that multiple classes can be specified
1159 */
1160enum fc_cos {
1161 FC_CLASS_2 = 0x04,
1162 FC_CLASS_3 = 0x08,
1163 FC_CLASS_2_3 = 0x0C,
1164};
1165
1166/*
1167 * symbolic name
1168 */
1169struct fc_symname_s {
1170 u8 symname[FC_SYMNAME_MAX];
1171};
1172
1173/*
1174 * protocol default timeout values
1175 */
1176#define FC_ED_TOV 2
1177#define FC_REC_TOV (FC_ED_TOV + 1)
1178#define FC_RA_TOV 10
1179#define FC_ELS_TOV ((2 * FC_RA_TOV) + 1)
1180#define FC_FCCT_TOV (3 * FC_RA_TOV)
1181
1182/*
1183 * virtual fabric related defines
1184 */
1185#define FC_VF_ID_NULL 0 /* must not be used as VF_ID */
1186#define FC_VF_ID_MIN 1
1187#define FC_VF_ID_MAX 0xEFF
1188#define FC_VF_ID_CTL 0xFEF /* control VF_ID */
1189
1190/*
1191 * Virtual Fabric Tagging header format
1192 * @caution This is defined only in BIG ENDIAN format.
1193 */
1194struct fc_vft_s {
1195 u32 r_ctl:8;
1196 u32 ver:2;
1197 u32 type:4;
1198 u32 res_a:2;
1199 u32 priority:3;
1200 u32 vf_id:12;
1201 u32 res_b:1;
1202 u32 hopct:8;
1203 u32 res_c:24;
1204};
1205
1206/*
1207 * FCP_CMND definitions
1208 */
1209#define FCP_CMND_CDB_LEN 16
1210#define FCP_CMND_LUN_LEN 8
1211
1212struct fcp_cmnd_s {
1213 struct scsi_lun lun; /* 64-bit LU number */
1214 u8 crn; /* command reference number */
1215#ifdef __BIG_ENDIAN
1216 u8 resvd:1,
1217 priority:4, /* FCP-3: SAM-3 priority */
1218 taskattr:3; /* scsi task attribute */
1219#else
1220 u8 taskattr:3, /* scsi task attribute */
1221 priority:4, /* FCP-3: SAM-3 priority */
1222 resvd:1;
1223#endif
1224 u8 tm_flags; /* task management flags */
1225#ifdef __BIG_ENDIAN
1226 u8 addl_cdb_len:6, /* additional CDB length words */
1227 iodir:2; /* read/write FCP_DATA IUs */
1228#else
1229 u8 iodir:2, /* read/write FCP_DATA IUs */
1230 addl_cdb_len:6; /* additional CDB length */
1231#endif
1232 struct scsi_cdb_s cdb;
1233
1234 __be32 fcp_dl; /* bytes to be transferred */
1235};
1236
1237#define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN)
1238#define fcp_cmnd_fcpdl(_cmnd) ((&(_cmnd)->fcp_dl)[(_cmnd)->addl_cdb_len])
1239
1240/*
1241 * struct fcp_cmnd_s .iodir field values
1242 */
1243enum fcp_iodir {
1244 FCP_IODIR_NONE = 0,
1245 FCP_IODIR_WRITE = 1,
1246 FCP_IODIR_READ = 2,
1247 FCP_IODIR_RW = 3,
1248};
1249
1250/*
1251 * Task management flags field - only one bit shall be set
1252 */
1253enum fcp_tm_cmnd {
1254 FCP_TM_ABORT_TASK_SET = BIT(1),
1255 FCP_TM_CLEAR_TASK_SET = BIT(2),
1256 FCP_TM_LUN_RESET = BIT(4),
1257 FCP_TM_TARGET_RESET = BIT(5), /* obsolete in FCP-3 */
1258 FCP_TM_CLEAR_ACA = BIT(6),
1259};
1260
1261/*
1262 * FCP_RSP residue flags
1263 */
1264enum fcp_residue {
1265 FCP_NO_RESIDUE = 0, /* no residue */
1266 FCP_RESID_OVER = 1, /* more data left that was not sent */
1267 FCP_RESID_UNDER = 2, /* less data than requested */
1268};
1269
1270struct fcp_rspinfo_s {
1271 u32 res0:24;
1272 u32 rsp_code:8; /* response code (as above) */
1273 u32 res1;
1274};
1275
1276struct fcp_resp_s {
1277 u32 reserved[2]; /* 2 words reserved */
1278 u16 reserved2;
1279#ifdef __BIG_ENDIAN
1280 u8 reserved3:3;
1281 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1282 u8 resid_flags:2; /* underflow/overflow */
1283 u8 sns_len_valid:1; /* sense len is valid */
1284 u8 rsp_len_valid:1; /* response len is valid */
1285#else
1286 u8 rsp_len_valid:1; /* response len is valid */
1287 u8 sns_len_valid:1; /* sense len is valid */
1288 u8 resid_flags:2; /* underflow/overflow */
1289 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1290 u8 reserved3:3;
1291#endif
1292 u8 scsi_status; /* one byte SCSI status */
1293 u32 residue; /* residual data bytes */
1294 u32 sns_len; /* length od sense info */
1295 u32 rsp_len; /* length of response info */
1296};
1297
1298#define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \
1299 (__fcprsp)->sns_len : 0)
1300#define fcp_rsplen(__fcprsp) ((__fcprsp)->rsp_len_valid ? \
1301 (__fcprsp)->rsp_len : 0)
1302#define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1))
1303#define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \
1304 fcp_rsplen(__fcprsp))
1305/*
1306 * CT
1307 */
1308struct ct_hdr_s {
1309 u32 rev_id:8; /* Revision of the CT */
1310 u32 in_id:24; /* Initiator Id */
1311 u32 gs_type:8; /* Generic service Type */
1312 u32 gs_sub_type:8; /* Generic service sub type */
1313 u32 options:8; /* options */
1314 u32 rsvrd:8; /* reserved */
1315 u32 cmd_rsp_code:16;/* ct command/response code */
1316 u32 max_res_size:16;/* maximum/residual size */
1317 u32 frag_id:8; /* fragment ID */
1318 u32 reason_code:8; /* reason code */
1319 u32 exp_code:8; /* explanation code */
1320 u32 vendor_unq:8; /* vendor unique */
1321};
1322
1323/*
1324 * defines for the Revision
1325 */
1326enum {
1327 CT_GS3_REVISION = 0x01,
1328};
1329
1330/*
1331 * defines for gs_type
1332 */
1333enum {
1334 CT_GSTYPE_KEYSERVICE = 0xF7,
1335 CT_GSTYPE_ALIASSERVICE = 0xF8,
1336 CT_GSTYPE_MGMTSERVICE = 0xFA,
1337 CT_GSTYPE_TIMESERVICE = 0xFB,
1338 CT_GSTYPE_DIRSERVICE = 0xFC,
1339};
1340
1341/*
1342 * defines for gs_sub_type for gs type directory service
1343 */
1344enum {
1345 CT_GSSUBTYPE_NAMESERVER = 0x02,
1346};
1347
1348/*
1349 * defines for gs_sub_type for gs type management service
1350 */
1351enum {
1352 CT_GSSUBTYPE_CFGSERVER = 0x01,
1353 CT_GSSUBTYPE_UNZONED_NS = 0x02,
1354 CT_GSSUBTYPE_ZONESERVER = 0x03,
1355 CT_GSSUBTYPE_LOCKSERVER = 0x04,
1356 CT_GSSUBTYPE_HBA_MGMTSERVER = 0x10, /* for FDMI */
1357};
1358
1359/*
1360 * defines for CT response code field
1361 */
1362enum {
1363 CT_RSP_REJECT = 0x8001,
1364 CT_RSP_ACCEPT = 0x8002,
1365};
1366
1367/*
1368 * defintions for CT reason code
1369 */
1370enum {
1371 CT_RSN_INV_CMD = 0x01,
1372 CT_RSN_INV_VER = 0x02,
1373 CT_RSN_LOGIC_ERR = 0x03,
1374 CT_RSN_INV_SIZE = 0x04,
1375 CT_RSN_LOGICAL_BUSY = 0x05,
1376 CT_RSN_PROTO_ERR = 0x07,
1377 CT_RSN_UNABLE_TO_PERF = 0x09,
1378 CT_RSN_NOT_SUPP = 0x0B,
1379 CT_RSN_SERVER_NOT_AVBL = 0x0D,
1380 CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E,
1381 CT_RSN_VENDOR_SPECIFIC = 0xFF,
1382
1383};
1384
1385/*
1386 * definitions for explanations code for Name server
1387 */
1388enum {
1389 CT_NS_EXP_NOADDITIONAL = 0x00,
1390 CT_NS_EXP_ID_NOT_REG = 0x01,
1391 CT_NS_EXP_PN_NOT_REG = 0x02,
1392 CT_NS_EXP_NN_NOT_REG = 0x03,
1393 CT_NS_EXP_CS_NOT_REG = 0x04,
1394 CT_NS_EXP_IPN_NOT_REG = 0x05,
1395 CT_NS_EXP_IPA_NOT_REG = 0x06,
1396 CT_NS_EXP_FT_NOT_REG = 0x07,
1397 CT_NS_EXP_SPN_NOT_REG = 0x08,
1398 CT_NS_EXP_SNN_NOT_REG = 0x09,
1399 CT_NS_EXP_PT_NOT_REG = 0x0A,
1400 CT_NS_EXP_IPP_NOT_REG = 0x0B,
1401 CT_NS_EXP_FPN_NOT_REG = 0x0C,
1402 CT_NS_EXP_HA_NOT_REG = 0x0D,
1403 CT_NS_EXP_FD_NOT_REG = 0x0E,
1404 CT_NS_EXP_FF_NOT_REG = 0x0F,
1405 CT_NS_EXP_ACCESSDENIED = 0x10,
1406 CT_NS_EXP_UNACCEPTABLE_ID = 0x11,
1407 CT_NS_EXP_DATABASEEMPTY = 0x12,
1408 CT_NS_EXP_NOT_REG_IN_SCOPE = 0x13,
1409 CT_NS_EXP_DOM_ID_NOT_PRESENT = 0x14,
1410 CT_NS_EXP_PORT_NUM_NOT_PRESENT = 0x15,
1411 CT_NS_EXP_NO_DEVICE_ATTACHED = 0x16
1412};
1413
1414/*
1415 * defintions for the explanation code for all servers
1416 */
1417enum {
1418 CT_EXP_AUTH_EXCEPTION = 0xF1,
1419 CT_EXP_DB_FULL = 0xF2,
1420 CT_EXP_DB_EMPTY = 0xF3,
1421 CT_EXP_PROCESSING_REQ = 0xF4,
1422 CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5,
1423 CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6
1424};
1425
1426/*
1427 * Command codes for Name server
1428 */
1429enum {
1430 GS_GID_PN = 0x0121, /* Get Id on port name */
1431 GS_GPN_ID = 0x0112, /* Get port name on ID */
1432 GS_GNN_ID = 0x0113, /* Get node name on ID */
1433 GS_GID_FT = 0x0171, /* Get Id on FC4 type */
1434 GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */
1435 GS_RFT_ID = 0x0217, /* Register fc4type on ID */
1436 GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */
1437 GS_RPN_ID = 0x0212, /* Register port name */
1438 GS_RNN_ID = 0x0213, /* Register node name */
1439 GS_RCS_ID = 0x0214, /* Register class of service */
1440 GS_RPT_ID = 0x021A, /* Register port type */
1441 GS_GA_NXT = 0x0100, /* Get all next */
1442 GS_RFF_ID = 0x021F, /* Register FC4 Feature */
1443};
1444
1445struct fcgs_id_req_s {
1446 u32 rsvd:8;
1447 u32 dap:24; /* port identifier */
1448};
1449#define fcgs_gpnid_req_t struct fcgs_id_req_s
1450#define fcgs_gnnid_req_t struct fcgs_id_req_s
1451#define fcgs_gspnid_req_t struct fcgs_id_req_s
1452
1453struct fcgs_gidpn_req_s {
1454 wwn_t port_name; /* port wwn */
1455};
1456
1457struct fcgs_gidpn_resp_s {
1458 u32 rsvd:8;
1459 u32 dap:24; /* port identifier */
1460};
1461
1462/*
1463 * RFT_ID
1464 */
1465struct fcgs_rftid_req_s {
1466 u32 rsvd:8;
1467 u32 dap:24; /* port identifier */
1468 __be32 fc4_type[8]; /* fc4 types */
1469};
1470
1471/*
1472 * RFF_ID : Register FC4 features.
1473 */
1474#define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02
1475#define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
1476
1477struct fcgs_rffid_req_s {
1478 u32 rsvd:8;
1479 u32 dap:24; /* port identifier */
1480 u32 rsvd1:16;
1481 u32 fc4ftr_bits:8; /* fc4 feature bits */
1482 u32 fc4_type:8; /* corresponding FC4 Type */
1483};
1484
1485/*
1486 * GID_FT Request
1487 */
1488struct fcgs_gidft_req_s {
1489 u8 reserved;
1490 u8 domain_id; /* domain, 0 - all fabric */
1491 u8 area_id; /* area, 0 - whole domain */
1492 u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */
1493};
1494
1495/*
1496 * GID_FT Response
1497 */
1498struct fcgs_gidft_resp_s {
1499 u8 last:1; /* last port identifier flag */
1500 u8 reserved:7;
1501 u32 pid:24; /* port identifier */
1502};
1503
1504/*
1505 * RSPN_ID
1506 */
1507struct fcgs_rspnid_req_s {
1508 u32 rsvd:8;
1509 u32 dap:24; /* port identifier */
1510 u8 spn_len; /* symbolic port name length */
1511 u8 spn[256]; /* symbolic port name */
1512};
1513
1514/*
1515 * RPN_ID
1516 */
1517struct fcgs_rpnid_req_s {
1518 u32 rsvd:8;
1519 u32 port_id:24;
1520 wwn_t port_name;
1521};
1522
1523/*
1524 * RNN_ID
1525 */
1526struct fcgs_rnnid_req_s {
1527 u32 rsvd:8;
1528 u32 port_id:24;
1529 wwn_t node_name;
1530};
1531
1532/*
1533 * RCS_ID
1534 */
1535struct fcgs_rcsid_req_s {
1536 u32 rsvd:8;
1537 u32 port_id:24;
1538 u32 cos;
1539};
1540
1541/*
1542 * RPT_ID
1543 */
1544struct fcgs_rptid_req_s {
1545 u32 rsvd:8;
1546 u32 port_id:24;
1547 u32 port_type:8;
1548 u32 rsvd1:24;
1549};
1550
1551/*
1552 * GA_NXT Request
1553 */
1554struct fcgs_ganxt_req_s {
1555 u32 rsvd:8;
1556 u32 port_id:24;
1557};
1558
1559/*
1560 * GA_NXT Response
1561 */
1562struct fcgs_ganxt_rsp_s {
1563 u32 port_type:8; /* Port Type */
1564 u32 port_id:24; /* Port Identifier */
1565 wwn_t port_name; /* Port Name */
1566 u8 spn_len; /* Length of Symbolic Port Name */
1567 char spn[255]; /* Symbolic Port Name */
1568 wwn_t node_name; /* Node Name */
1569 u8 snn_len; /* Length of Symbolic Node Name */
1570 char snn[255]; /* Symbolic Node Name */
1571 u8 ipa[8]; /* Initial Process Associator */
1572 u8 ip[16]; /* IP Address */
1573 u32 cos; /* Class of Service */
1574 u32 fc4types[8]; /* FC-4 TYPEs */
1575 wwn_t fabric_port_name; /* Fabric Port Name */
1576 u32 rsvd:8; /* Reserved */
1577 u32 hard_addr:24; /* Hard Address */
1578};
1579
1580/*
1581 * Command codes for Fabric Configuration Server
1582 */
1583enum {
1584 GS_FC_GFN_CMD = 0x0114, /* GS FC Get Fabric Name */
1585 GS_FC_GMAL_CMD = 0x0116, /* GS FC GMAL */
1586 GS_FC_TRACE_CMD = 0x0400, /* GS FC Trace Route */
1587 GS_FC_PING_CMD = 0x0401, /* GS FC Ping */
1588};
1589
1590/*
1591 * GMAL Command ( Get ( interconnect Element) Management Address List)
1592 * To retrieve the IP Address of a Switch.
1593 */
1594#define CT_GMAL_RESP_PREFIX_TELNET "telnet://"
1595#define CT_GMAL_RESP_PREFIX_HTTP "http://"
1596
1597/* GMAL/GFN request */
1598struct fcgs_req_s {
1599 wwn_t wwn; /* PWWN/NWWN */
1600};
1601
1602#define fcgs_gmal_req_t struct fcgs_req_s
1603#define fcgs_gfn_req_t struct fcgs_req_s
1604
1605/* Accept Response to GMAL */
1606struct fcgs_gmal_resp_s {
1607 __be32 ms_len; /* Num of entries */
1608 u8 ms_ma[256];
1609};
1610
1611struct fcgs_gmal_entry_s {
1612 u8 len;
1613 u8 prefix[7]; /* like "http://" */
1614 u8 ip_addr[248];
1615};
1616
1617/*
1618 * FDMI Command Codes
1619 */
1620#define FDMI_GRHL 0x0100
1621#define FDMI_GHAT 0x0101
1622#define FDMI_GRPL 0x0102
1623#define FDMI_GPAT 0x0110
1624#define FDMI_RHBA 0x0200
1625#define FDMI_RHAT 0x0201
1626#define FDMI_RPRT 0x0210
1627#define FDMI_RPA 0x0211
1628#define FDMI_DHBA 0x0300
1629#define FDMI_DPRT 0x0310
1630
1631/*
1632 * FDMI reason codes
1633 */
1634#define FDMI_NO_ADDITIONAL_EXP 0x00
1635#define FDMI_HBA_ALREADY_REG 0x10
1636#define FDMI_HBA_ATTRIB_NOT_REG 0x11
1637#define FDMI_HBA_ATTRIB_MULTIPLE 0x12
1638#define FDMI_HBA_ATTRIB_LENGTH_INVALID 0x13
1639#define FDMI_HBA_ATTRIB_NOT_PRESENT 0x14
1640#define FDMI_PORT_ORIG_NOT_IN_LIST 0x15
1641#define FDMI_PORT_HBA_NOT_IN_LIST 0x16
1642#define FDMI_PORT_ATTRIB_NOT_REG 0x20
1643#define FDMI_PORT_NOT_REG 0x21
1644#define FDMI_PORT_ATTRIB_MULTIPLE 0x22
1645#define FDMI_PORT_ATTRIB_LENGTH_INVALID 0x23
1646#define FDMI_PORT_ALREADY_REGISTEREED 0x24
1647
1648/*
1649 * FDMI Transmission Speed Mask values
1650 */
1651#define FDMI_TRANS_SPEED_1G 0x00000001
1652#define FDMI_TRANS_SPEED_2G 0x00000002
1653#define FDMI_TRANS_SPEED_10G 0x00000004
1654#define FDMI_TRANS_SPEED_4G 0x00000008
1655#define FDMI_TRANS_SPEED_8G 0x00000010
1656#define FDMI_TRANS_SPEED_16G 0x00000020
1657#define FDMI_TRANS_SPEED_UNKNOWN 0x00008000
1658
1659/*
1660 * FDMI HBA attribute types
1661 */
1662enum fdmi_hba_attribute_type {
1663 FDMI_HBA_ATTRIB_NODENAME = 1, /* 0x0001 */
1664 FDMI_HBA_ATTRIB_MANUFACTURER, /* 0x0002 */
1665 FDMI_HBA_ATTRIB_SERIALNUM, /* 0x0003 */
1666 FDMI_HBA_ATTRIB_MODEL, /* 0x0004 */
1667 FDMI_HBA_ATTRIB_MODEL_DESC, /* 0x0005 */
1668 FDMI_HBA_ATTRIB_HW_VERSION, /* 0x0006 */
1669 FDMI_HBA_ATTRIB_DRIVER_VERSION, /* 0x0007 */
1670 FDMI_HBA_ATTRIB_ROM_VERSION, /* 0x0008 */
1671 FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */
1672 FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */
1673 FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */
1674
1675 FDMI_HBA_ATTRIB_MAX_TYPE
1676};
1677
1678/*
1679 * FDMI Port attribute types
1680 */
1681enum fdmi_port_attribute_type {
1682 FDMI_PORT_ATTRIB_FC4_TYPES = 1, /* 0x0001 */
1683 FDMI_PORT_ATTRIB_SUPP_SPEED, /* 0x0002 */
1684 FDMI_PORT_ATTRIB_PORT_SPEED, /* 0x0003 */
1685 FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */
1686 FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */
1687 FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */
1688
1689 FDMI_PORT_ATTR_MAX_TYPE
1690};
1691
1692/*
1693 * FDMI attribute
1694 */
1695struct fdmi_attr_s {
1696 __be16 type;
1697 __be16 len;
1698 u8 value[1];
1699};
1700
1701/*
1702 * HBA Attribute Block
1703 */
1704struct fdmi_hba_attr_s {
1705 __be32 attr_count; /* # of attributes */
1706 struct fdmi_attr_s hba_attr; /* n attributes */
1707};
1708
1709/*
1710 * Registered Port List
1711 */
1712struct fdmi_port_list_s {
1713 __be32 num_ports; /* number Of Port Entries */
1714 wwn_t port_entry; /* one or more */
1715};
1716
1717/*
1718 * Port Attribute Block
1719 */
1720struct fdmi_port_attr_s {
1721 __be32 attr_count; /* # of attributes */
1722 struct fdmi_attr_s port_attr; /* n attributes */
1723};
1724
1725/*
1726 * FDMI Register HBA Attributes
1727 */
1728struct fdmi_rhba_s {
1729 wwn_t hba_id; /* HBA Identifier */
1730 struct fdmi_port_list_s port_list; /* Registered Port List */
1731 struct fdmi_hba_attr_s hba_attr_blk; /* HBA attribute block */
1732};
1733
1734/*
1735 * FDMI Register Port
1736 */
1737struct fdmi_rprt_s {
1738 wwn_t hba_id; /* HBA Identifier */
1739 wwn_t port_name; /* Port wwn */
1740 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1741};
1742
1743/*
1744 * FDMI Register Port Attributes
1745 */
1746struct fdmi_rpa_s {
1747 wwn_t port_name; /* port wwn */
1748 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1749};
1750
1751#pragma pack()
1752
1753#endif /* __BFA_FC_H__ */