2 * Copyright (c) 2012 Broadcom Corporation
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.
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.
21 #include <linux/if_ether.h>
24 #define BRCMF_FIL_ACTION_FRAME_SIZE 1800
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
32 #define BRCMF_BSS_INFO_VERSION 109 /* curr ver of brcmf_bss_info_le struct */
33 #define BRCMF_BSS_RSSI_ON_CHANNEL 0x0004
35 #define BRCMF_STA_WME 0x00000002 /* WMM association */
36 #define BRCMF_STA_AUTHE 0x00000008 /* Authenticated */
37 #define BRCMF_STA_ASSOC 0x00000010 /* Associated */
38 #define BRCMF_STA_AUTHO 0x00000020 /* Authorized */
39 #define BRCMF_STA_SCBSTATS 0x00004000 /* Per STA debug stats */
41 /* size of brcmf_scan_params not including variable length array */
42 #define BRCMF_SCAN_PARAMS_FIXED_SIZE 64
44 /* masks for channel and ssid count */
45 #define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff
46 #define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16
48 /* scan type definitions */
49 #define BRCMF_SCANTYPE_DEFAULT 0xFF
50 #define BRCMF_SCANTYPE_ACTIVE 0
51 #define BRCMF_SCANTYPE_PASSIVE 1
53 /* primary (ie tx) key */
54 #define BRCMF_PRIMARY_KEY (1 << 1)
55 #define DOT11_BSSTYPE_ANY 2
56 #define BRCMF_ESCAN_REQ_VERSION 1
58 #define BRCMF_MAXRATES_IN_SET 16 /* max # of rates in rateset */
60 /* OBSS Coex Auto/On/Off */
61 #define BRCMF_OBSS_COEX_AUTO (-1)
62 #define BRCMF_OBSS_COEX_OFF 0
63 #define BRCMF_OBSS_COEX_ON 1
66 /* Wakeup on Magic packet: */
67 #define BRCMF_WOWL_MAGIC (1 << 0)
68 /* Wakeup on Netpattern */
69 #define BRCMF_WOWL_NET (1 << 1)
70 /* Wakeup on loss-of-link due to Disassoc/Deauth: */
71 #define BRCMF_WOWL_DIS (1 << 2)
72 /* Wakeup on retrograde TSF: */
73 #define BRCMF_WOWL_RETR (1 << 3)
74 /* Wakeup on loss of beacon: */
75 #define BRCMF_WOWL_BCN (1 << 4)
76 /* Wakeup after test: */
77 #define BRCMF_WOWL_TST (1 << 5)
78 /* Wakeup after PTK refresh: */
79 #define BRCMF_WOWL_M1 (1 << 6)
80 /* Wakeup after receipt of EAP-Identity Req: */
81 #define BRCMF_WOWL_EAPID (1 << 7)
82 /* Wakeind via PME(0) or GPIO(1): */
83 #define BRCMF_WOWL_PME_GPIO (1 << 8)
84 /* need tkip phase 1 key to be updated by the driver: */
85 #define BRCMF_WOWL_NEEDTKIP1 (1 << 9)
86 /* enable wakeup if GTK fails: */
87 #define BRCMF_WOWL_GTK_FAILURE (1 << 10)
88 /* support extended magic packets: */
89 #define BRCMF_WOWL_EXTMAGPAT (1 << 11)
90 /* support ARP/NS/keepalive offloading: */
91 #define BRCMF_WOWL_ARPOFFLOAD (1 << 12)
92 /* read protocol version for EAPOL frames: */
93 #define BRCMF_WOWL_WPA2 (1 << 13)
94 /* If the bit is set, use key rotaton: */
95 #define BRCMF_WOWL_KEYROT (1 << 14)
96 /* If the bit is set, frm received was bcast frame: */
97 #define BRCMF_WOWL_BCAST (1 << 15)
98 /* If the bit is set, scan offload is enabled: */
99 #define BRCMF_WOWL_SCANOL (1 << 16)
100 /* Wakeup on tcpkeep alive timeout: */
101 #define BRCMF_WOWL_TCPKEEP_TIME (1 << 17)
102 /* Wakeup on mDNS Conflict Resolution: */
103 #define BRCMF_WOWL_MDNS_CONFLICT (1 << 18)
104 /* Wakeup on mDNS Service Connect: */
105 #define BRCMF_WOWL_MDNS_SERVICE (1 << 19)
106 /* tcp keepalive got data: */
107 #define BRCMF_WOWL_TCPKEEP_DATA (1 << 20)
108 /* Firmware died in wowl mode: */
109 #define BRCMF_WOWL_FW_HALT (1 << 21)
110 /* Enable detection of radio button changes: */
111 #define BRCMF_WOWL_ENAB_HWRADIO (1 << 22)
112 /* Offloads detected MIC failure(s): */
113 #define BRCMF_WOWL_MIC_FAIL (1 << 23)
114 /* Wakeup in Unassociated state (Net/Magic Pattern): */
115 #define BRCMF_WOWL_UNASSOC (1 << 24)
116 /* Wakeup if received matched secured pattern: */
117 #define BRCMF_WOWL_SECURE (1 << 25)
118 /* Link Down indication in WoWL mode: */
119 #define BRCMF_WOWL_LINKDOWN (1 << 31)
121 #define BRCMF_WOWL_MAXPATTERNS 8
122 #define BRCMF_WOWL_MAXPATTERNSIZE 128
124 #define BRCMF_COUNTRY_BUF_SZ 4
125 #define BRCMF_ANT_MAX 4
127 #define BRCMF_MAX_ASSOCLIST 128
129 /* join preference types for join_pref iovar */
130 enum brcmf_join_pref_types {
131 BRCMF_JOIN_PREF_RSSI = 1,
133 BRCMF_JOIN_PREF_BAND,
134 BRCMF_JOIN_PREF_RSSI_DELTA,
137 enum brcmf_fil_p2p_if_types {
138 BRCMF_FIL_P2P_IF_CLIENT,
140 BRCMF_FIL_P2P_IF_DYNBCN_GO,
141 BRCMF_FIL_P2P_IF_DEV,
144 enum brcmf_wowl_pattern_type {
145 BRCMF_WOWL_PATTERN_TYPE_BITMAP = 0,
146 BRCMF_WOWL_PATTERN_TYPE_ARP,
147 BRCMF_WOWL_PATTERN_TYPE_NA
150 struct brcmf_fil_p2p_if_le {
156 struct brcmf_fil_chan_info_le {
158 __le32 target_channel;
162 struct brcmf_fil_action_frame_le {
166 u8 data[BRCMF_FIL_ACTION_FRAME_SIZE];
169 struct brcmf_fil_af_params_le {
174 struct brcmf_fil_action_frame_le action_frame;
177 struct brcmf_fil_bss_enable_le {
182 struct brcmf_fil_bwcap_le {
188 * struct tdls_iovar - common structure for tdls iovars.
190 * @ea: ether address of peer station.
191 * @mode: mode value depending on specific tdls iovar.
192 * @chanspec: channel specification.
193 * @pad: unused (for future use).
195 struct brcmf_tdls_iovar_le {
196 u8 ea[ETH_ALEN]; /* Station address */
197 u8 mode; /* mode: depends on iovar */
199 __le32 pad; /* future */
202 enum brcmf_tdls_manual_ep_ops {
203 BRCMF_TDLS_MANUAL_EP_CREATE = 1,
204 BRCMF_TDLS_MANUAL_EP_DELETE = 3,
205 BRCMF_TDLS_MANUAL_EP_DISCOVERY = 6
208 /* Pattern matching filter. Specifies an offset within received packets to
209 * start matching, the pattern to match, the size of the pattern, and a bitmask
210 * that indicates which bits within the pattern should be matched.
212 struct brcmf_pkt_filter_pattern_le {
214 * Offset within received packet to start pattern matching.
215 * Offset '0' is the first byte of the ethernet header.
218 /* Size of the pattern. Bitmask must be the same size.*/
221 * Variable length mask and pattern data. mask starts at offset 0.
222 * Pattern immediately follows mask.
224 u8 mask_and_pattern[1];
227 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
228 struct brcmf_pkt_filter_le {
229 __le32 id; /* Unique filter id, specified by app. */
230 __le32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
231 __le32 negate_match; /* Negate the result of filter matches */
232 union { /* Filter definitions */
233 struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */
237 /* IOVAR "pkt_filter_enable" parameter. */
238 struct brcmf_pkt_filter_enable_le {
239 __le32 id; /* Unique filter id */
240 __le32 enable; /* Enable/disable bool */
243 /* BSS info structure
244 * Applications MUST CHECK ie_offset field and length field to access IEs and
245 * next bss_info structure in a vector (in struct brcmf_scan_results)
247 struct brcmf_bss_info_le {
248 __le32 version; /* version field */
249 __le32 length; /* byte length of data in this record,
250 * starting at version and including IEs
253 __le16 beacon_period; /* units are Kusec */
254 __le16 capability; /* Capability information */
258 __le32 count; /* # rates in this set */
259 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
260 } rateset; /* supported rates */
261 __le16 chanspec; /* chanspec for bss */
262 __le16 atim_window; /* units are Kusec */
263 u8 dtim_period; /* DTIM period */
264 __le16 RSSI; /* receive signal strength (in dBm) */
265 s8 phy_noise; /* noise (in dBm) */
267 u8 n_cap; /* BSS is 802.11N Capable */
268 /* 802.11N BSS Capabilities (based on HT_CAP_*): */
270 u8 ctl_ch; /* 802.11N BSS control channel number */
271 __le32 reserved32[1]; /* Reserved for expansion of BSS properties */
272 u8 flags; /* flags */
273 u8 reserved[3]; /* Reserved for expansion of BSS properties */
274 u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
276 __le16 ie_offset; /* offset at which IEs start, from beginning */
277 __le32 ie_length; /* byte length of Information Elements */
278 __le16 SNR; /* average SNR of during frame reception */
279 /* Add new fields here */
280 /* variable length Information Elements */
283 struct brcm_rateset_le {
284 /* # rates in this set */
286 /* rates in 500kbps units w/hi bit set if basic */
287 u8 rates[BRCMF_MAXRATES_IN_SET];
292 unsigned char SSID[32];
295 struct brcmf_ssid_le {
297 unsigned char SSID[32];
300 struct brcmf_scan_params_le {
301 struct brcmf_ssid_le ssid_le; /* default: {0, ""} */
302 u8 bssid[ETH_ALEN]; /* default: bcast */
303 s8 bss_type; /* default: any,
304 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
306 u8 scan_type; /* flags, 0 use default */
307 __le32 nprobes; /* -1 use default, number of probes per channel */
308 __le32 active_time; /* -1 use default, dwell time per channel for
311 __le32 passive_time; /* -1 use default, dwell time per channel
312 * for passive scanning
314 __le32 home_time; /* -1 use default, dwell time for the
315 * home channel between channel scans
317 __le32 channel_num; /* count of channels and ssids that follow
319 * low half is count of channels in
320 * channel_list, 0 means default (use all
321 * available channels)
323 * high half is entries in struct brcmf_ssid
324 * array that follows channel_list, aligned for
325 * s32 (4 bytes) meaning an odd channel count
326 * implies a 2-byte pad between end of
327 * channel_list and first ssid
329 * if ssid count is zero, single ssid in the
330 * fixed parameter portion is assumed, otherwise
331 * ssid in the fixed portion is ignored
333 __le16 channel_list[1]; /* list of chanspecs */
336 struct brcmf_scan_results {
340 struct brcmf_bss_info_le bss_info_le[];
343 struct brcmf_escan_params_le {
347 struct brcmf_scan_params_le params_le;
350 struct brcmf_escan_result_le {
355 struct brcmf_bss_info_le bss_info_le;
358 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \
359 sizeof(struct brcmf_bss_info_le))
361 /* used for association with a specific BSSID and chanspec list */
362 struct brcmf_assoc_params_le {
363 /* 00:00:00:00:00:00: broadcast scan */
365 /* 0: all available channels, otherwise count of chanspecs in
368 /* list of chanspecs */
369 __le16 chanspec_list[1];
373 * struct join_pref params - parameters for preferred join selection.
375 * @type: preference type (see enum brcmf_join_pref_types).
376 * @len: length of bytes following (currently always 2).
377 * @rssi_gain: signal gain for selection (only when @type is RSSI_DELTA).
378 * @band: band to which selection preference applies.
379 * This is used if @type is BAND or RSSI_DELTA.
381 struct brcmf_join_pref_params {
388 /* used for join with or without a specific bssid and channel list */
389 struct brcmf_join_params {
390 struct brcmf_ssid_le ssid_le;
391 struct brcmf_assoc_params_le params_le;
394 /* scan params for extended join */
395 struct brcmf_join_scan_params_le {
396 u8 scan_type; /* 0 use default, active or passive scan */
397 __le32 nprobes; /* -1 use default, nr of probes per channel */
398 __le32 active_time; /* -1 use default, dwell time per channel for
401 __le32 passive_time; /* -1 use default, dwell time per channel
402 * for passive scanning
404 __le32 home_time; /* -1 use default, dwell time for the home
405 * channel between channel scans
409 /* extended join params */
410 struct brcmf_ext_join_params_le {
411 struct brcmf_ssid_le ssid_le; /* {0, ""}: wildcard scan */
412 struct brcmf_join_scan_params_le scan_le;
413 struct brcmf_assoc_params_le assoc_le;
416 struct brcmf_wsec_key {
417 u32 index; /* key index */
418 u32 len; /* key length */
419 u8 data[WLAN_MAX_KEY_LEN]; /* key data */
421 u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
422 u32 flags; /* misc flags */
424 u32 iv_initialized; /* has IV been initialized already? */
428 u32 hi; /* upper 32 bits of IV */
429 u16 lo; /* lower 16 bits of IV */
432 u8 ea[ETH_ALEN]; /* per station */
436 * dongle requires same struct as above but with fields in little endian order
438 struct brcmf_wsec_key_le {
439 __le32 index; /* key index */
440 __le32 len; /* key length */
441 u8 data[WLAN_MAX_KEY_LEN]; /* key data */
443 __le32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
444 __le32 flags; /* misc flags */
446 __le32 iv_initialized; /* has IV been initialized already? */
450 __le32 hi; /* upper 32 bits of IV */
451 __le16 lo; /* lower 16 bits of IV */
454 u8 ea[ETH_ALEN]; /* per station */
457 /* Used to get specific STA parameters */
458 struct brcmf_scb_val_le {
463 /* channel encoding */
464 struct brcmf_channel_info_le {
466 __le32 target_channel;
470 struct brcmf_sta_info_le {
471 __le16 ver; /* version of this struct */
472 __le16 len; /* length in bytes of this structure */
473 __le16 cap; /* sta's advertised capabilities */
474 __le32 flags; /* flags defined below */
475 __le32 idle; /* time since data pkt rx'd from sta */
476 u8 ea[ETH_ALEN]; /* Station address */
477 __le32 count; /* # rates in this set */
478 u8 rates[BRCMF_MAXRATES_IN_SET]; /* rates in 500kbps units */
479 /* w/hi bit set if basic */
480 __le32 in; /* seconds elapsed since associated */
481 __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
482 __le32 tx_pkts; /* # of packets transmitted */
483 __le32 tx_failures; /* # of packets failed */
484 __le32 rx_ucast_pkts; /* # of unicast packets received */
485 __le32 rx_mcast_pkts; /* # of multicast packets received */
486 __le32 tx_rate; /* Rate of last successful tx frame */
487 __le32 rx_rate; /* Rate of last successful rx frame */
488 __le32 rx_decrypt_succeeds; /* # of packet decrypted successfully */
489 __le32 rx_decrypt_failures; /* # of packet decrypted failed */
490 __le32 tx_tot_pkts; /* # of tx pkts (ucast + mcast) */
491 __le32 rx_tot_pkts; /* # of data packets recvd (uni + mcast) */
492 __le32 tx_mcast_pkts; /* # of mcast pkts txed */
493 __le64 tx_tot_bytes; /* data bytes txed (ucast + mcast) */
494 __le64 rx_tot_bytes; /* data bytes recvd (ucast + mcast) */
495 __le64 tx_ucast_bytes; /* data bytes txed (ucast) */
496 __le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
497 __le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
498 __le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
499 s8 rssi[BRCMF_ANT_MAX]; /* per antenna rssi */
500 s8 nf[BRCMF_ANT_MAX]; /* per antenna noise floor */
501 __le16 aid; /* association ID */
502 __le16 ht_capabilities; /* advertised ht caps */
503 __le16 vht_flags; /* converted vht flags */
504 __le32 tx_pkts_retry_cnt; /* # of frames where a retry was
507 __le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
510 s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
511 * received data frame.
513 /* TX WLAN retry/failure statistics:
514 * Separated for host requested frames and locally generated frames.
515 * Include unicast frame only where the retries/failures can be counted.
517 __le32 tx_pkts_total; /* # user frames sent successfully */
518 __le32 tx_pkts_retries; /* # user frames retries */
519 __le32 tx_pkts_fw_total; /* # FW generated sent successfully */
520 __le32 tx_pkts_fw_retries; /* # retries for FW generated frames */
521 __le32 tx_pkts_fw_retry_exhausted; /* # FW generated where a retry
524 __le32 rx_pkts_retried; /* # rx with retry bit set */
525 __le32 tx_rate_fallback; /* lowest fallback TX rate */
528 struct brcmf_chanspec_list {
529 __le32 count; /* # of entries */
530 __le32 element[1]; /* variable length uint32 list */
535 * WLC_E_P2P_PROBREQ_MSG
536 * WLC_E_ACTION_FRAME_RX
538 struct brcmf_rx_mgmt_data {
547 * struct brcmf_fil_wowl_pattern_le - wowl pattern configuration struct.
549 * @cmd: "add", "del" or "clr".
550 * @masksize: Size of the mask in #of bytes
551 * @offset: Pattern byte offset in packet
552 * @patternoffset: Offset of start of pattern. Starting from field masksize.
553 * @patternsize: Size of the pattern itself in #of bytes
555 * @reasonsize: Size of the wakeup reason code
556 * @type: Type of pattern (enum brcmf_wowl_pattern_type)
558 struct brcmf_fil_wowl_pattern_le {
562 __le32 patternoffset;
567 /* u8 mask[] - Mask follows the structure above */
568 /* u8 pattern[] - Pattern follows the mask is at 'patternoffset' */
571 struct brcmf_mbss_ssid_le {
574 unsigned char SSID[32];
578 * struct brcmf_fil_country_le - country configuration structure.
580 * @country_abbrev: null-terminated country code used in the country IE.
581 * @rev: revision specifier for ccode. on set, -1 indicates unspecified.
582 * @ccode: null-terminated built-in country code.
584 struct brcmf_fil_country_le {
585 char country_abbrev[BRCMF_COUNTRY_BUF_SZ];
587 char ccode[BRCMF_COUNTRY_BUF_SZ];
591 * struct brcmf_rev_info_le - device revision info.
593 * @vendorid: PCI vendor id.
594 * @deviceid: device id of chip.
595 * @radiorev: radio revision.
596 * @chiprev: chip revision.
597 * @corerev: core revision.
598 * @boardid: board identifier (usu. PCI sub-device id).
599 * @boardvendor: board vendor (usu. PCI sub-vendor id).
600 * @boardrev: board revision.
601 * @driverrev: driver version.
602 * @ucoderev: microcode version.
604 * @chipnum: chip number.
605 * @phytype: phy type.
606 * @phyrev: phy revision.
607 * @anarev: anacore rev.
608 * @chippkg: chip package info.
609 * @nvramrev: nvram revision number.
611 struct brcmf_rev_info_le {
632 * struct brcmf_assoclist_le - request assoc list.
634 * @count: indicates number of stations.
635 * @mac: MAC addresses of stations.
637 struct brcmf_assoclist_le {
639 u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
642 #endif /* FWIL_TYPES_H_ */