#ifndef _EMLXS_DFC_H
#define _EMLXS_DFC_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/fibre-channel/fcio.h>
#include <emlxs_fcio.h>
#define DFC_REV 1
#ifdef DHCHAP_SUPPORT
#undef DFC_REV
#define DFC_REV 2
#endif
#undef DFC_REV
#define DFC_REV 3
typedef struct dfc
{
uint32_t cmd;
uint32_t flag;
void *buf1;
uint32_t buf1_size;
uint32_t data1;
void *buf2;
uint32_t buf2_size;
uint32_t data2;
void *buf3;
uint32_t buf3_size;
uint32_t data3;
void *buf4;
uint32_t buf4_size;
uint32_t data4;
} dfc_t;
typedef struct dfc32
{
uint32_t cmd;
uint32_t flag;
uint32_t buf1;
uint32_t buf1_size;
uint32_t data1;
uint32_t buf2;
uint32_t buf2_size;
uint32_t data2;
uint32_t buf3;
uint32_t buf3_size;
uint32_t data3;
uint32_t buf4;
uint32_t buf4_size;
uint32_t data4;
} dfc32_t;
#ifdef SAN_DIAG_SUPPORT
typedef struct sd_bucket_info
{
uint16_t type;
uint16_t search_type;
uint32_t base;
uint32_t step;
uint16_t state;
uint64_t values[SD_IO_LATENCY_MAX_BUCKETS];
} sd_bucket_info_t;
#endif
#define EMLXS_GET_HBAINFO 1
#define EMLXS_GET_IOINFO 2
#define EMLXS_GET_LINKINFO 3
#define EMLXS_GET_NODEINFO 4
#define EMLXS_GET_EVENTINFO 5
#define EMLXS_GET_REV 6
#define EMLXS_GET_DUMPREGION 7
#define EMLXS_GET_HBASTATS 8
#define EMLXS_GET_DRVSTATS 9
#define EMLXS_FCIO_CMD 10
#define EMLXS_GET_CFG 15
#define EMLXS_SET_CFG 16
#define EMLXS_GET_EVENT 17
#define EMLXS_SET_EVENT 18
#define EMLXS_SEND_MBOX 20
#define EMLXS_SEND_ELS 21
#define EMLXS_SEND_CT 22
#define EMLXS_SEND_CT_RSP 23
#define EMLXS_SEND_MENLO 24
#define EMLXS_SEND_SCSI 25
#define EMLXS_SET_DIAG 30
#define EMLXS_LOOPBACK_MODE 31
#define EMLXS_LOOPBACK_TEST 32
#define EMLXS_RESET_PORT 33
#define EMLXS_READ_PCI 40
#define EMLXS_WRITE_PCI 41
#define EMLXS_WRITE_FLASH 42
#define EMLXS_READ_FLASH 43
#define EMLXS_READ_MEM 44
#define EMLXS_WRITE_MEM 45
#define EMLXS_WRITE_CTLREG 46
#define EMLXS_READ_CTLREG 47
#define EMLXS_CREATE_VPORT 50
#define EMLXS_DESTROY_VPORT 51
#define EMLXS_GET_VPORTINFO 52
#define EMLXS_NPIV_RESOURCE 53
#define EMLXS_NPIV_TEST 54
#define EMLXS_INIT_AUTH 60
#define EMLXS_GET_AUTH_CFG 61
#define EMLXS_SET_AUTH_CFG 62
#define EMLXS_GET_AUTH_PASSWORD 63
#define EMLXS_SET_AUTH_PASSWORD 64
#define EMLXS_GET_AUTH_STATUS 65
#define EMLXS_GET_AUTH_CFG_TABLE 66
#define EMLXS_GET_AUTH_KEY_TABLE 67
#define EMLXS_GET_FCTSTAT 70
#define EMLXS_GET_PERSIST_LINKDOWN 71
#define EMLXS_SET_PERSIST_LINKDOWN 72
#define EMLXS_GET_FCOE_FCFLIST 80
#define EMLXS_SEND_MBOX4 81
#define EMLXS_RD_BE_FCF 82
#define EMLXS_SET_BE_DCBX 83
#define EMLXS_GET_BE_DCBX 84
#define EMLXS_GET_QOS 85
#define EMLXS_SD_SET_BUCKET 100
#define EMLXS_SD_START_DATA_COLLECTION 101
#define EMLXS_SD_STOP_DATA_COLLECTION 102
#define EMLXS_SD_RESET_DATA_COLLECTION 103
#define EMLXS_SD_GET_DATA 104
#define EMLXS_SD_DESTROY_BUCKET 105
#define EMLXS_SD_GET_BUCKET 106
#define EMLXS_SD_SET_EVENT 107
#define EMLXS_SD_GET_EVENT 108
#define EMLXS_AUTH_CFG_ADD 0
#define EMLXS_AUTH_CFG_DELETE 1
#define DFC_ERRNO_START 0x200
#define DFC_SUCCESS 0
#define DFC_SYS_ERROR (DFC_ERRNO_START + 1)
#define DFC_DRV_ERROR (DFC_ERRNO_START + 2)
#define DFC_HBA_ERROR (DFC_ERRNO_START + 3)
#define DFC_IO_ERROR (DFC_ERRNO_START + 4)
#define DFC_ARG_INVALID (DFC_ERRNO_START + 5)
#define DFC_ARG_MISALIGNED (DFC_ERRNO_START + 6)
#define DFC_ARG_NULL (DFC_ERRNO_START + 7)
#define DFC_ARG_TOOSMALL (DFC_ERRNO_START + 8)
#define DFC_ARG_TOOBIG (DFC_ERRNO_START + 9)
#define DFC_COPYIN_ERROR (DFC_ERRNO_START + 10)
#define DFC_COPYOUT_ERROR (DFC_ERRNO_START + 11)
#define DFC_TIMEOUT (DFC_ERRNO_START + 12)
#define DFC_SYSRES_ERROR (DFC_ERRNO_START + 13)
#define DFC_DRVRES_ERROR (DFC_ERRNO_START + 14)
#define DFC_HBARES_ERROR (DFC_ERRNO_START + 15)
#define DFC_OFFLINE_ERROR (DFC_ERRNO_START + 16)
#define DFC_ONLINE_ERROR (DFC_ERRNO_START + 17)
#define DFC_NPIV_DISABLED (DFC_ERRNO_START + 18)
#define DFC_NPIV_UNSUPPORTED (DFC_ERRNO_START + 19)
#define DFC_NPIV_ACTIVE (DFC_ERRNO_START + 20)
#define DFC_NOT_SUPPORTED (DFC_ERRNO_START + 21)
#define DFC_NO_DATA (DFC_ERRNO_START + 22)
#define DFC_AUTH_NOT_CONFIGURED (DFC_ERRNO_START + 30)
#define DFC_AUTH_FAILED_NO_SA_FOUND (DFC_ERRNO_START + 31)
#define DFC_AUTH_INIT_OK_AUTH_FAILED (DFC_ERRNO_START + 32)
#define DFC_AUTH_COMPARE_FAILED (DFC_ERRNO_START + 33)
#define DFC_AUTH_WWN_NOT_FOUND (DFC_ERRNO_START + 34)
#define DFC_AUTH_PASSWORD_INVALID (DFC_ERRNO_START + 35)
#define DFC_AUTH_INVALID_ENTITY (DFC_ERRNO_START + 36)
#define DFC_AUTH_ENTITY_NOT_ACTIVE (DFC_ERRNO_START + 37)
#define DFC_AUTH_INVALID_OPERATION (DFC_ERRNO_START + 38)
#define DFC_AUTH_AUTHENTICATION_GOINGON (DFC_ERRNO_START + 39)
#define DFC_AUTH_CREATE_STORKEY_ERROR (DFC_ERRNO_START + 40)
#define DFC_AUTH_CREATE_PARMKEY_ERROR (DFC_ERRNO_START + 41)
#define DFC_AUTH_CREATE_AUTHKEY_ERROR (DFC_ERRNO_START + 42)
#define DFC_AUTH_CREATE_BORDKEY_ERROR (DFC_ERRNO_START + 43)
#define DFC_AUTH_AUTHENTICATION_NOT_SUPPORTED (DFC_ERRNO_START + 44)
#define DFC_AUTH_AUTHENTICATION_DISABLED (DFC_ERRNO_START + 45)
#define DFC_AUTH_CONFIG_NOT_FOUND (DFC_ERRNO_START + 47)
#define DFC_AUTH_LOCAL_REMOTE_PWD_EQUAL (DFC_ERRNO_START + 48)
#define DFC_INVALID_ADAPTER (DFC_ERRNO_START + 50)
#define DFC_RSP_BUF_OVERRUN (DFC_ERRNO_START + 51)
#define DFC_LINKDOWN_ERROR (DFC_ERRNO_START + 52)
#define DFC_SD_STAT_START (DFC_ERRNO_START + 60)
#define DFC_SD_OK (DFC_ERRNO_START + 60)
#define DFC_SD_ERROR_GENERIC (DFC_ERRNO_START + 61)
#define DFC_SD_ERROR_INVALID_ARG (DFC_ERRNO_START + 62)
#define DFC_SD_ERROR_INVALID_BOARD_ID (DFC_ERRNO_START + 63)
#define DFC_SD_ERROR_INVALID_PORT (DFC_ERRNO_START + 64)
#define DFC_SD_ERROR_NOT_SUPPORTED (DFC_ERRNO_START + 65)
#define DFC_SD_ERROR_CATEGORY_NOT_SUPPORTED (DFC_ERRNO_START + 66)
#define DFC_SD_ERROR_SUBCAT_NOT_SUPPORTED (DFC_ERRNO_START + 67)
#define DFC_SD_ERROR_MORE_DATA_AVAIL (DFC_ERRNO_START + 68)
#define DFC_SD_ERROR_EVENT_ALREADY_REG (DFC_ERRNO_START + 69)
#define DFC_SD_ERROR_NO_ACTIVE_REG (DFC_ERRNO_START + 70)
#define DFC_SD_ERROR_ARG_MISSING (DFC_ERRNO_START + 71)
#define DFC_SD_ERROR_NO_MEM (DFC_ERRNO_START + 72)
#define DFC_SD_ERROR_BUCKET_NOT_SET (DFC_ERRNO_START + 73)
#define DFC_SD_ERROR_REG_HANDLE (DFC_ERRNO_START + 74)
#define DFC_SD_ERROR_INVALID_SEARCH_TYPE (DFC_ERRNO_START + 75)
#define DFC_SD_ERROR_FUNCTION_NOT_SUPPORTED (DFC_ERRNO_START + 76)
#define DFC_SD_ERROR_OUT_OF_HANDLES (DFC_ERRNO_START + 77)
#define DFC_SD_ERROR_LIB_NOT_INIT (DFC_ERRNO_START + 78)
#define DFC_SD_ERROR_DATA_COLLECTION_ACTIVE (DFC_ERRNO_START + 79)
#define DFC_SD_ERROR_DATA_COLLECTION_NOT_ACTIVE (DFC_ERRNO_START + 80)
#define DFC_ERRNO_END (DFC_ERRNO_START + 128)
typedef struct dfc_hbainfo
{
char vpd_serial_num[32];
char vpd_part_num[32];
char vpd_port_num[20];
char vpd_eng_change[32];
char vpd_manufacturer[80];
char vpd_model[80];
char vpd_model_desc[256];
char vpd_prog_types[256];
char vpd_id[80];
uint32_t flags;
#define HBA_FLAG_SBUS 0x00000001
#define HBA_FLAG_OFFLINE 0x00000002
#define HBA_FLAG_NPIV 0x00000004
#define HBA_FLAG_DHCHAP 0x00000008
#define HBA_FLAG_DYN_WWN 0x00000010
#define HBA_FLAG_E2E_AUTH 0x00000020
#define HBA_FLAG_TARGET_MODE 0x00000040
#define HBA_FLAG_TARGET_MODE_ENA 0x00000080
#define HBA_FLAG_SAN_DIAG 0x00000100
#define HBA_FLAG_FCOE 0x00000200
#define HBA_FLAG_PERSISTLINK 0x00000400
#define HBA_FLAG_EXT_MBOX 0x00000800
uint32_t device_id;
uint32_t vendor_id;
uint32_t ports;
uint32_t port_index;
uint32_t vpi_max;
uint32_t vpi_high;
char wwnn[8];
char snn[256];
char wwpn[8];
char spn[256];
char fw_version[256];
char fcode_version[256];
char boot_version[256];
uint32_t biuRev;
uint32_t smRev;
uint32_t smFwRev;
uint32_t endecRev;
uint32_t rBit;
uint32_t fcphHigh;
uint32_t fcphLow;
uint32_t feaLevelHigh;
uint32_t feaLevelLow;
uint32_t kern_rev;
char kern_name[32];
uint32_t stub_rev;
char stub_name[32];
uint32_t sli1_rev;
char sli1_name[32];
uint32_t sli2_rev;
char sli2_name[32];
uint32_t sli3_rev;
char sli3_name[32];
uint32_t sli4_rev;
char sli4_name[32];
uint32_t sli_mode;
uint32_t drv_instance;
char drv_label[64];
char drv_module[64];
char drv_name[32];
char drv_version[64];
char drv_revision[64];
char hostname[32];
char os_devname[256];
uint32_t port_id;
uint32_t port_type;
uint32_t port_state;
uint32_t topology;
uint32_t hard_alpa;
uint8_t alpa_count;
uint8_t alpa_map[128];
uint32_t supported_cos;
uint32_t supported_types[8];
uint32_t active_types[8];
uint32_t supported_speeds;
uint32_t port_speed;
uint32_t max_frame_size;
uint8_t fabric_wwpn[8];
uint8_t fabric_wwnn[8];
uint32_t node_count;
uint8_t pci_function_number;
uint8_t pci_device_number;
uint8_t pci_bus_number;
} dfc_hbainfo_t;
typedef struct fc_class
{
#ifdef EMLXS_BIG_ENDIAN
uint8_t classValid:1;
uint8_t intermix:1;
uint8_t stackedXparent:1;
uint8_t stackedLockDown:1;
uint8_t seqDelivery:1;
uint8_t word0Reserved1:3;
#endif
#ifdef EMLXS_LITTLE_ENDIAN
uint8_t word0Reserved1:3;
uint8_t seqDelivery:1;
uint8_t stackedLockDown:1;
uint8_t stackedXparent:1;
uint8_t intermix:1;
uint8_t classValid:1;
#endif
uint8_t word0Reserved2;
#ifdef EMLXS_BIG_ENDIAN
uint8_t iCtlXidReAssgn:2;
uint8_t iCtlInitialPa:2;
uint8_t iCtlAck0capable:1;
uint8_t iCtlAckNcapable:1;
uint8_t word0Reserved3:2;
#endif
#ifdef EMLXS_LITTLE_ENDIAN
uint8_t word0Reserved3:2;
uint8_t iCtlAckNcapable:1;
uint8_t iCtlAck0capable:1;
uint8_t iCtlInitialPa:2;
uint8_t iCtlXidReAssgn:2;
#endif
uint8_t word0Reserved4;
#ifdef EMLXS_BIG_ENDIAN
uint8_t rCtlAck0capable:1;
uint8_t rCtlAckNcapable:1;
uint8_t rCtlXidInterlck:1;
uint8_t rCtlErrorPolicy:2;
uint8_t word1Reserved1:1;
uint8_t rCtlCatPerSeq:2;
#endif
#ifdef EMLXS_LITTLE_ENDIAN
uint8_t rCtlCatPerSeq:2;
uint8_t word1Reserved1:1;
uint8_t rCtlErrorPolicy:2;
uint8_t rCtlXidInterlck:1;
uint8_t rCtlAckNcapable:1;
uint8_t rCtlAck0capable:1;
#endif
uint8_t word1Reserved2;
uint8_t rcvDataSizeMsb;
uint8_t rcvDataSizeLsb;
uint8_t concurrentSeqMsb;
uint8_t concurrentSeqLsb;
uint8_t EeCreditSeqMsb;
uint8_t EeCreditSeqLsb;
uint8_t openSeqPerXchgMsb;
uint8_t openSeqPerXchgLsb;
uint8_t word3Reserved1;
uint8_t word3Reserved2;
} fc_class_t;
typedef struct fc_csp
{
uint8_t fcphHigh;
uint8_t fcphLow;
uint8_t bbCreditMsb;
uint8_t bbCreditlsb;
#ifdef EMLXS_BIG_ENDIAN
uint16_t increasingOffset:1;
uint16_t randomOffset:1;
uint16_t word1Reserved2:1;
uint16_t fPort:1;
uint16_t altBbCredit:1;
uint16_t edtovResolution:1;
uint16_t multicast:1;
uint16_t broadcast:1;
uint16_t huntgroup:1;
uint16_t simplex:1;
uint16_t word1Reserved1:3;
uint16_t dhd:1;
uint16_t contIncSeqCnt:1;
uint16_t payloadlength:1;
#endif
#ifdef EMLXS_LITTLE_ENDIAN
uint16_t broadcast:1;
uint16_t multicast:1;
uint16_t edtovResolution:1;
uint16_t altBbCredit:1;
uint16_t fPort:1;
uint16_t word1Reserved2:1;
uint16_t randomOffset:1;
uint16_t increasingOffset:1;
uint16_t payloadlength:1;
uint16_t contIncSeqCnt:1;
uint16_t dhd:1;
uint16_t word1Reserved1:3;
uint16_t simplex:1;
uint16_t huntgroup:1;
#endif
uint8_t bbRcvSizeMsb;
uint8_t bbRcvSizeLsb;
union
{
struct
{
uint8_t word2Reserved1;
uint8_t totalConcurrSeq;
uint8_t roByCategoryMsb;
uint8_t roByCategoryLsb;
} nPort;
uint32_t r_a_tov;
} w2;
uint32_t e_d_tov;
} fc_csp_t;
typedef struct fc_sparm
{
fc_csp_t csp;
uint8_t wwpn[8];
uint8_t wwnn[8];
fc_class_t cls1;
fc_class_t cls2;
fc_class_t cls3;
fc_class_t cls4;
uint8_t vendorVersion[16];
} fc_sparm_t;
typedef struct dfc_node
{
uint32_t port_id;
uint32_t rpi;
uint32_t xri;
uint32_t flags;
#define PORT_FLAG_FCP_TARGET 0x00000001
#define PORT_FLAG_FCP_INI 0x00000002
#define PORT_FLAG_FCP2 0x00000004
#define PORT_FLAG_IP 0x00000008
#define PORT_FLAG_VPORT 0x00000010
#define PORT_FLAG_DFC_STATE_VALID 0x00000020
#define PORT_FLAG_DFC_STATE 0xF0000000
fc_sparm_t sparm;
} dfc_node_t;
typedef struct dfc_hbastats
{
uint32_t tx_frame_cnt;
uint32_t rx_frame_cnt;
uint32_t tx_kbyte_cnt;
uint32_t rx_kbyte_cnt;
uint32_t tx_seq_cnt;
uint32_t rx_seq_cnt;
uint32_t orig_exch_cnt;
uint32_t resp_exch_cnt;
uint32_t pbsy_cnt;
uint32_t fbsy_cnt;
uint32_t link_failure_cnt;
uint32_t loss_sync_cnt;
uint32_t loss_signal_cnt;
uint32_t seq_error_cnt;
uint32_t inval_tx_word_cnt;
uint32_t crc_error_cnt;
uint32_t seq_timeout_cnt;
uint32_t elastic_overrun_cnt;
uint32_t arb_timeout_cnt;
uint32_t rx_buf_credit;
uint32_t rx_buf_cnt;
uint32_t tx_buf_credit;
uint32_t tx_buf_cnt;
uint32_t EOFa_cnt;
uint32_t EOFdti_cnt;
uint32_t EOFni_cnt;
uint32_t SOFf_cnt;
uint32_t link_event_tag;
uint32_t last_reset_time;
uint32_t topology;
uint32_t port_type;
uint32_t link_speed;
} dfc_hbastats_t;
typedef struct dfc_drvstats
{
uint32_t LinkUp;
uint32_t LinkDown;
uint32_t LinkEvent;
uint32_t LinkMultiEvent;
uint32_t MboxIssued;
uint32_t MboxCompleted;
uint32_t MboxGood;
uint32_t MboxError;
uint32_t MboxBusy;
uint32_t MboxInvalid;
uint32_t IocbIssued[4];
uint32_t IocbReceived[4];
uint32_t IocbTxPut[4];
uint32_t IocbTxGet[4];
uint32_t IocbRingFull[4];
uint32_t IntrEvent[8];
#define RESV_INTR 7
#define ERATT_INTR 6
#define MBATT_INTR 5
#define LKATT_INTR 4
#define R3ATT_INTR 3
#define R2ATT_INTR 2
#define R1ATT_INTR 1
#define R0ATT_INTR 0
uint32_t FcpIssued;
uint32_t FcpCompleted;
uint32_t FcpGood;
uint32_t FcpError;
uint32_t FcpEvent;
uint32_t FcpStray;
uint32_t ElsEvent;
uint32_t ElsStray;
uint32_t ElsCmdIssued;
uint32_t ElsCmdCompleted;
uint32_t ElsCmdGood;
uint32_t ElsCmdError;
uint32_t ElsRspIssued;
uint32_t ElsRspCompleted;
uint32_t ElsRcvEvent;
uint32_t ElsRcvError;
uint32_t ElsRcvDropped;
uint32_t ElsCmdReceived;
uint32_t ElsRscnReceived;
uint32_t ElsPlogiReceived;
uint32_t ElsPrliReceived;
uint32_t ElsPrloReceived;
uint32_t ElsLogoReceived;
uint32_t ElsAdiscReceived;
uint32_t ElsGenReceived;
uint32_t CtEvent;
uint32_t CtStray;
uint32_t CtCmdIssued;
uint32_t CtCmdCompleted;
uint32_t CtCmdGood;
uint32_t CtCmdError;
uint32_t CtRspIssued;
uint32_t CtRspCompleted;
uint32_t CtRcvEvent;
uint32_t CtRcvError;
uint32_t CtRcvDropped;
uint32_t CtCmdReceived;
uint32_t IpEvent;
uint32_t IpStray;
uint32_t IpSeqIssued;
uint32_t IpSeqCompleted;
uint32_t IpSeqGood;
uint32_t IpSeqError;
uint32_t IpBcastIssued;
uint32_t IpBcastCompleted;
uint32_t IpBcastGood;
uint32_t IpBcastError;
uint32_t IpRcvEvent;
uint32_t IpDropped;
uint32_t IpSeqReceived;
uint32_t IpBcastReceived;
uint32_t IpUbPosted;
uint32_t ElsUbPosted;
uint32_t CtUbPosted;
#if (DFC_REV >= 2)
uint32_t IocbThrottled;
uint32_t ElsAuthReceived;
#endif
} dfc_drvstats_t;
#ifdef SFCT_SUPPORT
#define DFC_TGTPORT_STAT_VERSION 1
#define MAX_TGTPORT_IOCNT 16
typedef struct dfc_tgtport_stat
{
uint8_t Version;
uint8_t Reserved[7];
uint64_t FctP2IOWcnt[MAX_TGTPORT_IOCNT];
uint64_t FctP2IORcnt[MAX_TGTPORT_IOCNT];
uint64_t FctIOCmdCnt;
uint64_t FctCmdReceived;
uint64_t FctReadBytes;
uint64_t FctWriteBytes;
uint64_t FctEvent;
uint64_t FctCompleted;
uint64_t FctCmplGood;
uint32_t FctCmplError;
uint32_t FctStray;
uint32_t FctRcvDropped;
uint32_t FctOverQDepth;
uint32_t FctOutstandingIO;
uint32_t FctFailedPortRegister;
uint32_t FctPortRegister;
uint32_t FctPortDeregister;
uint32_t FctAbortSent;
uint32_t FctNoBuffer;
uint32_t FctScsiStatusErr;
uint32_t FctScsiQfullErr;
uint32_t FctScsiResidOver;
uint32_t FctScsiResidUnder;
uint32_t FctScsiSenseErr;
uint32_t FctLinkState;
} dfc_tgtport_stat_t;
#endif
typedef struct dfc_vportinfo
{
uint32_t flags;
#define VPORT_CONFIG 0x00000001
#define VPORT_ENABLED 0x00000002
#define VPORT_BOUND 0x00000004
#define VPORT_IP 0x00000008
#define VPORT_RESTRICTED 0x00000010
uint32_t vpi;
uint32_t port_id;
uint8_t wwpn[8];
uint8_t wwnn[8];
char snn[256];
char spn[256];
uint32_t ulp_statec;
} dfc_vportinfo_t;
#ifdef __cplusplus
}
#endif
#endif