Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. |
| 3 | * All rights reserved |
| 4 | * www.brocade.com |
| 5 | * |
| 6 | * Linux driver for Brocade Fibre Channel Host Bus Adapter. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License (GPL) Version 2 as |
| 10 | * published by the Free Software Foundation |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | */ |
| 17 | #ifndef BFAD_BSG_H |
| 18 | #define BFAD_BSG_H |
| 19 | |
| 20 | #include "bfa_defs.h" |
| 21 | #include "bfa_defs_fcs.h" |
| 22 | |
| 23 | /* Definitions of vendor unique structures and command codes passed in |
| 24 | * using FC_BSG_HST_VENDOR message code. |
| 25 | */ |
| 26 | enum { |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 27 | IOCMD_IOC_ENABLE = 0x1, |
| 28 | IOCMD_IOC_DISABLE, |
| 29 | IOCMD_IOC_GET_ATTR, |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 30 | IOCMD_IOC_GET_INFO, |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 31 | IOCMD_IOC_GET_STATS, |
| 32 | IOCMD_IOC_GET_FWSTATS, |
| 33 | IOCMD_IOCFC_GET_ATTR, |
| 34 | IOCMD_IOCFC_SET_INTR, |
| 35 | IOCMD_PORT_ENABLE, |
| 36 | IOCMD_PORT_DISABLE, |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 37 | IOCMD_PORT_GET_ATTR, |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 38 | IOCMD_PORT_GET_STATS, |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 39 | IOCMD_LPORT_GET_ATTR, |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 40 | IOCMD_LPORT_GET_RPORTS, |
| 41 | IOCMD_LPORT_GET_STATS, |
| 42 | IOCMD_LPORT_GET_IOSTATS, |
| 43 | IOCMD_RPORT_GET_ATTR, |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 44 | IOCMD_RPORT_GET_ADDR, |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 45 | IOCMD_RPORT_GET_STATS, |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 46 | IOCMD_FABRIC_GET_LPORTS, |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 47 | IOCMD_FCPIM_MODSTATS, |
| 48 | IOCMD_FCPIM_DEL_ITN_STATS, |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 49 | IOCMD_ITNIM_GET_ATTR, |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 50 | IOCMD_ITNIM_GET_IOSTATS, |
| 51 | IOCMD_ITNIM_GET_ITNSTATS, |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame] | 52 | IOCMD_IOC_PCIFN_CFG, |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 53 | IOCMD_FCPORT_ENABLE, |
| 54 | IOCMD_FCPORT_DISABLE, |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame] | 55 | IOCMD_PCIFN_CREATE, |
| 56 | IOCMD_PCIFN_DELETE, |
| 57 | IOCMD_PCIFN_BW, |
| 58 | IOCMD_ADAPTER_CFG_MODE, |
| 59 | IOCMD_PORT_CFG_MODE, |
| 60 | IOCMD_FLASH_ENABLE_OPTROM, |
| 61 | IOCMD_FLASH_DISABLE_OPTROM, |
Krishna Gudipati | a714134 | 2011-06-24 20:23:19 -0700 | [diff] [blame] | 62 | IOCMD_FAA_ENABLE, |
| 63 | IOCMD_FAA_DISABLE, |
| 64 | IOCMD_FAA_QUERY, |
Krishna Gudipati | 148d610 | 2011-06-24 20:25:36 -0700 | [diff] [blame] | 65 | IOCMD_CEE_GET_ATTR, |
| 66 | IOCMD_CEE_GET_STATS, |
| 67 | IOCMD_CEE_RESET_STATS, |
Krishna Gudipati | 51e569a | 2011-06-24 20:26:25 -0700 | [diff] [blame] | 68 | IOCMD_SFP_MEDIA, |
| 69 | IOCMD_SFP_SPEED, |
Krishna Gudipati | 5a54b1d | 2011-06-24 20:27:13 -0700 | [diff] [blame^] | 70 | IOCMD_FLASH_GET_ATTR, |
| 71 | IOCMD_FLASH_ERASE_PART, |
| 72 | IOCMD_FLASH_UPDATE_PART, |
| 73 | IOCMD_FLASH_READ_PART, |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | struct bfa_bsg_gen_s { |
| 77 | bfa_status_t status; |
| 78 | u16 bfad_num; |
| 79 | u16 rsvd; |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | struct bfa_bsg_ioc_info_s { |
| 83 | bfa_status_t status; |
| 84 | u16 bfad_num; |
| 85 | u16 rsvd; |
| 86 | char serialnum[64]; |
| 87 | char hwpath[BFA_STRING_32]; |
| 88 | char adapter_hwpath[BFA_STRING_32]; |
| 89 | char guid[BFA_ADAPTER_SYM_NAME_LEN*2]; |
| 90 | char name[BFA_ADAPTER_SYM_NAME_LEN]; |
| 91 | char port_name[BFA_ADAPTER_SYM_NAME_LEN]; |
| 92 | char eth_name[BFA_ADAPTER_SYM_NAME_LEN]; |
| 93 | wwn_t pwwn; |
| 94 | wwn_t nwwn; |
| 95 | wwn_t factorypwwn; |
| 96 | wwn_t factorynwwn; |
| 97 | mac_t mac; |
| 98 | mac_t factory_mac; /* Factory mac address */ |
| 99 | mac_t current_mac; /* Currently assigned mac address */ |
| 100 | enum bfa_ioc_type_e ioc_type; |
| 101 | u16 pvid; /* Port vlan id */ |
| 102 | u16 rsvd1; |
| 103 | u32 host; |
| 104 | u32 bandwidth; /* For PF support */ |
| 105 | u32 rsvd2; |
| 106 | }; |
| 107 | |
| 108 | struct bfa_bsg_ioc_attr_s { |
| 109 | bfa_status_t status; |
| 110 | u16 bfad_num; |
| 111 | u16 rsvd; |
| 112 | struct bfa_ioc_attr_s ioc_attr; |
| 113 | }; |
| 114 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 115 | struct bfa_bsg_ioc_stats_s { |
| 116 | bfa_status_t status; |
| 117 | u16 bfad_num; |
| 118 | u16 rsvd; |
| 119 | struct bfa_ioc_stats_s ioc_stats; |
| 120 | }; |
| 121 | |
| 122 | struct bfa_bsg_ioc_fwstats_s { |
| 123 | bfa_status_t status; |
| 124 | u16 bfad_num; |
| 125 | u16 rsvd; |
| 126 | u32 buf_size; |
| 127 | u32 rsvd1; |
| 128 | u64 buf_ptr; |
| 129 | }; |
| 130 | |
| 131 | struct bfa_bsg_iocfc_attr_s { |
| 132 | bfa_status_t status; |
| 133 | u16 bfad_num; |
| 134 | u16 rsvd; |
| 135 | struct bfa_iocfc_attr_s iocfc_attr; |
| 136 | }; |
| 137 | |
| 138 | struct bfa_bsg_iocfc_intr_s { |
| 139 | bfa_status_t status; |
| 140 | u16 bfad_num; |
| 141 | u16 rsvd; |
| 142 | struct bfa_iocfc_intr_attr_s attr; |
| 143 | }; |
| 144 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 145 | struct bfa_bsg_port_attr_s { |
| 146 | bfa_status_t status; |
| 147 | u16 bfad_num; |
| 148 | u16 rsvd; |
| 149 | struct bfa_port_attr_s attr; |
| 150 | }; |
| 151 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 152 | struct bfa_bsg_port_stats_s { |
| 153 | bfa_status_t status; |
| 154 | u16 bfad_num; |
| 155 | u16 rsvd; |
| 156 | u32 buf_size; |
| 157 | u32 rsvd1; |
| 158 | u64 buf_ptr; |
| 159 | }; |
| 160 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 161 | struct bfa_bsg_lport_attr_s { |
| 162 | bfa_status_t status; |
| 163 | u16 bfad_num; |
| 164 | u16 vf_id; |
| 165 | wwn_t pwwn; |
| 166 | struct bfa_lport_attr_s port_attr; |
| 167 | }; |
| 168 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 169 | struct bfa_bsg_lport_stats_s { |
| 170 | bfa_status_t status; |
| 171 | u16 bfad_num; |
| 172 | u16 vf_id; |
| 173 | wwn_t pwwn; |
| 174 | struct bfa_lport_stats_s port_stats; |
| 175 | }; |
| 176 | |
| 177 | struct bfa_bsg_lport_iostats_s { |
| 178 | bfa_status_t status; |
| 179 | u16 bfad_num; |
| 180 | u16 vf_id; |
| 181 | wwn_t pwwn; |
| 182 | struct bfa_itnim_iostats_s iostats; |
| 183 | }; |
| 184 | |
| 185 | struct bfa_bsg_lport_get_rports_s { |
| 186 | bfa_status_t status; |
| 187 | u16 bfad_num; |
| 188 | u16 vf_id; |
| 189 | wwn_t pwwn; |
| 190 | u64 rbuf_ptr; |
| 191 | u32 nrports; |
| 192 | u32 rsvd; |
| 193 | }; |
| 194 | |
| 195 | struct bfa_bsg_rport_attr_s { |
| 196 | bfa_status_t status; |
| 197 | u16 bfad_num; |
| 198 | u16 vf_id; |
| 199 | wwn_t pwwn; |
| 200 | wwn_t rpwwn; |
| 201 | struct bfa_rport_attr_s attr; |
| 202 | }; |
| 203 | |
| 204 | struct bfa_bsg_rport_stats_s { |
| 205 | bfa_status_t status; |
| 206 | u16 bfad_num; |
| 207 | u16 vf_id; |
| 208 | wwn_t pwwn; |
| 209 | wwn_t rpwwn; |
| 210 | struct bfa_rport_stats_s stats; |
| 211 | }; |
| 212 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 213 | struct bfa_bsg_rport_scsi_addr_s { |
| 214 | bfa_status_t status; |
| 215 | u16 bfad_num; |
| 216 | u16 vf_id; |
| 217 | wwn_t pwwn; |
| 218 | wwn_t rpwwn; |
| 219 | u32 host; |
| 220 | u32 bus; |
| 221 | u32 target; |
| 222 | u32 lun; |
| 223 | }; |
| 224 | |
| 225 | struct bfa_bsg_fabric_get_lports_s { |
| 226 | bfa_status_t status; |
| 227 | u16 bfad_num; |
| 228 | u16 vf_id; |
| 229 | u64 buf_ptr; |
| 230 | u32 nports; |
| 231 | u32 rsvd; |
| 232 | }; |
| 233 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 234 | struct bfa_bsg_fcpim_modstats_s { |
| 235 | bfa_status_t status; |
| 236 | u16 bfad_num; |
| 237 | struct bfa_itnim_iostats_s modstats; |
| 238 | }; |
| 239 | |
| 240 | struct bfa_bsg_fcpim_del_itn_stats_s { |
| 241 | bfa_status_t status; |
| 242 | u16 bfad_num; |
| 243 | struct bfa_fcpim_del_itn_stats_s modstats; |
| 244 | }; |
| 245 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 246 | struct bfa_bsg_itnim_attr_s { |
| 247 | bfa_status_t status; |
| 248 | u16 bfad_num; |
| 249 | u16 vf_id; |
| 250 | wwn_t lpwwn; |
| 251 | wwn_t rpwwn; |
| 252 | struct bfa_itnim_attr_s attr; |
| 253 | }; |
| 254 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 255 | struct bfa_bsg_itnim_iostats_s { |
| 256 | bfa_status_t status; |
| 257 | u16 bfad_num; |
| 258 | u16 vf_id; |
| 259 | wwn_t lpwwn; |
| 260 | wwn_t rpwwn; |
| 261 | struct bfa_itnim_iostats_s iostats; |
| 262 | }; |
| 263 | |
| 264 | struct bfa_bsg_itnim_itnstats_s { |
| 265 | bfa_status_t status; |
| 266 | u16 bfad_num; |
| 267 | u16 vf_id; |
| 268 | wwn_t lpwwn; |
| 269 | wwn_t rpwwn; |
| 270 | struct bfa_itnim_stats_s itnstats; |
| 271 | }; |
| 272 | |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame] | 273 | struct bfa_bsg_pcifn_cfg_s { |
| 274 | bfa_status_t status; |
| 275 | u16 bfad_num; |
| 276 | u16 rsvd; |
| 277 | struct bfa_ablk_cfg_s pcifn_cfg; |
| 278 | }; |
| 279 | |
| 280 | struct bfa_bsg_pcifn_s { |
| 281 | bfa_status_t status; |
| 282 | u16 bfad_num; |
| 283 | u16 pcifn_id; |
| 284 | u32 bandwidth; |
| 285 | u8 port; |
| 286 | enum bfi_pcifn_class pcifn_class; |
| 287 | u8 rsvd[1]; |
| 288 | }; |
| 289 | |
| 290 | struct bfa_bsg_adapter_cfg_mode_s { |
| 291 | bfa_status_t status; |
| 292 | u16 bfad_num; |
| 293 | u16 rsvd; |
| 294 | struct bfa_adapter_cfg_mode_s cfg; |
| 295 | }; |
| 296 | |
| 297 | struct bfa_bsg_port_cfg_mode_s { |
| 298 | bfa_status_t status; |
| 299 | u16 bfad_num; |
| 300 | u16 instance; |
| 301 | struct bfa_port_cfg_mode_s cfg; |
| 302 | }; |
| 303 | |
Krishna Gudipati | a714134 | 2011-06-24 20:23:19 -0700 | [diff] [blame] | 304 | struct bfa_bsg_faa_attr_s { |
| 305 | bfa_status_t status; |
| 306 | u16 bfad_num; |
| 307 | u16 rsvd; |
| 308 | struct bfa_faa_attr_s faa_attr; |
| 309 | }; |
| 310 | |
Krishna Gudipati | 148d610 | 2011-06-24 20:25:36 -0700 | [diff] [blame] | 311 | struct bfa_bsg_cee_attr_s { |
| 312 | bfa_status_t status; |
| 313 | u16 bfad_num; |
| 314 | u16 rsvd; |
| 315 | u32 buf_size; |
| 316 | u32 rsvd1; |
| 317 | u64 buf_ptr; |
| 318 | }; |
| 319 | |
| 320 | struct bfa_bsg_cee_stats_s { |
| 321 | bfa_status_t status; |
| 322 | u16 bfad_num; |
| 323 | u16 rsvd; |
| 324 | u32 buf_size; |
| 325 | u32 rsvd1; |
| 326 | u64 buf_ptr; |
| 327 | }; |
| 328 | |
Krishna Gudipati | 51e569a | 2011-06-24 20:26:25 -0700 | [diff] [blame] | 329 | struct bfa_bsg_sfp_media_s { |
| 330 | bfa_status_t status; |
| 331 | u16 bfad_num; |
| 332 | u16 rsvd; |
| 333 | enum bfa_defs_sfp_media_e media; |
| 334 | }; |
| 335 | |
| 336 | struct bfa_bsg_sfp_speed_s { |
| 337 | bfa_status_t status; |
| 338 | u16 bfad_num; |
| 339 | u16 rsvd; |
| 340 | enum bfa_port_speed speed; |
| 341 | }; |
| 342 | |
Krishna Gudipati | 5a54b1d | 2011-06-24 20:27:13 -0700 | [diff] [blame^] | 343 | struct bfa_bsg_flash_attr_s { |
| 344 | bfa_status_t status; |
| 345 | u16 bfad_num; |
| 346 | u16 rsvd; |
| 347 | struct bfa_flash_attr_s attr; |
| 348 | }; |
| 349 | |
| 350 | struct bfa_bsg_flash_s { |
| 351 | bfa_status_t status; |
| 352 | u16 bfad_num; |
| 353 | u8 instance; |
| 354 | u8 rsvd; |
| 355 | enum bfa_flash_part_type type; |
| 356 | int bufsz; |
| 357 | u64 buf_ptr; |
| 358 | }; |
| 359 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 360 | struct bfa_bsg_fcpt_s { |
| 361 | bfa_status_t status; |
| 362 | u16 vf_id; |
| 363 | wwn_t lpwwn; |
| 364 | wwn_t dpwwn; |
| 365 | u32 tsecs; |
| 366 | int cts; |
| 367 | enum fc_cos cos; |
| 368 | struct fchs_s fchs; |
| 369 | }; |
| 370 | #define bfa_bsg_fcpt_t struct bfa_bsg_fcpt_s |
| 371 | |
| 372 | struct bfa_bsg_data { |
| 373 | int payload_len; |
| 374 | void *payload; |
| 375 | }; |
| 376 | |
| 377 | #define bfad_chk_iocmd_sz(__payload_len, __hdrsz, __bufsz) \ |
| 378 | (((__payload_len) != ((__hdrsz) + (__bufsz))) ? \ |
| 379 | BFA_STATUS_FAILED : BFA_STATUS_OK) |
| 380 | |
| 381 | #endif /* BFAD_BSG_H */ |