1 /* 2 * Copyright (c) 2012 Broadcom Corporation 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 18 #ifndef FWIL_TYPES_H_ 19 #define FWIL_TYPES_H_ 20 21 #include <linux/if_ether.h> 22 23 24 #define BRCMF_FIL_ACTION_FRAME_SIZE 1800 25 26 /* ARP Offload feature flags for arp_ol iovar */ 27 #define BRCMF_ARP_OL_AGENT 0x00000001 28 #define BRCMF_ARP_OL_SNOOP 0x00000002 29 #define BRCMF_ARP_OL_HOST_AUTO_REPLY 0x00000004 30 #define BRCMF_ARP_OL_PEER_AUTO_REPLY 0x00000008 31 32 #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */ 33 #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0002 34 35 #define BRCMF_STA_ASSOC 0x10 /* Associated */ 36 37 /* size of brcmf_scan_params not including variable length array */ 38 #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64 39 40 /* masks for channel and ssid count */ 41 #define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff 42 #define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16 43 44 /* primary (ie tx) key */ 45 #define BRCMF_PRIMARY_KEY (1 << 1) 46 #define DOT11_BSSTYPE_ANY 2 47 #define BRCMF_ESCAN_REQ_VERSION 1 48 49 #define BRCMF_MAXRATES_IN_SET 16 /* max # of rates in rateset */ 50 51 /* OBSS Coex Auto/On/Off */ 52 #define BRCMF_OBSS_COEX_AUTO (-1) 53 #define BRCMF_OBSS_COEX_OFF 0 54 #define BRCMF_OBSS_COEX_ON 1 55 56 /* WOWL bits */ 57 /* Wakeup on Magic packet: */ 58 #define BRCMF_WOWL_MAGIC (1 << 0) 59 /* Wakeup on Netpattern */ 60 #define BRCMF_WOWL_NET (1 << 1) 61 /* Wakeup on loss-of-link due to Disassoc/Deauth: */ 62 #define BRCMF_WOWL_DIS (1 << 2) 63 /* Wakeup on retrograde TSF: */ 64 #define BRCMF_WOWL_RETR (1 << 3) 65 /* Wakeup on loss of beacon: */ 66 #define BRCMF_WOWL_BCN (1 << 4) 67 /* Wakeup after test: */ 68 #define BRCMF_WOWL_TST (1 << 5) 69 /* Wakeup after PTK refresh: */ 70 #define BRCMF_WOWL_M1 (1 << 6) 71 /* Wakeup after receipt of EAP-Identity Req: */ 72 #define BRCMF_WOWL_EAPID (1 << 7) 73 /* Wakeind via PME(0) or GPIO(1): */ 74 #define BRCMF_WOWL_PME_GPIO (1 << 8) 75 /* need tkip phase 1 key to be updated by the driver: */ 76 #define BRCMF_WOWL_NEEDTKIP1 (1 << 9) 77 /* enable wakeup if GTK fails: */ 78 #define BRCMF_WOWL_GTK_FAILURE (1 << 10) 79 /* support extended magic packets: */ 80 #define BRCMF_WOWL_EXTMAGPAT (1 << 11) 81 /* support ARP/NS/keepalive offloading: */ 82 #define BRCMF_WOWL_ARPOFFLOAD (1 << 12) 83 /* read protocol version for EAPOL frames: */ 84 #define BRCMF_WOWL_WPA2 (1 << 13) 85 /* If the bit is set, use key rotaton: */ 86 #define BRCMF_WOWL_KEYROT (1 << 14) 87 /* If the bit is set, frm received was bcast frame: */ 88 #define BRCMF_WOWL_BCAST (1 << 15) 89 /* If the bit is set, scan offload is enabled: */ 90 #define BRCMF_WOWL_SCANOL (1 << 16) 91 /* Wakeup on tcpkeep alive timeout: */ 92 #define BRCMF_WOWL_TCPKEEP_TIME (1 << 17) 93 /* Wakeup on mDNS Conflict Resolution: */ 94 #define BRCMF_WOWL_MDNS_CONFLICT (1 << 18) 95 /* Wakeup on mDNS Service Connect: */ 96 #define BRCMF_WOWL_MDNS_SERVICE (1 << 19) 97 /* tcp keepalive got data: */ 98 #define BRCMF_WOWL_TCPKEEP_DATA (1 << 20) 99 /* Firmware died in wowl mode: */ 100 #define BRCMF_WOWL_FW_HALT (1 << 21) 101 /* Enable detection of radio button changes: */ 102 #define BRCMF_WOWL_ENAB_HWRADIO (1 << 22) 103 /* Offloads detected MIC failure(s): */ 104 #define BRCMF_WOWL_MIC_FAIL (1 << 23) 105 /* Wakeup in Unassociated state (Net/Magic Pattern): */ 106 #define BRCMF_WOWL_UNASSOC (1 << 24) 107 /* Wakeup if received matched secured pattern: */ 108 #define BRCMF_WOWL_SECURE (1 << 25) 109 /* Link Down indication in WoWL mode: */ 110 #define BRCMF_WOWL_LINKDOWN (1 << 31) 111 112 #define BRCMF_WOWL_MAXPATTERNS 8 113 #define BRCMF_WOWL_MAXPATTERNSIZE 128 114 115 #define BRCMF_COUNTRY_BUF_SZ 4 116 117 /* join preference types for join_pref iovar */ 118 enum brcmf_join_pref_types { 119 BRCMF_JOIN_PREF_RSSI = 1, 120 BRCMF_JOIN_PREF_WPA, 121 BRCMF_JOIN_PREF_BAND, 122 BRCMF_JOIN_PREF_RSSI_DELTA, 123 }; 124 125 enum brcmf_fil_p2p_if_types { 126 BRCMF_FIL_P2P_IF_CLIENT, 127 BRCMF_FIL_P2P_IF_GO, 128 BRCMF_FIL_P2P_IF_DYNBCN_GO, 129 BRCMF_FIL_P2P_IF_DEV, 130 }; 131 132 enum brcmf_wowl_pattern_type { 133 BRCMF_WOWL_PATTERN_TYPE_BITMAP = 0, 134 BRCMF_WOWL_PATTERN_TYPE_ARP, 135 BRCMF_WOWL_PATTERN_TYPE_NA 136 }; 137 138 struct brcmf_fil_p2p_if_le { 139 u8 addr[ETH_ALEN]; 140 __le16 type; 141 __le16 chspec; 142 }; 143 144 struct brcmf_fil_chan_info_le { 145 __le32 hw_channel; 146 __le32 target_channel; 147 __le32 scan_channel; 148 }; 149 150 struct brcmf_fil_action_frame_le { 151 u8 da[ETH_ALEN]; 152 __le16 len; 153 __le32 packet_id; 154 u8 data[BRCMF_FIL_ACTION_FRAME_SIZE]; 155 }; 156 157 struct brcmf_fil_af_params_le { 158 __le32 channel; 159 __le32 dwell_time; 160 u8 bssid[ETH_ALEN]; 161 u8 pad[2]; 162 struct brcmf_fil_action_frame_le action_frame; 163 }; 164 165 struct brcmf_fil_bss_enable_le { 166 __le32 bsscfg_idx; 167 __le32 enable; 168 }; 169 170 struct brcmf_fil_bwcap_le { 171 __le32 band; 172 __le32 bw_cap; 173 }; 174 175 /** 176 * struct tdls_iovar - common structure for tdls iovars. 177 * 178 * @ea: ether address of peer station. 179 * @mode: mode value depending on specific tdls iovar. 180 * @chanspec: channel specification. 181 * @pad: unused (for future use). 182 */ 183 struct brcmf_tdls_iovar_le { 184 u8 ea[ETH_ALEN]; /* Station address */ 185 u8 mode; /* mode: depends on iovar */ 186 __le16 chanspec; 187 __le32 pad; /* future */ 188 }; 189 190 enum brcmf_tdls_manual_ep_ops { 191 BRCMF_TDLS_MANUAL_EP_CREATE = 1, 192 BRCMF_TDLS_MANUAL_EP_DELETE = 3, 193 BRCMF_TDLS_MANUAL_EP_DISCOVERY = 6 194 }; 195 196 /* Pattern matching filter. Specifies an offset within received packets to 197 * start matching, the pattern to match, the size of the pattern, and a bitmask 198 * that indicates which bits within the pattern should be matched. 199 */ 200 struct brcmf_pkt_filter_pattern_le { 201 /* 202 * Offset within received packet to start pattern matching. 203 * Offset '0' is the first byte of the ethernet header. 204 */ 205 __le32 offset; 206 /* Size of the pattern. Bitmask must be the same size.*/ 207 __le32 size_bytes; 208 /* 209 * Variable length mask and pattern data. mask starts at offset 0. 210 * Pattern immediately follows mask. 211 */ 212 u8 mask_and_pattern[1]; 213 }; 214 215 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */ 216 struct brcmf_pkt_filter_le { 217 __le32 id; /* Unique filter id, specified by app. */ 218 __le32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */ 219 __le32 negate_match; /* Negate the result of filter matches */ 220 union { /* Filter definitions */ 221 struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */ 222 } u; 223 }; 224 225 /* IOVAR "pkt_filter_enable" parameter. */ 226 struct brcmf_pkt_filter_enable_le { 227 __le32 id; /* Unique filter id */ 228 __le32 enable; /* Enable/disable bool */ 229 }; 230 231 /* BSS info structure 232 * Applications MUST CHECK ie_offset field and length field to access IEs and 233 * next bss_info structure in a vector (in struct brcmf_scan_results) 234 */ 235 struct brcmf_bss_info_le { 236 __le32 version; /* version field */ 237 __le32 length; /* byte length of data in this record, 238 * starting at version and including IEs 239 */ 240 u8 BSSID[ETH_ALEN]; 241 __le16 beacon_period; /* units are Kusec */ 242 __le16 capability; /* Capability information */ 243 u8 SSID_len; 244 u8 SSID[32]; 245 struct { 246 __le32 count; /* # rates in this set */ 247 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ 248 } rateset; /* supported rates */ 249 __le16 chanspec; /* chanspec for bss */ 250 __le16 atim_window; /* units are Kusec */ 251 u8 dtim_period; /* DTIM period */ 252 __le16 RSSI; /* receive signal strength (in dBm) */ 253 s8 phy_noise; /* noise (in dBm) */ 254 255 u8 n_cap; /* BSS is 802.11N Capable */ 256 /* 802.11N BSS Capabilities (based on HT_CAP_*): */ 257 __le32 nbss_cap; 258 u8 ctl_ch; /* 802.11N BSS control channel number */ 259 __le32 reserved32[1]; /* Reserved for expansion of BSS properties */ 260 u8 flags; /* flags */ 261 u8 reserved[3]; /* Reserved for expansion of BSS properties */ 262 u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */ 263 264 __le16 ie_offset; /* offset at which IEs start, from beginning */ 265 __le32 ie_length; /* byte length of Information Elements */ 266 __le16 SNR; /* average SNR of during frame reception */ 267 /* Add new fields here */ 268 /* variable length Information Elements */ 269 }; 270 271 struct brcm_rateset_le { 272 /* # rates in this set */ 273 __le32 count; 274 /* rates in 500kbps units w/hi bit set if basic */ 275 u8 rates[BRCMF_MAXRATES_IN_SET]; 276 }; 277 278 struct brcmf_ssid { 279 u32 SSID_len; 280 unsigned char SSID[32]; 281 }; 282 283 struct brcmf_ssid_le { 284 __le32 SSID_len; 285 unsigned char SSID[32]; 286 }; 287 288 struct brcmf_scan_params_le { 289 struct brcmf_ssid_le ssid_le; /* default: {0, ""} */ 290 u8 bssid[ETH_ALEN]; /* default: bcast */ 291 s8 bss_type; /* default: any, 292 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT 293 */ 294 u8 scan_type; /* flags, 0 use default */ 295 __le32 nprobes; /* -1 use default, number of probes per channel */ 296 __le32 active_time; /* -1 use default, dwell time per channel for 297 * active scanning 298 */ 299 __le32 passive_time; /* -1 use default, dwell time per channel 300 * for passive scanning 301 */ 302 __le32 home_time; /* -1 use default, dwell time for the 303 * home channel between channel scans 304 */ 305 __le32 channel_num; /* count of channels and ssids that follow 306 * 307 * low half is count of channels in 308 * channel_list, 0 means default (use all 309 * available channels) 310 * 311 * high half is entries in struct brcmf_ssid 312 * array that follows channel_list, aligned for 313 * s32 (4 bytes) meaning an odd channel count 314 * implies a 2-byte pad between end of 315 * channel_list and first ssid 316 * 317 * if ssid count is zero, single ssid in the 318 * fixed parameter portion is assumed, otherwise 319 * ssid in the fixed portion is ignored 320 */ 321 __le16 channel_list[1]; /* list of chanspecs */ 322 }; 323 324 struct brcmf_scan_results { 325 u32 buflen; 326 u32 version; 327 u32 count; 328 struct brcmf_bss_info_le bss_info_le[]; 329 }; 330 331 struct brcmf_escan_params_le { 332 __le32 version; 333 __le16 action; 334 __le16 sync_id; 335 struct brcmf_scan_params_le params_le; 336 }; 337 338 struct brcmf_escan_result_le { 339 __le32 buflen; 340 __le32 version; 341 __le16 sync_id; 342 __le16 bss_count; 343 struct brcmf_bss_info_le bss_info_le; 344 }; 345 346 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \ 347 sizeof(struct brcmf_bss_info_le)) 348 349 /* used for association with a specific BSSID and chanspec list */ 350 struct brcmf_assoc_params_le { 351 /* 00:00:00:00:00:00: broadcast scan */ 352 u8 bssid[ETH_ALEN]; 353 /* 0: all available channels, otherwise count of chanspecs in 354 * chanspec_list */ 355 __le32 chanspec_num; 356 /* list of chanspecs */ 357 __le16 chanspec_list[1]; 358 }; 359 360 /** 361 * struct join_pref params - parameters for preferred join selection. 362 * 363 * @type: preference type (see enum brcmf_join_pref_types). 364 * @len: length of bytes following (currently always 2). 365 * @rssi_gain: signal gain for selection (only when @type is RSSI_DELTA). 366 * @band: band to which selection preference applies. 367 * This is used if @type is BAND or RSSI_DELTA. 368 */ 369 struct brcmf_join_pref_params { 370 u8 type; 371 u8 len; 372 u8 rssi_gain; 373 u8 band; 374 }; 375 376 /* used for join with or without a specific bssid and channel list */ 377 struct brcmf_join_params { 378 struct brcmf_ssid_le ssid_le; 379 struct brcmf_assoc_params_le params_le; 380 }; 381 382 /* scan params for extended join */ 383 struct brcmf_join_scan_params_le { 384 u8 scan_type; /* 0 use default, active or passive scan */ 385 __le32 nprobes; /* -1 use default, nr of probes per channel */ 386 __le32 active_time; /* -1 use default, dwell time per channel for 387 * active scanning 388 */ 389 __le32 passive_time; /* -1 use default, dwell time per channel 390 * for passive scanning 391 */ 392 __le32 home_time; /* -1 use default, dwell time for the home 393 * channel between channel scans 394 */ 395 }; 396 397 /* extended join params */ 398 struct brcmf_ext_join_params_le { 399 struct brcmf_ssid_le ssid_le; /* {0, ""}: wildcard scan */ 400 struct brcmf_join_scan_params_le scan_le; 401 struct brcmf_assoc_params_le assoc_le; 402 }; 403 404 struct brcmf_wsec_key { 405 u32 index; /* key index */ 406 u32 len; /* key length */ 407 u8 data[WLAN_MAX_KEY_LEN]; /* key data */ 408 u32 pad_1[18]; 409 u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ 410 u32 flags; /* misc flags */ 411 u32 pad_2[3]; 412 u32 iv_initialized; /* has IV been initialized already? */ 413 u32 pad_3; 414 /* Rx IV */ 415 struct { 416 u32 hi; /* upper 32 bits of IV */ 417 u16 lo; /* lower 16 bits of IV */ 418 } rxiv; 419 u32 pad_4[2]; 420 u8 ea[ETH_ALEN]; /* per station */ 421 }; 422 423 /* 424 * dongle requires same struct as above but with fields in little endian order 425 */ 426 struct brcmf_wsec_key_le { 427 __le32 index; /* key index */ 428 __le32 len; /* key length */ 429 u8 data[WLAN_MAX_KEY_LEN]; /* key data */ 430 __le32 pad_1[18]; 431 __le32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ 432 __le32 flags; /* misc flags */ 433 __le32 pad_2[3]; 434 __le32 iv_initialized; /* has IV been initialized already? */ 435 __le32 pad_3; 436 /* Rx IV */ 437 struct { 438 __le32 hi; /* upper 32 bits of IV */ 439 __le16 lo; /* lower 16 bits of IV */ 440 } rxiv; 441 __le32 pad_4[2]; 442 u8 ea[ETH_ALEN]; /* per station */ 443 }; 444 445 /* Used to get specific STA parameters */ 446 struct brcmf_scb_val_le { 447 __le32 val; 448 u8 ea[ETH_ALEN]; 449 }; 450 451 /* channel encoding */ 452 struct brcmf_channel_info_le { 453 __le32 hw_channel; 454 __le32 target_channel; 455 __le32 scan_channel; 456 }; 457 458 struct brcmf_sta_info_le { 459 __le16 ver; /* version of this struct */ 460 __le16 len; /* length in bytes of this structure */ 461 __le16 cap; /* sta's advertised capabilities */ 462 __le32 flags; /* flags defined below */ 463 __le32 idle; /* time since data pkt rx'd from sta */ 464 u8 ea[ETH_ALEN]; /* Station address */ 465 __le32 count; /* # rates in this set */ 466 u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */ 467 /* w/hi bit set if basic */ 468 __le32 in; /* seconds elapsed since associated */ 469 __le32 listen_interval_inms; /* Min Listen interval in ms for STA */ 470 __le32 tx_pkts; /* # of packets transmitted */ 471 __le32 tx_failures; /* # of packets failed */ 472 __le32 rx_ucast_pkts; /* # of unicast packets received */ 473 __le32 rx_mcast_pkts; /* # of multicast packets received */ 474 __le32 tx_rate; /* Rate of last successful tx frame */ 475 __le32 rx_rate; /* Rate of last successful rx frame */ 476 __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */ 477 __le32 rx_decrypt_failures; /* # of packet decrypted failed */ 478 }; 479 480 struct brcmf_chanspec_list { 481 __le32 count; /* # of entries */ 482 __le32 element[1]; /* variable length uint32 list */ 483 }; 484 485 /* 486 * WLC_E_PROBRESP_MSG 487 * WLC_E_P2P_PROBREQ_MSG 488 * WLC_E_ACTION_FRAME_RX 489 */ 490 struct brcmf_rx_mgmt_data { 491 __be16 version; 492 __be16 chanspec; 493 __be32 rssi; 494 __be32 mactime; 495 __be32 rate; 496 }; 497 498 /** 499 * struct brcmf_fil_wowl_pattern_le - wowl pattern configuration struct. 500 * 501 * @cmd: "add", "del" or "clr". 502 * @masksize: Size of the mask in #of bytes 503 * @offset: Pattern byte offset in packet 504 * @patternoffset: Offset of start of pattern. Starting from field masksize. 505 * @patternsize: Size of the pattern itself in #of bytes 506 * @id: id 507 * @reasonsize: Size of the wakeup reason code 508 * @type: Type of pattern (enum brcmf_wowl_pattern_type) 509 */ 510 struct brcmf_fil_wowl_pattern_le { 511 u8 cmd[4]; 512 __le32 masksize; 513 __le32 offset; 514 __le32 patternoffset; 515 __le32 patternsize; 516 __le32 id; 517 __le32 reasonsize; 518 __le32 type; 519 /* u8 mask[] - Mask follows the structure above */ 520 /* u8 pattern[] - Pattern follows the mask is at 'patternoffset' */ 521 }; 522 523 struct brcmf_mbss_ssid_le { 524 __le32 bsscfgidx; 525 __le32 SSID_len; 526 unsigned char SSID[32]; 527 }; 528 529 /** 530 * struct brcmf_fil_country_le - country configuration structure. 531 * 532 * @country_abbrev: null-terminated country code used in the country IE. 533 * @rev: revision specifier for ccode. on set, -1 indicates unspecified. 534 * @ccode: null-terminated built-in country code. 535 */ 536 struct brcmf_fil_country_le { 537 char country_abbrev[BRCMF_COUNTRY_BUF_SZ]; 538 __le32 rev; 539 char ccode[BRCMF_COUNTRY_BUF_SZ]; 540 }; 541 542 /** 543 * struct brcmf_rev_info_le - device revision info. 544 * 545 * @vendorid: PCI vendor id. 546 * @deviceid: device id of chip. 547 * @radiorev: radio revision. 548 * @chiprev: chip revision. 549 * @corerev: core revision. 550 * @boardid: board identifier (usu. PCI sub-device id). 551 * @boardvendor: board vendor (usu. PCI sub-vendor id). 552 * @boardrev: board revision. 553 * @driverrev: driver version. 554 * @ucoderev: microcode version. 555 * @bus: bus type. 556 * @chipnum: chip number. 557 * @phytype: phy type. 558 * @phyrev: phy revision. 559 * @anarev: anacore rev. 560 * @chippkg: chip package info. 561 * @nvramrev: nvram revision number. 562 */ 563 struct brcmf_rev_info_le { 564 __le32 vendorid; 565 __le32 deviceid; 566 __le32 radiorev; 567 __le32 chiprev; 568 __le32 corerev; 569 __le32 boardid; 570 __le32 boardvendor; 571 __le32 boardrev; 572 __le32 driverrev; 573 __le32 ucoderev; 574 __le32 bus; 575 __le32 chipnum; 576 __le32 phytype; 577 __le32 phyrev; 578 __le32 anarev; 579 __le32 chippkg; 580 __le32 nvramrev; 581 }; 582 583 #endif /* FWIL_TYPES_H_ */ 584