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_DFC_H 28 #define _EMLXS_DFC_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 #include <sys/fibre-channel/fcio.h> 35 #include <emlxs_fcio.h> 36 37 #define DFC_REV 1 38 39 #ifdef DHCHAP_SUPPORT 40 #undef DFC_REV 41 #define DFC_REV 2 /* DHCHAP_SUPPORT */ 42 #endif /* DHCHAP_SUPPORT */ 43 44 #undef DFC_REV 45 #define DFC_REV 3 /* NPIV_SUPPORT */ 46 47 48 typedef struct dfc 49 { 50 uint32_t cmd; 51 uint32_t flag; 52 53 void *buf1; 54 uint32_t buf1_size; 55 uint32_t data1; 56 57 void *buf2; 58 uint32_t buf2_size; 59 uint32_t data2; 60 61 void *buf3; 62 uint32_t buf3_size; 63 uint32_t data3; 64 65 void *buf4; 66 uint32_t buf4_size; 67 uint32_t data4; 68 } dfc_t; 69 70 71 /* 72 * 32 bit varient of dfc_t to be used only in the driver and NOT applications 73 */ 74 typedef struct dfc32 75 { 76 uint32_t cmd; 77 uint32_t flag; 78 79 uint32_t buf1; 80 uint32_t buf1_size; 81 uint32_t data1; 82 83 uint32_t buf2; 84 uint32_t buf2_size; 85 uint32_t data2; 86 87 uint32_t buf3; 88 uint32_t buf3_size; 89 uint32_t data3; 90 91 uint32_t buf4; 92 uint32_t buf4_size; 93 uint32_t data4; 94 95 } dfc32_t; 96 97 98 #ifdef SAN_DIAG_SUPPORT 99 typedef struct sd_bucket_info 100 { 101 uint16_t type; 102 uint16_t search_type; 103 uint32_t base; 104 uint32_t step; 105 uint16_t state; 106 uint64_t values[SD_IO_LATENCY_MAX_BUCKETS]; 107 } sd_bucket_info_t; 108 #endif 109 110 /* Valid dfc.dfc_cmd codes (DFC_REV=1) */ 111 #define EMLXS_GET_HBAINFO 1 112 #define EMLXS_GET_IOINFO 2 113 #define EMLXS_GET_LINKINFO 3 114 #define EMLXS_GET_NODEINFO 4 115 #define EMLXS_GET_EVENTINFO 5 116 #define EMLXS_GET_REV 6 117 #define EMLXS_GET_DUMPREGION 7 118 #define EMLXS_GET_HBASTATS 8 119 #define EMLXS_GET_DRVSTATS 9 120 121 /* FCIO_SUPPORT */ 122 #define EMLXS_FCIO_CMD 10 123 124 #define EMLXS_GET_CFG 15 125 #define EMLXS_SET_CFG 16 126 #define EMLXS_GET_EVENT 17 127 #define EMLXS_SET_EVENT 18 128 129 #define EMLXS_SEND_MBOX 20 130 #define EMLXS_SEND_ELS 21 131 #define EMLXS_SEND_CT 22 132 #define EMLXS_SEND_CT_RSP 23 133 #define EMLXS_SEND_MENLO 24 134 #define EMLXS_SEND_SCSI 25 135 136 #define EMLXS_SET_DIAG 30 137 #define EMLXS_LOOPBACK_MODE 31 138 #define EMLXS_LOOPBACK_TEST 32 139 140 #define EMLXS_READ_PCI 40 141 #define EMLXS_WRITE_PCI 41 142 #define EMLXS_WRITE_FLASH 42 143 #define EMLXS_READ_FLASH 43 144 #define EMLXS_READ_MEM 44 145 #define EMLXS_WRITE_MEM 45 146 #define EMLXS_WRITE_CTLREG 46 147 #define EMLXS_READ_CTLREG 47 148 149 150 /* NPIV_SUPPORT */ 151 #define EMLXS_CREATE_VPORT 50 152 #define EMLXS_DESTROY_VPORT 51 153 #define EMLXS_GET_VPORTINFO 52 154 #define EMLXS_NPIV_RESOURCE 53 155 #define EMLXS_NPIV_TEST 54 156 157 /* DHCHAP_SUPPORT */ 158 #define EMLXS_INIT_AUTH 60 159 #define EMLXS_GET_AUTH_CFG 61 160 #define EMLXS_SET_AUTH_CFG 62 161 #define EMLXS_GET_AUTH_PASSWORD 63 162 #define EMLXS_SET_AUTH_PASSWORD 64 163 #define EMLXS_GET_AUTH_STATUS 65 164 #define EMLXS_GET_AUTH_CFG_TABLE 66 165 #define EMLXS_GET_AUTH_KEY_TABLE 67 166 167 /* SFCT_SUPPORT */ 168 #define EMLXS_GET_FCTSTAT 70 169 170 #define EMLXS_GET_PERSIST_LINKDOWN 71 171 #define EMLXS_SET_PERSIST_LINKDOWN 72 172 173 /* FCOE_SUPPORT */ 174 #define EMLXS_GET_FCOE_FCFLIST 80 175 #define EMLXS_SEND_MBOX4 81 176 #define EMLXS_RD_BE_FCF 82 177 #define EMLXS_SET_BE_DCBX 83 178 #define EMLXS_GET_BE_DCBX 84 179 #define EMLXS_GET_QOS 85 180 181 /* SAN DIAG SUPPORT */ 182 #define EMLXS_SD_SET_BUCKET 100 183 #define EMLXS_SD_START_DATA_COLLECTION 101 184 #define EMLXS_SD_STOP_DATA_COLLECTION 102 185 #define EMLXS_SD_RESET_DATA_COLLECTION 103 186 #define EMLXS_SD_GET_DATA 104 187 #define EMLXS_SD_DESTROY_BUCKET 105 188 #define EMLXS_SD_GET_BUCKET 106 189 #define EMLXS_SD_SET_EVENT 107 190 #define EMLXS_SD_GET_EVENT 108 191 192 193 194 /* EMLXS_SET_AUTH_CFG - flags */ 195 #define EMLXS_AUTH_CFG_ADD 0 196 #define EMLXS_AUTH_CFG_DELETE 1 197 198 /* ERROR Codes */ 199 #define DFC_ERRNO_START 0x200 200 201 #define DFC_SUCCESS 0 202 #define DFC_SYS_ERROR (DFC_ERRNO_START + 1) /* General system err */ 203 #define DFC_DRV_ERROR (DFC_ERRNO_START + 2) /* General driver err */ 204 #define DFC_HBA_ERROR (DFC_ERRNO_START + 3) /* General HBA err */ 205 #define DFC_IO_ERROR (DFC_ERRNO_START + 4) /* General IO err */ 206 207 #define DFC_ARG_INVALID (DFC_ERRNO_START + 5) /* Invalid Argument */ 208 #define DFC_ARG_MISALIGNED (DFC_ERRNO_START + 6) /* Misaligned Argument */ 209 #define DFC_ARG_NULL (DFC_ERRNO_START + 7) /* NULL Argument */ 210 #define DFC_ARG_TOOSMALL (DFC_ERRNO_START + 8) /* Argument too small */ 211 #define DFC_ARG_TOOBIG (DFC_ERRNO_START + 9) /* Argument too big */ 212 213 #define DFC_COPYIN_ERROR (DFC_ERRNO_START + 10) /* DDI copyin err */ 214 #define DFC_COPYOUT_ERROR (DFC_ERRNO_START + 11) /* DDI copyout err */ 215 216 #define DFC_TIMEOUT (DFC_ERRNO_START + 12) /* Resource timeout */ 217 #define DFC_SYSRES_ERROR (DFC_ERRNO_START + 13) /* Out of sys resource */ 218 #define DFC_DRVRES_ERROR (DFC_ERRNO_START + 14) /* Out of drv resource */ 219 #define DFC_HBARES_ERROR (DFC_ERRNO_START + 15) /* Out of HBA resource */ 220 221 #define DFC_OFFLINE_ERROR (DFC_ERRNO_START + 16) /* Driver offline */ 222 #define DFC_ONLINE_ERROR (DFC_ERRNO_START + 17) /* Driver offline */ 223 224 /* NPIV_SUPPORT */ 225 #define DFC_NPIV_DISABLED (DFC_ERRNO_START + 18) /* NPIV disabled */ 226 #define DFC_NPIV_UNSUPPORTED (DFC_ERRNO_START + 19) /* NPIV not supported */ 227 #define DFC_NPIV_ACTIVE (DFC_ERRNO_START + 20) /* NPIV active */ 228 229 /* FCOE_SUPPORT */ 230 #define DFC_FCOE_NOTSUPPORTED (DFC_ERRNO_START + 21) /* FCoE not supported */ 231 #define DFC_FCOE_NO_DATA (DFC_ERRNO_START + 22) /* No Data to return */ 232 233 /* DHCHAP_SUPPORT */ 234 #define DFC_AUTH_NOT_CONFIGURED (DFC_ERRNO_START + 30) 235 #define DFC_AUTH_FAILED_NO_SA_FOUND (DFC_ERRNO_START + 31) 236 #define DFC_AUTH_INIT_OK_AUTH_FAILED (DFC_ERRNO_START + 32) 237 #define DFC_AUTH_COMPARE_FAILED (DFC_ERRNO_START + 33) 238 #define DFC_AUTH_WWN_NOT_FOUND (DFC_ERRNO_START + 34) 239 #define DFC_AUTH_PASSWORD_INVALID (DFC_ERRNO_START + 35) 240 #define DFC_AUTH_INVALID_ENTITY (DFC_ERRNO_START + 36) 241 #define DFC_AUTH_ENTITY_NOT_ACTIVE (DFC_ERRNO_START + 37) 242 #define DFC_AUTH_INVALID_OPERATION (DFC_ERRNO_START + 38) 243 #define DFC_AUTH_AUTHENTICATION_GOINGON (DFC_ERRNO_START + 39) 244 #define DFC_AUTH_CREATE_STORKEY_ERROR (DFC_ERRNO_START + 40) 245 #define DFC_AUTH_CREATE_PARMKEY_ERROR (DFC_ERRNO_START + 41) 246 #define DFC_AUTH_CREATE_AUTHKEY_ERROR (DFC_ERRNO_START + 42) 247 #define DFC_AUTH_CREATE_BORDKEY_ERROR (DFC_ERRNO_START + 43) 248 #define DFC_AUTH_AUTHENTICATION_NOT_SUPPORTED (DFC_ERRNO_START + 44) 249 #define DFC_AUTH_AUTHENTICATION_DISABLED (DFC_ERRNO_START + 45) 250 #define DFC_AUTH_CONFIG_NOT_FOUND (DFC_ERRNO_START + 47) 251 #define DFC_AUTH_LOCAL_REMOTE_PWD_EQUAL (DFC_ERRNO_START + 48) 252 253 /* MENLO_SUPPORT */ 254 #define DFC_INVALID_ADAPTER (DFC_ERRNO_START + 50) 255 #define DFC_RSP_BUF_OVERRUN (DFC_ERRNO_START + 51) 256 #define DFC_LINKDOWN_ERROR (DFC_ERRNO_START + 52) 257 258 /* SAN_DIAG_SUPPORT */ 259 #define DFC_SD_STAT_START (DFC_ERRNO_START + 60) 260 261 #define DFC_SD_OK (DFC_ERRNO_START + 60) 262 #define DFC_SD_ERROR_GENERIC (DFC_ERRNO_START + 61) 263 #define DFC_SD_ERROR_INVALID_ARG (DFC_ERRNO_START + 62) 264 #define DFC_SD_ERROR_INVALID_BOARD_ID (DFC_ERRNO_START + 63) 265 #define DFC_SD_ERROR_INVALID_PORT (DFC_ERRNO_START + 64) 266 #define DFC_SD_ERROR_NOT_SUPPORTED (DFC_ERRNO_START + 65) 267 #define DFC_SD_ERROR_CATEGORY_NOT_SUPPORTED (DFC_ERRNO_START + 66) 268 #define DFC_SD_ERROR_SUBCAT_NOT_SUPPORTED (DFC_ERRNO_START + 67) 269 #define DFC_SD_ERROR_MORE_DATA_AVAIL (DFC_ERRNO_START + 68) 270 #define DFC_SD_ERROR_EVENT_ALREADY_REG (DFC_ERRNO_START + 69) 271 #define DFC_SD_ERROR_NO_ACTIVE_REG (DFC_ERRNO_START + 70) 272 #define DFC_SD_ERROR_ARG_MISSING (DFC_ERRNO_START + 71) 273 #define DFC_SD_ERROR_NO_MEM (DFC_ERRNO_START + 72) 274 #define DFC_SD_ERROR_BUCKET_NOT_SET (DFC_ERRNO_START + 73) 275 #define DFC_SD_ERROR_REG_HANDLE (DFC_ERRNO_START + 74) 276 #define DFC_SD_ERROR_INVALID_SEARCH_TYPE (DFC_ERRNO_START + 75) 277 #define DFC_SD_ERROR_FUNCTION_NOT_SUPPORTED (DFC_ERRNO_START + 76) 278 #define DFC_SD_ERROR_OUT_OF_HANDLES (DFC_ERRNO_START + 77) 279 #define DFC_SD_ERROR_LIB_NOT_INIT (DFC_ERRNO_START + 78) 280 #define DFC_SD_ERROR_DATA_COLLECTION_ACTIVE (DFC_ERRNO_START + 79) 281 #define DFC_SD_ERROR_DATA_COLLECTION_NOT_ACTIVE (DFC_ERRNO_START + 80) 282 283 284 #define DFC_ERRNO_END (DFC_ERRNO_START + 128) 285 286 typedef struct dfc_hbainfo 287 { 288 char vpd_serial_num[32]; 289 char vpd_part_num[32]; 290 char vpd_port_num[20]; 291 char vpd_eng_change[32]; 292 char vpd_manufacturer[80]; 293 char vpd_model[80]; 294 char vpd_model_desc[256]; 295 char vpd_prog_types[256]; 296 char vpd_id[80]; 297 298 uint32_t flags; 299 #define HBA_FLAG_SBUS 0x00000001 300 #define HBA_FLAG_OFFLINE 0x00000002 301 #define HBA_FLAG_NPIV 0x00000004 /* Supports NPIV */ 302 #define HBA_FLAG_DHCHAP 0x00000008 /* Supports DHCHAP */ 303 #define HBA_FLAG_DYN_WWN 0x00000010 /* Supports Dynamic WWN */ 304 #define HBA_FLAG_E2E_AUTH 0x00000020 /* Supports E2E Auth */ 305 #define HBA_FLAG_TARGET_MODE 0x00000040 /* Supports Target Mode */ 306 #define HBA_FLAG_TARGET_MODE_ENA 0x00000080 /* Target Mode is enabled */ 307 #define HBA_FLAG_SAN_DIAG 0x00000100 /* Supports SAN Diags */ 308 #define HBA_FLAG_FCOE 0x00000200 /* Supports FCoE */ 309 #define HBA_FLAG_PERSISTLINK 0x00000400 /* Supports Persist Link */ 310 /* Up/Down */ 311 312 uint32_t device_id; 313 uint32_t vendor_id; 314 uint32_t ports; 315 uint32_t port_index; 316 317 uint32_t vpi_max; 318 uint32_t vpi_high; 319 320 char wwnn[8]; 321 char snn[256]; 322 323 char wwpn[8]; 324 char spn[256]; 325 326 char fw_version[256]; 327 char fcode_version[256]; 328 char boot_version[256]; 329 330 uint32_t biuRev; 331 uint32_t smRev; 332 uint32_t smFwRev; 333 uint32_t endecRev; 334 uint32_t rBit; 335 uint32_t fcphHigh; 336 uint32_t fcphLow; 337 uint32_t feaLevelHigh; 338 uint32_t feaLevelLow; 339 340 uint32_t kern_rev; 341 char kern_name[32]; 342 uint32_t stub_rev; 343 char stub_name[32]; 344 uint32_t sli1_rev; 345 char sli1_name[32]; 346 uint32_t sli2_rev; 347 char sli2_name[32]; 348 uint32_t sli3_rev; 349 char sli3_name[32]; 350 uint32_t sli4_rev; 351 char sli4_name[32]; 352 uint32_t sli_mode; 353 354 uint32_t drv_instance; 355 char drv_label[64]; 356 char drv_module[64]; 357 char drv_name[32]; 358 char drv_version[64]; 359 char drv_revision[64]; 360 361 char hostname[32]; 362 char os_devname[256]; 363 364 uint32_t port_id; 365 uint32_t port_type; 366 uint32_t port_state; 367 uint32_t topology; 368 uint32_t hard_alpa; 369 uint8_t alpa_count; 370 uint8_t alpa_map[128]; 371 372 uint32_t supported_cos; 373 uint32_t supported_types[8]; 374 uint32_t active_types[8]; 375 376 uint32_t supported_speeds; 377 uint32_t port_speed; 378 uint32_t max_frame_size; 379 380 uint8_t fabric_wwpn[8]; 381 uint8_t fabric_wwnn[8]; 382 uint32_t node_count; 383 384 uint8_t pci_function_number; 385 uint8_t pci_device_number; 386 uint8_t pci_bus_number; 387 } dfc_hbainfo_t; 388 389 390 391 typedef struct fc_class 392 { 393 #ifdef EMLXS_BIG_ENDIAN 394 uint8_t classValid:1; /* FC Word 0, bit 31 */ 395 uint8_t intermix:1; /* FC Word 0, bit 30 */ 396 uint8_t stackedXparent:1; /* FC Word 0, bit 29 */ 397 uint8_t stackedLockDown:1; /* FC Word 0, bit 28 */ 398 uint8_t seqDelivery:1; /* FC Word 0, bit 27 */ 399 uint8_t word0Reserved1:3; /* FC Word 0, bit 24:26 */ 400 #endif 401 #ifdef EMLXS_LITTLE_ENDIAN 402 uint8_t word0Reserved1:3; /* FC Word 0, bit 24:26 */ 403 uint8_t seqDelivery:1; /* FC Word 0, bit 27 */ 404 uint8_t stackedLockDown:1; /* FC Word 0, bit 28 */ 405 uint8_t stackedXparent:1; /* FC Word 0, bit 29 */ 406 uint8_t intermix:1; /* FC Word 0, bit 30 */ 407 uint8_t classValid:1; /* FC Word 0, bit 31 */ 408 #endif 409 uint8_t word0Reserved2; /* FC Word 0, bit 16:23 */ 410 #ifdef EMLXS_BIG_ENDIAN 411 uint8_t iCtlXidReAssgn:2; /* FC Word 0, Bit 14:15 */ 412 uint8_t iCtlInitialPa:2; /* FC Word 0, bit 12:13 */ 413 uint8_t iCtlAck0capable:1; /* FC Word 0, bit 11 */ 414 uint8_t iCtlAckNcapable:1; /* FC Word 0, bit 10 */ 415 uint8_t word0Reserved3:2; /* FC Word 0, bit 8: 9 */ 416 #endif 417 #ifdef EMLXS_LITTLE_ENDIAN 418 uint8_t word0Reserved3:2; /* FC Word 0, bit 8: 9 */ 419 uint8_t iCtlAckNcapable:1; /* FC Word 0, bit 10 */ 420 uint8_t iCtlAck0capable:1; /* FC Word 0, bit 11 */ 421 uint8_t iCtlInitialPa:2; /* FC Word 0, bit 12:13 */ 422 uint8_t iCtlXidReAssgn:2; /* FC Word 0, Bit 14:15 */ 423 #endif 424 uint8_t word0Reserved4; /* FC Word 0, bit 0: 7 */ 425 #ifdef EMLXS_BIG_ENDIAN 426 uint8_t rCtlAck0capable:1; /* FC Word 1, bit 31 */ 427 uint8_t rCtlAckNcapable:1; /* FC Word 1, bit 30 */ 428 uint8_t rCtlXidInterlck:1; /* FC Word 1, bit 29 */ 429 uint8_t rCtlErrorPolicy:2; /* FC Word 1, bit 27:28 */ 430 uint8_t word1Reserved1:1; /* FC Word 1, bit 26 */ 431 uint8_t rCtlCatPerSeq:2; /* FC Word 1, bit 24:25 */ 432 #endif 433 #ifdef EMLXS_LITTLE_ENDIAN 434 uint8_t rCtlCatPerSeq:2; /* FC Word 1, bit 24:25 */ 435 uint8_t word1Reserved1:1; /* FC Word 1, bit 26 */ 436 uint8_t rCtlErrorPolicy:2; /* FC Word 1, bit 27:28 */ 437 uint8_t rCtlXidInterlck:1; /* FC Word 1, bit 29 */ 438 uint8_t rCtlAckNcapable:1; /* FC Word 1, bit 30 */ 439 uint8_t rCtlAck0capable:1; /* FC Word 1, bit 31 */ 440 #endif 441 uint8_t word1Reserved2; /* FC Word 1, bit 16:23 */ 442 uint8_t rcvDataSizeMsb; /* FC Word 1, bit 8:15 */ 443 uint8_t rcvDataSizeLsb; /* FC Word 1, bit 0: 7 */ 444 445 uint8_t concurrentSeqMsb; /* FC Word 2, bit 24:31 */ 446 uint8_t concurrentSeqLsb; /* FC Word 2, bit 16:23 */ 447 uint8_t EeCreditSeqMsb; /* FC Word 2, bit 8:15 */ 448 uint8_t EeCreditSeqLsb; /* FC Word 2, bit 0: 7 */ 449 450 uint8_t openSeqPerXchgMsb; /* FC Word 3, bit 24:31 */ 451 uint8_t openSeqPerXchgLsb; /* FC Word 3, bit 16:23 */ 452 uint8_t word3Reserved1; /* Fc Word 3, bit 8:15 */ 453 uint8_t word3Reserved2; /* Fc Word 3, bit 0: 7 */ 454 } fc_class_t; 455 456 typedef struct fc_csp 457 { 458 uint8_t fcphHigh; /* FC Word 0, byte 0 */ 459 uint8_t fcphLow; /* FC Word 0, byte 1 */ 460 uint8_t bbCreditMsb; /* FC Word 0, byte 2 */ 461 uint8_t bbCreditlsb; /* FC Word 0, byte 3 */ 462 463 #ifdef EMLXS_BIG_ENDIAN 464 uint16_t increasingOffset:1; /* FC Word 1, bit 31 */ 465 uint16_t randomOffset:1; /* FC Word 1, bit 30 */ 466 uint16_t word1Reserved2:1; /* FC Word 1, bit 29 */ 467 uint16_t fPort:1; /* FC Word 1, bit 28 */ 468 uint16_t altBbCredit:1; /* FC Word 1, bit 27 */ 469 uint16_t edtovResolution:1; /* FC Word 1, bit 26 */ 470 uint16_t multicast:1; /* FC Word 1, bit 25 */ 471 uint16_t broadcast:1; /* FC Word 1, bit 24 */ 472 473 uint16_t huntgroup:1; /* FC Word 1, bit 23 */ 474 uint16_t simplex:1; /* FC Word 1, bit 22 */ 475 uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */ 476 uint16_t dhd:1; /* FC Word 1, bit 18 */ 477 uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */ 478 uint16_t payloadlength:1; /* FC Word 1, bit 16 */ 479 #endif 480 #ifdef EMLXS_LITTLE_ENDIAN 481 uint16_t broadcast:1; /* FC Word 1, bit 24 */ 482 uint16_t multicast:1; /* FC Word 1, bit 25 */ 483 uint16_t edtovResolution:1; /* FC Word 1, bit 26 */ 484 uint16_t altBbCredit:1; /* FC Word 1, bit 27 */ 485 uint16_t fPort:1; /* FC Word 1, bit 28 */ 486 uint16_t word1Reserved2:1; /* FC Word 1, bit 29 */ 487 uint16_t randomOffset:1; /* FC Word 1, bit 30 */ 488 uint16_t increasingOffset:1; /* FC Word 1, bit 31 */ 489 490 uint16_t payloadlength:1; /* FC Word 1, bit 16 */ 491 uint16_t contIncSeqCnt:1; /* FC Word 1, bit 17 */ 492 uint16_t dhd:1; /* FC Word 1, bit 18 */ 493 uint16_t word1Reserved1:3; /* FC Word 1, bit 21:19 */ 494 uint16_t simplex:1; /* FC Word 1, bit 22 */ 495 uint16_t huntgroup:1; /* FC Word 1, bit 23 */ 496 #endif 497 498 uint8_t bbRcvSizeMsb; /* FC Word 1, byte 2 */ 499 uint8_t bbRcvSizeLsb; /* FC Word 1, byte 3 */ 500 501 union 502 { 503 struct 504 { 505 uint8_t word2Reserved1; /* FC Word 2 byte 0 */ 506 uint8_t totalConcurrSeq; /* FC Word 2 byte 1 */ 507 uint8_t roByCategoryMsb; /* FC Word 2 byte 2 */ 508 uint8_t roByCategoryLsb; /* FC Word 2 byte 3 */ 509 } nPort; 510 511 uint32_t r_a_tov; /* RATOV (Big Endian) */ 512 } w2; 513 514 uint32_t e_d_tov; /* E_D_TOV must be in B.E. format */ 515 } fc_csp_t; 516 517 518 typedef struct fc_sparm 519 { 520 fc_csp_t csp; 521 522 uint8_t wwpn[8]; 523 uint8_t wwnn[8]; 524 525 fc_class_t cls1; 526 fc_class_t cls2; 527 fc_class_t cls3; 528 fc_class_t cls4; 529 530 uint8_t vendorVersion[16]; 531 } fc_sparm_t; 532 533 534 typedef struct dfc_node 535 { 536 uint32_t port_id; 537 uint32_t rpi; 538 uint32_t xri; 539 uint32_t flags; 540 541 #define PORT_FLAG_FCP_TARGET 0x00000001 542 #define PORT_FLAG_FCP_INI 0x00000002 543 #define PORT_FLAG_FCP2 0x00000004 544 #define PORT_FLAG_IP 0x00000008 545 #define PORT_FLAG_VPORT 0x00000010 546 547 fc_sparm_t sparm; 548 549 } dfc_node_t; 550 551 552 typedef struct dfc_hbastats 553 { 554 uint32_t tx_frame_cnt; 555 uint32_t rx_frame_cnt; 556 uint32_t tx_kbyte_cnt; 557 uint32_t rx_kbyte_cnt; 558 uint32_t tx_seq_cnt; 559 uint32_t rx_seq_cnt; 560 uint32_t orig_exch_cnt; 561 uint32_t resp_exch_cnt; 562 uint32_t pbsy_cnt; 563 uint32_t fbsy_cnt; 564 uint32_t link_failure_cnt; 565 uint32_t loss_sync_cnt; 566 uint32_t loss_signal_cnt; 567 uint32_t seq_error_cnt; 568 uint32_t inval_tx_word_cnt; 569 uint32_t crc_error_cnt; 570 uint32_t seq_timeout_cnt; 571 uint32_t elastic_overrun_cnt; 572 uint32_t arb_timeout_cnt; 573 uint32_t rx_buf_credit; 574 uint32_t rx_buf_cnt; 575 uint32_t tx_buf_credit; 576 uint32_t tx_buf_cnt; 577 uint32_t EOFa_cnt; 578 uint32_t EOFdti_cnt; 579 uint32_t EOFni_cnt; 580 uint32_t SOFf_cnt; 581 uint32_t link_event_tag; 582 uint32_t last_reset_time; 583 uint32_t topology; 584 uint32_t port_type; 585 uint32_t link_speed; 586 } dfc_hbastats_t; 587 588 589 typedef struct dfc_drvstats 590 { 591 uint32_t LinkUp; 592 uint32_t LinkDown; 593 uint32_t LinkEvent; 594 uint32_t LinkMultiEvent; 595 596 uint32_t MboxIssued; 597 uint32_t MboxCompleted; /* = MboxError + MbxGood */ 598 uint32_t MboxGood; 599 uint32_t MboxError; 600 uint32_t MboxBusy; 601 uint32_t MboxInvalid; 602 603 uint32_t IocbIssued[4]; 604 uint32_t IocbReceived[4]; 605 uint32_t IocbTxPut[4]; 606 uint32_t IocbTxGet[4]; 607 uint32_t IocbRingFull[4]; 608 609 uint32_t IntrEvent[8]; 610 #define RESV_INTR 7 611 #define ERATT_INTR 6 612 #define MBATT_INTR 5 613 #define LKATT_INTR 4 614 #define R3ATT_INTR 3 615 #define R2ATT_INTR 2 616 #define R1ATT_INTR 1 617 #define R0ATT_INTR 0 618 619 uint32_t FcpIssued; 620 uint32_t FcpCompleted; /* FcpGood + FcpError */ 621 uint32_t FcpGood; 622 uint32_t FcpError; 623 624 uint32_t FcpEvent; /* FcpStray + FcpComplete */ 625 uint32_t FcpStray; 626 627 uint32_t ElsEvent; /* ElsStray + ElsComplete (cmd + rsp) */ 628 uint32_t ElsStray; 629 630 uint32_t ElsCmdIssued; 631 uint32_t ElsCmdCompleted; /* ElsCmdGood + ElsCmdError */ 632 uint32_t ElsCmdGood; 633 uint32_t ElsCmdError; 634 635 uint32_t ElsRspIssued; 636 uint32_t ElsRspCompleted; 637 638 uint32_t ElsRcvEvent; /* ElsRcvError + ElsRcvDrop + ElsCmdRcv */ 639 uint32_t ElsRcvError; 640 uint32_t ElsRcvDropped; 641 uint32_t ElsCmdReceived; /* ElsRscnRcv + ElsPlogiRcv + ... */ 642 uint32_t ElsRscnReceived; 643 uint32_t ElsPlogiReceived; 644 uint32_t ElsPrliReceived; 645 uint32_t ElsPrloReceived; 646 uint32_t ElsLogoReceived; 647 uint32_t ElsAdiscReceived; 648 uint32_t ElsGenReceived; 649 650 uint32_t CtEvent; /* CtStray + CtCmdComplete + CtRspComplete */ 651 uint32_t CtStray; 652 653 uint32_t CtCmdIssued; 654 uint32_t CtCmdCompleted; /* CtCmdGood + CtCmdError */ 655 uint32_t CtCmdGood; 656 uint32_t CtCmdError; 657 658 uint32_t CtRspIssued; 659 uint32_t CtRspCompleted; 660 661 uint32_t CtRcvEvent; /* CtRcvError + CtRcvDropp + CtCmdRcv */ 662 uint32_t CtRcvError; 663 uint32_t CtRcvDropped; 664 uint32_t CtCmdReceived; 665 666 uint32_t IpEvent; /* IpStray + IpSeqComplete + IpBcastComplete */ 667 uint32_t IpStray; 668 669 uint32_t IpSeqIssued; 670 uint32_t IpSeqCompleted; /* IpSeqGood + IpSeqError */ 671 uint32_t IpSeqGood; 672 uint32_t IpSeqError; 673 674 uint32_t IpBcastIssued; 675 uint32_t IpBcastCompleted; /* IpBcastGood + IpBcastError */ 676 uint32_t IpBcastGood; 677 uint32_t IpBcastError; 678 679 uint32_t IpRcvEvent; /* IpDrop + IpSeqRcv + IpBcastRcv */ 680 uint32_t IpDropped; 681 uint32_t IpSeqReceived; 682 uint32_t IpBcastReceived; 683 684 uint32_t IpUbPosted; 685 uint32_t ElsUbPosted; 686 uint32_t CtUbPosted; 687 688 #if (DFC_REV >= 2) 689 uint32_t IocbThrottled; 690 uint32_t ElsAuthReceived; 691 #endif 692 } dfc_drvstats_t; 693 694 #ifdef SFCT_SUPPORT 695 /* 696 * FctP2IOXcnt will count IOs by their fcpDL. Counters 697 * are for buckets of various power of 2 sizes. 698 * Bucket 0 < 512 > 0 699 * Bucket 1 >= 512 < 1024 700 * Bucket 2 >= 1024 < 2048 701 * Bucket 3 >= 2048 < 4096 702 * Bucket 4 >= 4096 < 8192 703 * Bucket 5 >= 8192 < 16K 704 * Bucket 6 >= 16K < 32K 705 * Bucket 7 >= 32K < 64K 706 * Bucket 8 >= 64K < 128K 707 * Bucket 9 >= 128K < 256K 708 * Bucket 10 >= 256K < 512K 709 * Bucket 11 >= 512K < 1MB 710 * Bucket 12 >= 1MB < 2MB 711 * Bucket 13 >= 2MB < 4MB 712 * Bucket 14 >= 4MB < 8MB 713 * Bucket 15 >= 8MB 714 */ 715 #define DFC_TGTPORT_STAT_VERSION 1 716 #define MAX_TGTPORT_IOCNT 16 717 typedef struct dfc_tgtport_stat 718 { 719 uint8_t Version; 720 uint8_t Reserved[7]; 721 722 /* IO counters */ 723 uint64_t FctP2IOWcnt[MAX_TGTPORT_IOCNT]; /* Writes */ 724 uint64_t FctP2IORcnt[MAX_TGTPORT_IOCNT]; /* Reads */ 725 uint64_t FctIOCmdCnt; /* Other, ie TUR */ 726 uint64_t FctCmdReceived; /* total I/O */ 727 uint64_t FctReadBytes; /* total read bytes */ 728 uint64_t FctWriteBytes; /* total write bytes */ 729 730 /* IOCB handling counters */ 731 uint64_t FctEvent; /* FctStray + FctCmpl */ 732 uint64_t FctCompleted; /* FctCmpl (Good+Err) */ 733 uint64_t FctCmplGood; 734 735 uint32_t FctCmplError; 736 uint32_t FctStray; 737 738 /* Fct event counters */ 739 uint32_t FctRcvDropped; 740 uint32_t FctOverQDepth; 741 uint32_t FctOutstandingIO; 742 uint32_t FctFailedPortRegister; 743 uint32_t FctPortRegister; 744 uint32_t FctPortDeregister; 745 746 uint32_t FctAbortSent; 747 uint32_t FctNoBuffer; 748 uint32_t FctScsiStatusErr; 749 uint32_t FctScsiQfullErr; 750 uint32_t FctScsiResidOver; 751 uint32_t FctScsiResidUnder; 752 uint32_t FctScsiSenseErr; 753 754 /* Additional info */ 755 uint32_t FctLinkState; 756 } dfc_tgtport_stat_t; 757 #endif /* SFCT_SUPPORT */ 758 759 /* DFC_REV >= 3 */ 760 typedef struct dfc_vportinfo 761 { 762 uint32_t flags; 763 #define VPORT_CONFIG 0x00000001 764 #define VPORT_ENABLED 0x00000002 765 #define VPORT_BOUND 0x00000004 766 #define VPORT_IP 0x00000008 767 #define VPORT_RESTRICTED 0x00000010 /* login restricted */ 768 769 uint32_t vpi; 770 uint32_t port_id; 771 uint8_t wwpn[8]; 772 uint8_t wwnn[8]; 773 774 char snn[256]; 775 char spn[256]; 776 777 uint32_t ulp_statec; 778 } dfc_vportinfo_t; 779 780 #ifdef __cplusplus 781 } 782 #endif 783 784 #endif /* _EMLXS_DFC_H */ 785