Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
[linux-2.6/x86.git] / drivers / scsi / bfa / bfa_fc.h
blobe929d25b09e3083d3a095c974d48f4faa464d199
1 /*
2 * Copyright (c) 2005-2010 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 __BFA_FC_H__
19 #define __BFA_FC_H__
21 #include "bfa_os_inc.h"
23 typedef u64 wwn_t;
24 typedef u64 lun_t;
26 #define WWN_NULL (0)
27 #define FC_SYMNAME_MAX 256 /* max name server symbolic name size */
28 #define FC_ALPA_MAX 128
30 #pragma pack(1)
32 #define MAC_ADDRLEN (6)
33 struct mac_s { u8 mac[MAC_ADDRLEN]; };
34 #define mac_t struct mac_s
37 * generic SCSI cdb definition
39 #define SCSI_MAX_CDBLEN 16
40 struct scsi_cdb_s {
41 u8 scsi_cdb[SCSI_MAX_CDBLEN];
43 #define scsi_cdb_t struct scsi_cdb_s
45 /* ------------------------------------------------------------
46 * SCSI status byte values
47 * ------------------------------------------------------------
49 #define SCSI_STATUS_GOOD 0x00
50 #define SCSI_STATUS_CHECK_CONDITION 0x02
51 #define SCSI_STATUS_CONDITION_MET 0x04
52 #define SCSI_STATUS_BUSY 0x08
53 #define SCSI_STATUS_INTERMEDIATE 0x10
54 #define SCSI_STATUS_ICM 0x14 /* intermediate condition met */
55 #define SCSI_STATUS_RESERVATION_CONFLICT 0x18
56 #define SCSI_STATUS_COMMAND_TERMINATED 0x22
57 #define SCSI_STATUS_QUEUE_FULL 0x28
58 #define SCSI_STATUS_ACA_ACTIVE 0x30
60 #define SCSI_MAX_ALLOC_LEN 0xFF /* maximum allocarion length */
63 * Fibre Channel Header Structure (FCHS) definition
65 struct fchs_s {
66 #ifdef __BIGENDIAN
67 u32 routing:4; /* routing bits */
68 u32 cat_info:4; /* category info */
69 #else
70 u32 cat_info:4; /* category info */
71 u32 routing:4; /* routing bits */
72 #endif
73 u32 d_id:24; /* destination identifier */
75 u32 cs_ctl:8; /* class specific control */
76 u32 s_id:24; /* source identifier */
78 u32 type:8; /* data structure type */
79 u32 f_ctl:24; /* initial frame control */
81 u8 seq_id; /* sequence identifier */
82 u8 df_ctl; /* data field control */
83 u16 seq_cnt; /* sequence count */
85 u16 ox_id; /* originator exchange ID */
86 u16 rx_id; /* responder exchange ID */
88 u32 ro; /* relative offset */
91 #define FC_SOF_LEN 4
92 #define FC_EOF_LEN 4
93 #define FC_CRC_LEN 4
96 * Fibre Channel BB_E Header Structure
98 struct fcbbehs_s {
99 u16 ver_rsvd;
100 u32 rsvd[2];
101 u32 rsvd__sof;
104 #define FC_SEQ_ID_MAX 256
107 * routing bit definitions
109 enum {
110 FC_RTG_FC4_DEV_DATA = 0x0, /* FC-4 Device Data */
111 FC_RTG_EXT_LINK = 0x2, /* Extended Link Data */
112 FC_RTG_FC4_LINK_DATA = 0x3, /* FC-4 Link Data */
113 FC_RTG_VIDEO_DATA = 0x4, /* Video Data */
114 FC_RTG_EXT_HDR = 0x5, /* VFT, IFR or Encapsuled */
115 FC_RTG_BASIC_LINK = 0x8, /* Basic Link data */
116 FC_RTG_LINK_CTRL = 0xC, /* Link Control */
120 * information category for extended link data and FC-4 Link Data
122 enum {
123 FC_CAT_LD_REQUEST = 0x2, /* Request */
124 FC_CAT_LD_REPLY = 0x3, /* Reply */
125 FC_CAT_LD_DIAG = 0xF, /* for DIAG use only */
129 * information category for extended headers (VFT, IFR or encapsulation)
131 enum {
132 FC_CAT_VFT_HDR = 0x0, /* Virtual fabric tagging header */
133 FC_CAT_IFR_HDR = 0x1, /* Inter-Fabric routing header */
134 FC_CAT_ENC_HDR = 0x2, /* Encapsulation header */
138 * information category for FC-4 device data
140 enum {
141 FC_CAT_UNCATEG_INFO = 0x0, /* Uncategorized information */
142 FC_CAT_SOLICIT_DATA = 0x1, /* Solicited Data */
143 FC_CAT_UNSOLICIT_CTRL = 0x2, /* Unsolicited Control */
144 FC_CAT_SOLICIT_CTRL = 0x3, /* Solicited Control */
145 FC_CAT_UNSOLICIT_DATA = 0x4, /* Unsolicited Data */
146 FC_CAT_DATA_DESC = 0x5, /* Data Descriptor */
147 FC_CAT_UNSOLICIT_CMD = 0x6, /* Unsolicited Command */
148 FC_CAT_CMD_STATUS = 0x7, /* Command Status */
152 * information category for Link Control
154 enum {
155 FC_CAT_ACK_1 = 0x00,
156 FC_CAT_ACK_0_N = 0x01,
157 FC_CAT_P_RJT = 0x02,
158 FC_CAT_F_RJT = 0x03,
159 FC_CAT_P_BSY = 0x04,
160 FC_CAT_F_BSY_DATA = 0x05,
161 FC_CAT_F_BSY_LINK_CTL = 0x06,
162 FC_CAT_F_LCR = 0x07,
163 FC_CAT_NTY = 0x08,
164 FC_CAT_END = 0x09,
168 * Type Field Definitions. FC-PH Section 18.5 pg. 165
170 enum {
171 FC_TYPE_BLS = 0x0, /* Basic Link Service */
172 FC_TYPE_ELS = 0x1, /* Extended Link Service */
173 FC_TYPE_IP = 0x5, /* IP */
174 FC_TYPE_FCP = 0x8, /* SCSI-FCP */
175 FC_TYPE_GPP = 0x9, /* SCSI_GPP */
176 FC_TYPE_SERVICES = 0x20, /* Fibre Channel Services */
177 FC_TYPE_FC_FSS = 0x22, /* Fabric Switch Services */
178 FC_TYPE_FC_AL = 0x23, /* FC-AL */
179 FC_TYPE_FC_SNMP = 0x24, /* FC-SNMP */
180 FC_TYPE_FC_SPINFAB = 0xEE, /* SPINFAB */
181 FC_TYPE_FC_DIAG = 0xEF, /* DIAG */
182 FC_TYPE_MAX = 256, /* 256 FC-4 types */
185 struct fc_fc4types_s {
186 u8 bits[FC_TYPE_MAX / 8];
190 * Frame Control Definitions. FC-PH Table-45. pg. 168
192 enum {
193 FCTL_EC_ORIG = 0x000000, /* exchange originator */
194 FCTL_EC_RESP = 0x800000, /* exchange responder */
195 FCTL_SEQ_INI = 0x000000, /* sequence initiator */
196 FCTL_SEQ_REC = 0x400000, /* sequence recipient */
197 FCTL_FS_EXCH = 0x200000, /* first sequence of xchg */
198 FCTL_LS_EXCH = 0x100000, /* last sequence of xchg */
199 FCTL_END_SEQ = 0x080000, /* last frame of sequence */
200 FCTL_SI_XFER = 0x010000, /* seq initiative transfer */
201 FCTL_RO_PRESENT = 0x000008, /* relative offset present */
202 FCTL_FILLBYTE_MASK = 0x000003 /* , fill byte mask */
206 * Fabric Well Known Addresses
208 enum {
209 FC_MIN_WELL_KNOWN_ADDR = 0xFFFFF0,
210 FC_DOMAIN_CONTROLLER_MASK = 0xFFFC00,
211 FC_ALIAS_SERVER = 0xFFFFF8,
212 FC_MGMT_SERVER = 0xFFFFFA,
213 FC_TIME_SERVER = 0xFFFFFB,
214 FC_NAME_SERVER = 0xFFFFFC,
215 FC_FABRIC_CONTROLLER = 0xFFFFFD,
216 FC_FABRIC_PORT = 0xFFFFFE,
217 FC_BROADCAST_SERVER = 0xFFFFFF
221 * domain/area/port defines
223 #define FC_DOMAIN_MASK 0xFF0000
224 #define FC_DOMAIN_SHIFT 16
225 #define FC_AREA_MASK 0x00FF00
226 #define FC_AREA_SHIFT 8
227 #define FC_PORT_MASK 0x0000FF
228 #define FC_PORT_SHIFT 0
230 #define FC_GET_DOMAIN(p) (((p) & FC_DOMAIN_MASK) >> FC_DOMAIN_SHIFT)
231 #define FC_GET_AREA(p) (((p) & FC_AREA_MASK) >> FC_AREA_SHIFT)
232 #define FC_GET_PORT(p) (((p) & FC_PORT_MASK) >> FC_PORT_SHIFT)
234 #define FC_DOMAIN_CTRLR(p) (FC_DOMAIN_CONTROLLER_MASK | (FC_GET_DOMAIN(p)))
236 enum {
237 FC_RXID_ANY = 0xFFFFU,
241 * generic ELS command
243 struct fc_els_cmd_s {
244 u32 els_code:8; /* ELS Command Code */
245 u32 reserved:24;
249 * ELS Command Codes. FC-PH Table-75. pg. 223
251 enum {
252 FC_ELS_LS_RJT = 0x1, /* Link Service Reject. */
253 FC_ELS_ACC = 0x02, /* Accept */
254 FC_ELS_PLOGI = 0x03, /* N_Port Login. */
255 FC_ELS_FLOGI = 0x04, /* F_Port Login. */
256 FC_ELS_LOGO = 0x05, /* Logout. */
257 FC_ELS_ABTX = 0x06, /* Abort Exchange */
258 FC_ELS_RES = 0x08, /* Read Exchange status */
259 FC_ELS_RSS = 0x09, /* Read sequence status block */
260 FC_ELS_RSI = 0x0A, /* Request Sequence Initiative */
261 FC_ELS_ESTC = 0x0C, /* Estimate Credit. */
262 FC_ELS_RTV = 0x0E, /* Read Timeout Value. */
263 FC_ELS_RLS = 0x0F, /* Read Link Status. */
264 FC_ELS_ECHO = 0x10, /* Echo */
265 FC_ELS_TEST = 0x11, /* Test */
266 FC_ELS_RRQ = 0x12, /* Reinstate Recovery Qualifier. */
267 FC_ELS_REC = 0x13, /* Add this for TAPE support in FCR */
268 FC_ELS_PRLI = 0x20, /* Process Login */
269 FC_ELS_PRLO = 0x21, /* Process Logout. */
270 FC_ELS_SCN = 0x22, /* State Change Notification. */
271 FC_ELS_TPRLO = 0x24, /* Third Party Process Logout. */
272 FC_ELS_PDISC = 0x50, /* Discover N_Port Parameters. */
273 FC_ELS_FDISC = 0x51, /* Discover F_Port Parameters. */
274 FC_ELS_ADISC = 0x52, /* Discover Address. */
275 FC_ELS_FARP_REQ = 0x54, /* FARP Request. */
276 FC_ELS_FARP_REP = 0x55, /* FARP Reply. */
277 FC_ELS_FAN = 0x60, /* Fabric Address Notification */
278 FC_ELS_RSCN = 0x61, /* Reg State Change Notification */
279 FC_ELS_SCR = 0x62, /* State Change Registration. */
280 FC_ELS_RTIN = 0x77, /* Mangement server request */
281 FC_ELS_RNID = 0x78, /* Mangement server request */
282 FC_ELS_RLIR = 0x79, /* Registered Link Incident Record */
284 FC_ELS_RPSC = 0x7D, /* Report Port Speed Capabilities */
285 FC_ELS_QSA = 0x7E, /* Query Security Attributes. Ref FC-SP */
286 FC_ELS_E2E_LBEACON = 0x81,
287 /* End-to-End Link Beacon */
288 FC_ELS_AUTH = 0x90, /* Authentication. Ref FC-SP */
289 FC_ELS_RFCN = 0x97, /* Request Fabric Change Notification. Ref
290 *FC-SP */
295 * Version numbers for FC-PH standards,
296 * used in login to indicate what port
297 * supports. See FC-PH-X table 158.
299 enum {
300 FC_PH_VER_4_3 = 0x09,
301 FC_PH_VER_PH_3 = 0x20,
305 * PDU size defines
307 enum {
308 FC_MIN_PDUSZ = 512,
309 FC_MAX_PDUSZ = 2112,
313 * N_Port PLOGI Common Service Parameters.
314 * FC-PH-x. Figure-76. pg. 308.
316 struct fc_plogi_csp_s {
317 u8 verhi; /* FC-PH high version */
318 u8 verlo; /* FC-PH low version */
319 u16 bbcred; /* BB_Credit */
321 #ifdef __BIGENDIAN
322 u8 ciro:1, /* continuously increasing RO */
323 rro:1, /* random relative offset */
324 npiv_supp:1, /* NPIV supported */
325 port_type:1, /* N_Port/F_port */
326 altbbcred:1, /* alternate BB_Credit */
327 resolution:1, /* ms/ns ED_TOV resolution */
328 vvl_info:1, /* VVL Info included */
329 reserved1:1;
331 u8 hg_supp:1,
332 query_dbc:1,
333 security:1,
334 sync_cap:1,
335 r_t_tov:1,
336 dh_dup_supp:1,
337 cisc:1, /* continuously increasing seq count */
338 payload:1;
339 #else
340 u8 reserved2:2,
341 resolution:1, /* ms/ns ED_TOV resolution */
342 altbbcred:1, /* alternate BB_Credit */
343 port_type:1, /* N_Port/F_port */
344 npiv_supp:1, /* NPIV supported */
345 rro:1, /* random relative offset */
346 ciro:1; /* continuously increasing RO */
348 u8 payload:1,
349 cisc:1, /* continuously increasing seq count */
350 dh_dup_supp:1,
351 r_t_tov:1,
352 sync_cap:1,
353 security:1,
354 query_dbc:1,
355 hg_supp:1;
356 #endif
358 u16 rxsz; /* recieve data_field size */
360 u16 conseq;
361 u16 ro_bitmap;
363 u32 e_d_tov;
367 * N_Port PLOGI Class Specific Parameters.
368 * FC-PH-x. Figure 78. pg. 318.
370 struct fc_plogi_clp_s {
371 #ifdef __BIGENDIAN
372 u32 class_valid:1;
373 u32 intermix:1; /* class intermix supported if set =1.
374 * valid only for class1. Reserved for
375 * class2 & class3
377 u32 reserved1:2;
378 u32 sequential:1;
379 u32 reserved2:3;
380 #else
381 u32 reserved2:3;
382 u32 sequential:1;
383 u32 reserved1:2;
384 u32 intermix:1; /* class intermix supported if set =1.
385 * valid only for class1. Reserved for
386 * class2 & class3
388 u32 class_valid:1;
389 #endif
391 u32 reserved3:24;
393 u32 reserved4:16;
394 u32 rxsz:16; /* Receive data_field size */
396 u32 reserved5:8;
397 u32 conseq:8;
398 u32 e2e_credit:16; /* end to end credit */
400 u32 reserved7:8;
401 u32 ospx:8;
402 u32 reserved8:16;
405 /* ASCII value for each character in string "BRCD" */
406 #define FLOGI_VVL_BRCD 0x42524344
409 * PLOGI els command and reply payload
411 struct fc_logi_s {
412 struct fc_els_cmd_s els_cmd; /* ELS command code */
413 struct fc_plogi_csp_s csp; /* common service params */
414 wwn_t port_name;
415 wwn_t node_name;
416 struct fc_plogi_clp_s class1; /* class 1 service parameters */
417 struct fc_plogi_clp_s class2; /* class 2 service parameters */
418 struct fc_plogi_clp_s class3; /* class 3 service parameters */
419 struct fc_plogi_clp_s class4; /* class 4 service parameters */
420 u8 vvl[16]; /* vendor version level */
424 * LOGO els command payload
426 struct fc_logo_s {
427 struct fc_els_cmd_s els_cmd; /* ELS command code */
428 u32 res1:8;
429 u32 nport_id:24; /* N_Port identifier of source */
430 wwn_t orig_port_name; /* Port name of the LOGO originator */
434 * ADISC els command payload
436 struct fc_adisc_s {
437 struct fc_els_cmd_s els_cmd; /* ELS command code */
438 u32 res1:8;
439 u32 orig_HA:24; /* originator hard address */
440 wwn_t orig_port_name; /* originator port name */
441 wwn_t orig_node_name; /* originator node name */
442 u32 res2:8;
443 u32 nport_id:24; /* originator NPortID */
447 * Exchange status block
449 struct fc_exch_status_blk_s {
450 u32 oxid:16;
451 u32 rxid:16;
452 u32 res1:8;
453 u32 orig_np:24; /* originator NPortID */
454 u32 res2:8;
455 u32 resp_np:24; /* responder NPortID */
456 u32 es_bits;
457 u32 res3;
459 * un modified section of the fields
464 * RES els command payload
466 struct fc_res_s {
467 struct fc_els_cmd_s els_cmd; /* ELS command code */
468 u32 res1:8;
469 u32 nport_id:24; /* N_Port identifier of source */
470 u32 oxid:16;
471 u32 rxid:16;
472 u8 assoc_hdr[32];
476 * RES els accept payload
478 struct fc_res_acc_s {
479 struct fc_els_cmd_s els_cmd; /* ELS command code */
480 struct fc_exch_status_blk_s fc_exch_blk; /* Exchange status block */
484 * REC els command payload
486 struct fc_rec_s {
487 struct fc_els_cmd_s els_cmd; /* ELS command code */
488 u32 res1:8;
489 u32 nport_id:24; /* N_Port identifier of source */
490 u32 oxid:16;
491 u32 rxid:16;
494 #define FC_REC_ESB_OWN_RSP 0x80000000 /* responder owns */
495 #define FC_REC_ESB_SI 0x40000000 /* SI is owned */
496 #define FC_REC_ESB_COMP 0x20000000 /* exchange is complete */
497 #define FC_REC_ESB_ENDCOND_ABN 0x10000000 /* abnormal ending */
498 #define FC_REC_ESB_RQACT 0x04000000 /* recovery qual active */
499 #define FC_REC_ESB_ERRP_MSK 0x03000000
500 #define FC_REC_ESB_OXID_INV 0x00800000 /* invalid OXID */
501 #define FC_REC_ESB_RXID_INV 0x00400000 /* invalid RXID */
502 #define FC_REC_ESB_PRIO_INUSE 0x00200000
505 * REC els accept payload
507 struct fc_rec_acc_s {
508 struct fc_els_cmd_s els_cmd; /* ELS command code */
509 u32 oxid:16;
510 u32 rxid:16;
511 u32 res1:8;
512 u32 orig_id:24; /* N_Port id of exchange originator */
513 u32 res2:8;
514 u32 resp_id:24; /* N_Port id of exchange responder */
515 u32 count; /* data transfer count */
516 u32 e_stat; /* exchange status */
520 * RSI els payload
522 struct fc_rsi_s {
523 struct fc_els_cmd_s els_cmd;
524 u32 res1:8;
525 u32 orig_sid:24;
526 u32 oxid:16;
527 u32 rxid:16;
531 * structure for PRLI paramater pages, both request & response
532 * see FC-PH-X table 113 & 115 for explanation also FCP table 8
534 struct fc_prli_params_s {
535 u32 reserved:16;
536 #ifdef __BIGENDIAN
537 u32 reserved1:5;
538 u32 rec_support:1;
539 u32 task_retry_id:1;
540 u32 retry:1;
542 u32 confirm:1;
543 u32 doverlay:1;
544 u32 initiator:1;
545 u32 target:1;
546 u32 cdmix:1;
547 u32 drmix:1;
548 u32 rxrdisab:1;
549 u32 wxrdisab:1;
550 #else
551 u32 retry:1;
552 u32 task_retry_id:1;
553 u32 rec_support:1;
554 u32 reserved1:5;
556 u32 wxrdisab:1;
557 u32 rxrdisab:1;
558 u32 drmix:1;
559 u32 cdmix:1;
560 u32 target:1;
561 u32 initiator:1;
562 u32 doverlay:1;
563 u32 confirm:1;
564 #endif
568 * valid values for rspcode in PRLI ACC payload
570 enum {
571 FC_PRLI_ACC_XQTD = 0x1, /* request executed */
572 FC_PRLI_ACC_PREDEF_IMG = 0x5, /* predefined image - no prli needed */
575 struct fc_prli_params_page_s {
576 u32 type:8;
577 u32 codext:8;
578 #ifdef __BIGENDIAN
579 u32 origprocasv:1;
580 u32 rsppav:1;
581 u32 imagepair:1;
582 u32 reserved1:1;
583 u32 rspcode:4;
584 #else
585 u32 rspcode:4;
586 u32 reserved1:1;
587 u32 imagepair:1;
588 u32 rsppav:1;
589 u32 origprocasv:1;
590 #endif
591 u32 reserved2:8;
593 u32 origprocas;
594 u32 rspprocas;
595 struct fc_prli_params_s servparams;
599 * PRLI request and accept payload, FC-PH-X tables 112 & 114
601 struct fc_prli_s {
602 u32 command:8;
603 u32 pglen:8;
604 u32 pagebytes:16;
605 struct fc_prli_params_page_s parampage;
609 * PRLO logout params page
611 struct fc_prlo_params_page_s {
612 u32 type:8;
613 u32 type_ext:8;
614 #ifdef __BIGENDIAN
615 u32 opa_valid:1; /* originator process associator
616 * valid
618 u32 rpa_valid:1; /* responder process associator valid */
619 u32 res1:14;
620 #else
621 u32 res1:14;
622 u32 rpa_valid:1; /* responder process associator valid */
623 u32 opa_valid:1; /* originator process associator
624 * valid
626 #endif
627 u32 orig_process_assc;
628 u32 resp_process_assc;
630 u32 res2;
634 * PRLO els command payload
636 struct fc_prlo_s {
637 u32 command:8;
638 u32 page_len:8;
639 u32 payload_len:16;
640 struct fc_prlo_params_page_s prlo_params[1];
644 * PRLO Logout response parameter page
646 struct fc_prlo_acc_params_page_s {
647 u32 type:8;
648 u32 type_ext:8;
650 #ifdef __BIGENDIAN
651 u32 opa_valid:1; /* originator process associator
652 * valid
654 u32 rpa_valid:1; /* responder process associator valid */
655 u32 res1:14;
656 #else
657 u32 res1:14;
658 u32 rpa_valid:1; /* responder process associator valid */
659 u32 opa_valid:1; /* originator process associator
660 * valid
662 #endif
663 u32 orig_process_assc;
664 u32 resp_process_assc;
666 u32 fc4type_csp;
670 * PRLO els command ACC payload
672 struct fc_prlo_acc_s {
673 u32 command:8;
674 u32 page_len:8;
675 u32 payload_len:16;
676 struct fc_prlo_acc_params_page_s prlo_acc_params[1];
680 * SCR els command payload
682 enum {
683 FC_SCR_REG_FUNC_FABRIC_DETECTED = 0x01,
684 FC_SCR_REG_FUNC_N_PORT_DETECTED = 0x02,
685 FC_SCR_REG_FUNC_FULL = 0x03,
686 FC_SCR_REG_FUNC_CLEAR_REG = 0xFF,
689 /* SCR VU registrations */
690 enum {
691 FC_VU_SCR_REG_FUNC_FABRIC_NAME_CHANGE = 0x01
694 struct fc_scr_s {
695 u32 command:8;
696 u32 res:24;
697 u32 vu_reg_func:8; /* Vendor Unique Registrations */
698 u32 res1:16;
699 u32 reg_func:8;
703 * Information category for Basic link data
705 enum {
706 FC_CAT_NOP = 0x0,
707 FC_CAT_ABTS = 0x1,
708 FC_CAT_RMC = 0x2,
709 FC_CAT_BA_ACC = 0x4,
710 FC_CAT_BA_RJT = 0x5,
711 FC_CAT_PRMT = 0x6,
715 * LS_RJT els reply payload
717 struct fc_ls_rjt_s {
718 struct fc_els_cmd_s els_cmd; /* ELS command code */
719 u32 res1:8;
720 u32 reason_code:8; /* Reason code for reject */
721 u32 reason_code_expl:8; /* Reason code explanation */
722 u32 vendor_unique:8; /* Vendor specific */
726 * LS_RJT reason codes
728 enum {
729 FC_LS_RJT_RSN_INV_CMD_CODE = 0x01,
730 FC_LS_RJT_RSN_LOGICAL_ERROR = 0x03,
731 FC_LS_RJT_RSN_LOGICAL_BUSY = 0x05,
732 FC_LS_RJT_RSN_PROTOCOL_ERROR = 0x07,
733 FC_LS_RJT_RSN_UNABLE_TO_PERF_CMD = 0x09,
734 FC_LS_RJT_RSN_CMD_NOT_SUPP = 0x0B,
738 * LS_RJT reason code explanation
740 enum {
741 FC_LS_RJT_EXP_NO_ADDL_INFO = 0x00,
742 FC_LS_RJT_EXP_SPARMS_ERR_OPTIONS = 0x01,
743 FC_LS_RJT_EXP_SPARMS_ERR_INI_CTL = 0x03,
744 FC_LS_RJT_EXP_SPARMS_ERR_REC_CTL = 0x05,
745 FC_LS_RJT_EXP_SPARMS_ERR_RXSZ = 0x07,
746 FC_LS_RJT_EXP_SPARMS_ERR_CONSEQ = 0x09,
747 FC_LS_RJT_EXP_SPARMS_ERR_CREDIT = 0x0B,
748 FC_LS_RJT_EXP_INV_PORT_NAME = 0x0D,
749 FC_LS_RJT_EXP_INV_NODE_FABRIC_NAME = 0x0E,
750 FC_LS_RJT_EXP_INV_CSP = 0x0F,
751 FC_LS_RJT_EXP_INV_ASSOC_HDR = 0x11,
752 FC_LS_RJT_EXP_ASSOC_HDR_REQD = 0x13,
753 FC_LS_RJT_EXP_INV_ORIG_S_ID = 0x15,
754 FC_LS_RJT_EXP_INV_OXID_RXID_COMB = 0x17,
755 FC_LS_RJT_EXP_CMD_ALREADY_IN_PROG = 0x19,
756 FC_LS_RJT_EXP_LOGIN_REQUIRED = 0x1E,
757 FC_LS_RJT_EXP_INVALID_NPORT_ID = 0x1F,
758 FC_LS_RJT_EXP_INSUFF_RES = 0x29,
759 FC_LS_RJT_EXP_CMD_NOT_SUPP = 0x2C,
760 FC_LS_RJT_EXP_INV_PAYLOAD_LEN = 0x2D,
764 * RRQ els command payload
766 struct fc_rrq_s {
767 struct fc_els_cmd_s els_cmd; /* ELS command code */
768 u32 res1:8;
769 u32 s_id:24; /* exchange originator S_ID */
771 u32 ox_id:16; /* originator exchange ID */
772 u32 rx_id:16; /* responder exchange ID */
774 u32 res2[8]; /* optional association header */
778 * ABTS BA_ACC reply payload
780 struct fc_ba_acc_s {
781 u32 seq_id_valid:8; /* set to 0x00 for Abort Exchange */
782 u32 seq_id:8; /* invalid for Abort Exchange */
783 u32 res2:16;
784 u32 ox_id:16; /* OX_ID from ABTS frame */
785 u32 rx_id:16; /* RX_ID from ABTS frame */
786 u32 low_seq_cnt:16; /* set to 0x0000 for Abort Exchange */
787 u32 high_seq_cnt:16;/* set to 0xFFFF for Abort Exchange */
791 * ABTS BA_RJT reject payload
793 struct fc_ba_rjt_s {
794 u32 res1:8; /* Reserved */
795 u32 reason_code:8; /* reason code for reject */
796 u32 reason_expl:8; /* reason code explanation */
797 u32 vendor_unique:8;/* vendor unique reason code,set to 0 */
801 * TPRLO logout parameter page
803 struct fc_tprlo_params_page_s {
804 u32 type:8;
805 u32 type_ext:8;
807 #ifdef __BIGENDIAN
808 u32 opa_valid:1;
809 u32 rpa_valid:1;
810 u32 tpo_nport_valid:1;
811 u32 global_process_logout:1;
812 u32 res1:12;
813 #else
814 u32 res1:12;
815 u32 global_process_logout:1;
816 u32 tpo_nport_valid:1;
817 u32 rpa_valid:1;
818 u32 opa_valid:1;
819 #endif
821 u32 orig_process_assc;
822 u32 resp_process_assc;
824 u32 res2:8;
825 u32 tpo_nport_id;
829 * TPRLO ELS command payload
831 struct fc_tprlo_s {
832 u32 command:8;
833 u32 page_len:8;
834 u32 payload_len:16;
836 struct fc_tprlo_params_page_s tprlo_params[1];
839 enum fc_tprlo_type {
840 FC_GLOBAL_LOGO = 1,
841 FC_TPR_LOGO
845 * TPRLO els command ACC payload
847 struct fc_tprlo_acc_s {
848 u32 command:8;
849 u32 page_len:8;
850 u32 payload_len:16;
851 struct fc_prlo_acc_params_page_s tprlo_acc_params[1];
855 * RSCN els command req payload
857 #define FC_RSCN_PGLEN 0x4
859 enum fc_rscn_format {
860 FC_RSCN_FORMAT_PORTID = 0x0,
861 FC_RSCN_FORMAT_AREA = 0x1,
862 FC_RSCN_FORMAT_DOMAIN = 0x2,
863 FC_RSCN_FORMAT_FABRIC = 0x3,
866 struct fc_rscn_event_s {
867 u32 format:2;
868 u32 qualifier:4;
869 u32 resvd:2;
870 u32 portid:24;
873 struct fc_rscn_pl_s {
874 u8 command;
875 u8 pagelen;
876 u16 payldlen;
877 struct fc_rscn_event_s event[1];
881 * ECHO els command req payload
883 struct fc_echo_s {
884 struct fc_els_cmd_s els_cmd;
888 * RNID els command
891 #define RNID_NODEID_DATA_FORMAT_COMMON 0x00
892 #define RNID_NODEID_DATA_FORMAT_FCP3 0x08
893 #define RNID_NODEID_DATA_FORMAT_DISCOVERY 0xDF
895 #define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
896 #define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
897 #define RNID_ASSOCIATED_TYPE_HUB 0x00000003
898 #define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
899 #define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
900 #define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
901 #define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
902 #define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
903 #define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
904 #define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
905 #define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
906 #define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
907 #define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
910 * RNID els command payload
912 struct fc_rnid_cmd_s {
913 struct fc_els_cmd_s els_cmd;
914 u32 node_id_data_format:8;
915 u32 reserved:24;
919 * RNID els response payload
922 struct fc_rnid_common_id_data_s {
923 wwn_t port_name;
924 wwn_t node_name;
927 struct fc_rnid_general_topology_data_s {
928 u32 vendor_unique[4];
929 u32 asso_type;
930 u32 phy_port_num;
931 u32 num_attached_nodes;
932 u32 node_mgmt:8;
933 u32 ip_version:8;
934 u32 udp_tcp_port_num:16;
935 u32 ip_address[4];
936 u32 reserved:16;
937 u32 vendor_specific:16;
940 struct fc_rnid_acc_s {
941 struct fc_els_cmd_s els_cmd;
942 u32 node_id_data_format:8;
943 u32 common_id_data_length:8;
944 u32 reserved:8;
945 u32 specific_id_data_length:8;
946 struct fc_rnid_common_id_data_s common_id_data;
947 struct fc_rnid_general_topology_data_s gen_topology_data;
950 #define RNID_ASSOCIATED_TYPE_UNKNOWN 0x00000001
951 #define RNID_ASSOCIATED_TYPE_OTHER 0x00000002
952 #define RNID_ASSOCIATED_TYPE_HUB 0x00000003
953 #define RNID_ASSOCIATED_TYPE_SWITCH 0x00000004
954 #define RNID_ASSOCIATED_TYPE_GATEWAY 0x00000005
955 #define RNID_ASSOCIATED_TYPE_STORAGE_DEVICE 0x00000009
956 #define RNID_ASSOCIATED_TYPE_HOST 0x0000000A
957 #define RNID_ASSOCIATED_TYPE_STORAGE_SUBSYSTEM 0x0000000B
958 #define RNID_ASSOCIATED_TYPE_STORAGE_ACCESS_DEVICE 0x0000000E
959 #define RNID_ASSOCIATED_TYPE_NAS_SERVER 0x00000011
960 #define RNID_ASSOCIATED_TYPE_BRIDGE 0x00000002
961 #define RNID_ASSOCIATED_TYPE_VIRTUALIZATION_DEVICE 0x00000003
962 #define RNID_ASSOCIATED_TYPE_MULTI_FUNCTION_DEVICE 0x000000FF
964 enum fc_rpsc_speed_cap {
965 RPSC_SPEED_CAP_1G = 0x8000,
966 RPSC_SPEED_CAP_2G = 0x4000,
967 RPSC_SPEED_CAP_4G = 0x2000,
968 RPSC_SPEED_CAP_10G = 0x1000,
969 RPSC_SPEED_CAP_8G = 0x0800,
970 RPSC_SPEED_CAP_16G = 0x0400,
972 RPSC_SPEED_CAP_UNKNOWN = 0x0001,
975 enum fc_rpsc_op_speed {
976 RPSC_OP_SPEED_1G = 0x8000,
977 RPSC_OP_SPEED_2G = 0x4000,
978 RPSC_OP_SPEED_4G = 0x2000,
979 RPSC_OP_SPEED_10G = 0x1000,
980 RPSC_OP_SPEED_8G = 0x0800,
981 RPSC_OP_SPEED_16G = 0x0400,
983 RPSC_OP_SPEED_NOT_EST = 0x0001, /*! speed not established */
986 struct fc_rpsc_speed_info_s {
987 u16 port_speed_cap; /*! see enum fc_rpsc_speed_cap */
988 u16 port_op_speed; /*! see enum fc_rpsc_op_speed */
991 enum link_e2e_beacon_subcmd {
992 LINK_E2E_BEACON_ON = 1,
993 LINK_E2E_BEACON_OFF = 2
996 enum beacon_type {
997 BEACON_TYPE_NORMAL = 1, /*! Normal Beaconing. Green */
998 BEACON_TYPE_WARN = 2, /*! Warning Beaconing. Yellow/Amber */
999 BEACON_TYPE_CRITICAL = 3 /*! Critical Beaconing. Red */
1002 struct link_e2e_beacon_param_s {
1003 u8 beacon_type; /* Beacon Type. See enum beacon_type */
1004 u8 beacon_frequency;
1005 /* Beacon frequency. Number of blinks
1006 * per 10 seconds
1008 u16 beacon_duration;/* Beacon duration (in Seconds). The
1009 * command operation should be
1010 * terminated at the end of this
1011 * timeout value.
1013 * Ignored if diag_sub_cmd is
1014 * LINK_E2E_BEACON_OFF.
1016 * If 0, beaconing will continue till a
1017 * BEACON OFF request is received
1022 * Link E2E beacon request/good response format.
1023 * For LS_RJTs use struct fc_ls_rjt_s
1025 struct link_e2e_beacon_req_s {
1026 u32 ls_code; /*! FC_ELS_E2E_LBEACON in requests *
1027 *or FC_ELS_ACC in good replies */
1028 u32 ls_sub_cmd; /*! See enum link_e2e_beacon_subcmd */
1029 struct link_e2e_beacon_param_s beacon_parm;
1033 * If RPSC request is sent to the Domain Controller, the request is for
1034 * all the ports within that domain (TODO - I don't think FOS implements
1035 * this...).
1037 struct fc_rpsc_cmd_s {
1038 struct fc_els_cmd_s els_cmd;
1042 * RPSC Acc
1044 struct fc_rpsc_acc_s {
1045 u32 command:8;
1046 u32 rsvd:8;
1047 u32 num_entries:16;
1049 struct fc_rpsc_speed_info_s speed_info[1];
1053 * If RPSC2 request is sent to the Domain Controller,
1055 #define FC_BRCD_TOKEN 0x42524344
1057 struct fc_rpsc2_cmd_s {
1058 struct fc_els_cmd_s els_cmd;
1059 u32 token;
1060 u16 resvd;
1061 u16 num_pids; /* Number of pids in the request */
1062 struct {
1063 u32 rsvd1:8;
1064 u32 pid:24; /* port identifier */
1065 } pid_list[1];
1068 enum fc_rpsc2_port_type {
1069 RPSC2_PORT_TYPE_UNKNOWN = 0,
1070 RPSC2_PORT_TYPE_NPORT = 1,
1071 RPSC2_PORT_TYPE_NLPORT = 2,
1072 RPSC2_PORT_TYPE_NPIV_PORT = 0x5f,
1073 RPSC2_PORT_TYPE_NPORT_TRUNK = 0x6f,
1076 * RPSC2 portInfo entry structure
1078 struct fc_rpsc2_port_info_s {
1079 u32 pid; /* PID */
1080 u16 resvd1;
1081 u16 index; /* port number / index */
1082 u8 resvd2;
1083 u8 type; /* port type N/NL/... */
1084 u16 speed; /* port Operating Speed */
1088 * RPSC2 Accept payload
1090 struct fc_rpsc2_acc_s {
1091 u8 els_cmd;
1092 u8 resvd;
1093 u16 num_pids; /* Number of pids in the request */
1094 struct fc_rpsc2_port_info_s port_info[1]; /* port information */
1098 * bit fields so that multiple classes can be specified
1100 enum fc_cos {
1101 FC_CLASS_2 = 0x04,
1102 FC_CLASS_3 = 0x08,
1103 FC_CLASS_2_3 = 0x0C,
1107 * symbolic name
1109 struct fc_symname_s {
1110 u8 symname[FC_SYMNAME_MAX];
1113 struct fc_alpabm_s {
1114 u8 alpa_bm[FC_ALPA_MAX / 8];
1118 * protocol default timeout values
1120 #define FC_ED_TOV 2
1121 #define FC_REC_TOV (FC_ED_TOV + 1)
1122 #define FC_RA_TOV 10
1123 #define FC_ELS_TOV (2 * FC_RA_TOV)
1124 #define FC_FCCT_TOV (3 * FC_RA_TOV)
1127 * virtual fabric related defines
1129 #define FC_VF_ID_NULL 0 /* must not be used as VF_ID */
1130 #define FC_VF_ID_MIN 1
1131 #define FC_VF_ID_MAX 0xEFF
1132 #define FC_VF_ID_CTL 0xFEF /* control VF_ID */
1135 * Virtual Fabric Tagging header format
1136 * @caution This is defined only in BIG ENDIAN format.
1138 struct fc_vft_s {
1139 u32 r_ctl:8;
1140 u32 ver:2;
1141 u32 type:4;
1142 u32 res_a:2;
1143 u32 priority:3;
1144 u32 vf_id:12;
1145 u32 res_b:1;
1146 u32 hopct:8;
1147 u32 res_c:24;
1151 * FCP
1153 enum {
1154 FCP_RJT = 0x01000000, /* SRR reject */
1155 FCP_SRR_ACCEPT = 0x02000000, /* SRR accept */
1156 FCP_SRR = 0x14000000, /* Sequence Retransmission Request */
1160 * SRR FC-4 LS payload
1162 struct fc_srr_s {
1163 u32 ls_cmd;
1164 u32 ox_id:16; /* ox-id */
1165 u32 rx_id:16; /* rx-id */
1166 u32 ro; /* relative offset */
1167 u32 r_ctl:8; /* R_CTL for I.U. */
1168 u32 res:24;
1173 * FCP_CMND definitions
1175 #define FCP_CMND_CDB_LEN 16
1176 #define FCP_CMND_LUN_LEN 8
1178 struct fcp_cmnd_s {
1179 lun_t lun; /* 64-bit LU number */
1180 u8 crn; /* command reference number */
1181 #ifdef __BIGENDIAN
1182 u8 resvd:1,
1183 priority:4, /* FCP-3: SAM-3 priority */
1184 taskattr:3; /* scsi task attribute */
1185 #else
1186 u8 taskattr:3, /* scsi task attribute */
1187 priority:4, /* FCP-3: SAM-3 priority */
1188 resvd:1;
1189 #endif
1190 u8 tm_flags; /* task management flags */
1191 #ifdef __BIGENDIAN
1192 u8 addl_cdb_len:6, /* additional CDB length words */
1193 iodir:2; /* read/write FCP_DATA IUs */
1194 #else
1195 u8 iodir:2, /* read/write FCP_DATA IUs */
1196 addl_cdb_len:6; /* additional CDB length */
1197 #endif
1198 scsi_cdb_t cdb;
1201 * !!! additional cdb bytes follows here!!!
1203 u32 fcp_dl; /* bytes to be transferred */
1206 #define fcp_cmnd_cdb_len(_cmnd) ((_cmnd)->addl_cdb_len * 4 + FCP_CMND_CDB_LEN)
1207 #define fcp_cmnd_fcpdl(_cmnd) ((&(_cmnd)->fcp_dl)[(_cmnd)->addl_cdb_len])
1210 * struct fcp_cmnd_s .iodir field values
1212 enum fcp_iodir {
1213 FCP_IODIR_NONE = 0,
1214 FCP_IODIR_WRITE = 1,
1215 FCP_IODIR_READ = 2,
1216 FCP_IODIR_RW = 3,
1220 * Task attribute field
1222 enum {
1223 FCP_TASK_ATTR_SIMPLE = 0,
1224 FCP_TASK_ATTR_HOQ = 1,
1225 FCP_TASK_ATTR_ORDERED = 2,
1226 FCP_TASK_ATTR_ACA = 4,
1227 FCP_TASK_ATTR_UNTAGGED = 5, /* obsolete in FCP-3 */
1231 * Task management flags field - only one bit shall be set
1233 enum fcp_tm_cmnd {
1234 FCP_TM_ABORT_TASK_SET = BIT(1),
1235 FCP_TM_CLEAR_TASK_SET = BIT(2),
1236 FCP_TM_LUN_RESET = BIT(4),
1237 FCP_TM_TARGET_RESET = BIT(5), /* obsolete in FCP-3 */
1238 FCP_TM_CLEAR_ACA = BIT(6),
1242 * FCP_XFER_RDY IU defines
1244 struct fcp_xfer_rdy_s {
1245 u32 data_ro;
1246 u32 burst_len;
1247 u32 reserved;
1251 * FCP_RSP residue flags
1253 enum fcp_residue {
1254 FCP_NO_RESIDUE = 0, /* no residue */
1255 FCP_RESID_OVER = 1, /* more data left that was not sent */
1256 FCP_RESID_UNDER = 2, /* less data than requested */
1259 enum {
1260 FCP_RSPINFO_GOOD = 0,
1261 FCP_RSPINFO_DATALEN_MISMATCH = 1,
1262 FCP_RSPINFO_CMND_INVALID = 2,
1263 FCP_RSPINFO_ROLEN_MISMATCH = 3,
1264 FCP_RSPINFO_TM_NOT_SUPP = 4,
1265 FCP_RSPINFO_TM_FAILED = 5,
1268 struct fcp_rspinfo_s {
1269 u32 res0:24;
1270 u32 rsp_code:8; /* response code (as above) */
1271 u32 res1;
1274 struct fcp_resp_s {
1275 u32 reserved[2]; /* 2 words reserved */
1276 u16 reserved2;
1277 #ifdef __BIGENDIAN
1278 u8 reserved3:3;
1279 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1280 u8 resid_flags:2; /* underflow/overflow */
1281 u8 sns_len_valid:1;/* sense len is valid */
1282 u8 rsp_len_valid:1;/* response len is valid */
1283 #else
1284 u8 rsp_len_valid:1;/* response len is valid */
1285 u8 sns_len_valid:1;/* sense len is valid */
1286 u8 resid_flags:2; /* underflow/overflow */
1287 u8 fcp_conf_req:1; /* FCP_CONF is requested */
1288 u8 reserved3:3;
1289 #endif
1290 u8 scsi_status; /* one byte SCSI status */
1291 u32 residue; /* residual data bytes */
1292 u32 sns_len; /* length od sense info */
1293 u32 rsp_len; /* length of response info */
1296 #define fcp_snslen(__fcprsp) ((__fcprsp)->sns_len_valid ? \
1297 (__fcprsp)->sns_len : 0)
1298 #define fcp_rsplen(__fcprsp) ((__fcprsp)->rsp_len_valid ? \
1299 (__fcprsp)->rsp_len : 0)
1300 #define fcp_rspinfo(__fcprsp) ((struct fcp_rspinfo_s *)((__fcprsp) + 1))
1301 #define fcp_snsinfo(__fcprsp) (((u8 *)fcp_rspinfo(__fcprsp)) + \
1302 fcp_rsplen(__fcprsp))
1304 struct fcp_cmnd_fr_s {
1305 struct fchs_s fchs;
1306 struct fcp_cmnd_s fcp;
1310 * CT
1312 struct ct_hdr_s {
1313 u32 rev_id:8; /* Revision of the CT */
1314 u32 in_id:24; /* Initiator Id */
1315 u32 gs_type:8; /* Generic service Type */
1316 u32 gs_sub_type:8; /* Generic service sub type */
1317 u32 options:8; /* options */
1318 u32 rsvrd:8; /* reserved */
1319 u32 cmd_rsp_code:16;/* ct command/response code */
1320 u32 max_res_size:16;/* maximum/residual size */
1321 u32 frag_id:8; /* fragment ID */
1322 u32 reason_code:8; /* reason code */
1323 u32 exp_code:8; /* explanation code */
1324 u32 vendor_unq:8; /* vendor unique */
1328 * defines for the Revision
1330 enum {
1331 CT_GS3_REVISION = 0x01,
1335 * defines for gs_type
1337 enum {
1338 CT_GSTYPE_KEYSERVICE = 0xF7,
1339 CT_GSTYPE_ALIASSERVICE = 0xF8,
1340 CT_GSTYPE_MGMTSERVICE = 0xFA,
1341 CT_GSTYPE_TIMESERVICE = 0xFB,
1342 CT_GSTYPE_DIRSERVICE = 0xFC,
1346 * defines for gs_sub_type for gs type directory service
1348 enum {
1349 CT_GSSUBTYPE_NAMESERVER = 0x02,
1353 * defines for gs_sub_type for gs type management service
1355 enum {
1356 CT_GSSUBTYPE_CFGSERVER = 0x01,
1357 CT_GSSUBTYPE_UNZONED_NS = 0x02,
1358 CT_GSSUBTYPE_ZONESERVER = 0x03,
1359 CT_GSSUBTYPE_LOCKSERVER = 0x04,
1360 CT_GSSUBTYPE_HBA_MGMTSERVER = 0x10, /* for FDMI */
1364 * defines for CT response code field
1366 enum {
1367 CT_RSP_REJECT = 0x8001,
1368 CT_RSP_ACCEPT = 0x8002,
1372 * defintions for CT reason code
1374 enum {
1375 CT_RSN_INV_CMD = 0x01,
1376 CT_RSN_INV_VER = 0x02,
1377 CT_RSN_LOGIC_ERR = 0x03,
1378 CT_RSN_INV_SIZE = 0x04,
1379 CT_RSN_LOGICAL_BUSY = 0x05,
1380 CT_RSN_PROTO_ERR = 0x07,
1381 CT_RSN_UNABLE_TO_PERF = 0x09,
1382 CT_RSN_NOT_SUPP = 0x0B,
1383 CT_RSN_SERVER_NOT_AVBL = 0x0D,
1384 CT_RSN_SESSION_COULD_NOT_BE_ESTBD = 0x0E,
1385 CT_RSN_VENDOR_SPECIFIC = 0xFF,
1390 * definitions for explanations code for Name server
1392 enum {
1393 CT_NS_EXP_NOADDITIONAL = 0x00,
1394 CT_NS_EXP_ID_NOT_REG = 0x01,
1395 CT_NS_EXP_PN_NOT_REG = 0x02,
1396 CT_NS_EXP_NN_NOT_REG = 0x03,
1397 CT_NS_EXP_CS_NOT_REG = 0x04,
1398 CT_NS_EXP_IPN_NOT_REG = 0x05,
1399 CT_NS_EXP_IPA_NOT_REG = 0x06,
1400 CT_NS_EXP_FT_NOT_REG = 0x07,
1401 CT_NS_EXP_SPN_NOT_REG = 0x08,
1402 CT_NS_EXP_SNN_NOT_REG = 0x09,
1403 CT_NS_EXP_PT_NOT_REG = 0x0A,
1404 CT_NS_EXP_IPP_NOT_REG = 0x0B,
1405 CT_NS_EXP_FPN_NOT_REG = 0x0C,
1406 CT_NS_EXP_HA_NOT_REG = 0x0D,
1407 CT_NS_EXP_FD_NOT_REG = 0x0E,
1408 CT_NS_EXP_FF_NOT_REG = 0x0F,
1409 CT_NS_EXP_ACCESSDENIED = 0x10,
1410 CT_NS_EXP_UNACCEPTABLE_ID = 0x11,
1411 CT_NS_EXP_DATABASEEMPTY = 0x12,
1412 CT_NS_EXP_NOT_REG_IN_SCOPE = 0x13,
1413 CT_NS_EXP_DOM_ID_NOT_PRESENT = 0x14,
1414 CT_NS_EXP_PORT_NUM_NOT_PRESENT = 0x15,
1415 CT_NS_EXP_NO_DEVICE_ATTACHED = 0x16
1419 * defintions for the explanation code for all servers
1421 enum {
1422 CT_EXP_AUTH_EXCEPTION = 0xF1,
1423 CT_EXP_DB_FULL = 0xF2,
1424 CT_EXP_DB_EMPTY = 0xF3,
1425 CT_EXP_PROCESSING_REQ = 0xF4,
1426 CT_EXP_UNABLE_TO_VERIFY_CONN = 0xF5,
1427 CT_EXP_DEVICES_NOT_IN_CMN_ZONE = 0xF6
1431 * Command codes for Name server
1433 enum {
1434 GS_GID_PN = 0x0121, /* Get Id on port name */
1435 GS_GPN_ID = 0x0112, /* Get port name on ID */
1436 GS_GNN_ID = 0x0113, /* Get node name on ID */
1437 GS_GID_FT = 0x0171, /* Get Id on FC4 type */
1438 GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */
1439 GS_RFT_ID = 0x0217, /* Register fc4type on ID */
1440 GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */
1441 GS_RPN_ID = 0x0212, /* Register port name */
1442 GS_RNN_ID = 0x0213, /* Register node name */
1443 GS_RCS_ID = 0x0214, /* Register class of service */
1444 GS_RPT_ID = 0x021A, /* Register port type */
1445 GS_GA_NXT = 0x0100, /* Get all next */
1446 GS_RFF_ID = 0x021F, /* Register FC4 Feature */
1449 struct fcgs_id_req_s{
1450 u32 rsvd:8;
1451 u32 dap:24; /* port identifier */
1453 #define fcgs_gpnid_req_t struct fcgs_id_req_s
1454 #define fcgs_gnnid_req_t struct fcgs_id_req_s
1455 #define fcgs_gspnid_req_t struct fcgs_id_req_s
1457 struct fcgs_gidpn_req_s {
1458 wwn_t port_name; /* port wwn */
1461 struct fcgs_gidpn_resp_s {
1462 u32 rsvd:8;
1463 u32 dap:24; /* port identifier */
1467 * RFT_ID
1469 struct fcgs_rftid_req_s {
1470 u32 rsvd:8;
1471 u32 dap:24; /* port identifier */
1472 u32 fc4_type[8]; /* fc4 types */
1476 * RFF_ID : Register FC4 features.
1479 #define FC_GS_FCP_FC4_FEATURE_INITIATOR 0x02
1480 #define FC_GS_FCP_FC4_FEATURE_TARGET 0x01
1482 struct fcgs_rffid_req_s {
1483 u32 rsvd:8;
1484 u32 dap:24; /* port identifier */
1485 u32 rsvd1:16;
1486 u32 fc4ftr_bits:8; /* fc4 feature bits */
1487 u32 fc4_type:8; /* corresponding FC4 Type */
1491 * GID_FT Request
1493 struct fcgs_gidft_req_s {
1494 u8 reserved;
1495 u8 domain_id; /* domain, 0 - all fabric */
1496 u8 area_id; /* area, 0 - whole domain */
1497 u8 fc4_type; /* FC_TYPE_FCP for SCSI devices */
1498 }; /* GID_FT Request */
1501 * GID_FT Response
1503 struct fcgs_gidft_resp_s {
1504 u8 last:1; /* last port identifier flag */
1505 u8 reserved:7;
1506 u32 pid:24; /* port identifier */
1507 }; /* GID_FT Response */
1510 * RSPN_ID
1512 struct fcgs_rspnid_req_s {
1513 u32 rsvd:8;
1514 u32 dap:24; /* port identifier */
1515 u8 spn_len; /* symbolic port name length */
1516 u8 spn[256]; /* symbolic port name */
1520 * RPN_ID
1522 struct fcgs_rpnid_req_s {
1523 u32 rsvd:8;
1524 u32 port_id:24;
1525 wwn_t port_name;
1529 * RNN_ID
1531 struct fcgs_rnnid_req_s {
1532 u32 rsvd:8;
1533 u32 port_id:24;
1534 wwn_t node_name;
1538 * RCS_ID
1540 struct fcgs_rcsid_req_s {
1541 u32 rsvd:8;
1542 u32 port_id:24;
1543 u32 cos;
1547 * RPT_ID
1549 struct fcgs_rptid_req_s {
1550 u32 rsvd:8;
1551 u32 port_id:24;
1552 u32 port_type:8;
1553 u32 rsvd1:24;
1557 * GA_NXT Request
1559 struct fcgs_ganxt_req_s {
1560 u32 rsvd:8;
1561 u32 port_id:24;
1565 * GA_NXT Response
1567 struct fcgs_ganxt_rsp_s {
1568 u32 port_type:8; /* Port Type */
1569 u32 port_id:24; /* Port Identifier */
1570 wwn_t port_name; /* Port Name */
1571 u8 spn_len; /* Length of Symbolic Port Name */
1572 char spn[255]; /* Symbolic Port Name */
1573 wwn_t node_name; /* Node Name */
1574 u8 snn_len; /* Length of Symbolic Node Name */
1575 char snn[255]; /* Symbolic Node Name */
1576 u8 ipa[8]; /* Initial Process Associator */
1577 u8 ip[16]; /* IP Address */
1578 u32 cos; /* Class of Service */
1579 u32 fc4types[8]; /* FC-4 TYPEs */
1580 wwn_t fabric_port_name;
1581 /* Fabric Port Name */
1582 u32 rsvd:8; /* Reserved */
1583 u32 hard_addr:24; /* Hard Address */
1587 * Fabric Config Server
1591 * Command codes for Fabric Configuration Server
1593 enum {
1594 GS_FC_GFN_CMD = 0x0114, /* GS FC Get Fabric Name */
1595 GS_FC_GMAL_CMD = 0x0116, /* GS FC GMAL */
1596 GS_FC_TRACE_CMD = 0x0400, /* GS FC Trace Route */
1597 GS_FC_PING_CMD = 0x0401, /* GS FC Ping */
1601 * Source or Destination Port Tags.
1603 enum {
1604 GS_FTRACE_TAG_NPORT_ID = 1,
1605 GS_FTRACE_TAG_NPORT_NAME = 2,
1609 * Port Value : Could be a Port id or wwn
1611 union fcgs_port_val_u {
1612 u32 nport_id;
1613 wwn_t nport_wwn;
1616 #define GS_FTRACE_MAX_HOP_COUNT 20
1617 #define GS_FTRACE_REVISION 1
1620 * Ftrace Related Structures.
1624 * STR (Switch Trace) Reject Reason Codes. From FC-SW.
1626 enum {
1627 GS_FTRACE_STR_CMD_COMPLETED_SUCC = 0,
1628 GS_FTRACE_STR_CMD_NOT_SUPP_IN_NEXT_SWITCH,
1629 GS_FTRACE_STR_NO_RESP_FROM_NEXT_SWITCH,
1630 GS_FTRACE_STR_MAX_HOP_CNT_REACHED,
1631 GS_FTRACE_STR_SRC_PORT_NOT_FOUND,
1632 GS_FTRACE_STR_DST_PORT_NOT_FOUND,
1633 GS_FTRACE_STR_DEVICES_NOT_IN_COMMON_ZONE,
1634 GS_FTRACE_STR_NO_ROUTE_BW_PORTS,
1635 GS_FTRACE_STR_NO_ADDL_EXPLN,
1636 GS_FTRACE_STR_FABRIC_BUSY,
1637 GS_FTRACE_STR_FABRIC_BUILD_IN_PROGRESS,
1638 GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_START = 0xf0,
1639 GS_FTRACE_STR_VENDOR_SPECIFIC_ERR_END = 0xff,
1643 * Ftrace Request
1645 struct fcgs_ftrace_req_s {
1646 u32 revision;
1647 u16 src_port_tag; /* Source Port tag */
1648 u16 src_port_len; /* Source Port len */
1649 union fcgs_port_val_u src_port_val; /* Source Port value */
1650 u16 dst_port_tag; /* Destination Port tag */
1651 u16 dst_port_len; /* Destination Port len */
1652 union fcgs_port_val_u dst_port_val; /* Destination Port value */
1653 u32 token;
1654 u8 vendor_id[8]; /* T10 Vendor Identifier */
1655 u8 vendor_info[8]; /* Vendor specific Info */
1656 u32 max_hop_cnt; /* Max Hop Count */
1660 * Path info structure
1662 struct fcgs_ftrace_path_info_s {
1663 wwn_t switch_name; /* Switch WWN */
1664 u32 domain_id;
1665 wwn_t ingress_port_name; /* Ingress ports wwn */
1666 u32 ingress_phys_port_num; /* Ingress ports physical port
1667 * number
1669 wwn_t egress_port_name; /* Ingress ports wwn */
1670 u32 egress_phys_port_num; /* Ingress ports physical port
1671 * number
1676 * Ftrace Acc Response
1678 struct fcgs_ftrace_resp_s {
1679 u32 revision;
1680 u32 token;
1681 u8 vendor_id[8]; /* T10 Vendor Identifier */
1682 u8 vendor_info[8]; /* Vendor specific Info */
1683 u32 str_rej_reason_code; /* STR Reject Reason Code */
1684 u32 num_path_info_entries; /* No. of path info entries */
1686 * path info entry/entries.
1688 struct fcgs_ftrace_path_info_s path_info[1];
1693 * Fabric Config Server : FCPing
1697 * FC Ping Request
1699 struct fcgs_fcping_req_s {
1700 u32 revision;
1701 u16 port_tag;
1702 u16 port_len; /* Port len */
1703 union fcgs_port_val_u port_val; /* Port value */
1704 u32 token;
1708 * FC Ping Response
1710 struct fcgs_fcping_resp_s {
1711 u32 token;
1715 * Command codes for zone server query.
1717 enum {
1718 ZS_GZME = 0x0124, /* Get zone member extended */
1722 * ZS GZME request
1724 #define ZS_GZME_ZNAMELEN 32
1725 struct zs_gzme_req_s {
1726 u8 znamelen;
1727 u8 rsvd[3];
1728 u8 zname[ZS_GZME_ZNAMELEN];
1731 enum zs_mbr_type {
1732 ZS_MBR_TYPE_PWWN = 1,
1733 ZS_MBR_TYPE_DOMPORT = 2,
1734 ZS_MBR_TYPE_PORTID = 3,
1735 ZS_MBR_TYPE_NWWN = 4,
1738 struct zs_mbr_wwn_s {
1739 u8 mbr_type;
1740 u8 rsvd[3];
1741 wwn_t wwn;
1744 struct zs_query_resp_s {
1745 u32 nmbrs; /* number of zone members */
1746 struct zs_mbr_wwn_s mbr[1];
1750 * GMAL Command ( Get ( interconnect Element) Management Address List)
1751 * To retrieve the IP Address of a Switch.
1754 #define CT_GMAL_RESP_PREFIX_TELNET "telnet://"
1755 #define CT_GMAL_RESP_PREFIX_HTTP "http://"
1757 /* GMAL/GFN request */
1758 struct fcgs_req_s {
1759 wwn_t wwn; /* PWWN/NWWN */
1762 #define fcgs_gmal_req_t struct fcgs_req_s
1763 #define fcgs_gfn_req_t struct fcgs_req_s
1765 /* Accept Response to GMAL */
1766 struct fcgs_gmal_resp_s {
1767 u32 ms_len; /* Num of entries */
1768 u8 ms_ma[256];
1771 struct fcgs_gmal_entry_s {
1772 u8 len;
1773 u8 prefix[7]; /* like "http://" */
1774 u8 ip_addr[248];
1778 * FDMI
1781 * FDMI Command Codes
1783 #define FDMI_GRHL 0x0100
1784 #define FDMI_GHAT 0x0101
1785 #define FDMI_GRPL 0x0102
1786 #define FDMI_GPAT 0x0110
1787 #define FDMI_RHBA 0x0200
1788 #define FDMI_RHAT 0x0201
1789 #define FDMI_RPRT 0x0210
1790 #define FDMI_RPA 0x0211
1791 #define FDMI_DHBA 0x0300
1792 #define FDMI_DPRT 0x0310
1795 * FDMI reason codes
1797 #define FDMI_NO_ADDITIONAL_EXP 0x00
1798 #define FDMI_HBA_ALREADY_REG 0x10
1799 #define FDMI_HBA_ATTRIB_NOT_REG 0x11
1800 #define FDMI_HBA_ATTRIB_MULTIPLE 0x12
1801 #define FDMI_HBA_ATTRIB_LENGTH_INVALID 0x13
1802 #define FDMI_HBA_ATTRIB_NOT_PRESENT 0x14
1803 #define FDMI_PORT_ORIG_NOT_IN_LIST 0x15
1804 #define FDMI_PORT_HBA_NOT_IN_LIST 0x16
1805 #define FDMI_PORT_ATTRIB_NOT_REG 0x20
1806 #define FDMI_PORT_NOT_REG 0x21
1807 #define FDMI_PORT_ATTRIB_MULTIPLE 0x22
1808 #define FDMI_PORT_ATTRIB_LENGTH_INVALID 0x23
1809 #define FDMI_PORT_ALREADY_REGISTEREED 0x24
1812 * FDMI Transmission Speed Mask values
1814 #define FDMI_TRANS_SPEED_1G 0x00000001
1815 #define FDMI_TRANS_SPEED_2G 0x00000002
1816 #define FDMI_TRANS_SPEED_10G 0x00000004
1817 #define FDMI_TRANS_SPEED_4G 0x00000008
1818 #define FDMI_TRANS_SPEED_8G 0x00000010
1819 #define FDMI_TRANS_SPEED_16G 0x00000020
1820 #define FDMI_TRANS_SPEED_UNKNOWN 0x00008000
1823 * FDMI HBA attribute types
1825 enum fdmi_hba_attribute_type {
1826 FDMI_HBA_ATTRIB_NODENAME = 1, /* 0x0001 */
1827 FDMI_HBA_ATTRIB_MANUFACTURER, /* 0x0002 */
1828 FDMI_HBA_ATTRIB_SERIALNUM, /* 0x0003 */
1829 FDMI_HBA_ATTRIB_MODEL, /* 0x0004 */
1830 FDMI_HBA_ATTRIB_MODEL_DESC, /* 0x0005 */
1831 FDMI_HBA_ATTRIB_HW_VERSION, /* 0x0006 */
1832 FDMI_HBA_ATTRIB_DRIVER_VERSION, /* 0x0007 */
1833 FDMI_HBA_ATTRIB_ROM_VERSION, /* 0x0008 */
1834 FDMI_HBA_ATTRIB_FW_VERSION, /* 0x0009 */
1835 FDMI_HBA_ATTRIB_OS_NAME, /* 0x000A */
1836 FDMI_HBA_ATTRIB_MAX_CT, /* 0x000B */
1838 FDMI_HBA_ATTRIB_MAX_TYPE
1842 * FDMI Port attribute types
1844 enum fdmi_port_attribute_type {
1845 FDMI_PORT_ATTRIB_FC4_TYPES = 1, /* 0x0001 */
1846 FDMI_PORT_ATTRIB_SUPP_SPEED, /* 0x0002 */
1847 FDMI_PORT_ATTRIB_PORT_SPEED, /* 0x0003 */
1848 FDMI_PORT_ATTRIB_FRAME_SIZE, /* 0x0004 */
1849 FDMI_PORT_ATTRIB_DEV_NAME, /* 0x0005 */
1850 FDMI_PORT_ATTRIB_HOST_NAME, /* 0x0006 */
1852 FDMI_PORT_ATTR_MAX_TYPE
1856 * FDMI attribute
1858 struct fdmi_attr_s {
1859 u16 type;
1860 u16 len;
1861 u8 value[1];
1865 * HBA Attribute Block
1867 struct fdmi_hba_attr_s {
1868 u32 attr_count; /* # of attributes */
1869 struct fdmi_attr_s hba_attr; /* n attributes */
1873 * Registered Port List
1875 struct fdmi_port_list_s {
1876 u32 num_ports; /* number Of Port Entries */
1877 wwn_t port_entry; /* one or more */
1881 * Port Attribute Block
1883 struct fdmi_port_attr_s {
1884 u32 attr_count; /* # of attributes */
1885 struct fdmi_attr_s port_attr; /* n attributes */
1889 * FDMI Register HBA Attributes
1891 struct fdmi_rhba_s {
1892 wwn_t hba_id; /* HBA Identifier */
1893 struct fdmi_port_list_s port_list; /* Registered Port List */
1894 struct fdmi_hba_attr_s hba_attr_blk; /* HBA attribute block */
1898 * FDMI Register Port
1900 struct fdmi_rprt_s {
1901 wwn_t hba_id; /* HBA Identifier */
1902 wwn_t port_name; /* Port wwn */
1903 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1907 * FDMI Register Port Attributes
1909 struct fdmi_rpa_s {
1910 wwn_t port_name; /* port wwn */
1911 struct fdmi_port_attr_s port_attr_blk; /* Port Attr Block */
1914 #pragma pack()
1916 #endif /* __BFA_FC_H__ */