x86/amd-iommu: Add per IOMMU reference counting
[linux/fpc-iii.git] / drivers / scsi / bfa / include / protocol / fc.h
blob3e39ba58cfb516cccef95c585fa63ad667373759
1 /*
2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
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
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.
18 #ifndef __FC_H__
19 #define __FC_H__
21 #include <protocol/types.h>
23 #pragma pack(1)
26 * Fibre Channel Header Structure (FCHS) definition
28 struct fchs_s {
29 #ifdef __BIGENDIAN
30 u32 routing:4; /* routing bits */
31 u32 cat_info:4; /* category info */
32 #else
33 u32 cat_info:4; /* category info */
34 u32 routing:4; /* routing bits */
35 #endif
36 u32 d_id:24; /* destination identifier */
38 u32 cs_ctl:8; /* class specific control */
39 u32 s_id:24; /* source identifier */
41 u32 type:8; /* data structure type */
42 u32 f_ctl:24; /* initial frame control */
44 u8 seq_id; /* sequence identifier */
45 u8 df_ctl; /* data field control */
46 u16 seq_cnt; /* sequence count */
48 u16 ox_id; /* originator exchange ID */
49 u16 rx_id; /* responder exchange ID */
51 u32 ro; /* relative offset */
54 * Fibre Channel BB_E Header Structure
56 struct fcbbehs_s {
57 u16 ver_rsvd;
58 u32 rsvd[2];
59 u32 rsvd__sof;
62 #define FC_SEQ_ID_MAX 256
65 * routing bit definitions
67 enum {
68 FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
69 FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
70 FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
71 FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
72 FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
73 FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
74 FC_RTG_LINK_CTRL = 0xC, /* Link Control */
78 * information category for extended link data and FC-4 Link Data
80 enum {
81 FC_CAT_LD_REQUEST = 0x2, /* Request */
82 FC_CAT_LD_REPLY = 0x3, /* Reply */
83 FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
87 * information category for extended headers (VFT, IFR or encapsulation)
89 enum {
90 FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
91 FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
92 FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
96 * information category for FC-4 device data
98 enum {
99 FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
100 FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
101 FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
102 FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
103 FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
104 FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
105 FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
106 FC_CAT_CMD_STATUS = 0x7, /* Command Status */
110 * information category for Link Control
112 enum {
113 FC_CAT_ACK_1 = 0x00,
114 FC_CAT_ACK_0_N = 0x01,
115 FC_CAT_P_RJT = 0x02,
116 FC_CAT_F_RJT = 0x03,
117 FC_CAT_P_BSY = 0x04,
118 FC_CAT_F_BSY_DATA = 0x05,
119 FC_CAT_F_BSY_LINK_CTL = 0x06,
120 FC_CAT_F_LCR = 0x07,
121 FC_CAT_NTY = 0x08,
122 FC_CAT_END = 0x09,
126 * Type Field Definitions. FC-PH Section 18.5 pg. 165
128 enum {
129 FC_TYPE_BLS = 0x0, /* Basic Link Service */
130 FC_TYPE_ELS = 0x1, /* Extended Link Service */
131 FC_TYPE_IP = 0x5, /* IP */
132 FC_TYPE_FCP = 0x8, /* SCSI-FCP */
133 FC_TYPE_GPP = 0x9, /* SCSI_GPP */
134 FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
135 FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
136 FC_TYPE_FC_AL = 0x23, /* FC-AL */
137 FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
138 FC_TYPE_MAX = 256, /* 256 FC-4 types */
141 struct fc_fc4types_s{
142 u8 bits[FC_TYPE_MAX / 8];
146 * Frame Control Definitions. FC-PH Table-45. pg. 168
148 enum {
149 FCTL_EC_ORIG = 0x000000, /* exchange originator */
150 FCTL_EC_RESP = 0x800000, /* exchange responder */
151 FCTL_SEQ_INI = 0x000000, /* sequence initiator */
152 FCTL_SEQ_REC = 0x400000, /* sequence recipient */
153 FCTL_FS_EXCH = 0x200000, /* first sequence of xchg */
154 FCTL_LS_EXCH = 0x100000, /* last sequence of xchg */
155 FCTL_END_SEQ = 0x080000, /* last frame of sequence */
156 FCTL_SI_XFER = 0x010000, /* seq initiative transfer */
157 FCTL_RO_PRESENT = 0x000008, /* relative offset present */
158 FCTL_FILLBYTE_MASK = 0x000003 /* , fill byte mask */
162 * Fabric Well Known Addresses
164 enum {
165 FC_MIN_WELL_KNOWN_ADDR = 0xFFFFF0,
166 FC_DOMAIN_CONTROLLER_MASK = 0xFFFC00,
167 FC_ALIAS_SERVER = 0xFFFFF8,
168 FC_MGMT_SERVER = 0xFFFFFA,
169 FC_TIME_SERVER = 0xFFFFFB,
170 FC_NAME_SERVER = 0xFFFFFC,
171 FC_FABRIC_CONTROLLER = 0xFFFFFD,
172 FC_FABRIC_PORT = 0xFFFFFE,
173 FC_BROADCAST_SERVER = 0xFFFFFF
177 * domain/area/port defines
179 #define FC_DOMAIN_MASK 0xFF0000
180 #define FC_DOMAIN_SHIFT 16
181 #define FC_AREA_MASK 0x00FF00
182 #define FC_AREA_SHIFT 8
183 #define FC_PORT_MASK 0x0000FF
184 #define FC_PORT_SHIFT 0
186 #define FC_GET_DOMAIN(p) (((p) & FC_DOMAIN_MASK) >> FC_DOMAIN_SHIFT)
187 #define FC_GET_AREA(p) (((p) & FC_AREA_MASK) >> FC_AREA_SHIFT)
188 #define FC_GET_PORT(p) (((p) & FC_PORT_MASK) >> FC_PORT_SHIFT)
190 #define FC_DOMAIN_CTRLR(p) (FC_DOMAIN_CONTROLLER_MASK | (FC_GET_DOMAIN(p)))
192 enum {
193 FC_RXID_ANY = 0xFFFFU,
197 * generic ELS command
199 struct fc_els_cmd_s{
200 u32 els_code:8; /* ELS Command Code */
201 u32 reserved:24;
205 * ELS Command Codes. FC-PH Table-75. pg. 223
207 enum {
208 FC_ELS_LS_RJT = 0x1, /* Link Service Reject. */
209 FC_ELS_ACC = 0x02, /* Accept */
210 FC_ELS_PLOGI = 0x03, /* N_Port Login. */
211 FC_ELS_FLOGI = 0x04, /* F_Port Login. */
212 FC_ELS_LOGO = 0x05, /* Logout. */
213 FC_ELS_ABTX = 0x06, /* Abort Exchange */
214 FC_ELS_RES = 0x08, /* Read Exchange status */
215 FC_ELS_RSS = 0x09, /* Read sequence status block */
216 FC_ELS_RSI = 0x0A, /* Request Sequence Initiative */
217 FC_ELS_ESTC = 0x0C, /* Estimate Credit. */
218 FC_ELS_RTV = 0x0E, /* Read Timeout Value. */
219 FC_ELS_RLS = 0x0F, /* Read Link Status. */
220 FC_ELS_ECHO = 0x10, /* Echo */
221 FC_ELS_TEST = 0x11, /* Test */
222 FC_ELS_RRQ = 0x12, /* Reinstate Recovery Qualifier. */
223 FC_ELS_REC = 0x13, /* Add this for TAPE support in FCR */
224 FC_ELS_PRLI = 0x20, /* Process Login */
225 FC_ELS_PRLO = 0x21, /* Process Logout. */
226 FC_ELS_SCN = 0x22, /* State Change Notification. */
227 FC_ELS_TPRLO = 0x24, /* Third Party Process Logout. */
228 FC_ELS_PDISC = 0x50, /* Discover N_Port Parameters. */
229 FC_ELS_FDISC = 0x51, /* Discover F_Port Parameters. */
230 FC_ELS_ADISC = 0x52, /* Discover Address. */
231 FC_ELS_FAN = 0x60, /* Fabric Address Notification */
232 FC_ELS_RSCN = 0x61, /* Reg State Change Notification */
233 FC_ELS_SCR = 0x62, /* State Change Registration. */
234 FC_ELS_RTIN = 0x77, /* Mangement server request */
235 FC_ELS_RNID = 0x78, /* Mangement server request */
236 FC_ELS_RLIR = 0x79, /* Registered Link Incident Record */
238 FC_ELS_RPSC = 0x7D, /* Report Port Speed Capabilities */
239 FC_ELS_QSA = 0x7E, /* Query Security Attributes. Ref FC-SP */
240 FC_ELS_E2E_LBEACON = 0x81,
241 /* End-to-End Link Beacon */
242 FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */
243 FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref
244 *FC-SP */
249 * Version numbers for FC-PH standards,
250 * used in login to indicate what port
251 * supports. See FC-PH-X table 158.
253 enum {
254 FC_PH_VER_4_3 = 0x09,
255 FC_PH_VER_PH_3 = 0x20,
259 * PDU size defines
261 enum {
262 FC_MIN_PDUSZ = 512,
263 FC_MAX_PDUSZ = 2112,
267 * N_Port PLOGI Common Service Parameters.
268 * FC-PH-x. Figure-76. pg. 308.
270 struct fc_plogi_csp_s{
271 u8 verhi; /* FC-PH high version */
272 u8 verlo; /* FC-PH low version */
273 u16 bbcred; /* BB_Credit */
275 #ifdef __BIGENDIAN
276 u8 ciro:1, /* continuously increasing RO */
277 rro:1, /* random relative offset */
278 npiv_supp:1, /* NPIV supported */
279 port_type:1, /* N_Port/F_port */
280 altbbcred:1, /* alternate BB_Credit */
281 resolution:1, /* ms/ns ED_TOV resolution */
282 vvl_info:1, /* VVL Info included */
283 reserved1:1;
285 u8 hg_supp:1,
286 query_dbc:1,
287 security:1,
288 sync_cap:1,
289 r_t_tov:1,
290 dh_dup_supp:1,
291 cisc:1, /* continuously increasing seq count */
292 payload:1;
293 #else
294 u8 reserved2:2,
295 resolution:1, /* ms/ns ED_TOV resolution */
296 altbbcred:1, /* alternate BB_Credit */
297 port_type:1, /* N_Port/F_port */
298 npiv_supp:1, /* NPIV supported */
299 rro:1, /* random relative offset */
300 ciro:1; /* continuously increasing RO */
302 u8 payload:1,
303 cisc:1, /* continuously increasing seq count */
304 dh_dup_supp:1,
305 r_t_tov:1,
306 sync_cap:1,
307 security:1,
308 query_dbc:1,
309 hg_supp:1;
310 #endif
312 u16 rxsz; /* recieve data_field size */
314 u16 conseq;
315 u16 ro_bitmap;
317 u32 e_d_tov;
321 * N_Port PLOGI Class Specific Parameters.
322 * FC-PH-x. Figure 78. pg. 318.
324 struct fc_plogi_clp_s{
325 #ifdef __BIGENDIAN
326 u32 class_valid:1;
327 u32 intermix:1; /* class intermix supported if set =1.
328 * valid only for class1. Reserved for
329 * class2 & class3
331 u32 reserved1:2;
332 u32 sequential:1;
333 u32 reserved2:3;
334 #else
335 u32 reserved2:3;
336 u32 sequential:1;
337 u32 reserved1:2;
338 u32 intermix:1; /* class intermix supported if set =1.
339 * valid only for class1. Reserved for
340 * class2 & class3
342 u32 class_valid:1;
343 #endif
345 u32 reserved3:24;
347 u32 reserved4:16;
348 u32 rxsz:16; /* Receive data_field size */
350 u32 reserved5:8;
351 u32 conseq:8;
352 u32 e2e_credit:16; /* end to end credit */
354 u32 reserved7:8;
355 u32 ospx:8;
356 u32 reserved8:16;
359 #define FLOGI_VVL_BRCD 0x42524344 /* ASCII value for each character in
360 * string "BRCD" */
363 * PLOGI els command and reply payload
365 struct fc_logi_s{
366 struct fc_els_cmd_s els_cmd; /* ELS command code */
367 struct fc_plogi_csp_s csp; /* common service params */
368 wwn_t port_name;
369 wwn_t node_name;
370 struct fc_plogi_clp_s class1; /* class 1 service parameters */
371 struct fc_plogi_clp_s class2; /* class 2 service parameters */
372 struct fc_plogi_clp_s class3; /* class 3 service parameters */
373 struct fc_plogi_clp_s class4; /* class 4 service parameters */
374 u8 vvl[16]; /* vendor version level */
378 * LOGO els command payload
380 struct fc_logo_s{
381 struct fc_els_cmd_s els_cmd; /* ELS command code */
382 u32 res1:8;
383 u32 nport_id:24; /* N_Port identifier of source */
384 wwn_t orig_port_name; /* Port name of the LOGO originator */
388 * ADISC els command payload
390 struct fc_adisc_s {
391 struct fc_els_cmd_s els_cmd; /* ELS command code */
392 u32 res1:8;
393 u32 orig_HA:24; /* originator hard address */
394 wwn_t orig_port_name; /* originator port name */
395 wwn_t orig_node_name; /* originator node name */
396 u32 res2:8;
397 u32 nport_id:24; /* originator NPortID */
401 * Exchange status block
403 struct fc_exch_status_blk_s{
404 u32 oxid:16;
405 u32 rxid:16;
406 u32 res1:8;
407 u32 orig_np:24; /* originator NPortID */
408 u32 res2:8;
409 u32 resp_np:24; /* responder NPortID */
410 u32 es_bits;
411 u32 res3;
413 * un modified section of the fields
418 * RES els command payload
420 struct fc_res_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 u8 assoc_hdr[32];
430 * RES els accept payload
432 struct fc_res_acc_s{
433 struct fc_els_cmd_s els_cmd; /* ELS command code */
434 struct fc_exch_status_blk_s fc_exch_blk; /* Exchange status block */
438 * REC els command payload
440 struct fc_rec_s {
441 struct fc_els_cmd_s els_cmd; /* ELS command code */
442 u32 res1:8;
443 u32 nport_id:24; /* N_Port identifier of source */
444 u32 oxid:16;
445 u32 rxid:16;
448 #define FC_REC_ESB_OWN_RSP 0x80000000 /* responder owns */
449 #define FC_REC_ESB_SI 0x40000000 /* SI is owned */
450 #define FC_REC_ESB_COMP 0x20000000 /* exchange is complete */
451 #define FC_REC_ESB_ENDCOND_ABN 0x10000000 /* abnormal ending */
452 #define FC_REC_ESB_RQACT 0x04000000 /* recovery qual active */
453 #define FC_REC_ESB_ERRP_MSK 0x03000000
454 #define FC_REC_ESB_OXID_INV 0x00800000 /* invalid OXID */
455 #define FC_REC_ESB_RXID_INV 0x00400000 /* invalid RXID */
456 #define FC_REC_ESB_PRIO_INUSE 0x00200000
459 * REC els accept payload
461 struct fc_rec_acc_s {
462 struct fc_els_cmd_s els_cmd; /* ELS command code */
463 u32 oxid:16;
464 u32 rxid:16;
465 u32 res1:8;
466 u32 orig_id:24; /* N_Port id of exchange originator */
467 u32 res2:8;
468 u32 resp_id:24; /* N_Port id of exchange responder */
469 u32 count; /* data transfer count */
470 u32 e_stat; /* exchange status */
474 * RSI els payload
476 struct fc_rsi_s {
477 struct fc_els_cmd_s els_cmd;
478 u32 res1:8;
479 u32 orig_sid:24;
480 u32 oxid:16;
481 u32 rxid:16;
485 * structure for PRLI paramater pages, both request & response
486 * see FC-PH-X table 113 & 115 for explanation also FCP table 8
488 struct fc_prli_params_s{
489 u32 reserved: 16;
490 #ifdef __BIGENDIAN
491 u32 reserved1: 5;
492 u32 rec_support : 1;
493 u32 task_retry_id : 1;
494 u32 retry : 1;
496 u32 confirm : 1;
497 u32 doverlay:1;
498 u32 initiator:1;
499 u32 target:1;
500 u32 cdmix:1;
501 u32 drmix:1;
502 u32 rxrdisab:1;
503 u32 wxrdisab:1;
504 #else
505 u32 retry : 1;
506 u32 task_retry_id : 1;
507 u32 rec_support : 1;
508 u32 reserved1: 5;
510 u32 wxrdisab:1;
511 u32 rxrdisab:1;
512 u32 drmix:1;
513 u32 cdmix:1;
514 u32 target:1;
515 u32 initiator:1;
516 u32 doverlay:1;
517 u32 confirm : 1;
518 #endif
522 * valid values for rspcode in PRLI ACC payload
524 enum {
525 FC_PRLI_ACC_XQTD = 0x1, /* request executed */
526 FC_PRLI_ACC_PREDEF_IMG = 0x5, /* predefined image - no prli needed */
529 struct fc_prli_params_page_s{
530 u32 type:8;
531 u32 codext:8;
532 #ifdef __BIGENDIAN
533 u32 origprocasv:1;
534 u32 rsppav:1;
535 u32 imagepair:1;
536 u32 reserved1:1;
537 u32 rspcode:4;
538 #else
539 u32 rspcode:4;
540 u32 reserved1:1;
541 u32 imagepair:1;
542 u32 rsppav:1;
543 u32 origprocasv:1;
544 #endif
545 u32 reserved2:8;
547 u32 origprocas;
548 u32 rspprocas;
549 struct fc_prli_params_s servparams;
553 * PRLI request and accept payload, FC-PH-X tables 112 & 114
555 struct fc_prli_s{
556 u32 command:8;
557 u32 pglen:8;
558 u32 pagebytes:16;
559 struct fc_prli_params_page_s parampage;
563 * PRLO logout params page
565 struct fc_prlo_params_page_s{
566 u32 type:8;
567 u32 type_ext:8;
568 #ifdef __BIGENDIAN
569 u32 opa_valid:1; /* originator process associator
570 * valid
572 u32 rpa_valid:1; /* responder process associator valid */
573 u32 res1:14;
574 #else
575 u32 res1:14;
576 u32 rpa_valid:1; /* responder process associator valid */
577 u32 opa_valid:1; /* originator process associator
578 * valid
580 #endif
581 u32 orig_process_assc;
582 u32 resp_process_assc;
584 u32 res2;
588 * PRLO els command payload
590 struct fc_prlo_s{
591 u32 command:8;
592 u32 page_len:8;
593 u32 payload_len:16;
594 struct fc_prlo_params_page_s prlo_params[1];
598 * PRLO Logout response parameter page
600 struct fc_prlo_acc_params_page_s{
601 u32 type:8;
602 u32 type_ext:8;
604 #ifdef __BIGENDIAN
605 u32 opa_valid:1; /* originator process associator
606 * valid
608 u32 rpa_valid:1; /* responder process associator valid */
609 u32 res1:14;
610 #else
611 u32 res1:14;
612 u32 rpa_valid:1; /* responder process associator valid */
613 u32 opa_valid:1; /* originator process associator
614 * valid
616 #endif
617 u32 orig_process_assc;
618 u32 resp_process_assc;
620 u32 fc4type_csp;
624 * PRLO els command ACC payload
626 struct fc_prlo_acc_s{
627 u32 command:8;
628 u32 page_len:8;
629 u32 payload_len:16;
630 struct fc_prlo_acc_params_page_s prlo_acc_params[1];
634 * SCR els command payload
636 enum {
637 FC_SCR_REG_FUNC_FABRIC_DETECTED = 0x01,
638 FC_SCR_REG_FUNC_N_PORT_DETECTED = 0x02,
639 FC_SCR_REG_FUNC_FULL = 0x03,
640 FC_SCR_REG_FUNC_CLEAR_REG = 0xFF,
643 /* SCR VU registrations */
644 enum {
645 FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE = 0x01
648 struct fc_scr_s{
649 u32 command:8;
650 u32 res:24;
651 u32 vu_reg_func:8; /* Vendor Unique Registrations */
652 u32 res1:16;
653 u32 reg_func:8;
657 * Information category for Basic link data
659 enum {
660 FC_CAT_NOP = 0x0,
661 FC_CAT_ABTS = 0x1,
662 FC_CAT_RMC = 0x2,
663 FC_CAT_BA_ACC = 0x4,
664 FC_CAT_BA_RJT = 0x5,
665 FC_CAT_PRMT = 0x6,
669 * LS_RJT els reply payload
671 struct fc_ls_rjt_s {
672 struct fc_els_cmd_s els_cmd; /* ELS command code */
673 u32 res1:8;
674 u32 reason_code:8; /* Reason code for reject */
675 u32 reason_code_expl:8; /* Reason code explanation */
676 u32 vendor_unique:8; /* Vendor specific */
680 * LS_RJT reason codes
682 enum {
683 FC_LS_RJT_RSN_INV_CMD_CODE = 0x01,
684 FC_LS_RJT_RSN_LOGICAL_ERROR = 0x03,
685 FC_LS_RJT_RSN_LOGICAL_BUSY = 0x05,
686 FC_LS_RJT_RSN_PROTOCOL_ERROR = 0x07,
687 FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD = 0x09,
688 FC_LS_RJT_RSN_CMD_NOT_SUPP = 0x0B,
692 * LS_RJT reason code explanation
694 enum {
695 FC_LS_RJT_EXP_NO_ADDL_INFO = 0x00,
696 FC_LS_RJT_EXP_SPARMS_ERR_OPTIONS = 0x01,
697 FC_LS_RJT_EXP_SPARMS_ERR_INI_CTL = 0x03,
698 FC_LS_RJT_EXP_SPARMS_ERR_REC_CTL = 0x05,
699 FC_LS_RJT_EXP_SPARMS_ERR_RXSZ = 0x07,
700 FC_LS_RJT_EXP_SPARMS_ERR_CONSEQ = 0x09,
701 FC_LS_RJT_EXP_SPARMS_ERR_CREDIT = 0x0B,
702 FC_LS_RJT_EXP_INV_PORT_NAME = 0x0D,
703 FC_LS_RJT_EXP_INV_NODE_FABRIC_NAME = 0x0E,
704 FC_LS_RJT_EXP_INV_CSP = 0x0F,
705 FC_LS_RJT_EXP_INV_ASSOC_HDR = 0x11,
706 FC_LS_RJT_EXP_ASSOC_HDR_REQD = 0x13,
707 FC_LS_RJT_EXP_INV_ORIG_S_ID = 0x15,
708 FC_LS_RJT_EXP_INV_OXID_RXID_COMB = 0x17,
709 FC_LS_RJT_EXP_CMD_ALREADY_IN_PROG = 0x19,
710 FC_LS_RJT_EXP_LOGIN_REQUIRED = 0x1E,
711 FC_LS_RJT_EXP_INVALID_NPORT_ID = 0x1F,
712 FC_LS_RJT_EXP_INSUFF_RES = 0x29,
713 FC_LS_RJT_EXP_CMD_NOT_SUPP = 0x2C,
714 FC_LS_RJT_EXP_INV_PAYLOAD_LEN = 0x2D,
718 * RRQ els command payload
720 struct fc_rrq_s{
721 struct fc_els_cmd_s els_cmd; /* ELS command code */
722 u32 res1:8;
723 u32 s_id:24; /* exchange originator S_ID */
725 u32 ox_id:16; /* originator exchange ID */
726 u32 rx_id:16; /* responder exchange ID */
728 u32 res2[8]; /* optional association header */
732 * ABTS BA_ACC reply payload
734 struct fc_ba_acc_s{
735 u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */
736 u32 seq_id:8; /* invalid for Abort Exchange */
737 u32 res2:16;
738 u32 ox_id:16; /* OX_ID from ABTS frame */
739 u32 rx_id:16; /* RX_ID from ABTS frame */
740 u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */
741 u32 high_seq_cnt:16;/* set to 0xFFFF for Abort Exchange */
745 * ABTS BA_RJT reject payload
747 struct fc_ba_rjt_s{
748 u32 res1:8; /* Reserved */
749 u32 reason_code:8; /* reason code for reject */
750 u32 reason_expl:8; /* reason code explanation */
751 u32 vendor_unique:8;/* vendor unique reason code,set to 0 */
755 * TPRLO logout parameter page
757 struct fc_tprlo_params_page_s{
758 u32 type:8;
759 u32 type_ext:8;
761 #ifdef __BIGENDIAN
762 u32 opa_valid:1;
763 u32 rpa_valid:1;
764 u32 tpo_nport_valid:1;
765 u32 global_process_logout:1;
766 u32 res1:12;
767 #else
768 u32 res1:12;
769 u32 global_process_logout:1;
770 u32 tpo_nport_valid:1;
771 u32 rpa_valid:1;
772 u32 opa_valid:1;
773 #endif
775 u32 orig_process_assc;
776 u32 resp_process_assc;
778 u32 res2:8;
779 u32 tpo_nport_id;
783 * TPRLO ELS command payload
785 struct fc_tprlo_s{
786 u32 command:8;
787 u32 page_len:8;
788 u32 payload_len:16;
790 struct fc_tprlo_params_page_s tprlo_params[1];
793 enum fc_tprlo_type{
794 FC_GLOBAL_LOGO = 1,
795 FC_TPR_LOGO
799 * TPRLO els command ACC payload
801 struct fc_tprlo_acc_s{
802 u32 command:8;
803 u32 page_len:8;
804 u32 payload_len:16;
805 struct fc_prlo_acc_params_page_s tprlo_acc_params[1];
809 * RSCN els command req payload
811 #define FC_RSCN_PGLEN 0x4
813 enum fc_rscn_format{
814 FC_RSCN_FORMAT_PORTID = 0x0,
815 FC_RSCN_FORMAT_AREA = 0x1,
816 FC_RSCN_FORMAT_DOMAIN = 0x2,
817 FC_RSCN_FORMAT_FABRIC = 0x3,
820 struct fc_rscn_event_s{
821 u32 format:2;
822 u32 qualifier:4;
823 u32 resvd:2;
824 u32 portid:24;
827 struct fc_rscn_pl_s{
828 u8 command;
829 u8 pagelen;
830 u16 payldlen;
831 struct fc_rscn_event_s event[1];
835 * ECHO els command req payload
837 struct fc_echo_s {
838 struct fc_els_cmd_s els_cmd;
842 * RNID els command
845 #define RNID_NODEID_DATA_FORMAT_COMMON 0x00
846 #define RNID_NODEID_DATA_FORMAT_FCP3 0x08
847 #define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF
849 #define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
850 #define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
851 #define RNID_ASSOCIATED_TYPE_HUB 0x00000003
852 #define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
853 #define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
854 #define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
855 #define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
856 #define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
857 #define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
858 #define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
859 #define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
860 #define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
861 #define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
864 * RNID els command payload
866 struct fc_rnid_cmd_s{
867 struct fc_els_cmd_s els_cmd;
868 u32 node_id_data_format:8;
869 u32 reserved:24;
873 * RNID els response payload
876 struct fc_rnid_common_id_data_s{
877 wwn_t port_name;
878 wwn_t node_name;
881 struct fc_rnid_general_topology_data_s{
882 u32 vendor_unique[4];
883 u32 asso_type;
884 u32 phy_port_num;
885 u32 num_attached_nodes;
886 u32 node_mgmt:8;
887 u32 ip_version:8;
888 u32 udp_tcp_port_num:16;
889 u32 ip_address[4];
890 u32 reserved:16;
891 u32 vendor_specific:16;
894 struct fc_rnid_acc_s{
895 struct fc_els_cmd_s els_cmd;
896 u32 node_id_data_format:8;
897 u32 common_id_data_length:8;
898 u32 reserved:8;
899 u32 specific_id_data_length:8;
900 struct fc_rnid_common_id_data_s common_id_data;
901 struct fc_rnid_general_topology_data_s gen_topology_data;
904 #define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
905 #define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
906 #define RNID_ASSOCIATED_TYPE_HUB 0x00000003
907 #define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
908 #define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
909 #define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
910 #define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
911 #define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
912 #define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
913 #define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
914 #define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
915 #define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
916 #define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
918 enum fc_rpsc_speed_cap{
919 RPSC_SPEED_CAP_1G = 0x8000,
920 RPSC_SPEED_CAP_2G = 0x4000,
921 RPSC_SPEED_CAP_4G = 0x2000,
922 RPSC_SPEED_CAP_10G = 0x1000,
923 RPSC_SPEED_CAP_8G = 0x0800,
924 RPSC_SPEED_CAP_16G = 0x0400,
926 RPSC_SPEED_CAP_UNKNOWN = 0x0001,
929 enum fc_rpsc_op_speed_s{
930 RPSC_OP_SPEED_1G = 0x8000,
931 RPSC_OP_SPEED_2G = 0x4000,
932 RPSC_OP_SPEED_4G = 0x2000,
933 RPSC_OP_SPEED_10G = 0x1000,
934 RPSC_OP_SPEED_8G = 0x0800,
935 RPSC_OP_SPEED_16G = 0x0400,
937 RPSC_OP_SPEED_NOT_EST = 0x0001, /*! speed not established */
940 struct fc_rpsc_speed_info_s{
941 u16 port_speed_cap; /*! see fc_rpsc_speed_cap_t */
942 u16 port_op_speed; /*! see fc_rpsc_op_speed_t */
945 enum link_e2e_beacon_subcmd{
946 LINK_E2E_BEACON_ON = 1,
947 LINK_E2E_BEACON_OFF = 2
950 enum beacon_type{
951 BEACON_TYPE_NORMAL = 1, /*! Normal Beaconing. Green */
952 BEACON_TYPE_WARN = 2, /*! Warning Beaconing. Yellow/Amber */
953 BEACON_TYPE_CRITICAL = 3 /*! Critical Beaconing. Red */
956 struct link_e2e_beacon_param_s {
957 u8 beacon_type; /* Beacon Type. See beacon_type_t */
958 u8 beacon_frequency;
959 /* Beacon frequency. Number of blinks
960 * per 10 seconds
962 u16 beacon_duration;/* Beacon duration (in Seconds). The
963 * command operation should be
964 * terminated at the end of this
965 * timeout value.
967 * Ignored if diag_sub_cmd is
968 * LINK_E2E_BEACON_OFF.
970 * If 0, beaconing will continue till a
971 * BEACON OFF request is received
976 * Link E2E beacon request/good response format. For LS_RJTs use fc_ls_rjt_t
978 struct link_e2e_beacon_req_s{
979 u32 ls_code; /*! FC_ELS_E2E_LBEACON in requests *
980 *or FC_ELS_ACC in good replies */
981 u32 ls_sub_cmd; /*! See link_e2e_beacon_subcmd_t */
982 struct link_e2e_beacon_param_s beacon_parm;
986 * If RPSC request is sent to the Domain Controller, the request is for
987 * all the ports within that domain (TODO - I don't think FOS implements
988 * this...).
990 struct fc_rpsc_cmd_s{
991 struct fc_els_cmd_s els_cmd;
995 * RPSC Acc
997 struct fc_rpsc_acc_s{
998 u32 command:8;
999 u32 rsvd:8;
1000 u32 num_entries:16;
1002 struct fc_rpsc_speed_info_s speed_info[1];
1006 * If RPSC2 request is sent to the Domain Controller,
1008 #define FC_BRCD_TOKEN 0x42524344
1010 struct fc_rpsc2_cmd_s{
1011 struct fc_els_cmd_s els_cmd;
1012 u32 token;
1013 u16 resvd;
1014 u16 num_pids; /* Number of pids in the request */
1015 struct {
1016 u32 rsvd1:8;
1017 u32 pid:24; /* port identifier */
1018 } pid_list[1];
1021 enum fc_rpsc2_port_type{
1022 RPSC2_PORT_TYPE_UNKNOWN = 0,
1023 RPSC2_PORT_TYPE_NPORT = 1,
1024 RPSC2_PORT_TYPE_NLPORT = 2,
1025 RPSC2_PORT_TYPE_NPIV_PORT = 0x5f,
1026 RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f,
1030 * RPSC2 portInfo entry structure
1032 struct fc_rpsc2_port_info_s{
1033 u32 pid; /* PID */
1034 u16 resvd1;
1035 u16 index; /* port number / index */
1036 u8 resvd2;
1037 u8 type; /* port type N/NL/... */
1038 u16 speed; /* port Operating Speed */
1042 * RPSC2 Accept payload
1044 struct fc_rpsc2_acc_s{
1045 u8 els_cmd;
1046 u8 resvd;
1047 u16 num_pids; /* Number of pids in the request */
1048 struct fc_rpsc2_port_info_s port_info[1]; /* port information */
1052 * bit fields so that multiple classes can be specified
1054 enum fc_cos{
1055 FC_CLASS_2 = 0x04,
1056 FC_CLASS_3 = 0x08,
1057 FC_CLASS_2_3 = 0x0C,
1061 * symbolic name
1063 struct fc_symname_s{
1064 u8 symname[FC_SYMNAME_MAX];
1067 struct fc_alpabm_s{
1068 u8 alpa_bm[FC_ALPA_MAX / 8];
1072 * protocol default timeout values
1074 #define FC_ED_TOV 2
1075 #define FC_REC_TOV (FC_ED_TOV + 1)
1076 #define FC_RA_TOV 10
1077 #define FC_ELS_TOV (2 * FC_RA_TOV)
1080 * virtual fabric related defines
1082 #define FC_VF_ID_NULL 0 /* must not be used as VF_ID */
1083 #define FC_VF_ID_MIN 1
1084 #define FC_VF_ID_MAX 0xEFF
1085 #define FC_VF_ID_CTL 0xFEF /* control VF_ID */
1088 * Virtual Fabric Tagging header format
1089 * @caution This is defined only in BIG ENDIAN format.
1091 struct fc_vft_s{
1092 u32 r_ctl:8;
1093 u32 ver:2;
1094 u32 type:4;
1095 u32 res_a:2;
1096 u32 priority:3;
1097 u32 vf_id:12;
1098 u32 res_b:1;
1099 u32 hopct:8;
1100 u32 res_c:24;
1103 #pragma pack()
1105 #endif