1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at 9 * http://www.opensource.org/licenses/cddl1.txt. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright (c) 2004-2012 Emulex. All rights reserved. 24 * Use is subject to license terms. 25 * Copyright 2018 OmniOS Community Edition (OmniOSce) Association. 26 */ 27 28 #ifndef _EMLXS_FCF_H 29 #define _EMLXS_FCF_H 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 #define FCFTAB_MAX_FCFI_COUNT 1 36 #define FCFI_MAX_VFI_COUNT 1 37 38 /* Internal generic events */ 39 #define FCF_EVENT_STATE_ENTER 0 40 41 /* External async fabric events */ 42 #define FCF_EVENT_SHUTDOWN 1 43 #define FCF_EVENT_LINKUP 2 44 #define FCF_EVENT_LINKDOWN 3 45 #define FCF_EVENT_CVL 4 46 #define FCF_EVENT_FCFTAB_FULL 5 47 #define FCF_EVENT_FCF_FOUND 6 48 #define FCF_EVENT_FCF_LOST 7 49 #define FCF_EVENT_FCF_CHANGED 8 50 51 /* Internal async events */ 52 #define FCF_EVENT_FCFTAB_ONLINE 9 53 #define FCF_EVENT_FCFTAB_OFFLINE 10 54 55 #define FCF_EVENT_FCFI_ONLINE 11 56 #define FCF_EVENT_FCFI_OFFLINE 12 57 #define FCF_EVENT_FCFI_PAUSE 13 58 59 #define FCF_EVENT_VFI_ONLINE 14 60 #define FCF_EVENT_VFI_OFFLINE 15 61 #define FCF_EVENT_VFI_PAUSE 16 62 63 #define FCF_EVENT_VPI_ONLINE 17 64 #define FCF_EVENT_VPI_OFFLINE 18 65 #define FCF_EVENT_VPI_PAUSE 19 66 67 #define FCF_EVENT_RPI_ONLINE 20 68 #define FCF_EVENT_RPI_OFFLINE 21 69 #define FCF_EVENT_RPI_PAUSE 22 70 #define FCF_EVENT_RPI_RESUME 23 71 72 /* State change reason codes */ /* explan */ 73 #define FCF_REASON_NONE 0 74 #define FCF_REASON_REENTER 1 75 #define FCF_REASON_EVENT 2 /* evt */ 76 #define FCF_REASON_REQUESTED 3 77 #define FCF_REASON_NO_MBOX 4 78 #define FCF_REASON_NO_BUFFER 5 79 #define FCF_REASON_SEND_FAILED 6 /* status */ 80 #define FCF_REASON_MBOX_FAILED 7 /* status */ 81 #define FCF_REASON_MBOX_BUSY 8 /* status */ 82 #define FCF_REASON_NO_FCFI 9 83 #define FCF_REASON_NO_VFI 10 84 #define FCF_REASON_ONLINE_FAILED 11 85 #define FCF_REASON_OFFLINE_FAILED 12 86 #define FCF_REASON_OP_FAILED 13 /* attempts */ 87 #define FCF_REASON_NO_PKT 14 88 #define FCF_REASON_NO_NODE 15 89 #define FCF_REASON_NOT_ALLOWED 16 90 #define FCF_REASON_UNUSED 17 91 #define FCF_REASON_INVALID 18 92 93 typedef struct XRIobj 94 { 95 struct XRIobj *_f; 96 struct XRIobj *_b; 97 uint16_t XRI; 98 uint16_t state; 99 #define XRI_STATE_FREE 0 100 #define XRI_STATE_ALLOCATED 1 101 102 uint16_t sge_count; 103 uint16_t iotag; 104 MATCHMAP *SGList; 105 uint32_t SGSeg; 106 struct RPIobj *rpip; 107 struct RPIobj *reserved_rpip; 108 emlxs_buf_t *sbp; 109 uint32_t rx_id; /* Used for unsol exchanges */ 110 uint32_t flag; 111 #define EMLXS_XRI_RESERVED 0x00000001 112 #define EMLXS_XRI_PENDING_IO 0x00000002 113 #define EMLXS_XRI_BUSY 0x00000004 114 115 uint32_t type; 116 #define EMLXS_XRI_SOL_FCP_TYPE 1 117 #define EMLXS_XRI_UNSOL_FCP_TYPE 2 118 #define EMLXS_XRI_SOL_CT_TYPE 3 119 #define EMLXS_XRI_UNSOL_CT_TYPE 4 120 #define EMLXS_XRI_SOL_ELS_TYPE 5 121 #define EMLXS_XRI_UNSOL_ELS_TYPE 6 122 #define EMLXS_XRI_SOL_BLS_TYPE 7 123 124 } XRIobj_t; 125 126 127 typedef struct emlxs_deferred_cmpl 128 { 129 struct emlxs_port *port; 130 struct emlxs_node *node; 131 132 void *arg1; 133 void *arg2; 134 void *arg3; 135 136 } emlxs_deferred_cmpl_t; 137 138 139 #define FABRIC_RPI 0xffff 140 141 typedef struct RPIobj 142 { 143 uint16_t index; 144 uint16_t RPI; 145 146 uint16_t prev_reason; 147 uint16_t prev_state; 148 149 uint16_t reason; 150 uint16_t state; 151 #define RPI_STATE_FREE 0 152 153 #define RPI_STATE_RESERVED 1 154 #define RPI_STATE_OFFLINE 2 155 156 #define RPI_STATE_UNREG_CMPL 3 157 #define RPI_STATE_UNREG_FAILED 4 158 #define RPI_STATE_UNREG 5 159 160 #define RPI_STATE_REG 6 161 #define RPI_STATE_REG_FAILED 7 162 #define RPI_STATE_REG_CMPL 8 163 164 #define RPI_STATE_PAUSED 9 165 166 #define RPI_STATE_RESUME 10 167 #define RPI_STATE_RESUME_FAILED 11 168 #define RPI_STATE_RESUME_CMPL 12 169 170 #define RPI_STATE_ONLINE 13 171 172 173 uint32_t flag; 174 #define EMLXS_RPI_VPI 0x00000010 /* rpi_online set */ 175 #define EMLXS_RPI_PAUSED 0x00000020 /* rpi_paused set */ 176 #define EMLXS_RPI_REG 0x00000040 177 178 #define EMLXS_RPI_FIRST 0x80000000 179 180 uint32_t attempts; 181 uint32_t xri_count; /* Managed by XRIobj_t */ 182 183 uint32_t idle_timer; 184 185 struct VPIobj *vpip; 186 187 /* Node info */ 188 struct emlxs_node *node; 189 uint32_t did; 190 SERV_PARM sparam; 191 192 emlxs_deferred_cmpl_t *cmpl; 193 194 } RPIobj_t; 195 196 197 typedef struct VPIobj 198 { 199 uint16_t index; 200 uint16_t VPI; 201 202 uint16_t prev_reason; 203 uint16_t prev_state; 204 205 uint16_t reason; 206 uint16_t state; 207 #define VPI_STATE_OFFLINE 0 208 209 #define VPI_STATE_INIT 1 210 #define VPI_STATE_INIT_FAILED 2 211 #define VPI_STATE_INIT_CMPL 3 212 213 #define VPI_STATE_UNREG_CMPL 4 214 #define VPI_STATE_UNREG_FAILED 5 215 #define VPI_STATE_UNREG 6 216 217 #define VPI_STATE_LOGO_CMPL 7 218 #define VPI_STATE_LOGO_FAILED 8 219 #define VPI_STATE_LOGO 9 220 221 #define VPI_STATE_PORT_OFFLINE 10 222 #define VPI_STATE_PORT_ONLINE 11 223 224 #define VPI_STATE_LOGI 12 225 #define VPI_STATE_LOGI_FAILED 13 226 #define VPI_STATE_LOGI_CMPL 14 227 228 #define VPI_STATE_REG 15 229 #define VPI_STATE_REG_FAILED 16 230 #define VPI_STATE_REG_CMPL 17 231 232 #define VPI_STATE_PAUSED 18 233 #define VPI_STATE_ONLINE 19 234 235 236 uint32_t flag; 237 #define EMLXS_VPI_ONLINE_REQ 0x00000001 238 #define EMLXS_VPI_OFFLINE_REQ 0x00000002 239 #define EMLXS_VPI_PAUSE_REQ 0x00000004 240 #define EMLXS_VPI_REQ_MASK 0x0000000F 241 242 #define EMLXS_VPI_VFI 0x00000010 /* vpi_online set */ 243 #define EMLXS_VPI_VFI_LOGI 0x00000020 /* logi_count set */ 244 #define EMLXS_VPI_INIT 0x00000040 245 #define EMLXS_VPI_REG 0x00000080 246 #define EMLXS_VPI_PORT_ONLINE 0x00000100 247 #define EMLXS_VPI_LOGI 0x00000200 248 #define EMLXS_VPI_PORT_UNBIND 0x40000000 249 #define EMLXS_VPI_PORT_ENABLED 0x80000000 250 251 uint32_t attempts; 252 253 RPIobj_t fabric_rpi; /* Reserved Fabric RPI object */ 254 RPIobj_t *fabric_rpip; /* Fabric RPI pointer (&fabric_rpi) */ 255 RPIobj_t *p2p_rpip; 256 257 struct emlxs_port *port; 258 259 struct VFIobj *vfip; /* Managed by VFIobj_t */ 260 uint32_t rpi_online; /* Managed by RPIobj_t */ 261 uint32_t rpi_paused; /* Managed by RPIobj_t */ 262 263 } VPIobj_t; 264 265 266 typedef struct VFIobj 267 { 268 uint16_t index; 269 uint16_t VFI; 270 271 uint16_t prev_reason; 272 uint16_t prev_state; 273 274 uint16_t reason; 275 uint16_t state; 276 #define VFI_STATE_OFFLINE 0 277 278 #define VFI_STATE_INIT 1 279 #define VFI_STATE_INIT_FAILED 2 280 #define VFI_STATE_INIT_CMPL 3 281 282 #define VFI_STATE_VPI_OFFLINE_CMPL 4 283 #define VFI_STATE_VPI_OFFLINE 5 284 285 #define VFI_STATE_VPI_ONLINE 6 286 #define VFI_STATE_VPI_ONLINE_CMPL 7 287 288 #define VFI_STATE_UNREG_CMPL 8 289 #define VFI_STATE_UNREG_FAILED 9 290 #define VFI_STATE_UNREG 10 291 292 #define VFI_STATE_REG 11 293 #define VFI_STATE_REG_FAILED 12 294 #define VFI_STATE_REG_CMPL 13 295 296 #define VFI_STATE_PAUSED 14 297 #define VFI_STATE_ONLINE 15 298 299 uint32_t flag; 300 #define EMLXS_VFI_ONLINE_REQ 0x00000001 301 #define EMLXS_VFI_OFFLINE_REQ 0x00000002 302 #define EMLXS_VFI_PAUSE_REQ 0x00000004 303 #define EMLXS_VFI_REQ_MASK 0x0000000F 304 305 #define EMLXS_VFI_FCFI 0x00000010 /* vfi_online set */ 306 #define EMLXS_VFI_INIT 0x00000020 307 #define EMLXS_VFI_REG 0x00000040 308 309 SERV_PARM sparam; /* Last registered sparams */ 310 311 uint32_t attempts; 312 313 struct FCFIobj *fcfp; /* Managed by FCFIobj_t */ 314 315 uint32_t vpi_online; /* Managed by VPIobj_t */ 316 uint32_t logi_count; /* Managed by VPIobj_t */ 317 struct VPIobj *flogi_vpip; /* Managed by VPIobj_t */ 318 319 } VFIobj_t; 320 321 322 typedef struct FCFIobj 323 { 324 uint16_t index; 325 uint16_t FCFI; 326 327 uint16_t fcf_index; 328 uint16_t vlan_id; 329 330 uint16_t prev_reason; 331 uint16_t prev_state; 332 333 uint16_t reason; 334 uint16_t state; 335 #define FCFI_STATE_FREE 0 336 337 #define FCFI_STATE_OFFLINE 1 338 339 #define FCFI_STATE_UNREG_CMPL 2 340 #define FCFI_STATE_UNREG_FAILED 3 341 #define FCFI_STATE_UNREG 4 342 343 #define FCFI_STATE_REG 5 344 #define FCFI_STATE_REG_FAILED 6 345 #define FCFI_STATE_REG_CMPL 7 346 347 #define FCFI_STATE_VFI_OFFLINE_CMPL 8 348 #define FCFI_STATE_VFI_OFFLINE 9 349 350 #define FCFI_STATE_VFI_ONLINE 10 351 #define FCFI_STATE_VFI_ONLINE_CMPL 11 352 353 #define FCFI_STATE_PAUSED 12 354 #define FCFI_STATE_ONLINE 13 355 356 357 uint16_t pad; 358 uint16_t generation; 359 360 uint32_t offline_timer; 361 uint32_t attempts; 362 363 uint32_t event_tag; 364 uint32_t flag; 365 #define EMLXS_FCFI_ONLINE_REQ 0x00000001 366 #define EMLXS_FCFI_OFFLINE_REQ 0x00000002 367 #define EMLXS_FCFI_PAUSE_REQ 0x00000004 368 #define EMLXS_FCFI_REQ_MASK 0x0000000F 369 370 #define EMLXS_FCFI_FCFTAB 0x00000010 /* fcfi_online set */ 371 #define EMLXS_FCFI_REG 0x00000020 372 373 #define EMLXS_FCFI_VALID 0x00000100 374 #define EMLXS_FCFI_AVAILABLE 0x00000200 375 #define EMLXS_FCFI_CONFIGURED 0x00000400 376 #define EMLXS_FCFI_FRESH 0x00000800 377 #define EMLXS_FCFI_FAILED 0x00001000 378 #define EMLXS_FCFI_SELECTED 0x00002000 /* in use */ 379 380 #define EMLXS_FCFI_VLAN_ID 0x00010000 381 #define EMLXS_FCFI_BOOT 0x00020000 382 #define EMLXS_FCFI_PRIMARY 0x00040000 383 384 #define EMLXS_FCFI_TAGGED 0x80000000 385 386 /* struct VFTable vftab */ 387 388 FCF_RECORD_t fcf_rec; 389 uint32_t priority; 390 391 uint32_t vfi_online; /* Managed by VFIobj_t */ 392 393 } FCFIobj_t; 394 395 396 typedef struct VFTable 397 { 398 uint16_t prev_reason; 399 uint16_t prev_state; 400 401 uint16_t reason; 402 uint16_t state; 403 #define VFTAB_STATE_DISABLED 0 404 405 uint32_t vfi_active; 406 uint32_t vfi_count; 407 VFIobj_t *table; 408 409 } VFTable_t; 410 411 typedef struct FCFTable 412 { 413 414 uint16_t prev_reason; 415 uint16_t prev_state; 416 417 uint16_t reason; 418 uint16_t state; 419 /* Common states */ 420 #define FCFTAB_STATE_SHUTDOWN 0 421 #define FCFTAB_STATE_OFFLINE 1 422 423 /* FCOE states */ 424 #define FCOE_FCFTAB_STATE_SHUTDOWN FCFTAB_STATE_SHUTDOWN 425 #define FCOE_FCFTAB_STATE_OFFLINE FCFTAB_STATE_OFFLINE 426 427 #define FCOE_FCFTAB_STATE_SOLICIT 2 428 #define FCOE_FCFTAB_STATE_SOLICIT_FAILED 3 429 #define FCOE_FCFTAB_STATE_SOLICIT_CMPL 4 430 431 #define FCOE_FCFTAB_STATE_READ 5 432 #define FCOE_FCFTAB_STATE_READ_FAILED 6 433 #define FCOE_FCFTAB_STATE_READ_CMPL 7 434 435 #define FCOE_FCFTAB_STATE_FCFI_OFFLINE_CMPL 8 436 #define FCOE_FCFTAB_STATE_FCFI_OFFLINE 9 437 438 #define FCOE_FCFTAB_STATE_FCFI_ONLINE 10 439 #define FCOE_FCFTAB_STATE_FCFI_ONLINE_CMPL 11 440 441 #define FCOE_FCFTAB_STATE_ONLINE 12 442 443 444 /* FC states */ 445 #define FC_FCFTAB_STATE_SHUTDOWN FCFTAB_STATE_SHUTDOWN 446 #define FC_FCFTAB_STATE_OFFLINE FCFTAB_STATE_OFFLINE 447 448 #define FC_FCFTAB_STATE_TOPO 2 449 #define FC_FCFTAB_STATE_TOPO_FAILED 3 450 #define FC_FCFTAB_STATE_TOPO_CMPL 4 451 452 #define FC_FCFTAB_STATE_CFGLINK 5 453 #define FC_FCFTAB_STATE_CFGLINK_FAILED 6 454 #define FC_FCFTAB_STATE_CFGLINK_CMPL 7 455 456 #define FC_FCFTAB_STATE_SPARM 8 457 #define FC_FCFTAB_STATE_SPARM_FAILED 9 458 #define FC_FCFTAB_STATE_SPARM_CMPL 10 459 460 #define FC_FCFTAB_STATE_FCFI_OFFLINE_CMPL 11 461 #define FC_FCFTAB_STATE_FCFI_OFFLINE 12 462 463 #define FC_FCFTAB_STATE_FCFI_ONLINE 13 464 #define FC_FCFTAB_STATE_FCFI_ONLINE_CMPL 14 465 466 #define FC_FCFTAB_STATE_ONLINE 15 467 468 469 uint16_t TID; 470 uint16_t generation; 471 472 uint32_t flag; 473 /* Common flags */ 474 #define EMLXS_FCFTAB_REQ_MASK 0x0000000F 475 #define EMLXS_FCFTAB_SHUTDOWN 0x80000000 476 477 /* FCOE flags */ 478 #define EMLXS_FCOE_FCFTAB_SOL_REQ 0x00000001 479 #define EMLXS_FCOE_FCFTAB_READ_REQ 0x00000002 480 #define EMLXS_FCOE_FCFTAB_OFFLINE_REQ 0x00000004 481 482 /* FC flags */ 483 #define EMLXS_FC_FCFTAB_TOPO_REQ 0x00000001 484 #define EMLXS_FC_FCFTAB_CFGLINK_REQ 0x00000002 485 #define EMLXS_FC_FCFTAB_SPARM_REQ 0x00000004 486 #define EMLXS_FC_FCFTAB_OFFLINE_REQ 0x00000008 487 488 uint32_t attempts; 489 490 uint32_t fcfi_online; /* Managed by FCFIobj_t */ 491 492 FCFIobj_t *fcfi[FCFTAB_MAX_FCFI_COUNT]; 493 uint32_t fcfi_count; 494 495 FCFIobj_t *table; 496 uint16_t table_count; 497 498 uint32_t online_timer; /* FC */ 499 500 uint32_t sol_timer; /* FCOE */ 501 uint32_t read_timer; /* FCOE */ 502 503 } FCFTable_t; 504 #define FCFTAB_READ_ALL (void*)0xffff 505 506 #ifdef __cplusplus 507 } 508 #endif 509 510 #endif /* _EMLXS_FCF_H */ 511