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