Linux-libre 4.14.145-gnu
[librecmc/linux-libre.git] / drivers / net / wireless / broadcom / brcm80211 / brcmfmac / fwil_types.h
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_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 */
40
41 /* size of brcmf_scan_params not including variable length array */
42 #define BRCMF_SCAN_PARAMS_FIXED_SIZE    64
43
44 /* masks for channel and ssid count */
45 #define BRCMF_SCAN_PARAMS_COUNT_MASK    0x0000ffff
46 #define BRCMF_SCAN_PARAMS_NSSID_SHIFT   16
47
48 /* scan type definitions */
49 #define BRCMF_SCANTYPE_DEFAULT          0xFF
50 #define BRCMF_SCANTYPE_ACTIVE           0
51 #define BRCMF_SCANTYPE_PASSIVE          1
52
53 #define BRCMF_WSEC_MAX_PSK_LEN          32
54 #define BRCMF_WSEC_PASSPHRASE           BIT(0)
55
56 /* primary (ie tx) key */
57 #define BRCMF_PRIMARY_KEY               (1 << 1)
58 #define DOT11_BSSTYPE_ANY               2
59 #define BRCMF_ESCAN_REQ_VERSION         1
60
61 #define BRCMF_MAXRATES_IN_SET           16      /* max # of rates in rateset */
62
63 /* OBSS Coex Auto/On/Off */
64 #define BRCMF_OBSS_COEX_AUTO            (-1)
65 #define BRCMF_OBSS_COEX_OFF             0
66 #define BRCMF_OBSS_COEX_ON              1
67
68 /* WOWL bits */
69 /* Wakeup on Magic packet: */
70 #define BRCMF_WOWL_MAGIC                (1 << 0)
71 /* Wakeup on Netpattern */
72 #define BRCMF_WOWL_NET                  (1 << 1)
73 /* Wakeup on loss-of-link due to Disassoc/Deauth: */
74 #define BRCMF_WOWL_DIS                  (1 << 2)
75 /* Wakeup on retrograde TSF: */
76 #define BRCMF_WOWL_RETR                 (1 << 3)
77 /* Wakeup on loss of beacon: */
78 #define BRCMF_WOWL_BCN                  (1 << 4)
79 /* Wakeup after test: */
80 #define BRCMF_WOWL_TST                  (1 << 5)
81 /* Wakeup after PTK refresh: */
82 #define BRCMF_WOWL_M1                   (1 << 6)
83 /* Wakeup after receipt of EAP-Identity Req: */
84 #define BRCMF_WOWL_EAPID                (1 << 7)
85 /* Wakeind via PME(0) or GPIO(1): */
86 #define BRCMF_WOWL_PME_GPIO             (1 << 8)
87 /* need tkip phase 1 key to be updated by the driver: */
88 #define BRCMF_WOWL_NEEDTKIP1            (1 << 9)
89 /* enable wakeup if GTK fails: */
90 #define BRCMF_WOWL_GTK_FAILURE          (1 << 10)
91 /* support extended magic packets: */
92 #define BRCMF_WOWL_EXTMAGPAT            (1 << 11)
93 /* support ARP/NS/keepalive offloading: */
94 #define BRCMF_WOWL_ARPOFFLOAD           (1 << 12)
95 /* read protocol version for EAPOL frames: */
96 #define BRCMF_WOWL_WPA2                 (1 << 13)
97 /* If the bit is set, use key rotaton: */
98 #define BRCMF_WOWL_KEYROT               (1 << 14)
99 /* If the bit is set, frm received was bcast frame: */
100 #define BRCMF_WOWL_BCAST                (1 << 15)
101 /* If the bit is set, scan offload is enabled: */
102 #define BRCMF_WOWL_SCANOL               (1 << 16)
103 /* Wakeup on tcpkeep alive timeout: */
104 #define BRCMF_WOWL_TCPKEEP_TIME         (1 << 17)
105 /* Wakeup on mDNS Conflict Resolution: */
106 #define BRCMF_WOWL_MDNS_CONFLICT        (1 << 18)
107 /* Wakeup on mDNS Service Connect: */
108 #define BRCMF_WOWL_MDNS_SERVICE         (1 << 19)
109 /* tcp keepalive got data: */
110 #define BRCMF_WOWL_TCPKEEP_DATA         (1 << 20)
111 /* Firmware died in wowl mode: */
112 #define BRCMF_WOWL_FW_HALT              (1 << 21)
113 /* Enable detection of radio button changes: */
114 #define BRCMF_WOWL_ENAB_HWRADIO         (1 << 22)
115 /* Offloads detected MIC failure(s): */
116 #define BRCMF_WOWL_MIC_FAIL             (1 << 23)
117 /* Wakeup in Unassociated state (Net/Magic Pattern): */
118 #define BRCMF_WOWL_UNASSOC              (1 << 24)
119 /* Wakeup if received matched secured pattern: */
120 #define BRCMF_WOWL_SECURE               (1 << 25)
121 /* Wakeup on finding preferred network */
122 #define BRCMF_WOWL_PFN_FOUND            (1 << 27)
123 /* Wakeup on receiving pairwise key EAP packets: */
124 #define WIPHY_WOWL_EAP_PK               (1 << 28)
125 /* Link Down indication in WoWL mode: */
126 #define BRCMF_WOWL_LINKDOWN             (1 << 31)
127
128 #define BRCMF_WOWL_MAXPATTERNS          8
129 #define BRCMF_WOWL_MAXPATTERNSIZE       128
130
131 #define BRCMF_COUNTRY_BUF_SZ            4
132 #define BRCMF_ANT_MAX                   4
133
134 #define BRCMF_MAX_ASSOCLIST             128
135
136 #define BRCMF_TXBF_SU_BFE_CAP           BIT(0)
137 #define BRCMF_TXBF_MU_BFE_CAP           BIT(1)
138 #define BRCMF_TXBF_SU_BFR_CAP           BIT(0)
139 #define BRCMF_TXBF_MU_BFR_CAP           BIT(1)
140
141 #define BRCMF_MAXPMKID                  16      /* max # PMKID cache entries */
142 #define BRCMF_NUMCHANNELS               64
143
144 #define BRCMF_PFN_MACADDR_CFG_VER       1
145 #define BRCMF_PFN_MAC_OUI_ONLY          BIT(0)
146 #define BRCMF_PFN_SET_MAC_UNASSOC       BIT(1)
147
148 #define BRCMF_MCSSET_LEN                16
149
150 #define BRCMF_RSN_KCK_LENGTH            16
151 #define BRCMF_RSN_KEK_LENGTH            16
152 #define BRCMF_RSN_REPLAY_LEN            8
153
154 #define BRCMF_MFP_NONE                  0
155 #define BRCMF_MFP_CAPABLE               1
156 #define BRCMF_MFP_REQUIRED              2
157
158 /* join preference types for join_pref iovar */
159 enum brcmf_join_pref_types {
160         BRCMF_JOIN_PREF_RSSI = 1,
161         BRCMF_JOIN_PREF_WPA,
162         BRCMF_JOIN_PREF_BAND,
163         BRCMF_JOIN_PREF_RSSI_DELTA,
164 };
165
166 enum brcmf_fil_p2p_if_types {
167         BRCMF_FIL_P2P_IF_CLIENT,
168         BRCMF_FIL_P2P_IF_GO,
169         BRCMF_FIL_P2P_IF_DYNBCN_GO,
170         BRCMF_FIL_P2P_IF_DEV,
171 };
172
173 enum brcmf_wowl_pattern_type {
174         BRCMF_WOWL_PATTERN_TYPE_BITMAP = 0,
175         BRCMF_WOWL_PATTERN_TYPE_ARP,
176         BRCMF_WOWL_PATTERN_TYPE_NA
177 };
178
179 struct brcmf_fil_p2p_if_le {
180         u8 addr[ETH_ALEN];
181         __le16 type;
182         __le16 chspec;
183 };
184
185 struct brcmf_fil_chan_info_le {
186         __le32 hw_channel;
187         __le32 target_channel;
188         __le32 scan_channel;
189 };
190
191 struct brcmf_fil_action_frame_le {
192         u8      da[ETH_ALEN];
193         __le16  len;
194         __le32  packet_id;
195         u8      data[BRCMF_FIL_ACTION_FRAME_SIZE];
196 };
197
198 struct brcmf_fil_af_params_le {
199         __le32                                  channel;
200         __le32                                  dwell_time;
201         u8                                      bssid[ETH_ALEN];
202         u8                                      pad[2];
203         struct brcmf_fil_action_frame_le        action_frame;
204 };
205
206 struct brcmf_fil_bss_enable_le {
207         __le32 bsscfgidx;
208         __le32 enable;
209 };
210
211 struct brcmf_fil_bwcap_le {
212         __le32 band;
213         __le32 bw_cap;
214 };
215
216 /**
217  * struct tdls_iovar - common structure for tdls iovars.
218  *
219  * @ea: ether address of peer station.
220  * @mode: mode value depending on specific tdls iovar.
221  * @chanspec: channel specification.
222  * @pad: unused (for future use).
223  */
224 struct brcmf_tdls_iovar_le {
225         u8 ea[ETH_ALEN];                /* Station address */
226         u8 mode;                        /* mode: depends on iovar */
227         __le16 chanspec;
228         __le32 pad;                     /* future */
229 };
230
231 enum brcmf_tdls_manual_ep_ops {
232         BRCMF_TDLS_MANUAL_EP_CREATE = 1,
233         BRCMF_TDLS_MANUAL_EP_DELETE = 3,
234         BRCMF_TDLS_MANUAL_EP_DISCOVERY = 6
235 };
236
237 /* Pattern matching filter. Specifies an offset within received packets to
238  * start matching, the pattern to match, the size of the pattern, and a bitmask
239  * that indicates which bits within the pattern should be matched.
240  */
241 struct brcmf_pkt_filter_pattern_le {
242         /*
243          * Offset within received packet to start pattern matching.
244          * Offset '0' is the first byte of the ethernet header.
245          */
246         __le32 offset;
247         /* Size of the pattern.  Bitmask must be the same size.*/
248         __le32 size_bytes;
249         /*
250          * Variable length mask and pattern data. mask starts at offset 0.
251          * Pattern immediately follows mask.
252          */
253         u8 mask_and_pattern[1];
254 };
255
256 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
257 struct brcmf_pkt_filter_le {
258         __le32 id;              /* Unique filter id, specified by app. */
259         __le32 type;            /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
260         __le32 negate_match;    /* Negate the result of filter matches */
261         union {                 /* Filter definitions */
262                 struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */
263         } u;
264 };
265
266 /* IOVAR "pkt_filter_enable" parameter. */
267 struct brcmf_pkt_filter_enable_le {
268         __le32 id;              /* Unique filter id */
269         __le32 enable;          /* Enable/disable bool */
270 };
271
272 /* BSS info structure
273  * Applications MUST CHECK ie_offset field and length field to access IEs and
274  * next bss_info structure in a vector (in struct brcmf_scan_results)
275  */
276 struct brcmf_bss_info_le {
277         __le32 version;         /* version field */
278         __le32 length;          /* byte length of data in this record,
279                                  * starting at version and including IEs
280                                  */
281         u8 BSSID[ETH_ALEN];
282         __le16 beacon_period;   /* units are Kusec */
283         __le16 capability;      /* Capability information */
284         u8 SSID_len;
285         u8 SSID[32];
286         struct {
287                 __le32 count;   /* # rates in this set */
288                 u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
289         } rateset;              /* supported rates */
290         __le16 chanspec;        /* chanspec for bss */
291         __le16 atim_window;     /* units are Kusec */
292         u8 dtim_period; /* DTIM period */
293         __le16 RSSI;            /* receive signal strength (in dBm) */
294         s8 phy_noise;           /* noise (in dBm) */
295
296         u8 n_cap;               /* BSS is 802.11N Capable */
297         /* 802.11N BSS Capabilities (based on HT_CAP_*): */
298         __le32 nbss_cap;
299         u8 ctl_ch;              /* 802.11N BSS control channel number */
300         __le32 reserved32[1];   /* Reserved for expansion of BSS properties */
301         u8 flags;               /* flags */
302         u8 reserved[3]; /* Reserved for expansion of BSS properties */
303         u8 basic_mcs[BRCMF_MCSSET_LEN]; /* 802.11N BSS required MCS set */
304
305         __le16 ie_offset;       /* offset at which IEs start, from beginning */
306         __le32 ie_length;       /* byte length of Information Elements */
307         __le16 SNR;             /* average SNR of during frame reception */
308         /* Add new fields here */
309         /* variable length Information Elements */
310 };
311
312 struct brcm_rateset_le {
313         /* # rates in this set */
314         __le32 count;
315         /* rates in 500kbps units w/hi bit set if basic */
316         u8 rates[BRCMF_MAXRATES_IN_SET];
317 };
318
319 struct brcmf_ssid_le {
320         __le32 SSID_len;
321         unsigned char SSID[IEEE80211_MAX_SSID_LEN];
322 };
323
324 struct brcmf_scan_params_le {
325         struct brcmf_ssid_le ssid_le;   /* default: {0, ""} */
326         u8 bssid[ETH_ALEN];     /* default: bcast */
327         s8 bss_type;            /* default: any,
328                                  * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
329                                  */
330         u8 scan_type;   /* flags, 0 use default */
331         __le32 nprobes;   /* -1 use default, number of probes per channel */
332         __le32 active_time;     /* -1 use default, dwell time per channel for
333                                  * active scanning
334                                  */
335         __le32 passive_time;    /* -1 use default, dwell time per channel
336                                  * for passive scanning
337                                  */
338         __le32 home_time;       /* -1 use default, dwell time for the
339                                  * home channel between channel scans
340                                  */
341         __le32 channel_num;     /* count of channels and ssids that follow
342                                  *
343                                  * low half is count of channels in
344                                  * channel_list, 0 means default (use all
345                                  * available channels)
346                                  *
347                                  * high half is entries in struct brcmf_ssid
348                                  * array that follows channel_list, aligned for
349                                  * s32 (4 bytes) meaning an odd channel count
350                                  * implies a 2-byte pad between end of
351                                  * channel_list and first ssid
352                                  *
353                                  * if ssid count is zero, single ssid in the
354                                  * fixed parameter portion is assumed, otherwise
355                                  * ssid in the fixed portion is ignored
356                                  */
357         __le16 channel_list[1]; /* list of chanspecs */
358 };
359
360 struct brcmf_scan_results {
361         u32 buflen;
362         u32 version;
363         u32 count;
364         struct brcmf_bss_info_le bss_info_le[];
365 };
366
367 struct brcmf_escan_params_le {
368         __le32 version;
369         __le16 action;
370         __le16 sync_id;
371         struct brcmf_scan_params_le params_le;
372 };
373
374 struct brcmf_escan_result_le {
375         __le32 buflen;
376         __le32 version;
377         __le16 sync_id;
378         __le16 bss_count;
379         struct brcmf_bss_info_le bss_info_le;
380 };
381
382 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \
383         sizeof(struct brcmf_bss_info_le))
384
385 /* used for association with a specific BSSID and chanspec list */
386 struct brcmf_assoc_params_le {
387         /* 00:00:00:00:00:00: broadcast scan */
388         u8 bssid[ETH_ALEN];
389         /* 0: all available channels, otherwise count of chanspecs in
390          * chanspec_list */
391         __le32 chanspec_num;
392         /* list of chanspecs */
393         __le16 chanspec_list[1];
394 };
395
396 /**
397  * struct join_pref params - parameters for preferred join selection.
398  *
399  * @type: preference type (see enum brcmf_join_pref_types).
400  * @len: length of bytes following (currently always 2).
401  * @rssi_gain: signal gain for selection (only when @type is RSSI_DELTA).
402  * @band: band to which selection preference applies.
403  *      This is used if @type is BAND or RSSI_DELTA.
404  */
405 struct brcmf_join_pref_params {
406         u8 type;
407         u8 len;
408         u8 rssi_gain;
409         u8 band;
410 };
411
412 /* used for join with or without a specific bssid and channel list */
413 struct brcmf_join_params {
414         struct brcmf_ssid_le ssid_le;
415         struct brcmf_assoc_params_le params_le;
416 };
417
418 /* scan params for extended join */
419 struct brcmf_join_scan_params_le {
420         u8 scan_type;           /* 0 use default, active or passive scan */
421         __le32 nprobes;         /* -1 use default, nr of probes per channel */
422         __le32 active_time;     /* -1 use default, dwell time per channel for
423                                  * active scanning
424                                  */
425         __le32 passive_time;    /* -1 use default, dwell time per channel
426                                  * for passive scanning
427                                  */
428         __le32 home_time;       /* -1 use default, dwell time for the home
429                                  * channel between channel scans
430                                  */
431 };
432
433 /* extended join params */
434 struct brcmf_ext_join_params_le {
435         struct brcmf_ssid_le ssid_le;   /* {0, ""}: wildcard scan */
436         struct brcmf_join_scan_params_le scan_le;
437         struct brcmf_assoc_params_le assoc_le;
438 };
439
440 struct brcmf_wsec_key {
441         u32 index;              /* key index */
442         u32 len;                /* key length */
443         u8 data[WLAN_MAX_KEY_LEN];      /* key data */
444         u32 pad_1[18];
445         u32 algo;       /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
446         u32 flags;      /* misc flags */
447         u32 pad_2[3];
448         u32 iv_initialized;     /* has IV been initialized already? */
449         u32 pad_3;
450         /* Rx IV */
451         struct {
452                 u32 hi; /* upper 32 bits of IV */
453                 u16 lo; /* lower 16 bits of IV */
454         } rxiv;
455         u32 pad_4[2];
456         u8 ea[ETH_ALEN];        /* per station */
457 };
458
459 /*
460  * dongle requires same struct as above but with fields in little endian order
461  */
462 struct brcmf_wsec_key_le {
463         __le32 index;           /* key index */
464         __le32 len;             /* key length */
465         u8 data[WLAN_MAX_KEY_LEN];      /* key data */
466         __le32 pad_1[18];
467         __le32 algo;    /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
468         __le32 flags;   /* misc flags */
469         __le32 pad_2[3];
470         __le32 iv_initialized;  /* has IV been initialized already? */
471         __le32 pad_3;
472         /* Rx IV */
473         struct {
474                 __le32 hi;      /* upper 32 bits of IV */
475                 __le16 lo;      /* lower 16 bits of IV */
476         } rxiv;
477         __le32 pad_4[2];
478         u8 ea[ETH_ALEN];        /* per station */
479 };
480
481 /**
482  * struct brcmf_wsec_pmk_le - firmware pmk material.
483  *
484  * @key_len: number of octets in key material.
485  * @flags: key handling qualifiers.
486  * @key: PMK key material.
487  */
488 struct brcmf_wsec_pmk_le {
489         __le16  key_len;
490         __le16  flags;
491         u8 key[2 * BRCMF_WSEC_MAX_PSK_LEN + 1];
492 };
493
494 /* Used to get specific STA parameters */
495 struct brcmf_scb_val_le {
496         __le32 val;
497         u8 ea[ETH_ALEN];
498 };
499
500 /* channel encoding */
501 struct brcmf_channel_info_le {
502         __le32 hw_channel;
503         __le32 target_channel;
504         __le32 scan_channel;
505 };
506
507 struct brcmf_sta_info_le {
508         __le16 ver;             /* version of this struct */
509         __le16 len;             /* length in bytes of this structure */
510         __le16 cap;             /* sta's advertised capabilities */
511         __le32 flags;           /* flags defined below */
512         __le32 idle;            /* time since data pkt rx'd from sta */
513         u8 ea[ETH_ALEN];                /* Station address */
514         __le32 count;                   /* # rates in this set */
515         u8 rates[BRCMF_MAXRATES_IN_SET];        /* rates in 500kbps units */
516                                                 /* w/hi bit set if basic */
517         __le32 in;              /* seconds elapsed since associated */
518         __le32 listen_interval_inms; /* Min Listen interval in ms for STA */
519         __le32 tx_pkts; /* # of packets transmitted */
520         __le32 tx_failures;     /* # of packets failed */
521         __le32 rx_ucast_pkts;   /* # of unicast packets received */
522         __le32 rx_mcast_pkts;   /* # of multicast packets received */
523         __le32 tx_rate; /* Rate of last successful tx frame */
524         __le32 rx_rate; /* Rate of last successful rx frame */
525         __le32 rx_decrypt_succeeds;     /* # of packet decrypted successfully */
526         __le32 rx_decrypt_failures;     /* # of packet decrypted failed */
527         __le32 tx_tot_pkts;    /* # of tx pkts (ucast + mcast) */
528         __le32 rx_tot_pkts;    /* # of data packets recvd (uni + mcast) */
529         __le32 tx_mcast_pkts;  /* # of mcast pkts txed */
530         __le64 tx_tot_bytes;   /* data bytes txed (ucast + mcast) */
531         __le64 rx_tot_bytes;   /* data bytes recvd (ucast + mcast) */
532         __le64 tx_ucast_bytes; /* data bytes txed (ucast) */
533         __le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
534         __le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
535         __le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
536         s8 rssi[BRCMF_ANT_MAX];   /* per antenna rssi */
537         s8 nf[BRCMF_ANT_MAX];     /* per antenna noise floor */
538         __le16 aid;                    /* association ID */
539         __le16 ht_capabilities;        /* advertised ht caps */
540         __le16 vht_flags;              /* converted vht flags */
541         __le32 tx_pkts_retry_cnt;      /* # of frames where a retry was
542                                          * exhausted.
543                                          */
544         __le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
545                                          * was exhausted
546                                          */
547         s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
548                                             * received data frame.
549                                             */
550         /* TX WLAN retry/failure statistics:
551          * Separated for host requested frames and locally generated frames.
552          * Include unicast frame only where the retries/failures can be counted.
553          */
554         __le32 tx_pkts_total;          /* # user frames sent successfully */
555         __le32 tx_pkts_retries;        /* # user frames retries */
556         __le32 tx_pkts_fw_total;       /* # FW generated sent successfully */
557         __le32 tx_pkts_fw_retries;     /* # retries for FW generated frames */
558         __le32 tx_pkts_fw_retry_exhausted;     /* # FW generated where a retry
559                                                 * was exhausted
560                                                 */
561         __le32 rx_pkts_retried;        /* # rx with retry bit set */
562         __le32 tx_rate_fallback;       /* lowest fallback TX rate */
563 };
564
565 struct brcmf_chanspec_list {
566         __le32  count;          /* # of entries */
567         __le32  element[1];     /* variable length uint32 list */
568 };
569
570 /*
571  * WLC_E_PROBRESP_MSG
572  * WLC_E_P2P_PROBREQ_MSG
573  * WLC_E_ACTION_FRAME_RX
574  */
575 struct brcmf_rx_mgmt_data {
576         __be16  version;
577         __be16  chanspec;
578         __be32  rssi;
579         __be32  mactime;
580         __be32  rate;
581 };
582
583 /**
584  * struct brcmf_fil_wowl_pattern_le - wowl pattern configuration struct.
585  *
586  * @cmd: "add", "del" or "clr".
587  * @masksize: Size of the mask in #of bytes
588  * @offset: Pattern byte offset in packet
589  * @patternoffset: Offset of start of pattern. Starting from field masksize.
590  * @patternsize: Size of the pattern itself in #of bytes
591  * @id: id
592  * @reasonsize: Size of the wakeup reason code
593  * @type: Type of pattern (enum brcmf_wowl_pattern_type)
594  */
595 struct brcmf_fil_wowl_pattern_le {
596         u8      cmd[4];
597         __le32  masksize;
598         __le32  offset;
599         __le32  patternoffset;
600         __le32  patternsize;
601         __le32  id;
602         __le32  reasonsize;
603         __le32  type;
604         /* u8 mask[] - Mask follows the structure above */
605         /* u8 pattern[] - Pattern follows the mask is at 'patternoffset' */
606 };
607
608 struct brcmf_mbss_ssid_le {
609         __le32  bsscfgidx;
610         __le32  SSID_len;
611         unsigned char SSID[32];
612 };
613
614 /**
615  * struct brcmf_fil_country_le - country configuration structure.
616  *
617  * @country_abbrev: null-terminated country code used in the country IE.
618  * @rev: revision specifier for ccode. on set, -1 indicates unspecified.
619  * @ccode: null-terminated built-in country code.
620  */
621 struct brcmf_fil_country_le {
622         char country_abbrev[BRCMF_COUNTRY_BUF_SZ];
623         __le32 rev;
624         char ccode[BRCMF_COUNTRY_BUF_SZ];
625 };
626
627 /**
628  * struct brcmf_rev_info_le - device revision info.
629  *
630  * @vendorid: PCI vendor id.
631  * @deviceid: device id of chip.
632  * @radiorev: radio revision.
633  * @chiprev: chip revision.
634  * @corerev: core revision.
635  * @boardid: board identifier (usu. PCI sub-device id).
636  * @boardvendor: board vendor (usu. PCI sub-vendor id).
637  * @boardrev: board revision.
638  * @driverrev: driver version.
639  * @ucoderev: microcode version.
640  * @bus: bus type.
641  * @chipnum: chip number.
642  * @phytype: phy type.
643  * @phyrev: phy revision.
644  * @anarev: anacore rev.
645  * @chippkg: chip package info.
646  * @nvramrev: nvram revision number.
647  */
648 struct brcmf_rev_info_le {
649         __le32 vendorid;
650         __le32 deviceid;
651         __le32 radiorev;
652         __le32 chiprev;
653         __le32 corerev;
654         __le32 boardid;
655         __le32 boardvendor;
656         __le32 boardrev;
657         __le32 driverrev;
658         __le32 ucoderev;
659         __le32 bus;
660         __le32 chipnum;
661         __le32 phytype;
662         __le32 phyrev;
663         __le32 anarev;
664         __le32 chippkg;
665         __le32 nvramrev;
666 };
667
668 /**
669  * struct brcmf_assoclist_le - request assoc list.
670  *
671  * @count: indicates number of stations.
672  * @mac: MAC addresses of stations.
673  */
674 struct brcmf_assoclist_le {
675         __le32 count;
676         u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
677 };
678
679 /**
680  * struct brcmf_wowl_wakeind_le - Wakeup indicators
681  *      Note: note both fields contain same information.
682  *
683  * @pci_wakeind: Whether PCI PMECSR PMEStatus bit was set.
684  * @ucode_wakeind: What wakeup-event indication was set by ucode
685  */
686 struct brcmf_wowl_wakeind_le {
687         __le32 pci_wakeind;
688         __le32 ucode_wakeind;
689 };
690
691 /**
692  * struct brcmf_pmksa - PMK Security Association
693  *
694  * @bssid: The AP's BSSID.
695  * @pmkid: he PMK material itself.
696  */
697 struct brcmf_pmksa {
698         u8 bssid[ETH_ALEN];
699         u8 pmkid[WLAN_PMKID_LEN];
700 };
701
702 /**
703  * struct brcmf_pmk_list_le - List of pmksa's.
704  *
705  * @npmk: Number of pmksa's.
706  * @pmk: PMK SA information.
707  */
708 struct brcmf_pmk_list_le {
709         __le32 npmk;
710         struct brcmf_pmksa pmk[BRCMF_MAXPMKID];
711 };
712
713 /**
714  * struct brcmf_pno_param_le - PNO scan configuration parameters
715  *
716  * @version: PNO parameters version.
717  * @scan_freq: scan frequency.
718  * @lost_network_timeout: #sec. to declare discovered network as lost.
719  * @flags: Bit field to control features of PFN such as sort criteria auto
720  *      enable switch and background scan.
721  * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort
722  *      criteria.
723  * @bestn: number of best networks in each scan.
724  * @mscan: number of scans recorded.
725  * @repeat: minimum number of scan intervals before scan frequency changes
726  *      in adaptive scan.
727  * @exp: exponent of 2 for maximum scan interval.
728  * @slow_freq: slow scan period.
729  */
730 struct brcmf_pno_param_le {
731         __le32 version;
732         __le32 scan_freq;
733         __le32 lost_network_timeout;
734         __le16 flags;
735         __le16 rssi_margin;
736         u8 bestn;
737         u8 mscan;
738         u8 repeat;
739         u8 exp;
740         __le32 slow_freq;
741 };
742
743 /**
744  * struct brcmf_pno_config_le - PNO channel configuration.
745  *
746  * @reporttype: determines what is reported.
747  * @channel_num: number of channels specified in @channel_list.
748  * @channel_list: channels to use in PNO scan.
749  * @flags: reserved.
750  */
751 struct brcmf_pno_config_le {
752         __le32  reporttype;
753         __le32  channel_num;
754         __le16  channel_list[BRCMF_NUMCHANNELS];
755         __le32  flags;
756 };
757
758 /**
759  * struct brcmf_pno_net_param_le - scan parameters per preferred network.
760  *
761  * @ssid: ssid name and its length.
762  * @flags: bit2: hidden.
763  * @infra: BSS vs IBSS.
764  * @auth: Open vs Closed.
765  * @wpa_auth: WPA type.
766  * @wsec: wsec value.
767  */
768 struct brcmf_pno_net_param_le {
769         struct brcmf_ssid_le ssid;
770         __le32 flags;
771         __le32 infra;
772         __le32 auth;
773         __le32 wpa_auth;
774         __le32 wsec;
775 };
776
777 /**
778  * struct brcmf_pno_net_info_le - information per found network.
779  *
780  * @bssid: BSS network identifier.
781  * @channel: channel number only.
782  * @SSID_len: length of ssid.
783  * @SSID: ssid characters.
784  * @RSSI: receive signal strength (in dBm).
785  * @timestamp: age in seconds.
786  */
787 struct brcmf_pno_net_info_le {
788         u8 bssid[ETH_ALEN];
789         u8 channel;
790         u8 SSID_len;
791         u8 SSID[32];
792         __le16  RSSI;
793         __le16  timestamp;
794 };
795
796 /**
797  * struct brcmf_pno_scanresults_le - result returned in PNO NET FOUND event.
798  *
799  * @version: PNO version identifier.
800  * @status: indicates completion status of PNO scan.
801  * @count: amount of brcmf_pno_net_info_le entries appended.
802  */
803 struct brcmf_pno_scanresults_le {
804         __le32 version;
805         __le32 status;
806         __le32 count;
807 };
808
809 struct brcmf_pno_scanresults_v2_le {
810         __le32 version;
811         __le32 status;
812         __le32 count;
813         __le32 scan_ch_bucket;
814 };
815
816 /**
817  * struct brcmf_pno_macaddr_le - to configure PNO macaddr randomization.
818  *
819  * @version: PNO version identifier.
820  * @flags: Flags defining how mac addrss should be used.
821  * @mac: MAC address.
822  */
823 struct brcmf_pno_macaddr_le {
824         u8 version;
825         u8 flags;
826         u8 mac[ETH_ALEN];
827 };
828
829 /**
830  * struct brcmf_pno_bssid_le - bssid configuration for PNO scan.
831  *
832  * @bssid: BSS network identifier.
833  * @flags: flags for this BSSID.
834  */
835 struct brcmf_pno_bssid_le {
836         u8 bssid[ETH_ALEN];
837         __le16 flags;
838 };
839
840 /**
841  * struct brcmf_pktcnt_le - packet counters.
842  *
843  * @rx_good_pkt: packets (MSDUs & MMPDUs) received from this station
844  * @rx_bad_pkt: failed rx packets
845  * @tx_good_pkt: packets (MSDUs & MMPDUs) transmitted to this station
846  * @tx_bad_pkt: failed tx packets
847  * @rx_ocast_good_pkt: unicast packets destined for others
848  */
849 struct brcmf_pktcnt_le {
850         __le32 rx_good_pkt;
851         __le32 rx_bad_pkt;
852         __le32 tx_good_pkt;
853         __le32 tx_bad_pkt;
854         __le32 rx_ocast_good_pkt;
855 };
856
857 /**
858  * struct brcmf_gtk_keyinfo_le - GTP rekey data
859  *
860  * @kck: key confirmation key.
861  * @kek: key encryption key.
862  * @replay_counter: replay counter.
863  */
864 struct brcmf_gtk_keyinfo_le {
865         u8 kck[BRCMF_RSN_KCK_LENGTH];
866         u8 kek[BRCMF_RSN_KEK_LENGTH];
867         u8 replay_counter[BRCMF_RSN_REPLAY_LEN];
868 };
869
870 #define BRCMF_PNO_REPORT_NO_BATCH       BIT(2)
871
872 /**
873  * struct brcmf_gscan_bucket_config - configuration data for channel bucket.
874  *
875  * @bucket_end_index: last channel index in @channel_list in
876  *      @struct brcmf_pno_config_le.
877  * @bucket_freq_multiple: scan interval expressed in N * @scan_freq.
878  * @flag: channel bucket report flags.
879  * @reserved: for future use.
880  * @repeat: number of scan at interval for exponential scan.
881  * @max_freq_multiple: maximum scan interval for exponential scan.
882  */
883 struct brcmf_gscan_bucket_config {
884         u8 bucket_end_index;
885         u8 bucket_freq_multiple;
886         u8 flag;
887         u8 reserved;
888         __le16 repeat;
889         __le16 max_freq_multiple;
890 };
891
892 /* version supported which must match firmware */
893 #define BRCMF_GSCAN_CFG_VERSION                     2
894
895 /**
896  * enum brcmf_gscan_cfg_flags - bit values for gscan flags.
897  *
898  * @BRCMF_GSCAN_CFG_FLAGS_ALL_RESULTS: send probe responses/beacons to host.
899  * @BRCMF_GSCAN_CFG_ALL_BUCKETS_IN_1ST_SCAN: all buckets will be included in
900  *      first scan cycle.
901  * @BRCMF_GSCAN_CFG_FLAGS_CHANGE_ONLY: indicated only flags member is changed.
902  */
903 enum brcmf_gscan_cfg_flags {
904         BRCMF_GSCAN_CFG_FLAGS_ALL_RESULTS = BIT(0),
905         BRCMF_GSCAN_CFG_ALL_BUCKETS_IN_1ST_SCAN = BIT(3),
906         BRCMF_GSCAN_CFG_FLAGS_CHANGE_ONLY = BIT(7),
907 };
908
909 /**
910  * struct brcmf_gscan_config - configuration data for gscan.
911  *
912  * @version: version of the api to match firmware.
913  * @flags: flags according %enum brcmf_gscan_cfg_flags.
914  * @buffer_threshold: percentage threshold of buffer to generate an event.
915  * @swc_nbssid_threshold: number of BSSIDs with significant change that
916  *      will generate an event.
917  * @swc_rssi_window_size: size of rssi cache buffer (max=8).
918  * @count_of_channel_buckets: number of array members in @bucket.
919  * @retry_threshold: !unknown!
920  * @lost_ap_window: !unknown!
921  * @bucket: array of channel buckets.
922  */
923 struct brcmf_gscan_config {
924         __le16 version;
925         u8 flags;
926         u8 buffer_threshold;
927         u8 swc_nbssid_threshold;
928         u8 swc_rssi_window_size;
929         u8 count_of_channel_buckets;
930         u8 retry_threshold;
931         __le16  lost_ap_window;
932         struct brcmf_gscan_bucket_config bucket[1];
933 };
934
935 #endif /* FWIL_TYPES_H_ */