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 2014 QLogic Corporation 24 * The contents of this file are subject to the terms of the 25 * QLogic End User License (the "License"). 26 * You may not use this file except in compliance with the License. 27 * 28 * You can obtain a copy of the License at 29 * http://www.qlogic.com/Resources/Documents/DriverDownloadHelp/ 30 * QLogic_End_User_Software_License.txt 31 * See the License for the specific language governing permissions 32 * and limitations under the License. 33 */ 34 35 #ifndef __BNXE_BINDING_H 36 #define __BNXE_BINDING_H 37 38 #include "bcmtype.h" 39 #include "mac_drv_info.h" 40 41 #define BNXE_BINDING_VERSION \ 42 ((MAJVERSION << 16) | (MINVERSION << 8) | (REVVERSION << 0)) 43 44 /* cb_ioctl commands sent to bnxe */ 45 #define BNXE_BIND_FCOE 0x0ead0001 46 #define BNXE_UNBIND_FCOE 0x0ead0002 47 48 49 /* default FCoE max exchanges is 4096 for SF and 2048 for MF */ 50 #define FCOE_MAX_EXCHANGES_SF 4096 51 #define FCOE_MAX_EXCHANGES_MF 2048 52 53 54 #ifndef BNXE_FCOE_WWN_SIZE 55 #define BNXE_FCOE_WWN_SIZE 8 56 #endif 57 58 typedef struct bnxe_wwn_info 59 { 60 uint32_t fcp_pwwn_provided; 61 uint8_t fcp_pwwn[BNXE_FCOE_WWN_SIZE]; 62 uint32_t fcp_nwwn_provided; 63 uint8_t fcp_nwwn[BNXE_FCOE_WWN_SIZE]; 64 } BnxeWwnInfo; 65 66 67 #define FCOE_INFO_FLAG_FORCE_LOAD 0x1 68 69 #define FCOE_INFO_FLAG_MF_MODE_MASK 0x6 /* bits 2-3 */ 70 #define FCOE_INFO_FLAG_MF_MODE_SF 0x0 /* single function */ 71 #define FCOE_INFO_FLAG_MF_MODE_SD 0x2 /* switch dependent (vlan based) */ 72 #define FCOE_INFO_FLAG_MF_MODE_SI 0x4 /* switch independent (mac based) */ 73 #define FCOE_INFO_FLAG_MF_MODE_AFEX 0x6 /* switch dependent (afex based) */ 74 75 #define FCOE_INFO_IS_MF_MODE_SF(flags) \ 76 (((flags) & FCOE_INFO_FLAG_MF_MODE_MASK) == FCOE_INFO_FLAG_MF_MODE_SF) 77 #define FCOE_INFO_IS_MF_MODE_SD(flags) \ 78 (((flags) & FCOE_INFO_FLAG_MF_MODE_MASK) == FCOE_INFO_FLAG_MF_MODE_SD) 79 #define FCOE_INFO_IS_MF_MODE_SI(flags) \ 80 (((flags) & FCOE_INFO_FLAG_MF_MODE_MASK) == FCOE_INFO_FLAG_MF_MODE_SI) 81 #define FCOE_INFO_IS_MF_MODE_AFEX(flags) \ 82 (((flags) & FCOE_INFO_FLAG_MF_MODE_MASK) == FCOE_INFO_FLAG_MF_MODE_AFEX) 83 84 typedef struct bnxe_fcoe_info 85 { 86 u32_t flags; 87 u32_t max_fcoe_conn; 88 u32_t max_fcoe_exchanges; 89 BnxeWwnInfo wwn; 90 } BnxeFcoeInfo; 91 92 93 typedef struct bnxe_fcoe_caps 94 { 95 struct fcoe_capabilities fcoe_caps; 96 } BnxeFcoeCaps; 97 98 99 /* 100 * cli_ctl - misc control interface up to the client 101 * 102 * cmd: CLI_CTL_LINK_UP - link up event, no data passed 103 * CLI_CTL_LINK_DOWN - link down event, no data passed 104 * CLI_CTL_UNLOAD - graceful unload event, no data passed 105 * 106 * pData: pointer to command data or NULL 107 * 108 * dataLen: length of command data or 0 109 */ 110 #define CLI_CTL_LINK_UP 1 111 #define CLI_CTL_LINK_DOWN 2 112 #define CLI_CTL_UNLOAD 3 113 typedef boolean_t (*cli_ctl)(dev_info_t * pDev, 114 int cmd, 115 void * pData, 116 int dataLen); 117 118 typedef boolean_t (*cli_indicate_tx)(dev_info_t * pDev, 119 mblk_t * pMblk); 120 121 typedef boolean_t (*cli_indicate_rx)(dev_info_t * pDev, 122 mblk_t * pMblk); 123 124 typedef boolean_t (*cli_indicate_cqes)(dev_info_t * pDev, 125 void * cqes[], 126 int cqeCnt); 127 128 129 /* 130 * prv_ctl - misc control interface down to the provider 131 * 132 * cmd: PRV_CTL_GET_MAC_ADDR - get MAC Address, pass data buffer to hold addr 133 * PRV_CTL_SET_MAC_ADDR - set MAC Address, pass data buffer contains addr 134 * PRV_CTL_QUERY_PARAMS - query related params, pass BnxeXXXInfo struct 135 * PRV_CTL_DISABLE_INTR - disable interrupts, no data passed 136 * PRV_CTL_ENABLE_INTR - enable interrupts, no data passed 137 * PRV_CTL_MBA_BOOT - check if MBA performed network boot 138 * PRV_CTL_LINK_STATE - query the link state, pass boolean buffer 139 * PRV_CTL_BOARD_TYPE - query the board type, pass string buffer 140 * PRV_CTL_BOARD_SERNUM - query the board's serial number, pass string buffer 141 * PRV_CTL_BOOTCODE_VERSION - query the MFW bootcode version, pass string buffer 142 * PRV_CTL_REPORT_FCOE_STATS - report FCoE stats, pass filled in fcoe_stats_info_t 143 * PRV_CTL_SET_CAPS - report FCoE capabilities, pass filled in BnxeFcoeCaps struct 144 * 145 * pData: pointer to command data or NULL 146 * 147 * dataLen: length of command data or 0 148 * 149 * returns: TRUE upon success, FALSE otherwise 150 */ 151 #define PRV_CTL_GET_MAC_ADDR 1 152 #define PRV_CTL_SET_MAC_ADDR 2 153 #define PRV_CTL_QUERY_PARAMS 3 154 #define PRV_CTL_DISABLE_INTR 4 155 #define PRV_CTL_ENABLE_INTR 5 156 #define PRV_CTL_MBA_BOOT 6 157 #define PRV_CTL_LINK_STATE 7 158 #define PRV_CTL_BOARD_TYPE 8 159 #define PRV_CTL_BOARD_SERNUM 9 160 #define PRV_CTL_BOOTCODE_VERSION 10 161 #define PRV_CTL_REPORT_FCOE_STATS 11 162 #define PRV_CTL_SET_CAPS 12 163 typedef boolean_t (*prv_ctl)(dev_info_t * pDev, 164 int cmd, 165 void * pData, 166 int dataLen); 167 168 #define PRV_TX_VLAN_TAG 1 169 typedef mblk_t * (*prv_tx)(dev_info_t * pDev, 170 mblk_t * pMblk, 171 u32_t flags, 172 u16_t vlan_tag); 173 174 typedef boolean_t (*prv_poll)(dev_info_t * pDev); 175 176 typedef boolean_t (*prv_send_wqes)(dev_info_t * pDev, 177 void * wqes[], 178 int wqeCnt); 179 180 typedef boolean_t (*prv_map_mailboxq)(dev_info_t * pDev, 181 u32_t cid, 182 void ** ppMap, 183 ddi_acc_handle_t * pAccHandle); 184 185 typedef boolean_t (*prv_unmap_mailboxq)(dev_info_t * pDev, 186 u32_t cid, 187 void * pMap, 188 ddi_acc_handle_t accHandle); 189 190 191 typedef struct bnxe_binding 192 { 193 u32_t version; 194 195 dev_info_t * pCliDev; /* bnxe client */ 196 197 cli_ctl cliCtl; 198 cli_indicate_tx cliIndicateTx; 199 cli_indicate_rx cliIndicateRx; 200 cli_indicate_cqes cliIndicateCqes; 201 202 u32_t numRxDescs; 203 u32_t numTxDescs; 204 205 dev_info_t * pPrvDev; /* bnxe */ 206 207 prv_ctl prvCtl; 208 prv_tx prvTx; 209 prv_poll prvPoll; 210 prv_send_wqes prvSendWqes; 211 prv_map_mailboxq prvMapMailboxq; 212 prv_unmap_mailboxq prvUnmapMailboxq; 213 } BnxeBinding; 214 215 #endif /* __BNXE_BINDING_H */ 216 217