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 usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 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 2010 Emulex. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _EMLXS_FCF_H 28 #define _EMLXS_FCF_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #define FCFTAB_MAX_FCFI_COUNT 1 35 #define FCFI_MAX_VFI_COUNT 1 36 37 /* Internal generic events */ 38 #define FCF_EVENT_STATE_ENTER 0 39 40 /* External async fabric events */ 41 #define FCF_EVENT_SHUTDOWN 1 42 #define FCF_EVENT_LINKUP 2 43 #define FCF_EVENT_LINKDOWN 3 44 #define FCF_EVENT_CVL 4 45 #define FCF_EVENT_FCFTAB_FULL 5 46 #define FCF_EVENT_FCF_FOUND 6 47 #define FCF_EVENT_FCF_LOST 7 48 #define FCF_EVENT_FCF_CHANGED 8 49 50 /* Internal async events */ 51 #define FCF_EVENT_FCFI_ONLINE 9 52 #define FCF_EVENT_FCFI_OFFLINE 10 53 #define FCF_EVENT_FCFI_PAUSE 11 54 55 #define FCF_EVENT_VFI_ONLINE 12 56 #define FCF_EVENT_VFI_OFFLINE 13 57 #define FCF_EVENT_VFI_PAUSE 14 58 59 #define FCF_EVENT_VPI_ONLINE 15 60 #define FCF_EVENT_VPI_OFFLINE 16 61 #define FCF_EVENT_VPI_PAUSE 17 62 63 #define FCF_EVENT_RPI_ONLINE 18 64 #define FCF_EVENT_RPI_OFFLINE 19 65 #define FCF_EVENT_RPI_PAUSE 20 66 #define FCF_EVENT_RPI_RESUME 21 67 68 /* State change reason codes */ /* explan */ 69 #define FCF_REASON_NONE 0 70 #define FCF_REASON_REENTER 1 71 #define FCF_REASON_EVENT 2 /* evt */ 72 #define FCF_REASON_REQUESTED 3 73 #define FCF_REASON_NO_MBOX 4 74 #define FCF_REASON_NO_BUFFER 5 75 #define FCF_REASON_SEND_FAILED 6 /* status */ 76 #define FCF_REASON_MBOX_FAILED 7 /* status */ 77 #define FCF_REASON_NO_FCFI 8 78 #define FCF_REASON_NO_VFI 9 79 #define FCF_REASON_ONLINE_FAILED 10 80 #define FCF_REASON_OFFLINE_FAILED 11 81 #define FCF_REASON_OP_FAILED 12 /* attempts */ 82 #define FCF_REASON_NO_PKT 13 83 #define FCF_REASON_NO_NODE 14 84 #define FCF_REASON_NOT_ALLOWED 15 85 86 typedef struct XRIobj 87 { 88 struct XRIobj *_f; 89 struct XRIobj *_b; 90 uint16_t XRI; 91 uint16_t state; 92 #define XRI_STATE_FREE 0 93 #define XRI_STATE_ALLOCATED 1 94 95 uint16_t sge_count; 96 uint16_t iotag; 97 MBUF_INFO SGList; 98 struct RPIobj *rpip; 99 emlxs_buf_t *sbp; 100 uint32_t rx_id; /* Used for unsol exchanges */ 101 uint32_t flag; 102 #define EMLXS_XRI_RESERVED 0x00000001 103 #define EMLXS_XRI_PENDING_IO 0x00000002 104 #define EMLXS_XRI_ABORT_INP 0x00000004 105 106 } XRIobj_t; 107 108 109 typedef struct emlxs_deferred_cmpl 110 { 111 struct emlxs_port *port; 112 struct emlxs_node *node; 113 114 void *arg1; 115 void *arg2; 116 void *arg3; 117 118 } emlxs_deferred_cmpl_t; 119 120 121 typedef struct RPIobj 122 { 123 uint16_t index; 124 uint16_t RPI; 125 126 uint16_t prev_reason; 127 uint16_t prev_state; 128 129 uint16_t reason; 130 uint16_t state; 131 #define RPI_STATE_FREE 0 132 #define RPI_STATE_OFFLINE 1 133 134 #define RPI_STATE_UNREG_CMPL 2 135 #define RPI_STATE_UNREG_FAILED 3 136 #define RPI_STATE_UNREG 4 137 138 #define RPI_STATE_REG 5 139 #define RPI_STATE_REG_FAILED 6 140 #define RPI_STATE_REG_CMPL 7 141 142 #define RPI_STATE_PAUSED 8 143 144 #define RPI_STATE_RESUME 9 145 #define RPI_STATE_RESUME_FAILED 10 146 #define RPI_STATE_RESUME_CMPL 11 147 148 #define RPI_STATE_ONLINE 12 149 150 151 uint32_t flag; 152 #define EMLXS_RPI_VPI 0x00000010 /* rpi_online set */ 153 #define EMLXS_RPI_PAUSED 0x00000020 /* rpi_paused set */ 154 #define EMLXS_RPI_REG 0x00000040 155 156 #define EMLXS_RPI_FIRST 0x80000000 157 158 uint32_t attempts; 159 uint32_t xri_count; /* Managed by XRIobj_t */ 160 161 struct VPIobj *vpip; 162 163 /* Node info */ 164 struct emlxs_node *node; 165 uint32_t did; 166 SERV_PARM sparam; 167 168 emlxs_deferred_cmpl_t *cmpl; 169 170 } RPIobj_t; 171 172 173 typedef struct VPIobj 174 { 175 uint16_t index; 176 uint16_t VPI; 177 178 uint16_t prev_reason; 179 uint16_t prev_state; 180 181 uint16_t reason; 182 uint16_t state; 183 #define VPI_STATE_OFFLINE 0 184 185 #define VPI_STATE_INIT 1 186 #define VPI_STATE_INIT_FAILED 2 187 #define VPI_STATE_INIT_CMPL 3 188 189 #define VPI_STATE_UNREG_CMPL 4 190 #define VPI_STATE_UNREG_FAILED 5 191 #define VPI_STATE_UNREG 6 192 193 #define VPI_STATE_LOGO_CMPL 7 194 #define VPI_STATE_LOGO_FAILED 8 195 #define VPI_STATE_LOGO 9 196 197 #define VPI_STATE_PORT_OFFLINE 10 198 #define VPI_STATE_PORT_ONLINE 11 199 200 #define VPI_STATE_LOGI 12 201 #define VPI_STATE_LOGI_FAILED 13 202 #define VPI_STATE_LOGI_CMPL 14 203 204 #define VPI_STATE_REG 15 205 #define VPI_STATE_REG_FAILED 16 206 #define VPI_STATE_REG_CMPL 17 207 208 #define VPI_STATE_PAUSED 18 209 #define VPI_STATE_ONLINE 19 210 211 212 uint32_t flag; 213 #define EMLXS_VPI_ONLINE_REQ 0x00000001 214 #define EMLXS_VPI_OFFLINE_REQ 0x00000002 215 #define EMLXS_VPI_PAUSE_REQ 0x00000004 216 #define EMLXS_VPI_REQ_MASK 0x0000000F 217 218 #define EMLXS_VPI_VFI 0x00000010 /* vpi_online set */ 219 #define EMLXS_VPI_VFI_LOGI 0x00000020 /* logi_count set */ 220 #define EMLXS_VPI_INIT 0x00000040 221 #define EMLXS_VPI_REG 0x00000080 222 #define EMLXS_VPI_PORT_ONLINE 0x00000100 223 #define EMLXS_VPI_LOGI 0x00000200 224 #define EMLXS_VPI_PORT_ENABLED 0x80000000 225 226 uint32_t attempts; 227 228 RPIobj_t fcf_rpi; /* Reserved Fabric RPI object */ 229 RPIobj_t *rpip; /* Fabric RPI pointer (&fcf_rpi) */ 230 231 emlxs_buf_t *flogi_sbp; 232 233 struct emlxs_port *port; 234 235 struct VFIobj *vfip; /* Managed by VFIobj_t */ 236 uint32_t rpi_online; /* Managed by RPIobj_t */ 237 uint32_t rpi_paused; /* Managed by RPIobj_t */ 238 239 } VPIobj_t; 240 241 242 typedef struct VFIobj 243 { 244 uint16_t index; 245 uint16_t VFI; 246 247 uint16_t prev_reason; 248 uint16_t prev_state; 249 250 uint16_t reason; 251 uint16_t state; 252 #define VFI_STATE_OFFLINE 0 253 254 #define VFI_STATE_INIT 1 255 #define VFI_STATE_INIT_FAILED 2 256 #define VFI_STATE_INIT_CMPL 3 257 258 #define VFI_STATE_VPI_OFFLINE_CMPL 4 259 #define VFI_STATE_VPI_OFFLINE 5 260 261 #define VFI_STATE_VPI_ONLINE 6 262 #define VFI_STATE_VPI_ONLINE_CMPL 7 263 264 #define VFI_STATE_UNREG_CMPL 8 265 #define VFI_STATE_UNREG_FAILED 9 266 #define VFI_STATE_UNREG 10 267 268 #define VFI_STATE_REG 11 269 #define VFI_STATE_REG_FAILED 12 270 #define VFI_STATE_REG_CMPL 13 271 272 #define VFI_STATE_PAUSED 14 273 #define VFI_STATE_ONLINE 15 274 275 uint32_t flag; 276 #define EMLXS_VFI_ONLINE_REQ 0x00000001 277 #define EMLXS_VFI_OFFLINE_REQ 0x00000002 278 #define EMLXS_VFI_PAUSE_REQ 0x00000004 279 #define EMLXS_VFI_REQ_MASK 0x0000000F 280 281 #define EMLXS_VFI_FCFI 0x00000010 /* vfi_online set */ 282 #define EMLXS_VFI_INIT 0x00000020 283 #define EMLXS_VFI_REG 0x00000040 284 285 uint32_t attempts; 286 287 SERV_PARM fcf_sparam; 288 289 struct FCFIobj *fcfp; /* Managed by FCFIobj_t */ 290 uint32_t vpi_online; /* Managed by VPIobj_t */ 291 uint32_t logi_count; /* Managed by VPIobj_t */ 292 293 } VFIobj_t; 294 295 296 typedef struct FCFIobj 297 { 298 uint16_t index; 299 uint16_t FCFI; 300 301 uint16_t fcf_index; 302 uint16_t vlan_id; 303 304 uint16_t prev_reason; 305 uint16_t prev_state; 306 307 uint16_t reason; 308 uint16_t state; 309 #define FCFI_STATE_FREE 0 310 311 #define FCFI_STATE_OFFLINE 1 312 313 #define FCFI_STATE_UNREG_CMPL 2 314 #define FCFI_STATE_UNREG_FAILED 3 315 #define FCFI_STATE_UNREG 4 316 317 #define FCFI_STATE_REG 5 318 #define FCFI_STATE_REG_FAILED 6 319 #define FCFI_STATE_REG_CMPL 7 320 321 #define FCFI_STATE_VFI_OFFLINE_CMPL 8 322 #define FCFI_STATE_VFI_OFFLINE 9 323 324 #define FCFI_STATE_VFI_ONLINE 10 325 #define FCFI_STATE_VFI_ONLINE_CMPL 11 326 327 #define FCFI_STATE_PAUSED 12 328 #define FCFI_STATE_ONLINE 13 329 330 uint32_t offline_timer; 331 uint32_t attempts; 332 uint32_t generation; 333 uint32_t event_tag; 334 uint32_t flag; 335 #define EMLXS_FCFI_ONLINE_REQ 0x00000001 336 #define EMLXS_FCFI_OFFLINE_REQ 0x00000002 337 #define EMLXS_FCFI_PAUSE_REQ 0x00000004 338 #define EMLXS_FCFI_REQ_MASK 0x0000000F 339 340 #define EMLXS_FCFI_FCFTAB 0x00000010 /* fcfi_online set */ 341 #define EMLXS_FCFI_REG 0x00000020 342 343 #define EMLXS_FCFI_VALID 0x00000100 344 #define EMLXS_FCFI_AVAILABLE 0x00000200 345 #define EMLXS_FCFI_CONFIGURED 0x00000400 346 #define EMLXS_FCFI_FRESH 0x00000800 347 #define EMLXS_FCFI_FAILED 0x00001000 348 #define EMLXS_FCFI_SELECTED 0x00002000 /* in use */ 349 350 #define EMLXS_FCFI_VLAN_ID 0x00010000 351 #define EMLXS_FCFI_BOOT 0x00020000 352 #define EMLXS_FCFI_PRIMARY 0x00040000 353 354 #define EMLXS_FCFI_TAGGED 0x80000000 355 356 /* struct VFTable vftab */ 357 358 FCF_RECORD_t fcf_rec; 359 uint32_t priority; 360 361 uint32_t vfi_online; /* Managed by VFIobj_t */ 362 363 } FCFIobj_t; 364 365 366 typedef struct VFTable 367 { 368 uint16_t prev_reason; 369 uint16_t prev_state; 370 371 uint16_t reason; 372 uint16_t state; 373 #define VFTAB_STATE_DISABLED 0 374 375 uint32_t vfi_active; 376 uint32_t vfi_count; 377 VFIobj_t *table; 378 379 } VFTable_t; 380 381 typedef struct FCFTable 382 { 383 384 uint16_t prev_reason; 385 uint16_t prev_state; 386 387 uint16_t reason; 388 uint16_t state; 389 #define FCFTAB_STATE_SHUTDOWN 0 390 #define FCFTAB_STATE_OFFLINE 1 391 392 #define FCFTAB_STATE_SOLICIT 2 393 #define FCFTAB_STATE_SOLICIT_FAILED 3 394 #define FCFTAB_STATE_SOLICIT_CMPL 4 395 396 #define FCFTAB_STATE_READ 5 397 #define FCFTAB_STATE_READ_FAILED 6 398 #define FCFTAB_STATE_READ_CMPL 7 399 400 #define FCFTAB_STATE_FCFI_OFFLINE_CMPL 8 401 #define FCFTAB_STATE_FCFI_OFFLINE 9 402 403 #define FCFTAB_STATE_FCFI_ONLINE 10 404 #define FCFTAB_STATE_FCFI_ONLINE_CMPL 11 405 406 #define FCFTAB_STATE_ONLINE 12 407 408 uint32_t generation; 409 410 uint32_t read_timer; 411 uint32_t index; /* Used for read operations */ 412 uint32_t flag; 413 #define EMLXS_FCFTAB_SOL_REQ 0x00000001 414 #define EMLXS_FCFTAB_READ_REQ 0x00000002 415 #define EMLXS_FCFTAB_OFFLINE_REQ 0x00000004 416 #define EMLXS_FCFTAB_REQ_MASK 0x0000000F 417 #define EMLXS_FCFTAB_SHUTDOWN 0x80000000 418 419 uint32_t attempts; 420 421 uint32_t fcfi_online; /* Managed by FCFIobj_t */ 422 423 FCFIobj_t *fcfi[FCFTAB_MAX_FCFI_COUNT]; 424 uint32_t fcfi_count; 425 426 FCFIobj_t *table; 427 uint16_t table_count; 428 429 uint32_t sol_timer; 430 431 } FCFTable_t; 432 #define FCFTAB_READ_ALL (void*)0xffff 433 434 #ifdef __cplusplus 435 } 436 #endif 437 438 #endif /* _EMLXS_FCF_H */ 439