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 | 3d7fc66 | 2011-06-24 20:28:17 -0700 | [diff] [blame^] | 74 | IOCMD_DIAG_TEMP, |
| 75 | IOCMD_DIAG_MEMTEST, |
| 76 | IOCMD_DIAG_LOOPBACK, |
| 77 | IOCMD_DIAG_FWPING, |
| 78 | IOCMD_DIAG_QUEUETEST, |
| 79 | IOCMD_DIAG_SFP, |
| 80 | IOCMD_DIAG_LED, |
| 81 | IOCMD_DIAG_BEACON_LPORT, |
| 82 | IOCMD_DIAG_LB_STAT, |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame] | 83 | }; |
| 84 | |
| 85 | struct bfa_bsg_gen_s { |
| 86 | bfa_status_t status; |
| 87 | u16 bfad_num; |
| 88 | u16 rsvd; |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | struct bfa_bsg_ioc_info_s { |
| 92 | bfa_status_t status; |
| 93 | u16 bfad_num; |
| 94 | u16 rsvd; |
| 95 | char serialnum[64]; |
| 96 | char hwpath[BFA_STRING_32]; |
| 97 | char adapter_hwpath[BFA_STRING_32]; |
| 98 | char guid[BFA_ADAPTER_SYM_NAME_LEN*2]; |
| 99 | char name[BFA_ADAPTER_SYM_NAME_LEN]; |
| 100 | char port_name[BFA_ADAPTER_SYM_NAME_LEN]; |
| 101 | char eth_name[BFA_ADAPTER_SYM_NAME_LEN]; |
| 102 | wwn_t pwwn; |
| 103 | wwn_t nwwn; |
| 104 | wwn_t factorypwwn; |
| 105 | wwn_t factorynwwn; |
| 106 | mac_t mac; |
| 107 | mac_t factory_mac; /* Factory mac address */ |
| 108 | mac_t current_mac; /* Currently assigned mac address */ |
| 109 | enum bfa_ioc_type_e ioc_type; |
| 110 | u16 pvid; /* Port vlan id */ |
| 111 | u16 rsvd1; |
| 112 | u32 host; |
| 113 | u32 bandwidth; /* For PF support */ |
| 114 | u32 rsvd2; |
| 115 | }; |
| 116 | |
| 117 | struct bfa_bsg_ioc_attr_s { |
| 118 | bfa_status_t status; |
| 119 | u16 bfad_num; |
| 120 | u16 rsvd; |
| 121 | struct bfa_ioc_attr_s ioc_attr; |
| 122 | }; |
| 123 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 124 | struct bfa_bsg_ioc_stats_s { |
| 125 | bfa_status_t status; |
| 126 | u16 bfad_num; |
| 127 | u16 rsvd; |
| 128 | struct bfa_ioc_stats_s ioc_stats; |
| 129 | }; |
| 130 | |
| 131 | struct bfa_bsg_ioc_fwstats_s { |
| 132 | bfa_status_t status; |
| 133 | u16 bfad_num; |
| 134 | u16 rsvd; |
| 135 | u32 buf_size; |
| 136 | u32 rsvd1; |
| 137 | u64 buf_ptr; |
| 138 | }; |
| 139 | |
| 140 | struct bfa_bsg_iocfc_attr_s { |
| 141 | bfa_status_t status; |
| 142 | u16 bfad_num; |
| 143 | u16 rsvd; |
| 144 | struct bfa_iocfc_attr_s iocfc_attr; |
| 145 | }; |
| 146 | |
| 147 | struct bfa_bsg_iocfc_intr_s { |
| 148 | bfa_status_t status; |
| 149 | u16 bfad_num; |
| 150 | u16 rsvd; |
| 151 | struct bfa_iocfc_intr_attr_s attr; |
| 152 | }; |
| 153 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 154 | struct bfa_bsg_port_attr_s { |
| 155 | bfa_status_t status; |
| 156 | u16 bfad_num; |
| 157 | u16 rsvd; |
| 158 | struct bfa_port_attr_s attr; |
| 159 | }; |
| 160 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 161 | struct bfa_bsg_port_stats_s { |
| 162 | bfa_status_t status; |
| 163 | u16 bfad_num; |
| 164 | u16 rsvd; |
| 165 | u32 buf_size; |
| 166 | u32 rsvd1; |
| 167 | u64 buf_ptr; |
| 168 | }; |
| 169 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 170 | struct bfa_bsg_lport_attr_s { |
| 171 | bfa_status_t status; |
| 172 | u16 bfad_num; |
| 173 | u16 vf_id; |
| 174 | wwn_t pwwn; |
| 175 | struct bfa_lport_attr_s port_attr; |
| 176 | }; |
| 177 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 178 | struct bfa_bsg_lport_stats_s { |
| 179 | bfa_status_t status; |
| 180 | u16 bfad_num; |
| 181 | u16 vf_id; |
| 182 | wwn_t pwwn; |
| 183 | struct bfa_lport_stats_s port_stats; |
| 184 | }; |
| 185 | |
| 186 | struct bfa_bsg_lport_iostats_s { |
| 187 | bfa_status_t status; |
| 188 | u16 bfad_num; |
| 189 | u16 vf_id; |
| 190 | wwn_t pwwn; |
| 191 | struct bfa_itnim_iostats_s iostats; |
| 192 | }; |
| 193 | |
| 194 | struct bfa_bsg_lport_get_rports_s { |
| 195 | bfa_status_t status; |
| 196 | u16 bfad_num; |
| 197 | u16 vf_id; |
| 198 | wwn_t pwwn; |
| 199 | u64 rbuf_ptr; |
| 200 | u32 nrports; |
| 201 | u32 rsvd; |
| 202 | }; |
| 203 | |
| 204 | struct bfa_bsg_rport_attr_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_attr_s attr; |
| 211 | }; |
| 212 | |
| 213 | struct bfa_bsg_rport_stats_s { |
| 214 | bfa_status_t status; |
| 215 | u16 bfad_num; |
| 216 | u16 vf_id; |
| 217 | wwn_t pwwn; |
| 218 | wwn_t rpwwn; |
| 219 | struct bfa_rport_stats_s stats; |
| 220 | }; |
| 221 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 222 | struct bfa_bsg_rport_scsi_addr_s { |
| 223 | bfa_status_t status; |
| 224 | u16 bfad_num; |
| 225 | u16 vf_id; |
| 226 | wwn_t pwwn; |
| 227 | wwn_t rpwwn; |
| 228 | u32 host; |
| 229 | u32 bus; |
| 230 | u32 target; |
| 231 | u32 lun; |
| 232 | }; |
| 233 | |
| 234 | struct bfa_bsg_fabric_get_lports_s { |
| 235 | bfa_status_t status; |
| 236 | u16 bfad_num; |
| 237 | u16 vf_id; |
| 238 | u64 buf_ptr; |
| 239 | u32 nports; |
| 240 | u32 rsvd; |
| 241 | }; |
| 242 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 243 | struct bfa_bsg_fcpim_modstats_s { |
| 244 | bfa_status_t status; |
| 245 | u16 bfad_num; |
| 246 | struct bfa_itnim_iostats_s modstats; |
| 247 | }; |
| 248 | |
| 249 | struct bfa_bsg_fcpim_del_itn_stats_s { |
| 250 | bfa_status_t status; |
| 251 | u16 bfad_num; |
| 252 | struct bfa_fcpim_del_itn_stats_s modstats; |
| 253 | }; |
| 254 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 255 | struct bfa_bsg_itnim_attr_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_attr_s attr; |
| 262 | }; |
| 263 | |
Krishna Gudipati | 6013806 | 2011-06-24 20:25:15 -0700 | [diff] [blame] | 264 | struct bfa_bsg_itnim_iostats_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_iostats_s iostats; |
| 271 | }; |
| 272 | |
| 273 | struct bfa_bsg_itnim_itnstats_s { |
| 274 | bfa_status_t status; |
| 275 | u16 bfad_num; |
| 276 | u16 vf_id; |
| 277 | wwn_t lpwwn; |
| 278 | wwn_t rpwwn; |
| 279 | struct bfa_itnim_stats_s itnstats; |
| 280 | }; |
| 281 | |
Krishna Gudipati | 1a4d8e1 | 2011-06-24 20:22:28 -0700 | [diff] [blame] | 282 | struct bfa_bsg_pcifn_cfg_s { |
| 283 | bfa_status_t status; |
| 284 | u16 bfad_num; |
| 285 | u16 rsvd; |
| 286 | struct bfa_ablk_cfg_s pcifn_cfg; |
| 287 | }; |
| 288 | |
| 289 | struct bfa_bsg_pcifn_s { |
| 290 | bfa_status_t status; |
| 291 | u16 bfad_num; |
| 292 | u16 pcifn_id; |
| 293 | u32 bandwidth; |
| 294 | u8 port; |
| 295 | enum bfi_pcifn_class pcifn_class; |
| 296 | u8 rsvd[1]; |
| 297 | }; |
| 298 | |
| 299 | struct bfa_bsg_adapter_cfg_mode_s { |
| 300 | bfa_status_t status; |
| 301 | u16 bfad_num; |
| 302 | u16 rsvd; |
| 303 | struct bfa_adapter_cfg_mode_s cfg; |
| 304 | }; |
| 305 | |
| 306 | struct bfa_bsg_port_cfg_mode_s { |
| 307 | bfa_status_t status; |
| 308 | u16 bfad_num; |
| 309 | u16 instance; |
| 310 | struct bfa_port_cfg_mode_s cfg; |
| 311 | }; |
| 312 | |
Krishna Gudipati | a714134 | 2011-06-24 20:23:19 -0700 | [diff] [blame] | 313 | struct bfa_bsg_faa_attr_s { |
| 314 | bfa_status_t status; |
| 315 | u16 bfad_num; |
| 316 | u16 rsvd; |
| 317 | struct bfa_faa_attr_s faa_attr; |
| 318 | }; |
| 319 | |
Krishna Gudipati | 148d610 | 2011-06-24 20:25:36 -0700 | [diff] [blame] | 320 | struct bfa_bsg_cee_attr_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 | |
| 329 | struct bfa_bsg_cee_stats_s { |
| 330 | bfa_status_t status; |
| 331 | u16 bfad_num; |
| 332 | u16 rsvd; |
| 333 | u32 buf_size; |
| 334 | u32 rsvd1; |
| 335 | u64 buf_ptr; |
| 336 | }; |
| 337 | |
Krishna Gudipati | 51e569a | 2011-06-24 20:26:25 -0700 | [diff] [blame] | 338 | struct bfa_bsg_sfp_media_s { |
| 339 | bfa_status_t status; |
| 340 | u16 bfad_num; |
| 341 | u16 rsvd; |
| 342 | enum bfa_defs_sfp_media_e media; |
| 343 | }; |
| 344 | |
| 345 | struct bfa_bsg_sfp_speed_s { |
| 346 | bfa_status_t status; |
| 347 | u16 bfad_num; |
| 348 | u16 rsvd; |
| 349 | enum bfa_port_speed speed; |
| 350 | }; |
| 351 | |
Krishna Gudipati | 5a54b1d | 2011-06-24 20:27:13 -0700 | [diff] [blame] | 352 | struct bfa_bsg_flash_attr_s { |
| 353 | bfa_status_t status; |
| 354 | u16 bfad_num; |
| 355 | u16 rsvd; |
| 356 | struct bfa_flash_attr_s attr; |
| 357 | }; |
| 358 | |
| 359 | struct bfa_bsg_flash_s { |
| 360 | bfa_status_t status; |
| 361 | u16 bfad_num; |
| 362 | u8 instance; |
| 363 | u8 rsvd; |
| 364 | enum bfa_flash_part_type type; |
| 365 | int bufsz; |
| 366 | u64 buf_ptr; |
| 367 | }; |
| 368 | |
Krishna Gudipati | 3d7fc66 | 2011-06-24 20:28:17 -0700 | [diff] [blame^] | 369 | struct bfa_bsg_diag_get_temp_s { |
| 370 | bfa_status_t status; |
| 371 | u16 bfad_num; |
| 372 | u16 rsvd; |
| 373 | struct bfa_diag_results_tempsensor_s result; |
| 374 | }; |
| 375 | |
| 376 | struct bfa_bsg_diag_memtest_s { |
| 377 | bfa_status_t status; |
| 378 | u16 bfad_num; |
| 379 | u16 rsvd[3]; |
| 380 | u32 pat; |
| 381 | struct bfa_diag_memtest_result result; |
| 382 | struct bfa_diag_memtest_s memtest; |
| 383 | }; |
| 384 | |
| 385 | struct bfa_bsg_diag_loopback_s { |
| 386 | bfa_status_t status; |
| 387 | u16 bfad_num; |
| 388 | u16 rsvd; |
| 389 | enum bfa_port_opmode opmode; |
| 390 | enum bfa_port_speed speed; |
| 391 | u32 lpcnt; |
| 392 | u32 pat; |
| 393 | struct bfa_diag_loopback_result_s result; |
| 394 | }; |
| 395 | |
| 396 | struct bfa_bsg_diag_fwping_s { |
| 397 | bfa_status_t status; |
| 398 | u16 bfad_num; |
| 399 | u16 rsvd; |
| 400 | u32 cnt; |
| 401 | u32 pattern; |
| 402 | struct bfa_diag_results_fwping result; |
| 403 | }; |
| 404 | |
| 405 | struct bfa_bsg_diag_qtest_s { |
| 406 | bfa_status_t status; |
| 407 | u16 bfad_num; |
| 408 | u16 rsvd; |
| 409 | u32 force; |
| 410 | u32 queue; |
| 411 | struct bfa_diag_qtest_result_s result; |
| 412 | }; |
| 413 | |
| 414 | struct bfa_bsg_sfp_show_s { |
| 415 | bfa_status_t status; |
| 416 | u16 bfad_num; |
| 417 | u16 rsvd; |
| 418 | struct sfp_mem_s sfp; |
| 419 | }; |
| 420 | |
| 421 | struct bfa_bsg_diag_led_s { |
| 422 | bfa_status_t status; |
| 423 | u16 bfad_num; |
| 424 | u16 rsvd; |
| 425 | struct bfa_diag_ledtest_s ledtest; |
| 426 | }; |
| 427 | |
| 428 | struct bfa_bsg_diag_beacon_s { |
| 429 | bfa_status_t status; |
| 430 | u16 bfad_num; |
| 431 | u16 rsvd; |
| 432 | bfa_boolean_t beacon; |
| 433 | bfa_boolean_t link_e2e_beacon; |
| 434 | u32 second; |
| 435 | }; |
| 436 | |
| 437 | struct bfa_bsg_diag_lb_stat_s { |
| 438 | bfa_status_t status; |
| 439 | u16 bfad_num; |
| 440 | u16 rsvd; |
| 441 | }; |
| 442 | |
Krishna Gudipati | b85daaf | 2011-06-13 15:55:11 -0700 | [diff] [blame] | 443 | struct bfa_bsg_fcpt_s { |
| 444 | bfa_status_t status; |
| 445 | u16 vf_id; |
| 446 | wwn_t lpwwn; |
| 447 | wwn_t dpwwn; |
| 448 | u32 tsecs; |
| 449 | int cts; |
| 450 | enum fc_cos cos; |
| 451 | struct fchs_s fchs; |
| 452 | }; |
| 453 | #define bfa_bsg_fcpt_t struct bfa_bsg_fcpt_s |
| 454 | |
| 455 | struct bfa_bsg_data { |
| 456 | int payload_len; |
| 457 | void *payload; |
| 458 | }; |
| 459 | |
| 460 | #define bfad_chk_iocmd_sz(__payload_len, __hdrsz, __bufsz) \ |
| 461 | (((__payload_len) != ((__hdrsz) + (__bufsz))) ? \ |
| 462 | BFA_STATUS_FAILED : BFA_STATUS_OK) |
| 463 | |
| 464 | #endif /* BFAD_BSG_H */ |