1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * Copyright(c) 2007 Intel Corporation. All rights reserved. 4 * 5 * Maintained at www.Open-FCoE.org 6 */ 7 8 #ifndef _FC_ELS_H_ 9 #define _FC_ELS_H_ 10 11 #include <linux/types.h> 12 #include <asm/byteorder.h> 13 14 #ifdef __KERNEL__ 15 #include <linux/stddef.h> /* for offsetof */ 16 #else 17 #include <stddef.h> /* for offsetof */ 18 #endif 19 20 /* 21 * Fibre Channel Switch - Enhanced Link Services definitions. 22 * From T11 FC-LS Rev 1.2 June 7, 2005. 23 */ 24 25 /* 26 * ELS Command codes - byte 0 of the frame payload 27 */ 28 enum fc_els_cmd { 29 ELS_LS_RJT = 0x01, /* ESL reject */ 30 ELS_LS_ACC = 0x02, /* ESL Accept */ 31 ELS_PLOGI = 0x03, /* N_Port login */ 32 ELS_FLOGI = 0x04, /* F_Port login */ 33 ELS_LOGO = 0x05, /* Logout */ 34 ELS_ABTX = 0x06, /* Abort exchange - obsolete */ 35 ELS_RCS = 0x07, /* read connection status */ 36 ELS_RES = 0x08, /* read exchange status block */ 37 ELS_RSS = 0x09, /* read sequence status block */ 38 ELS_RSI = 0x0a, /* read sequence initiative */ 39 ELS_ESTS = 0x0b, /* establish streaming */ 40 ELS_ESTC = 0x0c, /* estimate credit */ 41 ELS_ADVC = 0x0d, /* advise credit */ 42 ELS_RTV = 0x0e, /* read timeout value */ 43 ELS_RLS = 0x0f, /* read link error status block */ 44 ELS_ECHO = 0x10, /* echo */ 45 ELS_TEST = 0x11, /* test */ 46 ELS_RRQ = 0x12, /* reinstate recovery qualifier */ 47 ELS_REC = 0x13, /* read exchange concise */ 48 ELS_SRR = 0x14, /* sequence retransmission request */ 49 ELS_FPIN = 0x16, /* Fabric Performance Impact Notification */ 50 ELS_EDC = 0x17, /* Exchange Diagnostic Capabilities */ 51 ELS_RDP = 0x18, /* Read Diagnostic Parameters */ 52 ELS_RDF = 0x19, /* Register Diagnostic Functions */ 53 ELS_PRLI = 0x20, /* process login */ 54 ELS_PRLO = 0x21, /* process logout */ 55 ELS_SCN = 0x22, /* state change notification */ 56 ELS_TPLS = 0x23, /* test process login state */ 57 ELS_TPRLO = 0x24, /* third party process logout */ 58 ELS_LCLM = 0x25, /* login control list mgmt (obs) */ 59 ELS_GAID = 0x30, /* get alias_ID */ 60 ELS_FACT = 0x31, /* fabric activate alias_id */ 61 ELS_FDACDT = 0x32, /* fabric deactivate alias_id */ 62 ELS_NACT = 0x33, /* N-port activate alias_id */ 63 ELS_NDACT = 0x34, /* N-port deactivate alias_id */ 64 ELS_QOSR = 0x40, /* quality of service request */ 65 ELS_RVCS = 0x41, /* read virtual circuit status */ 66 ELS_PDISC = 0x50, /* discover N_port service params */ 67 ELS_FDISC = 0x51, /* discover F_port service params */ 68 ELS_ADISC = 0x52, /* discover address */ 69 ELS_RNC = 0x53, /* report node cap (obs) */ 70 ELS_FARP_REQ = 0x54, /* FC ARP request */ 71 ELS_FARP_REPL = 0x55, /* FC ARP reply */ 72 ELS_RPS = 0x56, /* read port status block */ 73 ELS_RPL = 0x57, /* read port list */ 74 ELS_RPBC = 0x58, /* read port buffer condition */ 75 ELS_FAN = 0x60, /* fabric address notification */ 76 ELS_RSCN = 0x61, /* registered state change notification */ 77 ELS_SCR = 0x62, /* state change registration */ 78 ELS_RNFT = 0x63, /* report node FC-4 types */ 79 ELS_CSR = 0x68, /* clock synch. request */ 80 ELS_CSU = 0x69, /* clock synch. update */ 81 ELS_LINIT = 0x70, /* loop initialize */ 82 ELS_LSTS = 0x72, /* loop status */ 83 ELS_RNID = 0x78, /* request node ID data */ 84 ELS_RLIR = 0x79, /* registered link incident report */ 85 ELS_LIRR = 0x7a, /* link incident record registration */ 86 ELS_SRL = 0x7b, /* scan remote loop */ 87 ELS_SBRP = 0x7c, /* set bit-error reporting params */ 88 ELS_RPSC = 0x7d, /* report speed capabilities */ 89 ELS_QSA = 0x7e, /* query security attributes */ 90 ELS_EVFP = 0x7f, /* exchange virt. fabrics params */ 91 ELS_LKA = 0x80, /* link keep-alive */ 92 ELS_AUTH_ELS = 0x90, /* authentication ELS */ 93 }; 94 95 /* 96 * Initializer useful for decoding table. 97 * Please keep this in sync with the above definitions. 98 */ 99 #define FC_ELS_CMDS_INIT { \ 100 [ELS_LS_RJT] = "LS_RJT", \ 101 [ELS_LS_ACC] = "LS_ACC", \ 102 [ELS_PLOGI] = "PLOGI", \ 103 [ELS_FLOGI] = "FLOGI", \ 104 [ELS_LOGO] = "LOGO", \ 105 [ELS_ABTX] = "ABTX", \ 106 [ELS_RCS] = "RCS", \ 107 [ELS_RES] = "RES", \ 108 [ELS_RSS] = "RSS", \ 109 [ELS_RSI] = "RSI", \ 110 [ELS_ESTS] = "ESTS", \ 111 [ELS_ESTC] = "ESTC", \ 112 [ELS_ADVC] = "ADVC", \ 113 [ELS_RTV] = "RTV", \ 114 [ELS_RLS] = "RLS", \ 115 [ELS_ECHO] = "ECHO", \ 116 [ELS_TEST] = "TEST", \ 117 [ELS_RRQ] = "RRQ", \ 118 [ELS_REC] = "REC", \ 119 [ELS_SRR] = "SRR", \ 120 [ELS_FPIN] = "FPIN", \ 121 [ELS_EDC] = "EDC", \ 122 [ELS_RDP] = "RDP", \ 123 [ELS_RDF] = "RDF", \ 124 [ELS_PRLI] = "PRLI", \ 125 [ELS_PRLO] = "PRLO", \ 126 [ELS_SCN] = "SCN", \ 127 [ELS_TPLS] = "TPLS", \ 128 [ELS_TPRLO] = "TPRLO", \ 129 [ELS_LCLM] = "LCLM", \ 130 [ELS_GAID] = "GAID", \ 131 [ELS_FACT] = "FACT", \ 132 [ELS_FDACDT] = "FDACDT", \ 133 [ELS_NACT] = "NACT", \ 134 [ELS_NDACT] = "NDACT", \ 135 [ELS_QOSR] = "QOSR", \ 136 [ELS_RVCS] = "RVCS", \ 137 [ELS_PDISC] = "PDISC", \ 138 [ELS_FDISC] = "FDISC", \ 139 [ELS_ADISC] = "ADISC", \ 140 [ELS_RNC] = "RNC", \ 141 [ELS_FARP_REQ] = "FARP_REQ", \ 142 [ELS_FARP_REPL] = "FARP_REPL", \ 143 [ELS_RPS] = "RPS", \ 144 [ELS_RPL] = "RPL", \ 145 [ELS_RPBC] = "RPBC", \ 146 [ELS_FAN] = "FAN", \ 147 [ELS_RSCN] = "RSCN", \ 148 [ELS_SCR] = "SCR", \ 149 [ELS_RNFT] = "RNFT", \ 150 [ELS_CSR] = "CSR", \ 151 [ELS_CSU] = "CSU", \ 152 [ELS_LINIT] = "LINIT", \ 153 [ELS_LSTS] = "LSTS", \ 154 [ELS_RNID] = "RNID", \ 155 [ELS_RLIR] = "RLIR", \ 156 [ELS_LIRR] = "LIRR", \ 157 [ELS_SRL] = "SRL", \ 158 [ELS_SBRP] = "SBRP", \ 159 [ELS_RPSC] = "RPSC", \ 160 [ELS_QSA] = "QSA", \ 161 [ELS_EVFP] = "EVFP", \ 162 [ELS_LKA] = "LKA", \ 163 [ELS_AUTH_ELS] = "AUTH_ELS", \ 164 } 165 166 /* 167 * LS_ACC payload. 168 */ 169 struct fc_els_ls_acc { 170 __u8 la_cmd; /* command code ELS_LS_ACC */ 171 __u8 la_resv[3]; /* reserved */ 172 }; 173 174 /* 175 * ELS reject payload. 176 */ 177 struct fc_els_ls_rjt { 178 __u8 er_cmd; /* command code ELS_LS_RJT */ 179 __u8 er_resv[4]; /* reserved must be zero */ 180 __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */ 181 __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */ 182 __u8 er_vendor; /* vendor specific code */ 183 }; 184 185 /* 186 * ELS reject reason codes (er_reason). 187 */ 188 enum fc_els_rjt_reason { 189 ELS_RJT_NONE = 0, /* no reject - not to be sent */ 190 ELS_RJT_INVAL = 0x01, /* invalid ELS command code */ 191 ELS_RJT_LOGIC = 0x03, /* logical error */ 192 ELS_RJT_BUSY = 0x05, /* logical busy */ 193 ELS_RJT_PROT = 0x07, /* protocol error */ 194 ELS_RJT_UNAB = 0x09, /* unable to perform command request */ 195 ELS_RJT_UNSUP = 0x0b, /* command not supported */ 196 ELS_RJT_INPROG = 0x0e, /* command already in progress */ 197 ELS_RJT_FIP = 0x20, /* FIP error */ 198 ELS_RJT_VENDOR = 0xff, /* vendor specific error */ 199 }; 200 201 202 /* 203 * reason code explanation (er_explan). 204 */ 205 enum fc_els_rjt_explan { 206 ELS_EXPL_NONE = 0x00, /* No additional explanation */ 207 ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */ 208 ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */ 209 ELS_EXPL_AH = 0x11, /* invalid association header */ 210 ELS_EXPL_AH_REQ = 0x13, /* association_header required */ 211 ELS_EXPL_SID = 0x15, /* invalid originator S_ID */ 212 ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */ 213 ELS_EXPL_INPROG = 0x19, /* Request already in progress */ 214 ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */ 215 ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */ 216 ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */ 217 ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */ 218 ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */ 219 ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */ 220 /* TBD - above definitions incomplete */ 221 }; 222 223 /* 224 * Link Service TLV Descriptor Tag Values 225 */ 226 enum fc_ls_tlv_dtag { 227 ELS_DTAG_LS_REQ_INFO = 0x00000001, 228 /* Link Service Request Information Descriptor */ 229 ELS_DTAG_LNK_FAULT_CAP = 0x0001000D, 230 /* Link Fault Capability Descriptor */ 231 ELS_DTAG_CG_SIGNAL_CAP = 0x0001000F, 232 /* Congestion Signaling Capability Descriptor */ 233 ELS_DTAG_LNK_INTEGRITY = 0x00020001, 234 /* Link Integrity Notification Descriptor */ 235 ELS_DTAG_DELIVERY = 0x00020002, 236 /* Delivery Notification Descriptor */ 237 ELS_DTAG_PEER_CONGEST = 0x00020003, 238 /* Peer Congestion Notification Descriptor */ 239 ELS_DTAG_CONGESTION = 0x00020004, 240 /* Congestion Notification Descriptor */ 241 ELS_DTAG_FPIN_REGISTER = 0x00030001, 242 /* FPIN Registration Descriptor */ 243 }; 244 245 /* 246 * Initializer useful for decoding table. 247 * Please keep this in sync with the above definitions. 248 */ 249 #define FC_LS_TLV_DTAG_INIT { \ 250 { ELS_DTAG_LS_REQ_INFO, "Link Service Request Information" }, \ 251 { ELS_DTAG_LNK_FAULT_CAP, "Link Fault Capability" }, \ 252 { ELS_DTAG_CG_SIGNAL_CAP, "Congestion Signaling Capability" }, \ 253 { ELS_DTAG_LNK_INTEGRITY, "Link Integrity Notification" }, \ 254 { ELS_DTAG_DELIVERY, "Delivery Notification Present" }, \ 255 { ELS_DTAG_PEER_CONGEST, "Peer Congestion Notification" }, \ 256 { ELS_DTAG_CONGESTION, "Congestion Notification" }, \ 257 { ELS_DTAG_FPIN_REGISTER, "FPIN Registration" }, \ 258 } 259 260 261 /* 262 * Generic Link Service TLV Descriptor format 263 * 264 * This structure, as it defines no payload, will also be referred to 265 * as the "tlv header" - which contains the tag and len fields. 266 */ 267 struct fc_tlv_desc { 268 __be32 desc_tag; /* Notification Descriptor Tag */ 269 __be32 desc_len; /* Length of Descriptor (in bytes). 270 * Size of descriptor excluding 271 * desc_tag and desc_len fields. 272 */ 273 __u8 desc_value[]; /* Descriptor Value */ 274 }; 275 276 /* Descriptor tag and len fields are considered the mandatory header 277 * for a descriptor 278 */ 279 #define FC_TLV_DESC_HDR_SZ sizeof(struct fc_tlv_desc) 280 281 /* 282 * Macro, used when initializing payloads, to return the descriptor length. 283 * Length is size of descriptor minus the tag and len fields. 284 */ 285 #define FC_TLV_DESC_LENGTH_FROM_SZ(desc) \ 286 (sizeof(desc) - FC_TLV_DESC_HDR_SZ) 287 288 /* Macro, used on received payloads, to return the descriptor length */ 289 #define FC_TLV_DESC_SZ_FROM_LENGTH(tlv) \ 290 (__be32_to_cpu((tlv)->desc_len) + FC_TLV_DESC_HDR_SZ) 291 292 /* 293 * This helper is used to walk descriptors in a descriptor list. 294 * Given the address of the current descriptor, which minimally contains a 295 * tag and len field, calculate the address of the next descriptor based 296 * on the len field. 297 */ 298 static inline void *fc_tlv_next_desc(void *desc) 299 { 300 struct fc_tlv_desc *tlv = desc; 301 302 return (desc + FC_TLV_DESC_SZ_FROM_LENGTH(tlv)); 303 } 304 305 306 /* 307 * Link Service Request Information Descriptor 308 */ 309 struct fc_els_lsri_desc { 310 __be32 desc_tag; /* descriptor tag (0x0000 0001) */ 311 __be32 desc_len; /* Length of Descriptor (in bytes) (4). 312 * Size of descriptor excluding 313 * desc_tag and desc_len fields. 314 */ 315 struct { 316 __u8 cmd; /* ELS cmd byte */ 317 __u8 bytes[3]; /* bytes 1..3 */ 318 } rqst_w0; /* Request word 0 */ 319 }; 320 321 322 /* 323 * Common service parameters (N ports). 324 */ 325 struct fc_els_csp { 326 __u8 sp_hi_ver; /* highest version supported (obs.) */ 327 __u8 sp_lo_ver; /* highest version supported (obs.) */ 328 __be16 sp_bb_cred; /* buffer-to-buffer credits */ 329 __be16 sp_features; /* common feature flags */ 330 __be16 sp_bb_data; /* b-b state number and data field sz */ 331 union { 332 struct { 333 __be16 _sp_tot_seq; /* total concurrent sequences */ 334 __be16 _sp_rel_off; /* rel. offset by info cat */ 335 } sp_plogi; 336 struct { 337 __be32 _sp_r_a_tov; /* resource alloc. timeout msec */ 338 } sp_flogi_acc; 339 } sp_u; 340 __be32 sp_e_d_tov; /* error detect timeout value */ 341 }; 342 #define sp_tot_seq sp_u.sp_plogi._sp_tot_seq 343 #define sp_rel_off sp_u.sp_plogi._sp_rel_off 344 #define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov 345 346 #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */ 347 348 /* 349 * Minimum and maximum values for max data field size in service parameters. 350 */ 351 #define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD 352 #define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD 353 354 /* 355 * sp_features 356 */ 357 #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */ 358 #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */ 359 #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ 360 #define FC_SP_FT_RAND 0x4000 /* random relative offset */ 361 #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ 362 #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */ 363 #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ 364 #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ 365 #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ 366 #define FC_SP_FT_MCAST 0x0200 /* multicast */ 367 #define FC_SP_FT_BCAST 0x0100 /* broadcast */ 368 #define FC_SP_FT_HUNT 0x0080 /* hunt group */ 369 #define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */ 370 #define FC_SP_FT_SEC 0x0020 /* reserved for security */ 371 #define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */ 372 #define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */ 373 #define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */ 374 #define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */ 375 #define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */ 376 377 /* 378 * Class-specific service parameters. 379 */ 380 struct fc_els_cssp { 381 __be16 cp_class; /* class flags */ 382 __be16 cp_init; /* initiator flags */ 383 __be16 cp_recip; /* recipient flags */ 384 __be16 cp_rdfs; /* receive data field size */ 385 __be16 cp_con_seq; /* concurrent sequences */ 386 __be16 cp_ee_cred; /* N-port end-to-end credit */ 387 __u8 cp_resv1; /* reserved */ 388 __u8 cp_open_seq; /* open sequences per exchange */ 389 __u8 _cp_resv2[2]; /* reserved */ 390 }; 391 392 /* 393 * cp_class flags. 394 */ 395 #define FC_CPC_VALID 0x8000 /* class valid */ 396 #define FC_CPC_IMIX 0x4000 /* intermix mode */ 397 #define FC_CPC_SEQ 0x0800 /* sequential delivery */ 398 #define FC_CPC_CAMP 0x0200 /* camp-on */ 399 #define FC_CPC_PRI 0x0080 /* priority */ 400 401 /* 402 * cp_init flags. 403 * (TBD: not all flags defined here). 404 */ 405 #define FC_CPI_CSYN 0x0010 /* clock synch. capable */ 406 407 /* 408 * cp_recip flags. 409 */ 410 #define FC_CPR_CSYN 0x0008 /* clock synch. capable */ 411 412 /* 413 * NFC_ELS_FLOGI: Fabric login request. 414 * NFC_ELS_PLOGI: Port login request (same format). 415 */ 416 struct fc_els_flogi { 417 __u8 fl_cmd; /* command */ 418 __u8 _fl_resvd[3]; /* must be zero */ 419 struct fc_els_csp fl_csp; /* common service parameters */ 420 __be64 fl_wwpn; /* port name */ 421 __be64 fl_wwnn; /* node name */ 422 struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */ 423 __u8 fl_vend[16]; /* vendor version level */ 424 } __attribute__((__packed__)); 425 426 /* 427 * Process login service parameter page. 428 */ 429 struct fc_els_spp { 430 __u8 spp_type; /* type code or common service params */ 431 __u8 spp_type_ext; /* type code extension */ 432 __u8 spp_flags; 433 __u8 _spp_resvd; 434 __be32 spp_orig_pa; /* originator process associator */ 435 __be32 spp_resp_pa; /* responder process associator */ 436 __be32 spp_params; /* service parameters */ 437 }; 438 439 /* 440 * spp_flags. 441 */ 442 #define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */ 443 #define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */ 444 #define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */ 445 #define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */ 446 447 /* 448 * SPP response code in spp_flags - lower 4 bits. 449 */ 450 enum fc_els_spp_resp { 451 FC_SPP_RESP_ACK = 1, /* request executed */ 452 FC_SPP_RESP_RES = 2, /* unable due to lack of resources */ 453 FC_SPP_RESP_INIT = 3, /* initialization not complete */ 454 FC_SPP_RESP_NO_PA = 4, /* unknown process associator */ 455 FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */ 456 FC_SPP_RESP_COND = 6, /* request completed conditionally */ 457 FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */ 458 FC_SPP_RESP_INVL = 8, /* SPP is invalid */ 459 }; 460 461 /* 462 * ELS_RRQ - Reinstate Recovery Qualifier 463 */ 464 struct fc_els_rrq { 465 __u8 rrq_cmd; /* command (0x12) */ 466 __u8 rrq_zero[3]; /* specified as zero - part of cmd */ 467 __u8 rrq_resvd; /* reserved */ 468 __u8 rrq_s_id[3]; /* originator FID */ 469 __be16 rrq_ox_id; /* originator exchange ID */ 470 __be16 rrq_rx_id; /* responders exchange ID */ 471 }; 472 473 /* 474 * ELS_REC - Read exchange concise. 475 */ 476 struct fc_els_rec { 477 __u8 rec_cmd; /* command (0x13) */ 478 __u8 rec_zero[3]; /* specified as zero - part of cmd */ 479 __u8 rec_resvd; /* reserved */ 480 __u8 rec_s_id[3]; /* originator FID */ 481 __be16 rec_ox_id; /* originator exchange ID */ 482 __be16 rec_rx_id; /* responders exchange ID */ 483 }; 484 485 /* 486 * ELS_REC LS_ACC payload. 487 */ 488 struct fc_els_rec_acc { 489 __u8 reca_cmd; /* accept (0x02) */ 490 __u8 reca_zero[3]; /* specified as zero - part of cmd */ 491 __be16 reca_ox_id; /* originator exchange ID */ 492 __be16 reca_rx_id; /* responders exchange ID */ 493 __u8 reca_resvd1; /* reserved */ 494 __u8 reca_ofid[3]; /* originator FID */ 495 __u8 reca_resvd2; /* reserved */ 496 __u8 reca_rfid[3]; /* responder FID */ 497 __be32 reca_fc4value; /* FC4 value */ 498 __be32 reca_e_stat; /* ESB (exchange status block) status */ 499 }; 500 501 /* 502 * ELS_PRLI - Process login request and response. 503 */ 504 struct fc_els_prli { 505 __u8 prli_cmd; /* command */ 506 __u8 prli_spp_len; /* length of each serv. parm. page */ 507 __be16 prli_len; /* length of entire payload */ 508 /* service parameter pages follow */ 509 }; 510 511 /* 512 * ELS_PRLO - Process logout request and response. 513 */ 514 struct fc_els_prlo { 515 __u8 prlo_cmd; /* command */ 516 __u8 prlo_obs; /* obsolete, but shall be set to 10h */ 517 __be16 prlo_len; /* payload length */ 518 }; 519 520 /* 521 * ELS_ADISC payload 522 */ 523 struct fc_els_adisc { 524 __u8 adisc_cmd; 525 __u8 adisc_resv[3]; 526 __u8 adisc_resv1; 527 __u8 adisc_hard_addr[3]; 528 __be64 adisc_wwpn; 529 __be64 adisc_wwnn; 530 __u8 adisc_resv2; 531 __u8 adisc_port_id[3]; 532 } __attribute__((__packed__)); 533 534 /* 535 * ELS_LOGO - process or fabric logout. 536 */ 537 struct fc_els_logo { 538 __u8 fl_cmd; /* command code */ 539 __u8 fl_zero[3]; /* specified as zero - part of cmd */ 540 __u8 fl_resvd; /* reserved */ 541 __u8 fl_n_port_id[3];/* N port ID */ 542 __be64 fl_n_port_wwn; /* port name */ 543 }; 544 545 /* 546 * ELS_RTV - read timeout value. 547 */ 548 struct fc_els_rtv { 549 __u8 rtv_cmd; /* command code 0x0e */ 550 __u8 rtv_zero[3]; /* specified as zero - part of cmd */ 551 }; 552 553 /* 554 * LS_ACC for ELS_RTV - read timeout value. 555 */ 556 struct fc_els_rtv_acc { 557 __u8 rtv_cmd; /* command code 0x02 */ 558 __u8 rtv_zero[3]; /* specified as zero - part of cmd */ 559 __be32 rtv_r_a_tov; /* resource allocation timeout value */ 560 __be32 rtv_e_d_tov; /* error detection timeout value */ 561 __be32 rtv_toq; /* timeout qualifier (see below) */ 562 }; 563 564 /* 565 * rtv_toq bits. 566 */ 567 #define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */ 568 #define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */ 569 570 /* 571 * ELS_SCR - state change registration payload. 572 */ 573 struct fc_els_scr { 574 __u8 scr_cmd; /* command code */ 575 __u8 scr_resv[6]; /* reserved */ 576 __u8 scr_reg_func; /* registration function (see below) */ 577 }; 578 579 enum fc_els_scr_func { 580 ELS_SCRF_FAB = 1, /* fabric-detected registration */ 581 ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */ 582 ELS_SCRF_FULL = 3, /* full registration */ 583 ELS_SCRF_CLEAR = 255, /* remove any current registrations */ 584 }; 585 586 /* 587 * ELS_RSCN - registered state change notification payload. 588 */ 589 struct fc_els_rscn { 590 __u8 rscn_cmd; /* RSCN opcode (0x61) */ 591 __u8 rscn_page_len; /* page length (4) */ 592 __be16 rscn_plen; /* payload length including this word */ 593 594 /* followed by 4-byte generic affected Port_ID pages */ 595 }; 596 597 struct fc_els_rscn_page { 598 __u8 rscn_page_flags; /* event and address format */ 599 __u8 rscn_fid[3]; /* fabric ID */ 600 }; 601 602 #define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */ 603 #define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */ 604 #define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */ 605 #define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */ 606 607 enum fc_els_rscn_ev_qual { 608 ELS_EV_QUAL_NONE = 0, /* unspecified */ 609 ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */ 610 ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */ 611 ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */ 612 ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */ 613 ELS_EV_QUAL_REM_OBJ = 5, /* removed object */ 614 }; 615 616 enum fc_els_rscn_addr_fmt { 617 ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */ 618 ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */ 619 ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */ 620 ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */ 621 }; 622 623 /* 624 * ELS_RNID - request Node ID. 625 */ 626 struct fc_els_rnid { 627 __u8 rnid_cmd; /* RNID opcode (0x78) */ 628 __u8 rnid_resv[3]; /* reserved */ 629 __u8 rnid_fmt; /* data format */ 630 __u8 rnid_resv2[3]; /* reserved */ 631 }; 632 633 /* 634 * Node Identification Data formats (rnid_fmt) 635 */ 636 enum fc_els_rnid_fmt { 637 ELS_RNIDF_NONE = 0, /* no specific identification data */ 638 ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */ 639 }; 640 641 /* 642 * ELS_RNID response. 643 */ 644 struct fc_els_rnid_resp { 645 __u8 rnid_cmd; /* response code (LS_ACC) */ 646 __u8 rnid_resv[3]; /* reserved */ 647 __u8 rnid_fmt; /* data format */ 648 __u8 rnid_cid_len; /* common ID data length */ 649 __u8 rnid_resv2; /* reserved */ 650 __u8 rnid_sid_len; /* specific ID data length */ 651 }; 652 653 struct fc_els_rnid_cid { 654 __be64 rnid_wwpn; /* N port name */ 655 __be64 rnid_wwnn; /* node name */ 656 }; 657 658 struct fc_els_rnid_gen { 659 __u8 rnid_vend_id[16]; /* vendor-unique ID */ 660 __be32 rnid_atype; /* associated type (see below) */ 661 __be32 rnid_phys_port; /* physical port number */ 662 __be32 rnid_att_nodes; /* number of attached nodes */ 663 __u8 rnid_node_mgmt; /* node management (see below) */ 664 __u8 rnid_ip_ver; /* IP version (see below) */ 665 __be16 rnid_prot_port; /* UDP / TCP port number */ 666 __be32 rnid_ip_addr[4]; /* IP address */ 667 __u8 rnid_resvd[2]; /* reserved */ 668 __be16 rnid_vend_spec; /* vendor-specific field */ 669 }; 670 671 enum fc_els_rnid_atype { 672 ELS_RNIDA_UNK = 0x01, /* unknown */ 673 ELS_RNIDA_OTHER = 0x02, /* none of the following */ 674 ELS_RNIDA_HUB = 0x03, 675 ELS_RNIDA_SWITCH = 0x04, 676 ELS_RNIDA_GATEWAY = 0x05, 677 ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */ 678 ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */ 679 ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */ 680 ELS_RNIDA_STORAGE = 0x09, 681 ELS_RNIDA_HOST = 0x0a, 682 ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */ 683 ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */ 684 ELS_RNIDA_NAS = 0x11, /* NAS server */ 685 ELS_RNIDA_BRIDGE = 0x12, /* bridge */ 686 ELS_RNIDA_VIRT = 0x13, /* virtualization device */ 687 ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */ 688 ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */ 689 ELS_RNIDA_MF_SW = 1UL << 30, /* switch */ 690 ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */ 691 ELS_RNIDA_MF_ST = 1UL << 28, /* storage */ 692 ELS_RNIDA_MF_HOST = 1UL << 27, /* host */ 693 ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */ 694 ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */ 695 ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */ 696 ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */ 697 ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */ 698 ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */ 699 }; 700 701 enum fc_els_rnid_mgmt { 702 ELS_RNIDM_SNMP = 0, 703 ELS_RNIDM_TELNET = 1, 704 ELS_RNIDM_HTTP = 2, 705 ELS_RNIDM_HTTPS = 3, 706 ELS_RNIDM_XML = 4, /* HTTP + XML */ 707 }; 708 709 enum fc_els_rnid_ipver { 710 ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */ 711 ELS_RNIDIP_V4 = 1, /* IPv4 */ 712 ELS_RNIDIP_V6 = 2, /* IPv6 */ 713 }; 714 715 /* 716 * ELS RPL - Read Port List. 717 */ 718 struct fc_els_rpl { 719 __u8 rpl_cmd; /* command */ 720 __u8 rpl_resv[5]; /* reserved - must be zero */ 721 __be16 rpl_max_size; /* maximum response size or zero */ 722 __u8 rpl_resv1; /* reserved - must be zero */ 723 __u8 rpl_index[3]; /* starting index */ 724 }; 725 726 /* 727 * Port number block in RPL response. 728 */ 729 struct fc_els_pnb { 730 __be32 pnb_phys_pn; /* physical port number */ 731 __u8 pnb_resv; /* reserved */ 732 __u8 pnb_port_id[3]; /* port ID */ 733 __be64 pnb_wwpn; /* port name */ 734 }; 735 736 /* 737 * RPL LS_ACC response. 738 */ 739 struct fc_els_rpl_resp { 740 __u8 rpl_cmd; /* ELS_LS_ACC */ 741 __u8 rpl_resv1; /* reserved - must be zero */ 742 __be16 rpl_plen; /* payload length */ 743 __u8 rpl_resv2; /* reserved - must be zero */ 744 __u8 rpl_llen[3]; /* list length */ 745 __u8 rpl_resv3; /* reserved - must be zero */ 746 __u8 rpl_index[3]; /* starting index */ 747 struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */ 748 }; 749 750 /* 751 * Link Error Status Block. 752 */ 753 struct fc_els_lesb { 754 __be32 lesb_link_fail; /* link failure count */ 755 __be32 lesb_sync_loss; /* loss of synchronization count */ 756 __be32 lesb_sig_loss; /* loss of signal count */ 757 __be32 lesb_prim_err; /* primitive sequence error count */ 758 __be32 lesb_inv_word; /* invalid transmission word count */ 759 __be32 lesb_inv_crc; /* invalid CRC count */ 760 }; 761 762 /* 763 * ELS RPS - Read Port Status Block request. 764 */ 765 struct fc_els_rps { 766 __u8 rps_cmd; /* command */ 767 __u8 rps_resv[2]; /* reserved - must be zero */ 768 __u8 rps_flag; /* flag - see below */ 769 __be64 rps_port_spec; /* port selection */ 770 }; 771 772 enum fc_els_rps_flag { 773 FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */ 774 FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */ 775 FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */ 776 }; 777 778 /* 779 * ELS RPS LS_ACC response. 780 */ 781 struct fc_els_rps_resp { 782 __u8 rps_cmd; /* command - LS_ACC */ 783 __u8 rps_resv[2]; /* reserved - must be zero */ 784 __u8 rps_flag; /* flag - see below */ 785 __u8 rps_resv2[2]; /* reserved */ 786 __be16 rps_status; /* port status - see below */ 787 struct fc_els_lesb rps_lesb; /* link error status block */ 788 }; 789 790 enum fc_els_rps_resp_flag { 791 FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */ 792 }; 793 794 enum fc_els_rps_resp_status { 795 FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */ 796 FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */ 797 FC_ELS_RPS_FAB = 1 << 3, /* fabric present */ 798 FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */ 799 FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */ 800 FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */ 801 }; 802 803 /* 804 * ELS LIRR - Link Incident Record Registration request. 805 */ 806 struct fc_els_lirr { 807 __u8 lirr_cmd; /* command */ 808 __u8 lirr_resv[3]; /* reserved - must be zero */ 809 __u8 lirr_func; /* registration function */ 810 __u8 lirr_fmt; /* FC-4 type of RLIR requested */ 811 __u8 lirr_resv2[2]; /* reserved - must be zero */ 812 }; 813 814 enum fc_els_lirr_func { 815 ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */ 816 ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */ 817 ELS_LIRR_CLEAR = 0xff /* clear registration */ 818 }; 819 820 /* 821 * ELS SRL - Scan Remote Loop request. 822 */ 823 struct fc_els_srl { 824 __u8 srl_cmd; /* command */ 825 __u8 srl_resv[3]; /* reserved - must be zero */ 826 __u8 srl_flag; /* flag - see below */ 827 __u8 srl_flag_param[3]; /* flag parameter */ 828 }; 829 830 enum fc_els_srl_flag { 831 FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */ 832 FC_ELS_SRL_ONE = 0x01, /* scan specified loop */ 833 FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */ 834 FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */ 835 }; 836 837 /* 838 * ELS RLS - Read Link Error Status Block request. 839 */ 840 struct fc_els_rls { 841 __u8 rls_cmd; /* command */ 842 __u8 rls_resv[4]; /* reserved - must be zero */ 843 __u8 rls_port_id[3]; /* port ID */ 844 }; 845 846 /* 847 * ELS RLS LS_ACC Response. 848 */ 849 struct fc_els_rls_resp { 850 __u8 rls_cmd; /* ELS_LS_ACC */ 851 __u8 rls_resv[3]; /* reserved - must be zero */ 852 struct fc_els_lesb rls_lesb; /* link error status block */ 853 }; 854 855 /* 856 * ELS RLIR - Registered Link Incident Report. 857 * This is followed by the CLIR and the CLID, described below. 858 */ 859 struct fc_els_rlir { 860 __u8 rlir_cmd; /* command */ 861 __u8 rlir_resv[3]; /* reserved - must be zero */ 862 __u8 rlir_fmt; /* format (FC4-type if type specific) */ 863 __u8 rlir_clr_len; /* common link incident record length */ 864 __u8 rlir_cld_len; /* common link incident desc. length */ 865 __u8 rlir_slr_len; /* spec. link incident record length */ 866 }; 867 868 /* 869 * CLIR - Common Link Incident Record Data. - Sent via RLIR. 870 */ 871 struct fc_els_clir { 872 __be64 clir_wwpn; /* incident port name */ 873 __be64 clir_wwnn; /* incident port node name */ 874 __u8 clir_port_type; /* incident port type */ 875 __u8 clir_port_id[3]; /* incident port ID */ 876 877 __be64 clir_conn_wwpn; /* connected port name */ 878 __be64 clir_conn_wwnn; /* connected node name */ 879 __be64 clir_fab_name; /* fabric name */ 880 __be32 clir_phys_port; /* physical port number */ 881 __be32 clir_trans_id; /* transaction ID */ 882 __u8 clir_resv[3]; /* reserved */ 883 __u8 clir_ts_fmt; /* time stamp format */ 884 __be64 clir_timestamp; /* time stamp */ 885 }; 886 887 /* 888 * CLIR clir_ts_fmt - time stamp format values. 889 */ 890 enum fc_els_clir_ts_fmt { 891 ELS_CLIR_TS_UNKNOWN = 0, /* time stamp field unknown */ 892 ELS_CLIR_TS_SEC_FRAC = 1, /* time in seconds and fractions */ 893 ELS_CLIR_TS_CSU = 2, /* time in clock synch update format */ 894 }; 895 896 /* 897 * Common Link Incident Descriptor - sent via RLIR. 898 */ 899 struct fc_els_clid { 900 __u8 clid_iq; /* incident qualifier flags */ 901 __u8 clid_ic; /* incident code */ 902 __be16 clid_epai; /* domain/area of ISL */ 903 }; 904 905 /* 906 * CLID incident qualifier flags. 907 */ 908 enum fc_els_clid_iq { 909 ELS_CLID_SWITCH = 0x20, /* incident port is a switch node */ 910 ELS_CLID_E_PORT = 0x10, /* incident is an ISL (E) port */ 911 ELS_CLID_SEV_MASK = 0x0c, /* severity 2-bit field mask */ 912 ELS_CLID_SEV_INFO = 0x00, /* report is informational */ 913 ELS_CLID_SEV_INOP = 0x08, /* link not operational */ 914 ELS_CLID_SEV_DEG = 0x04, /* link degraded but operational */ 915 ELS_CLID_LASER = 0x02, /* subassembly is a laser */ 916 ELS_CLID_FRU = 0x01, /* format can identify a FRU */ 917 }; 918 919 /* 920 * CLID incident code. 921 */ 922 enum fc_els_clid_ic { 923 ELS_CLID_IC_IMPL = 1, /* implicit incident */ 924 ELS_CLID_IC_BER = 2, /* bit-error-rate threshold exceeded */ 925 ELS_CLID_IC_LOS = 3, /* loss of synch or signal */ 926 ELS_CLID_IC_NOS = 4, /* non-operational primitive sequence */ 927 ELS_CLID_IC_PST = 5, /* primitive sequence timeout */ 928 ELS_CLID_IC_INVAL = 6, /* invalid primitive sequence */ 929 ELS_CLID_IC_LOOP_TO = 7, /* loop initialization time out */ 930 ELS_CLID_IC_LIP = 8, /* receiving LIP */ 931 }; 932 933 /* 934 * Link Integrity event types 935 */ 936 enum fc_fpin_li_event_types { 937 FPIN_LI_UNKNOWN = 0x0, 938 FPIN_LI_LINK_FAILURE = 0x1, 939 FPIN_LI_LOSS_OF_SYNC = 0x2, 940 FPIN_LI_LOSS_OF_SIG = 0x3, 941 FPIN_LI_PRIM_SEQ_ERR = 0x4, 942 FPIN_LI_INVALID_TX_WD = 0x5, 943 FPIN_LI_INVALID_CRC = 0x6, 944 FPIN_LI_DEVICE_SPEC = 0xF, 945 }; 946 947 /* 948 * Initializer useful for decoding table. 949 * Please keep this in sync with the above definitions. 950 */ 951 #define FC_FPIN_LI_EVT_TYPES_INIT { \ 952 { FPIN_LI_UNKNOWN, "Unknown" }, \ 953 { FPIN_LI_LINK_FAILURE, "Link Failure" }, \ 954 { FPIN_LI_LOSS_OF_SYNC, "Loss of Synchronization" }, \ 955 { FPIN_LI_LOSS_OF_SIG, "Loss of Signal" }, \ 956 { FPIN_LI_PRIM_SEQ_ERR, "Primitive Sequence Protocol Error" }, \ 957 { FPIN_LI_INVALID_TX_WD, "Invalid Transmission Word" }, \ 958 { FPIN_LI_INVALID_CRC, "Invalid CRC" }, \ 959 { FPIN_LI_DEVICE_SPEC, "Device Specific" }, \ 960 } 961 962 /* 963 * Delivery event types 964 */ 965 enum fc_fpin_deli_event_types { 966 FPIN_DELI_UNKNOWN = 0x0, 967 FPIN_DELI_TIMEOUT = 0x1, 968 FPIN_DELI_UNABLE_TO_ROUTE = 0x2, 969 FPIN_DELI_DEVICE_SPEC = 0xF, 970 }; 971 972 /* 973 * Initializer useful for decoding table. 974 * Please keep this in sync with the above definitions. 975 */ 976 #define FC_FPIN_DELI_EVT_TYPES_INIT { \ 977 { FPIN_DELI_UNKNOWN, "Unknown" }, \ 978 { FPIN_DELI_TIMEOUT, "Timeout" }, \ 979 { FPIN_DELI_UNABLE_TO_ROUTE, "Unable to Route" }, \ 980 { FPIN_DELI_DEVICE_SPEC, "Device Specific" }, \ 981 } 982 983 /* 984 * Congestion event types 985 */ 986 enum fc_fpin_congn_event_types { 987 FPIN_CONGN_CLEAR = 0x0, 988 FPIN_CONGN_LOST_CREDIT = 0x1, 989 FPIN_CONGN_CREDIT_STALL = 0x2, 990 FPIN_CONGN_OVERSUBSCRIPTION = 0x3, 991 FPIN_CONGN_DEVICE_SPEC = 0xF, 992 }; 993 994 /* 995 * Initializer useful for decoding table. 996 * Please keep this in sync with the above definitions. 997 */ 998 #define FC_FPIN_CONGN_EVT_TYPES_INIT { \ 999 { FPIN_CONGN_CLEAR, "Clear" }, \ 1000 { FPIN_CONGN_LOST_CREDIT, "Lost Credit" }, \ 1001 { FPIN_CONGN_CREDIT_STALL, "Credit Stall" }, \ 1002 { FPIN_CONGN_OVERSUBSCRIPTION, "Oversubscription" }, \ 1003 { FPIN_CONGN_DEVICE_SPEC, "Device Specific" }, \ 1004 } 1005 1006 enum fc_fpin_congn_severity_types { 1007 FPIN_CONGN_SEVERITY_WARNING = 0xF1, 1008 FPIN_CONGN_SEVERITY_ERROR = 0xF7, 1009 }; 1010 1011 /* 1012 * Link Integrity Notification Descriptor 1013 */ 1014 struct fc_fn_li_desc { 1015 __be32 desc_tag; /* Descriptor Tag (0x00020001) */ 1016 __be32 desc_len; /* Length of Descriptor (in bytes). 1017 * Size of descriptor excluding 1018 * desc_tag and desc_len fields. 1019 */ 1020 __be64 detecting_wwpn; /* Port Name that detected event */ 1021 __be64 attached_wwpn; /* Port Name of device attached to 1022 * detecting Port Name 1023 */ 1024 __be16 event_type; /* see enum fc_fpin_li_event_types */ 1025 __be16 event_modifier; /* Implementation specific value 1026 * describing the event type 1027 */ 1028 __be32 event_threshold;/* duration in ms of the link 1029 * integrity detection cycle 1030 */ 1031 __be32 event_count; /* minimum number of event 1032 * occurrences during the event 1033 * threshold to caause the LI event 1034 */ 1035 __be32 pname_count; /* number of portname_list elements */ 1036 __be64 pname_list[]; /* list of N_Port_Names accessible 1037 * through the attached port 1038 */ 1039 }; 1040 1041 /* 1042 * Delivery Notification Descriptor 1043 */ 1044 struct fc_fn_deli_desc { 1045 __be32 desc_tag; /* Descriptor Tag (0x00020002) */ 1046 __be32 desc_len; /* Length of Descriptor (in bytes). 1047 * Size of descriptor excluding 1048 * desc_tag and desc_len fields. 1049 */ 1050 __be64 detecting_wwpn; /* Port Name that detected event */ 1051 __be64 attached_wwpn; /* Port Name of device attached to 1052 * detecting Port Name 1053 */ 1054 __be32 deli_reason_code;/* see enum fc_fpin_deli_event_types */ 1055 }; 1056 1057 /* 1058 * Peer Congestion Notification Descriptor 1059 */ 1060 struct fc_fn_peer_congn_desc { 1061 __be32 desc_tag; /* Descriptor Tag (0x00020003) */ 1062 __be32 desc_len; /* Length of Descriptor (in bytes). 1063 * Size of descriptor excluding 1064 * desc_tag and desc_len fields. 1065 */ 1066 __be64 detecting_wwpn; /* Port Name that detected event */ 1067 __be64 attached_wwpn; /* Port Name of device attached to 1068 * detecting Port Name 1069 */ 1070 __be16 event_type; /* see enum fc_fpin_congn_event_types */ 1071 __be16 event_modifier; /* Implementation specific value 1072 * describing the event type 1073 */ 1074 __be32 event_period; /* duration (ms) of the detected 1075 * congestion event 1076 */ 1077 __be32 pname_count; /* number of portname_list elements */ 1078 __be64 pname_list[]; /* list of N_Port_Names accessible 1079 * through the attached port 1080 */ 1081 }; 1082 1083 /* 1084 * Congestion Notification Descriptor 1085 */ 1086 struct fc_fn_congn_desc { 1087 __be32 desc_tag; /* Descriptor Tag (0x00020004) */ 1088 __be32 desc_len; /* Length of Descriptor (in bytes). 1089 * Size of descriptor excluding 1090 * desc_tag and desc_len fields. 1091 */ 1092 __be16 event_type; /* see enum fc_fpin_congn_event_types */ 1093 __be16 event_modifier; /* Implementation specific value 1094 * describing the event type 1095 */ 1096 __be32 event_period; /* duration (ms) of the detected 1097 * congestion event 1098 */ 1099 __u8 severity; /* command */ 1100 __u8 resv[3]; /* reserved - must be zero */ 1101 }; 1102 1103 /* 1104 * ELS_FPIN - Fabric Performance Impact Notification 1105 */ 1106 struct fc_els_fpin { 1107 __u8 fpin_cmd; /* command (0x16) */ 1108 __u8 fpin_zero[3]; /* specified as zero - part of cmd */ 1109 __be32 desc_len; /* Length of Descriptor List (in bytes). 1110 * Size of ELS excluding fpin_cmd, 1111 * fpin_zero and desc_len fields. 1112 */ 1113 struct fc_tlv_desc fpin_desc[]; /* Descriptor list */ 1114 }; 1115 1116 /* Diagnostic Function Descriptor - FPIN Registration */ 1117 struct fc_df_desc_fpin_reg { 1118 /* New members MUST be added within the __struct_group() macro below. */ 1119 __struct_group(fc_df_desc_fpin_reg_hdr, __hdr, /* no attrs */, 1120 __be32 desc_tag; /* FPIN Registration (0x00030001) */ 1121 __be32 desc_len; /* Length of Descriptor (in bytes). 1122 * Size of descriptor excluding 1123 * desc_tag and desc_len fields. 1124 */ 1125 __be32 count; /* Number of desc_tags elements */ 1126 ); 1127 __be32 desc_tags[]; /* Array of Descriptor Tags. 1128 * Each tag indicates a function 1129 * supported by the N_Port (request) 1130 * or by the N_Port and Fabric 1131 * Controller (reply; may be a subset 1132 * of the request). 1133 * See ELS_FN_DTAG_xxx for tag values. 1134 */ 1135 }; 1136 _Static_assert(offsetof(struct fc_df_desc_fpin_reg, desc_tags) == sizeof(struct fc_df_desc_fpin_reg_hdr), 1137 "struct member likely outside of __struct_group()"); 1138 1139 /* 1140 * ELS_RDF - Register Diagnostic Functions 1141 */ 1142 struct fc_els_rdf { 1143 /* New members MUST be added within the __struct_group() macro below. */ 1144 __struct_group(fc_els_rdf_hdr, __hdr, /* no attrs */, 1145 __u8 fpin_cmd; /* command (0x19) */ 1146 __u8 fpin_zero[3]; /* specified as zero - part of cmd */ 1147 __be32 desc_len; /* Length of Descriptor List (in bytes). 1148 * Size of ELS excluding fpin_cmd, 1149 * fpin_zero and desc_len fields. 1150 */ 1151 ); 1152 struct fc_tlv_desc desc[]; /* Descriptor list */ 1153 }; 1154 _Static_assert(offsetof(struct fc_els_rdf, desc) == sizeof(struct fc_els_rdf_hdr), 1155 "struct member likely outside of __struct_group()"); 1156 1157 /* 1158 * ELS RDF LS_ACC Response. 1159 */ 1160 struct fc_els_rdf_resp { 1161 /* New members MUST be added within the __struct_group() macro below. */ 1162 __struct_group(fc_els_rdf_resp_hdr, __hdr, /* no attrs */, 1163 struct fc_els_ls_acc acc_hdr; 1164 __be32 desc_list_len; /* Length of response (in 1165 * bytes). Excludes acc_hdr 1166 * and desc_list_len fields. 1167 */ 1168 struct fc_els_lsri_desc lsri; 1169 ); 1170 struct fc_tlv_desc desc[]; /* Supported Descriptor list */ 1171 }; 1172 _Static_assert(offsetof(struct fc_els_rdf_resp, desc) == sizeof(struct fc_els_rdf_resp_hdr), 1173 "struct member likely outside of __struct_group()"); 1174 1175 /* 1176 * Diagnostic Capability Descriptors for EDC ELS 1177 */ 1178 1179 /* 1180 * Diagnostic: Link Fault Capability Descriptor 1181 */ 1182 struct fc_diag_lnkflt_desc { 1183 __be32 desc_tag; /* Descriptor Tag (0x0001000D) */ 1184 __be32 desc_len; /* Length of Descriptor (in bytes). 1185 * Size of descriptor excluding 1186 * desc_tag and desc_len fields. 1187 * 12 bytes 1188 */ 1189 __be32 degrade_activate_threshold; 1190 __be32 degrade_deactivate_threshold; 1191 __be32 fec_degrade_interval; 1192 }; 1193 1194 enum fc_edc_cg_signal_cap_types { 1195 /* Note: Capability: bits 31:4 Rsvd; bits 3:0 are capabilities */ 1196 EDC_CG_SIG_NOTSUPPORTED = 0x00, /* neither supported */ 1197 EDC_CG_SIG_WARN_ONLY = 0x01, 1198 EDC_CG_SIG_WARN_ALARM = 0x02, /* both supported */ 1199 }; 1200 1201 /* 1202 * Initializer useful for decoding table. 1203 * Please keep this in sync with the above definitions. 1204 */ 1205 #define FC_EDC_CG_SIGNAL_CAP_TYPES_INIT { \ 1206 { EDC_CG_SIG_NOTSUPPORTED, "Signaling Not Supported" }, \ 1207 { EDC_CG_SIG_WARN_ONLY, "Warning Signal" }, \ 1208 { EDC_CG_SIG_WARN_ALARM, "Warning and Alarm Signals" }, \ 1209 } 1210 1211 enum fc_diag_cg_sig_freq_types { 1212 EDC_CG_SIGFREQ_CNT_MIN = 1, /* Min Frequency Count */ 1213 EDC_CG_SIGFREQ_CNT_MAX = 999, /* Max Frequency Count */ 1214 1215 EDC_CG_SIGFREQ_SEC = 0x1, /* Units: seconds */ 1216 EDC_CG_SIGFREQ_MSEC = 0x2, /* Units: milliseconds */ 1217 }; 1218 1219 struct fc_diag_cg_sig_freq { 1220 __be16 count; /* Time between signals 1221 * note: upper 6 bits rsvd 1222 */ 1223 __be16 units; /* Time unit for count 1224 * note: upper 12 bits rsvd 1225 */ 1226 }; 1227 1228 /* 1229 * Diagnostic: Congestion Signaling Capability Descriptor 1230 */ 1231 struct fc_diag_cg_sig_desc { 1232 __be32 desc_tag; /* Descriptor Tag (0x0001000F) */ 1233 __be32 desc_len; /* Length of Descriptor (in bytes). 1234 * Size of descriptor excluding 1235 * desc_tag and desc_len fields. 1236 * 16 bytes 1237 */ 1238 __be32 xmt_signal_capability; 1239 struct fc_diag_cg_sig_freq xmt_signal_frequency; 1240 __be32 rcv_signal_capability; 1241 struct fc_diag_cg_sig_freq rcv_signal_frequency; 1242 }; 1243 1244 /* 1245 * ELS_EDC - Exchange Diagnostic Capabilities 1246 */ 1247 struct fc_els_edc { 1248 __u8 edc_cmd; /* command (0x17) */ 1249 __u8 edc_zero[3]; /* specified as zero - part of cmd */ 1250 __be32 desc_len; /* Length of Descriptor List (in bytes). 1251 * Size of ELS excluding edc_cmd, 1252 * edc_zero and desc_len fields. 1253 */ 1254 struct fc_tlv_desc desc[]; 1255 /* Diagnostic Descriptor list */ 1256 }; 1257 1258 /* 1259 * ELS EDC LS_ACC Response. 1260 */ 1261 struct fc_els_edc_resp { 1262 struct fc_els_ls_acc acc_hdr; 1263 __be32 desc_list_len; /* Length of response (in 1264 * bytes). Excludes acc_hdr 1265 * and desc_list_len fields. 1266 */ 1267 struct fc_els_lsri_desc lsri; 1268 struct fc_tlv_desc desc[]; 1269 /* Supported Diagnostic Descriptor list */ 1270 }; 1271 1272 1273 #endif /* _FC_ELS_H_ */ 1274