1 /* 2 * Copyright(c) 2007 Intel Corporation. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify it 5 * under the terms and conditions of the GNU General Public License, 6 * version 2, as published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope it will be useful, but WITHOUT 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * more details. 12 * 13 * You should have received a copy of the GNU General Public License along with 14 * this program; if not, write to the Free Software Foundation, Inc., 15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 16 * 17 * Maintained at www.Open-FCoE.org 18 */ 19 20 #ifndef _FC_ELS_H_ 21 #define _FC_ELS_H_ 22 23 #include <linux/types.h> 24 25 /* 26 * Fibre Channel Switch - Enhanced Link Services definitions. 27 * From T11 FC-LS Rev 1.2 June 7, 2005. 28 */ 29 30 /* 31 * ELS Command codes - byte 0 of the frame payload 32 */ 33 enum fc_els_cmd { 34 ELS_LS_RJT = 0x01, /* ESL reject */ 35 ELS_LS_ACC = 0x02, /* ESL Accept */ 36 ELS_PLOGI = 0x03, /* N_Port login */ 37 ELS_FLOGI = 0x04, /* F_Port login */ 38 ELS_LOGO = 0x05, /* Logout */ 39 ELS_ABTX = 0x06, /* Abort exchange - obsolete */ 40 ELS_RCS = 0x07, /* read connection status */ 41 ELS_RES = 0x08, /* read exchange status block */ 42 ELS_RSS = 0x09, /* read sequence status block */ 43 ELS_RSI = 0x0a, /* read sequence initiative */ 44 ELS_ESTS = 0x0b, /* establish streaming */ 45 ELS_ESTC = 0x0c, /* estimate credit */ 46 ELS_ADVC = 0x0d, /* advise credit */ 47 ELS_RTV = 0x0e, /* read timeout value */ 48 ELS_RLS = 0x0f, /* read link error status block */ 49 ELS_ECHO = 0x10, /* echo */ 50 ELS_TEST = 0x11, /* test */ 51 ELS_RRQ = 0x12, /* reinstate recovery qualifier */ 52 ELS_REC = 0x13, /* read exchange concise */ 53 ELS_SRR = 0x14, /* sequence retransmission request */ 54 ELS_PRLI = 0x20, /* process login */ 55 ELS_PRLO = 0x21, /* process logout */ 56 ELS_SCN = 0x22, /* state change notification */ 57 ELS_TPLS = 0x23, /* test process login state */ 58 ELS_TPRLO = 0x24, /* third party process logout */ 59 ELS_LCLM = 0x25, /* login control list mgmt (obs) */ 60 ELS_GAID = 0x30, /* get alias_ID */ 61 ELS_FACT = 0x31, /* fabric activate alias_id */ 62 ELS_FDACDT = 0x32, /* fabric deactivate alias_id */ 63 ELS_NACT = 0x33, /* N-port activate alias_id */ 64 ELS_NDACT = 0x34, /* N-port deactivate alias_id */ 65 ELS_QOSR = 0x40, /* quality of service request */ 66 ELS_RVCS = 0x41, /* read virtual circuit status */ 67 ELS_PDISC = 0x50, /* discover N_port service params */ 68 ELS_FDISC = 0x51, /* discover F_port service params */ 69 ELS_ADISC = 0x52, /* discover address */ 70 ELS_RNC = 0x53, /* report node cap (obs) */ 71 ELS_FARP_REQ = 0x54, /* FC ARP request */ 72 ELS_FARP_REPL = 0x55, /* FC ARP reply */ 73 ELS_RPS = 0x56, /* read port status block */ 74 ELS_RPL = 0x57, /* read port list */ 75 ELS_RPBC = 0x58, /* read port buffer condition */ 76 ELS_FAN = 0x60, /* fabric address notification */ 77 ELS_RSCN = 0x61, /* registered state change notification */ 78 ELS_SCR = 0x62, /* state change registration */ 79 ELS_RNFT = 0x63, /* report node FC-4 types */ 80 ELS_CSR = 0x68, /* clock synch. request */ 81 ELS_CSU = 0x69, /* clock synch. update */ 82 ELS_LINIT = 0x70, /* loop initialize */ 83 ELS_LSTS = 0x72, /* loop status */ 84 ELS_RNID = 0x78, /* request node ID data */ 85 ELS_RLIR = 0x79, /* registered link incident report */ 86 ELS_LIRR = 0x7a, /* link incident record registration */ 87 ELS_SRL = 0x7b, /* scan remote loop */ 88 ELS_SBRP = 0x7c, /* set bit-error reporting params */ 89 ELS_RPSC = 0x7d, /* report speed capabilities */ 90 ELS_QSA = 0x7e, /* query security attributes */ 91 ELS_EVFP = 0x7f, /* exchange virt. fabrics params */ 92 ELS_LKA = 0x80, /* link keep-alive */ 93 ELS_AUTH_ELS = 0x90, /* authentication ELS */ 94 }; 95 96 /* 97 * Initializer useful for decoding table. 98 * Please keep this in sync with the above definitions. 99 */ 100 #define FC_ELS_CMDS_INIT { \ 101 [ELS_LS_RJT] = "LS_RJT", \ 102 [ELS_LS_ACC] = "LS_ACC", \ 103 [ELS_PLOGI] = "PLOGI", \ 104 [ELS_FLOGI] = "FLOGI", \ 105 [ELS_LOGO] = "LOGO", \ 106 [ELS_ABTX] = "ABTX", \ 107 [ELS_RCS] = "RCS", \ 108 [ELS_RES] = "RES", \ 109 [ELS_RSS] = "RSS", \ 110 [ELS_RSI] = "RSI", \ 111 [ELS_ESTS] = "ESTS", \ 112 [ELS_ESTC] = "ESTC", \ 113 [ELS_ADVC] = "ADVC", \ 114 [ELS_RTV] = "RTV", \ 115 [ELS_RLS] = "RLS", \ 116 [ELS_ECHO] = "ECHO", \ 117 [ELS_TEST] = "TEST", \ 118 [ELS_RRQ] = "RRQ", \ 119 [ELS_REC] = "REC", \ 120 [ELS_SRR] = "SRR", \ 121 [ELS_PRLI] = "PRLI", \ 122 [ELS_PRLO] = "PRLO", \ 123 [ELS_SCN] = "SCN", \ 124 [ELS_TPLS] = "TPLS", \ 125 [ELS_TPRLO] = "TPRLO", \ 126 [ELS_LCLM] = "LCLM", \ 127 [ELS_GAID] = "GAID", \ 128 [ELS_FACT] = "FACT", \ 129 [ELS_FDACDT] = "FDACDT", \ 130 [ELS_NACT] = "NACT", \ 131 [ELS_NDACT] = "NDACT", \ 132 [ELS_QOSR] = "QOSR", \ 133 [ELS_RVCS] = "RVCS", \ 134 [ELS_PDISC] = "PDISC", \ 135 [ELS_FDISC] = "FDISC", \ 136 [ELS_ADISC] = "ADISC", \ 137 [ELS_RNC] = "RNC", \ 138 [ELS_FARP_REQ] = "FARP_REQ", \ 139 [ELS_FARP_REPL] = "FARP_REPL", \ 140 [ELS_RPS] = "RPS", \ 141 [ELS_RPL] = "RPL", \ 142 [ELS_RPBC] = "RPBC", \ 143 [ELS_FAN] = "FAN", \ 144 [ELS_RSCN] = "RSCN", \ 145 [ELS_SCR] = "SCR", \ 146 [ELS_RNFT] = "RNFT", \ 147 [ELS_CSR] = "CSR", \ 148 [ELS_CSU] = "CSU", \ 149 [ELS_LINIT] = "LINIT", \ 150 [ELS_LSTS] = "LSTS", \ 151 [ELS_RNID] = "RNID", \ 152 [ELS_RLIR] = "RLIR", \ 153 [ELS_LIRR] = "LIRR", \ 154 [ELS_SRL] = "SRL", \ 155 [ELS_SBRP] = "SBRP", \ 156 [ELS_RPSC] = "RPSC", \ 157 [ELS_QSA] = "QSA", \ 158 [ELS_EVFP] = "EVFP", \ 159 [ELS_LKA] = "LKA", \ 160 [ELS_AUTH_ELS] = "AUTH_ELS", \ 161 } 162 163 /* 164 * LS_ACC payload. 165 */ 166 struct fc_els_ls_acc { 167 __u8 la_cmd; /* command code ELS_LS_ACC */ 168 __u8 la_resv[3]; /* reserved */ 169 }; 170 171 /* 172 * ELS reject payload. 173 */ 174 struct fc_els_ls_rjt { 175 __u8 er_cmd; /* command code ELS_LS_RJT */ 176 __u8 er_resv[4]; /* reserved must be zero */ 177 __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */ 178 __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */ 179 __u8 er_vendor; /* vendor specific code */ 180 }; 181 182 /* 183 * ELS reject reason codes (er_reason). 184 */ 185 enum fc_els_rjt_reason { 186 ELS_RJT_NONE = 0, /* no reject - not to be sent */ 187 ELS_RJT_INVAL = 0x01, /* invalid ELS command code */ 188 ELS_RJT_LOGIC = 0x03, /* logical error */ 189 ELS_RJT_BUSY = 0x05, /* logical busy */ 190 ELS_RJT_PROT = 0x07, /* protocol error */ 191 ELS_RJT_UNAB = 0x09, /* unable to perform command request */ 192 ELS_RJT_UNSUP = 0x0b, /* command not supported */ 193 ELS_RJT_INPROG = 0x0e, /* command already in progress */ 194 ELS_RJT_FIP = 0x20, /* FIP error */ 195 ELS_RJT_VENDOR = 0xff, /* vendor specific error */ 196 }; 197 198 199 /* 200 * reason code explanation (er_explan). 201 */ 202 enum fc_els_rjt_explan { 203 ELS_EXPL_NONE = 0x00, /* No additional explanation */ 204 ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */ 205 ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */ 206 ELS_EXPL_AH = 0x11, /* invalid association header */ 207 ELS_EXPL_AH_REQ = 0x13, /* association_header required */ 208 ELS_EXPL_SID = 0x15, /* invalid originator S_ID */ 209 ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */ 210 ELS_EXPL_INPROG = 0x19, /* Request already in progress */ 211 ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */ 212 ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */ 213 ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */ 214 ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */ 215 ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */ 216 ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */ 217 /* TBD - above definitions incomplete */ 218 }; 219 220 /* 221 * Common service parameters (N ports). 222 */ 223 struct fc_els_csp { 224 __u8 sp_hi_ver; /* highest version supported (obs.) */ 225 __u8 sp_lo_ver; /* highest version supported (obs.) */ 226 __be16 sp_bb_cred; /* buffer-to-buffer credits */ 227 __be16 sp_features; /* common feature flags */ 228 __be16 sp_bb_data; /* b-b state number and data field sz */ 229 union { 230 struct { 231 __be16 _sp_tot_seq; /* total concurrent sequences */ 232 __be16 _sp_rel_off; /* rel. offset by info cat */ 233 } sp_plogi; 234 struct { 235 __be32 _sp_r_a_tov; /* resource alloc. timeout msec */ 236 } sp_flogi_acc; 237 } sp_u; 238 __be32 sp_e_d_tov; /* error detect timeout value */ 239 }; 240 #define sp_tot_seq sp_u.sp_plogi._sp_tot_seq 241 #define sp_rel_off sp_u.sp_plogi._sp_rel_off 242 #define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov 243 244 #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */ 245 246 /* 247 * Minimum and maximum values for max data field size in service parameters. 248 */ 249 #define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD 250 #define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD 251 252 /* 253 * sp_features 254 */ 255 #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */ 256 #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */ 257 #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ 258 #define FC_SP_FT_RAND 0x4000 /* random relative offset */ 259 #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ 260 #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */ 261 #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ 262 #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ 263 #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ 264 #define FC_SP_FT_MCAST 0x0200 /* multicast */ 265 #define FC_SP_FT_BCAST 0x0100 /* broadcast */ 266 #define FC_SP_FT_HUNT 0x0080 /* hunt group */ 267 #define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */ 268 #define FC_SP_FT_SEC 0x0020 /* reserved for security */ 269 #define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */ 270 #define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */ 271 #define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */ 272 #define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */ 273 #define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */ 274 275 /* 276 * Class-specific service parameters. 277 */ 278 struct fc_els_cssp { 279 __be16 cp_class; /* class flags */ 280 __be16 cp_init; /* initiator flags */ 281 __be16 cp_recip; /* recipient flags */ 282 __be16 cp_rdfs; /* receive data field size */ 283 __be16 cp_con_seq; /* concurrent sequences */ 284 __be16 cp_ee_cred; /* N-port end-to-end credit */ 285 __u8 cp_resv1; /* reserved */ 286 __u8 cp_open_seq; /* open sequences per exchange */ 287 __u8 _cp_resv2[2]; /* reserved */ 288 }; 289 290 /* 291 * cp_class flags. 292 */ 293 #define FC_CPC_VALID 0x8000 /* class valid */ 294 #define FC_CPC_IMIX 0x4000 /* intermix mode */ 295 #define FC_CPC_SEQ 0x0800 /* sequential delivery */ 296 #define FC_CPC_CAMP 0x0200 /* camp-on */ 297 #define FC_CPC_PRI 0x0080 /* priority */ 298 299 /* 300 * cp_init flags. 301 * (TBD: not all flags defined here). 302 */ 303 #define FC_CPI_CSYN 0x0010 /* clock synch. capable */ 304 305 /* 306 * cp_recip flags. 307 */ 308 #define FC_CPR_CSYN 0x0008 /* clock synch. capable */ 309 310 /* 311 * NFC_ELS_FLOGI: Fabric login request. 312 * NFC_ELS_PLOGI: Port login request (same format). 313 */ 314 struct fc_els_flogi { 315 __u8 fl_cmd; /* command */ 316 __u8 _fl_resvd[3]; /* must be zero */ 317 struct fc_els_csp fl_csp; /* common service parameters */ 318 __be64 fl_wwpn; /* port name */ 319 __be64 fl_wwnn; /* node name */ 320 struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */ 321 __u8 fl_vend[16]; /* vendor version level */ 322 } __attribute__((__packed__)); 323 324 /* 325 * Process login service parameter page. 326 */ 327 struct fc_els_spp { 328 __u8 spp_type; /* type code or common service params */ 329 __u8 spp_type_ext; /* type code extension */ 330 __u8 spp_flags; 331 __u8 _spp_resvd; 332 __be32 spp_orig_pa; /* originator process associator */ 333 __be32 spp_resp_pa; /* responder process associator */ 334 __be32 spp_params; /* service parameters */ 335 }; 336 337 /* 338 * spp_flags. 339 */ 340 #define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */ 341 #define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */ 342 #define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */ 343 #define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */ 344 345 /* 346 * SPP response code in spp_flags - lower 4 bits. 347 */ 348 enum fc_els_spp_resp { 349 FC_SPP_RESP_ACK = 1, /* request executed */ 350 FC_SPP_RESP_RES = 2, /* unable due to lack of resources */ 351 FC_SPP_RESP_INIT = 3, /* initialization not complete */ 352 FC_SPP_RESP_NO_PA = 4, /* unknown process associator */ 353 FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */ 354 FC_SPP_RESP_COND = 6, /* request completed conditionally */ 355 FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */ 356 FC_SPP_RESP_INVL = 8, /* SPP is invalid */ 357 }; 358 359 /* 360 * ELS_RRQ - Reinstate Recovery Qualifier 361 */ 362 struct fc_els_rrq { 363 __u8 rrq_cmd; /* command (0x12) */ 364 __u8 rrq_zero[3]; /* specified as zero - part of cmd */ 365 __u8 rrq_resvd; /* reserved */ 366 __u8 rrq_s_id[3]; /* originator FID */ 367 __be16 rrq_ox_id; /* originator exchange ID */ 368 __be16 rrq_rx_id; /* responders exchange ID */ 369 }; 370 371 /* 372 * ELS_REC - Read exchange concise. 373 */ 374 struct fc_els_rec { 375 __u8 rec_cmd; /* command (0x13) */ 376 __u8 rec_zero[3]; /* specified as zero - part of cmd */ 377 __u8 rec_resvd; /* reserved */ 378 __u8 rec_s_id[3]; /* originator FID */ 379 __be16 rec_ox_id; /* originator exchange ID */ 380 __be16 rec_rx_id; /* responders exchange ID */ 381 }; 382 383 /* 384 * ELS_REC LS_ACC payload. 385 */ 386 struct fc_els_rec_acc { 387 __u8 reca_cmd; /* accept (0x02) */ 388 __u8 reca_zero[3]; /* specified as zero - part of cmd */ 389 __be16 reca_ox_id; /* originator exchange ID */ 390 __be16 reca_rx_id; /* responders exchange ID */ 391 __u8 reca_resvd1; /* reserved */ 392 __u8 reca_ofid[3]; /* originator FID */ 393 __u8 reca_resvd2; /* reserved */ 394 __u8 reca_rfid[3]; /* responder FID */ 395 __be32 reca_fc4value; /* FC4 value */ 396 __be32 reca_e_stat; /* ESB (exchange status block) status */ 397 }; 398 399 /* 400 * ELS_PRLI - Process login request and response. 401 */ 402 struct fc_els_prli { 403 __u8 prli_cmd; /* command */ 404 __u8 prli_spp_len; /* length of each serv. parm. page */ 405 __be16 prli_len; /* length of entire payload */ 406 /* service parameter pages follow */ 407 }; 408 409 /* 410 * ELS_PRLO - Process logout request and response. 411 */ 412 struct fc_els_prlo { 413 __u8 prlo_cmd; /* command */ 414 __u8 prlo_obs; /* obsolete, but shall be set to 10h */ 415 __be16 prlo_len; /* payload length */ 416 }; 417 418 /* 419 * ELS_ADISC payload 420 */ 421 struct fc_els_adisc { 422 __u8 adisc_cmd; 423 __u8 adisc_resv[3]; 424 __u8 adisc_resv1; 425 __u8 adisc_hard_addr[3]; 426 __be64 adisc_wwpn; 427 __be64 adisc_wwnn; 428 __u8 adisc_resv2; 429 __u8 adisc_port_id[3]; 430 } __attribute__((__packed__)); 431 432 /* 433 * ELS_LOGO - process or fabric logout. 434 */ 435 struct fc_els_logo { 436 __u8 fl_cmd; /* command code */ 437 __u8 fl_zero[3]; /* specified as zero - part of cmd */ 438 __u8 fl_resvd; /* reserved */ 439 __u8 fl_n_port_id[3];/* N port ID */ 440 __be64 fl_n_port_wwn; /* port name */ 441 }; 442 443 /* 444 * ELS_RTV - read timeout value. 445 */ 446 struct fc_els_rtv { 447 __u8 rtv_cmd; /* command code 0x0e */ 448 __u8 rtv_zero[3]; /* specified as zero - part of cmd */ 449 }; 450 451 /* 452 * LS_ACC for ELS_RTV - read timeout value. 453 */ 454 struct fc_els_rtv_acc { 455 __u8 rtv_cmd; /* command code 0x02 */ 456 __u8 rtv_zero[3]; /* specified as zero - part of cmd */ 457 __be32 rtv_r_a_tov; /* resource allocation timeout value */ 458 __be32 rtv_e_d_tov; /* error detection timeout value */ 459 __be32 rtv_toq; /* timeout qualifier (see below) */ 460 }; 461 462 /* 463 * rtv_toq bits. 464 */ 465 #define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */ 466 #define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */ 467 468 /* 469 * ELS_SCR - state change registration payload. 470 */ 471 struct fc_els_scr { 472 __u8 scr_cmd; /* command code */ 473 __u8 scr_resv[6]; /* reserved */ 474 __u8 scr_reg_func; /* registration function (see below) */ 475 }; 476 477 enum fc_els_scr_func { 478 ELS_SCRF_FAB = 1, /* fabric-detected registration */ 479 ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */ 480 ELS_SCRF_FULL = 3, /* full registration */ 481 ELS_SCRF_CLEAR = 255, /* remove any current registrations */ 482 }; 483 484 /* 485 * ELS_RSCN - registered state change notification payload. 486 */ 487 struct fc_els_rscn { 488 __u8 rscn_cmd; /* RSCN opcode (0x61) */ 489 __u8 rscn_page_len; /* page length (4) */ 490 __be16 rscn_plen; /* payload length including this word */ 491 492 /* followed by 4-byte generic affected Port_ID pages */ 493 }; 494 495 struct fc_els_rscn_page { 496 __u8 rscn_page_flags; /* event and address format */ 497 __u8 rscn_fid[3]; /* fabric ID */ 498 }; 499 500 #define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */ 501 #define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */ 502 #define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */ 503 #define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */ 504 505 enum fc_els_rscn_ev_qual { 506 ELS_EV_QUAL_NONE = 0, /* unspecified */ 507 ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */ 508 ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */ 509 ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */ 510 ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */ 511 ELS_EV_QUAL_REM_OBJ = 5, /* removed object */ 512 }; 513 514 enum fc_els_rscn_addr_fmt { 515 ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */ 516 ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */ 517 ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */ 518 ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */ 519 }; 520 521 /* 522 * ELS_RNID - request Node ID. 523 */ 524 struct fc_els_rnid { 525 __u8 rnid_cmd; /* RNID opcode (0x78) */ 526 __u8 rnid_resv[3]; /* reserved */ 527 __u8 rnid_fmt; /* data format */ 528 __u8 rnid_resv2[3]; /* reserved */ 529 }; 530 531 /* 532 * Node Identification Data formats (rnid_fmt) 533 */ 534 enum fc_els_rnid_fmt { 535 ELS_RNIDF_NONE = 0, /* no specific identification data */ 536 ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */ 537 }; 538 539 /* 540 * ELS_RNID response. 541 */ 542 struct fc_els_rnid_resp { 543 __u8 rnid_cmd; /* response code (LS_ACC) */ 544 __u8 rnid_resv[3]; /* reserved */ 545 __u8 rnid_fmt; /* data format */ 546 __u8 rnid_cid_len; /* common ID data length */ 547 __u8 rnid_resv2; /* reserved */ 548 __u8 rnid_sid_len; /* specific ID data length */ 549 }; 550 551 struct fc_els_rnid_cid { 552 __be64 rnid_wwpn; /* N port name */ 553 __be64 rnid_wwnn; /* node name */ 554 }; 555 556 struct fc_els_rnid_gen { 557 __u8 rnid_vend_id[16]; /* vendor-unique ID */ 558 __be32 rnid_atype; /* associated type (see below) */ 559 __be32 rnid_phys_port; /* physical port number */ 560 __be32 rnid_att_nodes; /* number of attached nodes */ 561 __u8 rnid_node_mgmt; /* node management (see below) */ 562 __u8 rnid_ip_ver; /* IP version (see below) */ 563 __be16 rnid_prot_port; /* UDP / TCP port number */ 564 __be32 rnid_ip_addr[4]; /* IP address */ 565 __u8 rnid_resvd[2]; /* reserved */ 566 __be16 rnid_vend_spec; /* vendor-specific field */ 567 }; 568 569 enum fc_els_rnid_atype { 570 ELS_RNIDA_UNK = 0x01, /* unknown */ 571 ELS_RNIDA_OTHER = 0x02, /* none of the following */ 572 ELS_RNIDA_HUB = 0x03, 573 ELS_RNIDA_SWITCH = 0x04, 574 ELS_RNIDA_GATEWAY = 0x05, 575 ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */ 576 ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */ 577 ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */ 578 ELS_RNIDA_STORAGE = 0x09, 579 ELS_RNIDA_HOST = 0x0a, 580 ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */ 581 ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */ 582 ELS_RNIDA_NAS = 0x11, /* NAS server */ 583 ELS_RNIDA_BRIDGE = 0x12, /* bridge */ 584 ELS_RNIDA_VIRT = 0x13, /* virtualization device */ 585 ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */ 586 ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */ 587 ELS_RNIDA_MF_SW = 1UL << 30, /* switch */ 588 ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */ 589 ELS_RNIDA_MF_ST = 1UL << 28, /* storage */ 590 ELS_RNIDA_MF_HOST = 1UL << 27, /* host */ 591 ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */ 592 ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */ 593 ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */ 594 ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */ 595 ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */ 596 ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */ 597 }; 598 599 enum fc_els_rnid_mgmt { 600 ELS_RNIDM_SNMP = 0, 601 ELS_RNIDM_TELNET = 1, 602 ELS_RNIDM_HTTP = 2, 603 ELS_RNIDM_HTTPS = 3, 604 ELS_RNIDM_XML = 4, /* HTTP + XML */ 605 }; 606 607 enum fc_els_rnid_ipver { 608 ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */ 609 ELS_RNIDIP_V4 = 1, /* IPv4 */ 610 ELS_RNIDIP_V6 = 2, /* IPv6 */ 611 }; 612 613 /* 614 * ELS RPL - Read Port List. 615 */ 616 struct fc_els_rpl { 617 __u8 rpl_cmd; /* command */ 618 __u8 rpl_resv[5]; /* reserved - must be zero */ 619 __be16 rpl_max_size; /* maximum response size or zero */ 620 __u8 rpl_resv1; /* reserved - must be zero */ 621 __u8 rpl_index[3]; /* starting index */ 622 }; 623 624 /* 625 * Port number block in RPL response. 626 */ 627 struct fc_els_pnb { 628 __be32 pnb_phys_pn; /* physical port number */ 629 __u8 pnb_resv; /* reserved */ 630 __u8 pnb_port_id[3]; /* port ID */ 631 __be64 pnb_wwpn; /* port name */ 632 }; 633 634 /* 635 * RPL LS_ACC response. 636 */ 637 struct fc_els_rpl_resp { 638 __u8 rpl_cmd; /* ELS_LS_ACC */ 639 __u8 rpl_resv1; /* reserved - must be zero */ 640 __be16 rpl_plen; /* payload length */ 641 __u8 rpl_resv2; /* reserved - must be zero */ 642 __u8 rpl_llen[3]; /* list length */ 643 __u8 rpl_resv3; /* reserved - must be zero */ 644 __u8 rpl_index[3]; /* starting index */ 645 struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */ 646 }; 647 648 /* 649 * Link Error Status Block. 650 */ 651 struct fc_els_lesb { 652 __be32 lesb_link_fail; /* link failure count */ 653 __be32 lesb_sync_loss; /* loss of synchronization count */ 654 __be32 lesb_sig_loss; /* loss of signal count */ 655 __be32 lesb_prim_err; /* primitive sequence error count */ 656 __be32 lesb_inv_word; /* invalid transmission word count */ 657 __be32 lesb_inv_crc; /* invalid CRC count */ 658 }; 659 660 /* 661 * ELS RPS - Read Port Status Block request. 662 */ 663 struct fc_els_rps { 664 __u8 rps_cmd; /* command */ 665 __u8 rps_resv[2]; /* reserved - must be zero */ 666 __u8 rps_flag; /* flag - see below */ 667 __be64 rps_port_spec; /* port selection */ 668 }; 669 670 enum fc_els_rps_flag { 671 FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */ 672 FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */ 673 FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */ 674 }; 675 676 /* 677 * ELS RPS LS_ACC response. 678 */ 679 struct fc_els_rps_resp { 680 __u8 rps_cmd; /* command - LS_ACC */ 681 __u8 rps_resv[2]; /* reserved - must be zero */ 682 __u8 rps_flag; /* flag - see below */ 683 __u8 rps_resv2[2]; /* reserved */ 684 __be16 rps_status; /* port status - see below */ 685 struct fc_els_lesb rps_lesb; /* link error status block */ 686 }; 687 688 enum fc_els_rps_resp_flag { 689 FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */ 690 }; 691 692 enum fc_els_rps_resp_status { 693 FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */ 694 FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */ 695 FC_ELS_RPS_FAB = 1 << 3, /* fabric present */ 696 FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */ 697 FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */ 698 FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */ 699 }; 700 701 /* 702 * ELS LIRR - Link Incident Record Registration request. 703 */ 704 struct fc_els_lirr { 705 __u8 lirr_cmd; /* command */ 706 __u8 lirr_resv[3]; /* reserved - must be zero */ 707 __u8 lirr_func; /* registration function */ 708 __u8 lirr_fmt; /* FC-4 type of RLIR requested */ 709 __u8 lirr_resv2[2]; /* reserved - must be zero */ 710 }; 711 712 enum fc_els_lirr_func { 713 ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */ 714 ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */ 715 ELS_LIRR_CLEAR = 0xff /* clear registration */ 716 }; 717 718 /* 719 * ELS SRL - Scan Remote Loop request. 720 */ 721 struct fc_els_srl { 722 __u8 srl_cmd; /* command */ 723 __u8 srl_resv[3]; /* reserved - must be zero */ 724 __u8 srl_flag; /* flag - see below */ 725 __u8 srl_flag_param[3]; /* flag parameter */ 726 }; 727 728 enum fc_els_srl_flag { 729 FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */ 730 FC_ELS_SRL_ONE = 0x01, /* scan specified loop */ 731 FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */ 732 FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */ 733 }; 734 735 /* 736 * ELS RLS - Read Link Error Status Block request. 737 */ 738 struct fc_els_rls { 739 __u8 rls_cmd; /* command */ 740 __u8 rls_resv[4]; /* reserved - must be zero */ 741 __u8 rls_port_id[3]; /* port ID */ 742 }; 743 744 /* 745 * ELS RLS LS_ACC Response. 746 */ 747 struct fc_els_rls_resp { 748 __u8 rls_cmd; /* ELS_LS_ACC */ 749 __u8 rls_resv[3]; /* reserved - must be zero */ 750 struct fc_els_lesb rls_lesb; /* link error status block */ 751 }; 752 753 /* 754 * ELS RLIR - Registered Link Incident Report. 755 * This is followed by the CLIR and the CLID, described below. 756 */ 757 struct fc_els_rlir { 758 __u8 rlir_cmd; /* command */ 759 __u8 rlir_resv[3]; /* reserved - must be zero */ 760 __u8 rlir_fmt; /* format (FC4-type if type specific) */ 761 __u8 rlir_clr_len; /* common link incident record length */ 762 __u8 rlir_cld_len; /* common link incident desc. length */ 763 __u8 rlir_slr_len; /* spec. link incident record length */ 764 }; 765 766 /* 767 * CLIR - Common Link Incident Record Data. - Sent via RLIR. 768 */ 769 struct fc_els_clir { 770 __be64 clir_wwpn; /* incident port name */ 771 __be64 clir_wwnn; /* incident port node name */ 772 __u8 clir_port_type; /* incident port type */ 773 __u8 clir_port_id[3]; /* incident port ID */ 774 775 __be64 clir_conn_wwpn; /* connected port name */ 776 __be64 clir_conn_wwnn; /* connected node name */ 777 __be64 clir_fab_name; /* fabric name */ 778 __be32 clir_phys_port; /* physical port number */ 779 __be32 clir_trans_id; /* transaction ID */ 780 __u8 clir_resv[3]; /* reserved */ 781 __u8 clir_ts_fmt; /* time stamp format */ 782 __be64 clir_timestamp; /* time stamp */ 783 }; 784 785 /* 786 * CLIR clir_ts_fmt - time stamp format values. 787 */ 788 enum fc_els_clir_ts_fmt { 789 ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */ 790 ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */ 791 ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */ 792 }; 793 794 /* 795 * Common Link Incident Descriptor - sent via RLIR. 796 */ 797 struct fc_els_clid { 798 __u8 clid_iq; /* incident qualifier flags */ 799 __u8 clid_ic; /* incident code */ 800 __be16 clid_epai; /* domain/area of ISL */ 801 }; 802 803 /* 804 * CLID incident qualifier flags. 805 */ 806 enum fc_els_clid_iq { 807 ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */ 808 ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */ 809 ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */ 810 ELS_CLID_SEV_INFO = 0x00, /* report is informational */ 811 ELS_CLID_SEV_INOP = 0x08, /* link not operational */ 812 ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */ 813 ELS_CLID_LASER = 0x02, /* subassembly is a laser */ 814 ELS_CLID_FRU = 0x01, /* format can identify a FRU */ 815 }; 816 817 /* 818 * CLID incident code. 819 */ 820 enum fc_els_clid_ic { 821 ELS_CLID_IC_IMPL = 1, /* implicit incident */ 822 ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */ 823 ELS_CLID_IC_LOS = 3, /* loss of synch or signal */ 824 ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */ 825 ELS_CLID_IC_PST = 5, /* primitive sequence timeout */ 826 ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */ 827 ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */ 828 ELS_CLID_IC_LIP = 8, /* receiving LIP */ 829 }; 830 831 #endif /* _FC_ELS_H_ */ 832