net: wifi: rockchip: update broadcom drivers for kernel4.4
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rkwifi / bcmdhd / include / wlioctl.h
1 /*
2  * Custom OID/ioctl definitions for
3  *
4  *
5  * Broadcom 802.11abg Networking Device Driver
6  *
7  * Definitions subject to change without notice.
8  *
9  * Copyright (C) 1999-2016, Broadcom Corporation
10  * 
11  *      Unless you and Broadcom execute a separate written software license
12  * agreement governing use of this software, this software is licensed to you
13  * under the terms of the GNU General Public License version 2 (the "GPL"),
14  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
15  * following added to such license:
16  * 
17  *      As a special exception, the copyright holders of this software give you
18  * permission to link this software with independent modules, and to copy and
19  * distribute the resulting executable under terms of your choice, provided that
20  * you also meet, for each linked independent module, the terms and conditions of
21  * the license of that module.  An independent module is a module which is not
22  * derived from this software.  The special exception does not apply to any
23  * modifications of the software.
24  * 
25  *      Notwithstanding the above, under no circumstances may you combine this
26  * software in any way with any other Broadcom software provided under a license
27  * other than the GPL, without Broadcom's express prior written consent.
28  * <<Broadcom-WL-IPTag/Open:>>
29  *
30  * $Id: wlioctl.h 609280 2016-01-01 06:31:38Z $
31  */
32
33 #ifndef _wlioctl_h_
34 #define _wlioctl_h_
35
36 #include <typedefs.h>
37 #include <proto/ethernet.h>
38 #include <proto/bcmip.h>
39 #include <proto/bcmeth.h>
40 #include <proto/bcmip.h>
41 #include <proto/bcmevent.h>
42 #include <proto/802.11.h>
43 #include <proto/802.1d.h>
44 #include <bcmwifi_channels.h>
45 #include <bcmwifi_rates.h>
46 #include <devctrl_if/wlioctl_defs.h>
47 #include <proto/bcmipv6.h>
48
49 #include <bcm_mpool_pub.h>
50 #include <bcmcdc.h>
51
52
53
54
55
56 typedef struct {
57         uint32 num;
58         chanspec_t list[1];
59 } chanspec_list_t;
60
61 #define RSN_KCK_LENGTH  16
62 #define RSN_KEK_LENGTH  16
63
64
65 #ifndef INTF_NAME_SIZ
66 #define INTF_NAME_SIZ   16
67 #endif
68
69 /* Used to send ioctls over the transport pipe */
70 typedef struct remote_ioctl {
71         cdc_ioctl_t     msg;
72         uint32          data_len;
73         char           intf_name[INTF_NAME_SIZ];
74 } rem_ioctl_t;
75 #define REMOTE_SIZE     sizeof(rem_ioctl_t)
76
77
78 /* DFS Forced param */
79 typedef struct wl_dfs_forced_params {
80         chanspec_t chspec;
81         uint16 version;
82         chanspec_list_t chspec_list;
83 } wl_dfs_forced_t;
84
85 #define DFS_PREFCHANLIST_VER 0x01
86 #define WL_CHSPEC_LIST_FIXED_SIZE       OFFSETOF(chanspec_list_t, list)
87 #define WL_DFS_FORCED_PARAMS_FIXED_SIZE \
88         (WL_CHSPEC_LIST_FIXED_SIZE + OFFSETOF(wl_dfs_forced_t, chspec_list))
89 #define WL_DFS_FORCED_PARAMS_MAX_SIZE \
90         WL_DFS_FORCED_PARAMS_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(chanspec_t))
91
92 /* association decision information */
93 typedef struct {
94         bool            assoc_approved;         /**< (re)association approved */
95         uint16          reject_reason;          /**< reason code for rejecting association */
96         struct          ether_addr   da;
97         int64           sys_time;               /**< current system time */
98 } assoc_decision_t;
99
100 #define DFS_SCAN_S_IDLE         -1
101 #define DFS_SCAN_S_RADAR_FREE 0
102 #define DFS_SCAN_S_RADAR_FOUND 1
103 #define DFS_SCAN_S_INPROGESS 2
104 #define DFS_SCAN_S_SCAN_ABORTED 3
105 #define DFS_SCAN_S_SCAN_MODESW_INPROGRESS 4
106 #define DFS_SCAN_S_MAX 5
107
108
109 #define ACTION_FRAME_SIZE 1800
110
111 typedef struct wl_action_frame {
112         struct ether_addr       da;
113         uint16                  len;
114         uint32                  packetId;
115         uint8                   data[ACTION_FRAME_SIZE];
116 } wl_action_frame_t;
117
118 #define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame)
119
120 typedef struct ssid_info
121 {
122         uint8           ssid_len;       /**< the length of SSID */
123         uint8           ssid[32];       /**< SSID string */
124 } ssid_info_t;
125
126 typedef struct wl_af_params {
127         uint32                  channel;
128         int32                   dwell_time;
129         struct ether_addr       BSSID;
130         wl_action_frame_t       action_frame;
131 } wl_af_params_t;
132
133 #define WL_WIFI_AF_PARAMS_SIZE sizeof(struct wl_af_params)
134
135 #define MFP_TEST_FLAG_NORMAL    0
136 #define MFP_TEST_FLAG_ANY_KEY   1
137 typedef struct wl_sa_query {
138         uint32                  flag;
139         uint8                   action;
140         uint16                  id;
141         struct ether_addr       da;
142 } wl_sa_query_t;
143
144 /* require default structure packing */
145 #define BWL_DEFAULT_PACKING
146 #include <packed_section_start.h>
147
148
149 /* Flags for OBSS IOVAR Parameters */
150 #define WL_OBSS_DYN_BWSW_FLAG_ACTIVITY_PERIOD        (0x01)
151 #define WL_OBSS_DYN_BWSW_FLAG_NOACTIVITY_PERIOD      (0x02)
152 #define WL_OBSS_DYN_BWSW_FLAG_NOACTIVITY_INCR_PERIOD (0x04)
153 #define WL_OBSS_DYN_BWSW_FLAG_PSEUDO_SENSE_PERIOD    (0x08)
154 #define WL_OBSS_DYN_BWSW_FLAG_RX_CRS_PERIOD          (0x10)
155 #define WL_OBSS_DYN_BWSW_FLAG_DUR_THRESHOLD          (0x20)
156 #define WL_OBSS_DYN_BWSW_FLAG_TXOP_PERIOD            (0x40)
157
158 /* OBSS IOVAR Version information */
159 #define WL_PROT_OBSS_CONFIG_PARAMS_VERSION 1
160 typedef BWL_PRE_PACKED_STRUCT struct {
161         uint8 obss_bwsw_activity_cfm_count_cfg; /* configurable count in
162                 * seconds before we confirm that OBSS is present and
163                 * dynamically activate dynamic bwswitch.
164                 */
165         uint8 obss_bwsw_no_activity_cfm_count_cfg; /* configurable count in
166                 * seconds before we confirm that OBSS is GONE and
167                 * dynamically start pseudo upgrade. If in pseudo sense time, we
168                 * will see OBSS, [means that, we false detected that OBSS-is-gone
169                 * in watchdog] this count will be incremented in steps of
170                 * obss_bwsw_no_activity_cfm_count_incr_cfg for confirming OBSS
171                 * detection again. Note that, at present, max 30seconds is
172                 * allowed like this. [OBSS_BWSW_NO_ACTIVITY_MAX_INCR_DEFAULT]
173                 */
174         uint8 obss_bwsw_no_activity_cfm_count_incr_cfg; /* see above
175                 */
176         uint16 obss_bwsw_pseudo_sense_count_cfg; /* number of msecs/cnt to be in
177                 * pseudo state. This is used to sense/measure the stats from lq.
178                 */
179         uint8 obss_bwsw_rx_crs_threshold_cfg; /* RX CRS default threshold */
180         uint8 obss_bwsw_dur_thres; /* OBSS dyn bwsw trigger/RX CRS Sec */
181         uint8 obss_bwsw_txop_threshold_cfg; /* TXOP default threshold */
182 } BWL_POST_PACKED_STRUCT wlc_prot_dynbwsw_config_t;
183
184 typedef BWL_PRE_PACKED_STRUCT struct {
185         uint32 version; /**< version field */
186         uint32 config_mask;
187         uint32 reset_mask;
188         wlc_prot_dynbwsw_config_t config_params;
189 } BWL_POST_PACKED_STRUCT obss_config_params_t;
190
191
192 /* bsscfg type */
193 typedef enum bsscfg_type_t {
194         BSSCFG_TYPE_GENERIC = 0,        /**< default */
195         BSSCFG_TYPE_P2P = 1,    /**< The BSS is for p2p link */
196         BSSCFG_TYPE_BTA = 2,
197         BSSCFG_TYPE_TDLS = 4,
198         BSSCFG_TYPE_AWDL = 5,
199         BSSCFG_TYPE_PROXD = 6,
200         BSSCFG_TYPE_NAN = 7,
201         BSSCFG_TYPE_MAX
202 } bsscfg_type_t;
203
204 /* bsscfg subtype */
205 enum {
206         BSSCFG_GENERIC_STA  = 1, /* GENERIC */
207         BSSCFG_GENERIC_AP = 2, /* GENERIC */
208         BSSCFG_P2P_GC   = 3, /* P2P */
209         BSSCFG_P2P_GO   = 4, /* P2P */
210         BSSCFG_P2P_DISC = 5, /* P2P */
211 };
212
213 typedef struct wlc_bsscfg_info {
214         uint32 type;
215         uint32 subtype;
216 } wlc_bsscfg_info_t;
217
218
219
220 /* Legacy structure to help keep backward compatible wl tool and tray app */
221
222 #define LEGACY_WL_BSS_INFO_VERSION      107     /**< older version of wl_bss_info struct */
223
224 typedef struct wl_bss_info_107 {
225         uint32          version;                /**< version field */
226         uint32          length;                 /**< byte length of data in this record,
227                                                  * starting at version and including IEs
228                                                  */
229         struct ether_addr BSSID;
230         uint16          beacon_period;          /**< units are Kusec */
231         uint16          capability;             /**< Capability information */
232         uint8           SSID_len;
233         uint8           SSID[32];
234         struct {
235                 uint    count;                  /**< # rates in this set */
236                 uint8   rates[16];              /**< rates in 500kbps units w/hi bit set if basic */
237         } rateset;                              /**< supported rates */
238         uint8           channel;                /**< Channel no. */
239         uint16          atim_window;            /**< units are Kusec */
240         uint8           dtim_period;            /**< DTIM period */
241         int16           RSSI;                   /**< receive signal strength (in dBm) */
242         int8            phy_noise;              /**< noise (in dBm) */
243         uint32          ie_length;              /**< byte length of Information Elements */
244         /* variable length Information Elements */
245 } wl_bss_info_107_t;
246
247 /*
248  * Per-BSS information structure.
249  */
250
251 #define LEGACY2_WL_BSS_INFO_VERSION     108             /**< old version of wl_bss_info struct */
252
253 /* BSS info structure
254  * Applications MUST CHECK ie_offset field and length field to access IEs and
255  * next bss_info structure in a vector (in wl_scan_results_t)
256  */
257 typedef struct wl_bss_info_108 {
258         uint32          version;                /**< version field */
259         uint32          length;                 /**< byte length of data in this record,
260                                                  * starting at version and including IEs
261                                                  */
262         struct ether_addr BSSID;
263         uint16          beacon_period;          /**< units are Kusec */
264         uint16          capability;             /**< Capability information */
265         uint8           SSID_len;
266         uint8           SSID[32];
267         struct {
268                 uint    count;                  /**< # rates in this set */
269                 uint8   rates[16];              /**< rates in 500kbps units w/hi bit set if basic */
270         } rateset;                              /**< supported rates */
271         chanspec_t      chanspec;               /**< chanspec for bss */
272         uint16          atim_window;            /**< units are Kusec */
273         uint8           dtim_period;            /**< DTIM period */
274         int16           RSSI;                   /**< receive signal strength (in dBm) */
275         int8            phy_noise;              /**< noise (in dBm) */
276
277         uint8           n_cap;                  /**< BSS is 802.11N Capable */
278         uint32          nbss_cap;               /**< 802.11N BSS Capabilities (based on HT_CAP_*) */
279         uint8           ctl_ch;                 /**< 802.11N BSS control channel number */
280         uint32          reserved32[1];          /**< Reserved for expansion of BSS properties */
281         uint8           flags;                  /**< flags */
282         uint8           reserved[3];            /**< Reserved for expansion of BSS properties */
283         uint8           basic_mcs[MCSSET_LEN];  /**< 802.11N BSS required MCS set */
284
285         uint16          ie_offset;              /**< offset at which IEs start, from beginning */
286         uint32          ie_length;              /**< byte length of Information Elements */
287         /* Add new fields here */
288         /* variable length Information Elements */
289 } wl_bss_info_108_t;
290
291 #define WL_BSS_INFO_VERSION     109             /**< current version of wl_bss_info struct */
292
293 /* BSS info structure
294  * Applications MUST CHECK ie_offset field and length field to access IEs and
295  * next bss_info structure in a vector (in wl_scan_results_t)
296  */
297 typedef struct wl_bss_info {
298         uint32          version;                /**< version field */
299         uint32          length;                 /**< byte length of data in this record,
300                                                  * starting at version and including IEs
301                                                  */
302         struct ether_addr BSSID;
303         uint16          beacon_period;          /**< units are Kusec */
304         uint16          capability;             /**< Capability information */
305         uint8           SSID_len;
306         uint8           SSID[32];
307         struct {
308                 uint    count;                  /**< # rates in this set */
309                 uint8   rates[16];              /**< rates in 500kbps units w/hi bit set if basic */
310         } rateset;                              /**< supported rates */
311         chanspec_t      chanspec;               /**< chanspec for bss */
312         uint16          atim_window;            /**< units are Kusec */
313         uint8           dtim_period;            /**< DTIM period */
314         int16           RSSI;                   /**< receive signal strength (in dBm) */
315         int8            phy_noise;              /**< noise (in dBm) */
316
317         uint8           n_cap;                  /**< BSS is 802.11N Capable */
318         uint32          nbss_cap;               /**< 802.11N+AC BSS Capabilities */
319         uint8           ctl_ch;                 /**< 802.11N BSS control channel number */
320         uint8           padding1[3];            /**< explicit struct alignment padding */
321         uint16          vht_rxmcsmap;   /**< VHT rx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
322         uint16          vht_txmcsmap;   /**< VHT tx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
323         uint8           flags;                  /**< flags */
324         uint8           vht_cap;                /**< BSS is vht capable */
325         uint8           reserved[2];            /**< Reserved for expansion of BSS properties */
326         uint8           basic_mcs[MCSSET_LEN];  /**< 802.11N BSS required MCS set */
327
328         uint16          ie_offset;              /**< offset at which IEs start, from beginning */
329         uint32          ie_length;              /**< byte length of Information Elements */
330         int16           SNR;                    /**< average SNR of during frame reception */
331         uint16          vht_mcsmap;             /**< STA's Associated vhtmcsmap */
332         uint16          vht_mcsmap_prop;        /**< STA's Associated prop vhtmcsmap */
333         uint16          vht_txmcsmap_prop;      /**< prop VHT tx mcs prop */
334         /* Add new fields here */
335         /* variable length Information Elements */
336 } wl_bss_info_t;
337
338 #define WL_GSCAN_BSS_INFO_VERSION       1       /* current version of wl_gscan_bss_info struct */
339 #define WL_GSCAN_INFO_FIXED_FIELD_SIZE   (sizeof(wl_gscan_bss_info_t) - sizeof(wl_bss_info_t))
340
341 typedef struct wl_gscan_bss_info {
342         uint32      timestamp[2];
343         wl_bss_info_t info;
344         /* Do not add any more members below, fixed  */
345         /* and variable length Information Elements to follow */
346 } wl_gscan_bss_info_t;
347
348
349 typedef struct wl_bsscfg {
350         uint32  bsscfg_idx;
351         uint32  wsec;
352         uint32  WPA_auth;
353         uint32  wsec_index;
354         uint32  associated;
355         uint32  BSS;
356         uint32  phytest_on;
357         struct ether_addr   prev_BSSID;
358         struct ether_addr   BSSID;
359         uint32  targetbss_wpa2_flags;
360         uint32 assoc_type;
361         uint32 assoc_state;
362 } wl_bsscfg_t;
363
364 typedef struct wl_if_add {
365         uint32  bsscfg_flags;
366         uint32  if_flags;
367         uint32  ap;
368         struct ether_addr   mac_addr;
369         uint32  wlc_index;
370 } wl_if_add_t;
371
372 typedef struct wl_bss_config {
373         uint32  atim_window;
374         uint32  beacon_period;
375         uint32  chanspec;
376 } wl_bss_config_t;
377
378 #define WL_BSS_USER_RADAR_CHAN_SELECT   0x1     /**< User application will randomly select
379                                                  * radar channel.
380                                                  */
381
382 #define DLOAD_HANDLER_VER                       1       /**< Downloader version */
383 #define DLOAD_FLAG_VER_MASK             0xf000  /**< Downloader version mask */
384 #define DLOAD_FLAG_VER_SHIFT    12      /**< Downloader version shift */
385
386 #define DL_CRC_NOT_INUSE        0x0001
387 #define DL_BEGIN                0x0002
388 #define DL_END                  0x0004
389
390 /* generic download types & flags */
391 enum {
392         DL_TYPE_UCODE = 1,
393         DL_TYPE_CLM = 2
394 };
395
396 /* ucode type values */
397 enum {
398         UCODE_FW,
399         INIT_VALS,
400         BS_INIT_VALS
401 };
402
403 struct wl_dload_data {
404         uint16 flag;
405         uint16 dload_type;
406         uint32 len;
407         uint32 crc;
408         uint8  data[1];
409 };
410 typedef struct wl_dload_data wl_dload_data_t;
411
412 struct wl_ucode_info {
413         uint32 ucode_type;
414         uint32 num_chunks;
415         uint32 chunk_len;
416         uint32 chunk_num;
417         uint8  data_chunk[1];
418 };
419 typedef struct wl_ucode_info wl_ucode_info_t;
420
421 struct wl_clm_dload_info {
422         uint32 ds_id;
423         uint32 clm_total_len;
424         uint32 num_chunks;
425         uint32 chunk_len;
426         uint32 chunk_offset;
427         uint8  data_chunk[1];
428 };
429 typedef struct wl_clm_dload_info wl_clm_dload_info_t;
430
431 typedef struct wlc_ssid {
432         uint32          SSID_len;
433         uchar           SSID[DOT11_MAX_SSID_LEN];
434 } wlc_ssid_t;
435
436 typedef struct wlc_ssid_ext {
437         bool       hidden;
438         uint32          SSID_len;
439         uchar           SSID[DOT11_MAX_SSID_LEN];
440 } wlc_ssid_ext_t;
441
442
443 #define MAX_PREFERRED_AP_NUM     5
444 typedef struct wlc_fastssidinfo {
445         uint32                          SSID_channel[MAX_PREFERRED_AP_NUM];
446         wlc_ssid_t              SSID_info[MAX_PREFERRED_AP_NUM];
447 } wlc_fastssidinfo_t;
448
449 #ifdef CUSTOMER_HW_31_1
450
451 #define AP_NORM         0
452 #define AP_STEALTH  1
453 #define STREET_PASS_AP  2
454
455 #define NSC_MAX_TGT_SSID        20
456 typedef struct nsc_ssid_entry_list {
457         wlc_ssid_t ssid_info;
458         int ssid_type;
459 } nsc_ssid_entry_list_t;
460
461 typedef struct nsc_ssid_list {
462         uint32 num_entries;                             /* N wants 150 */
463         nsc_ssid_entry_list_t ssid_entry[1];
464 } nsc_ssid_list_t;
465
466 #define NSC_TGT_SSID_BUFSZ      (sizeof(nsc_ssid_entry_list_t) * \
467                 (NSC_MAX_TGT_SSID - 1) + sizeof(nsc_ssid_list_t))
468
469 /* Default values from N */
470 #define NSC_SCPATT_ARRSZ        32
471
472 /* scan types */
473 #define UNI_SCAN        0
474 #define SP_SCAN_ACTIVE  1
475 #define SP_SCAN_PASSIVE 2
476 #define DOZE    3
477
478 /* what we found */
479 typedef struct nsc_scan_results {
480         wlc_ssid_t ssid;
481         struct ether_addr mac;
482         int scantype;
483         uint16 channel;
484 } nsc_scan_results_t;
485
486 typedef BWL_PRE_PACKED_STRUCT struct nsc_af_body {
487         uint8                   type;           /* should be 0x7f */
488         uint8                   oui[DOT11_OUI_LEN];     /* just like it says */
489         uint8                   subtype;
490         uint8                   ielen;          /* */
491         uint8                   data[1];        /* variable */
492 } BWL_POST_PACKED_STRUCT nsc_af_body_t;
493
494 typedef BWL_PRE_PACKED_STRUCT struct nsc_sdlist {
495         uint8   scantype;
496         uint16  duration;
497         uint16  channel;                /* SP only */
498         uint8   ssid_index;             /* SP only */
499         uint16  rate;                   /* SP only */
500 } BWL_POST_PACKED_STRUCT nsc_sdlist_t;
501
502 typedef struct nsc_scandes {
503         uint32  num_entries;    /* number of list entries */
504         nsc_sdlist_t sdlist[1]; /* variable */
505 } nsc_scandes_t;
506
507 #define NSC_MAX_SDLIST_ENTRIES  8
508 #define NSC_SDDESC_BUFSZ        (sizeof(nsc_sdlist_t) * \
509                 (NSC_MAX_SDLIST_ENTRIES - 1) + sizeof(nsc_scandes_t))
510
511 #define SCAN_ARR_END    (NSC_MAX_SDLIST_ENTRIES)
512 #endif /* CUSTOMER_HW_31_1 */
513
514 typedef BWL_PRE_PACKED_STRUCT struct wnm_url {
515         uint8   len;
516         uint8   data[1];
517 } BWL_POST_PACKED_STRUCT wnm_url_t;
518
519 #define WNM_BSS_SELECT_TYPE_RSSI   0
520 #define WNM_BSS_SELECT_TYPE_CU   1
521
522 #define WNM_BSSLOAD_MONITOR_VERSION   1
523 typedef struct wnm_bssload_monitor_cfg {
524         uint8 version;
525         uint8 band;
526         uint8 duration; /* duration between 1 to 20sec */
527 } wnm_bssload_monitor_cfg_t;
528
529 #define BSS_MAXTABLE_SIZE 10
530 #define WNM_BSS_SELECT_FACTOR_VERSION   1
531 typedef struct wnm_bss_select_factor_params {
532         uint8 low;
533         uint8 high;
534         uint8 factor;
535         uint8 pad;
536 } wnm_bss_select_factor_params_t;
537
538 typedef struct wnm_bss_select_factor_cfg {
539         uint8 version;
540         uint8 band;
541         uint16 type;
542         uint16 pad;
543         uint16 count;
544         wnm_bss_select_factor_params_t params[1];
545 } wnm_bss_select_factor_cfg_t;
546
547 #define WNM_BSS_SELECT_WEIGHT_VERSION   1
548 typedef struct wnm_bss_select_weight_cfg {
549         uint8 version;
550         uint8 band;
551         uint16 type;
552         uint16 weight; /* weightage for each type between 0 to 100 */
553 } wnm_bss_select_weight_cfg_t;
554
555 #define WNM_ROAM_TRIGGER_VERSION   1
556 typedef struct wnm_roam_trigger_cfg {
557         uint8 version;
558         uint8 band;
559         uint16 type;
560         int16 trigger; /* trigger for each type in new roam algorithm */
561 } wnm_roam_trigger_cfg_t;
562
563 typedef struct chan_scandata {
564         uint8           txpower;
565         uint8           pad;
566         chanspec_t      channel;        /**< Channel num, bw, ctrl_sb and band */
567         uint32          channel_mintime;
568         uint32          channel_maxtime;
569 } chan_scandata_t;
570
571 typedef enum wl_scan_type {
572         EXTDSCAN_FOREGROUND_SCAN,
573         EXTDSCAN_BACKGROUND_SCAN,
574         EXTDSCAN_FORCEDBACKGROUND_SCAN
575 } wl_scan_type_t;
576
577 #define WLC_EXTDSCAN_MAX_SSID           5
578
579 typedef struct wl_extdscan_params {
580         int8            nprobes;                /**< 0, passive, otherwise active */
581         int8            split_scan;             /**< split scan */
582         int8            band;                   /**< band */
583         int8            pad;
584         wlc_ssid_t      ssid[WLC_EXTDSCAN_MAX_SSID]; /* ssid list */
585         uint32          tx_rate;                /**< in 500ksec units */
586         wl_scan_type_t  scan_type;              /**< enum */
587         int32           channel_num;
588         chan_scandata_t channel_list[1];        /**< list of chandata structs */
589 } wl_extdscan_params_t;
590
591 #define WL_EXTDSCAN_PARAMS_FIXED_SIZE   (sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
592
593 #define WL_SCAN_PARAMS_SSID_MAX         10
594
595 typedef struct wl_scan_params {
596         wlc_ssid_t ssid;                /**< default: {0, ""} */
597         struct ether_addr bssid;        /**< default: bcast */
598         int8 bss_type;                  /**< default: any,
599                                          * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
600                                          */
601         uint8 scan_type;                /**< flags, 0 use default */
602         int32 nprobes;                  /**< -1 use default, number of probes per channel */
603         int32 active_time;              /**< -1 use default, dwell time per channel for
604                                          * active scanning
605                                          */
606         int32 passive_time;             /**< -1 use default, dwell time per channel
607                                          * for passive scanning
608                                          */
609         int32 home_time;                /**< -1 use default, dwell time for the home channel
610                                          * between channel scans
611                                          */
612         int32 channel_num;              /**< count of channels and ssids that follow
613                                          *
614                                          * low half is count of channels in channel_list, 0
615                                          * means default (use all available channels)
616                                          *
617                                          * high half is entries in wlc_ssid_t array that
618                                          * follows channel_list, aligned for int32 (4 bytes)
619                                          * meaning an odd channel count implies a 2-byte pad
620                                          * between end of channel_list and first ssid
621                                          *
622                                          * if ssid count is zero, single ssid in the fixed
623                                          * parameter portion is assumed, otherwise ssid in
624                                          * the fixed portion is ignored
625                                          */
626         uint16 channel_list[1];         /**< list of chanspecs */
627 } wl_scan_params_t;
628
629 /* size of wl_scan_params not including variable length array */
630 #define WL_SCAN_PARAMS_FIXED_SIZE 64
631 #define WL_MAX_ROAMSCAN_DATSZ   (WL_SCAN_PARAMS_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(uint16)))
632
633 #define ISCAN_REQ_VERSION 1
634
635 /* incremental scan struct */
636 typedef struct wl_iscan_params {
637         uint32 version;
638         uint16 action;
639         uint16 scan_duration;
640         wl_scan_params_t params;
641 } wl_iscan_params_t;
642
643 /* 3 fields + size of wl_scan_params, not including variable length array */
644 #define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
645
646 typedef struct wl_scan_results {
647         uint32 buflen;
648         uint32 version;
649         uint32 count;
650         wl_bss_info_t bss_info[1];
651 } wl_scan_results_t;
652
653 /* size of wl_scan_results not including variable length array */
654 #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
655
656
657 #define ESCAN_REQ_VERSION 1
658
659 /** event scan reduces amount of SOC memory needed to store scan results */
660 typedef struct wl_escan_params {
661         uint32 version;
662         uint16 action;
663         uint16 sync_id;
664         wl_scan_params_t params;
665 } wl_escan_params_t;
666
667 #define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
668
669 /** event scan reduces amount of SOC memory needed to store scan results */
670 typedef struct wl_escan_result {
671         uint32 buflen;
672         uint32 version;
673         uint16 sync_id;
674         uint16 bss_count;
675         wl_bss_info_t bss_info[1];
676 } wl_escan_result_t;
677
678 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
679
680 typedef struct wl_gscan_result {
681         uint32 buflen;
682         uint32 version;
683         wl_gscan_bss_info_t bss_info[1];
684 } wl_gscan_result_t;
685
686 #define WL_GSCAN_RESULTS_FIXED_SIZE (sizeof(wl_gscan_result_t) - sizeof(wl_gscan_bss_info_t))
687
688 /* incremental scan results struct */
689 typedef struct wl_iscan_results {
690         uint32 status;
691         wl_scan_results_t results;
692 } wl_iscan_results_t;
693
694 /* size of wl_iscan_results not including variable length array */
695 #define WL_ISCAN_RESULTS_FIXED_SIZE \
696         (WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
697
698 #define SCANOL_PARAMS_VERSION   1
699
700 typedef struct scanol_params {
701         uint32 version;
702         uint32 flags;   /**< offload scanning flags */
703         int32 active_time;      /**< -1 use default, dwell time per channel for active scanning */
704         int32 passive_time;     /**< -1 use default, dwell time per channel for passive scanning */
705         int32 idle_rest_time;   /**< -1 use default, time idle between scan cycle */
706         int32 idle_rest_time_multiplier;
707         int32 active_rest_time;
708         int32 active_rest_time_multiplier;
709         int32 scan_cycle_idle_rest_time;
710         int32 scan_cycle_idle_rest_multiplier;
711         int32 scan_cycle_active_rest_time;
712         int32 scan_cycle_active_rest_multiplier;
713         int32 max_rest_time;
714         int32 max_scan_cycles;
715         int32 nprobes;          /**< -1 use default, number of probes per channel */
716         int32 scan_start_delay;
717         uint32 nchannels;
718         uint32 ssid_count;
719         wlc_ssid_t ssidlist[1];
720 } scanol_params_t;
721
722 typedef struct wl_probe_params {
723         wlc_ssid_t ssid;
724         struct ether_addr bssid;
725         struct ether_addr mac;
726 } wl_probe_params_t;
727
728 #define WL_MAXRATES_IN_SET              16      /**< max # of rates in a rateset */
729 typedef struct wl_rateset {
730         uint32  count;                  /**< # rates in this set */
731         uint8   rates[WL_MAXRATES_IN_SET];      /**< rates in 500kbps units w/hi bit set if basic */
732 } wl_rateset_t;
733
734 typedef struct wl_rateset_args {
735         uint32  count;                  /**< # rates in this set */
736         uint8   rates[WL_MAXRATES_IN_SET];      /**< rates in 500kbps units w/hi bit set if basic */
737         uint8   mcs[MCSSET_LEN];        /* supported mcs index bit map */
738         uint16 vht_mcs[VHT_CAP_MCS_MAP_NSS_MAX]; /* supported mcs index bit map per nss */
739 } wl_rateset_args_t;
740
741 #define TXBF_RATE_MCS_ALL               4
742 #define TXBF_RATE_VHT_ALL               4
743 #define TXBF_RATE_OFDM_ALL              8
744
745 typedef struct wl_txbf_rateset {
746         uint8   txbf_rate_mcs[TXBF_RATE_MCS_ALL];       /**< one for each stream */
747         uint8   txbf_rate_mcs_bcm[TXBF_RATE_MCS_ALL];   /**< one for each stream */
748         uint16  txbf_rate_vht[TXBF_RATE_VHT_ALL];       /**< one for each stream */
749         uint16  txbf_rate_vht_bcm[TXBF_RATE_VHT_ALL];   /**< one for each stream */
750         uint8   txbf_rate_ofdm[TXBF_RATE_OFDM_ALL]; /**< bitmap of ofdm rates that enables txbf */
751         uint8   txbf_rate_ofdm_bcm[TXBF_RATE_OFDM_ALL]; /* bitmap of ofdm rates that enables txbf */
752         uint8   txbf_rate_ofdm_cnt;
753         uint8   txbf_rate_ofdm_cnt_bcm;
754 } wl_txbf_rateset_t;
755
756 #define OFDM_RATE_MASK                  0x0000007f
757 typedef uint8 ofdm_rates_t;
758
759 typedef struct wl_rates_info {
760         wl_rateset_t rs_tgt;
761         uint32 phy_type;
762         int32 bandtype;
763         uint8 cck_only;
764         uint8 rate_mask;
765         uint8 mcsallow;
766         uint8 bw;
767         uint8 txstreams;
768 } wl_rates_info_t;
769
770 /* uint32 list */
771 typedef struct wl_uint32_list {
772         /* in - # of elements, out - # of entries */
773         uint32 count;
774         /* variable length uint32 list */
775         uint32 element[1];
776 } wl_uint32_list_t;
777
778 /* used for association with a specific BSSID and chanspec list */
779 typedef struct wl_assoc_params {
780         struct ether_addr bssid;        /**< 00:00:00:00:00:00: broadcast scan */
781         uint16 bssid_cnt;               /**< 0: use chanspec_num, and the single bssid,
782                                         * otherwise count of chanspecs in chanspec_list
783                                         * AND paired bssids following chanspec_list
784                                         * also, chanspec_num has to be set to zero
785                                         * for bssid list to be used
786                                         */
787         int32 chanspec_num;             /**< 0: all available channels,
788                                         * otherwise count of chanspecs in chanspec_list
789                                         */
790         chanspec_t chanspec_list[1];    /**< list of chanspecs */
791 } wl_assoc_params_t;
792
793 #define WL_ASSOC_PARAMS_FIXED_SIZE      OFFSETOF(wl_assoc_params_t, chanspec_list)
794
795 /* used for reassociation/roam to a specific BSSID and channel */
796 typedef wl_assoc_params_t wl_reassoc_params_t;
797 #define WL_REASSOC_PARAMS_FIXED_SIZE    WL_ASSOC_PARAMS_FIXED_SIZE
798
799 /* used for association to a specific BSSID and channel */
800 typedef wl_assoc_params_t wl_join_assoc_params_t;
801 #define WL_JOIN_ASSOC_PARAMS_FIXED_SIZE WL_ASSOC_PARAMS_FIXED_SIZE
802
803 /* used for join with or without a specific bssid and channel list */
804 typedef struct wl_join_params {
805         wlc_ssid_t ssid;
806         wl_assoc_params_t params;       /**< optional field, but it must include the fixed portion
807                                          * of the wl_assoc_params_t struct when it does present.
808                                          */
809 } wl_join_params_t;
810
811 #define WL_JOIN_PARAMS_FIXED_SIZE       (OFFSETOF(wl_join_params_t, params) + \
812                                          WL_ASSOC_PARAMS_FIXED_SIZE)
813 /* scan params for extended join */
814 typedef struct wl_join_scan_params {
815         uint8 scan_type;                /**< 0 use default, active or passive scan */
816         int32 nprobes;                  /**< -1 use default, number of probes per channel */
817         int32 active_time;              /**< -1 use default, dwell time per channel for
818                                          * active scanning
819                                          */
820         int32 passive_time;             /**< -1 use default, dwell time per channel
821                                          * for passive scanning
822                                          */
823         int32 home_time;                /**< -1 use default, dwell time for the home channel
824                                          * between channel scans
825                                          */
826 } wl_join_scan_params_t;
827
828 /* extended join params */
829 typedef struct wl_extjoin_params {
830         wlc_ssid_t ssid;                /**< {0, ""}: wildcard scan */
831         wl_join_scan_params_t scan;
832         wl_join_assoc_params_t assoc;   /**< optional field, but it must include the fixed portion
833                                          * of the wl_join_assoc_params_t struct when it does
834                                          * present.
835                                          */
836 } wl_extjoin_params_t;
837 #define WL_EXTJOIN_PARAMS_FIXED_SIZE    (OFFSETOF(wl_extjoin_params_t, assoc) + \
838                                          WL_JOIN_ASSOC_PARAMS_FIXED_SIZE)
839
840 #define ANT_SELCFG_MAX          4       /**< max number of antenna configurations */
841 #define MAX_STREAMS_SUPPORTED   4       /**< max number of streams supported */
842 typedef struct {
843         uint8 ant_config[ANT_SELCFG_MAX];       /**< antenna configuration */
844         uint8 num_antcfg;       /**< number of available antenna configurations */
845 } wlc_antselcfg_t;
846
847 typedef struct {
848         uint32 duration;        /**< millisecs spent sampling this channel */
849         uint32 congest_ibss;    /**< millisecs in our bss (presumably this traffic will */
850                                 /**<  move if cur bss moves channels) */
851         uint32 congest_obss;    /**< traffic not in our bss */
852         uint32 interference;    /**< millisecs detecting a non 802.11 interferer. */
853         uint32 timestamp;       /**< second timestamp */
854 } cca_congest_t;
855
856 typedef struct {
857         chanspec_t chanspec;    /**< Which channel? */
858         uint16 num_secs;        /**< How many secs worth of data */
859         cca_congest_t  secs[1]; /**< Data */
860 } cca_congest_channel_req_t;
861
862 typedef struct {
863         uint32 duration;        /**< millisecs spent sampling this channel */
864         uint32 congest;         /**< millisecs detecting busy CCA */
865         uint32 timestamp;       /**< second timestamp */
866 } cca_congest_simple_t;
867
868 typedef struct {
869         uint16 status;
870         uint16 id;
871         chanspec_t chanspec;    /**< Which channel? */
872         uint16 len;
873         union {
874                 cca_congest_simple_t  cca_busy; /**< CCA busy */
875                 int noise;                      /**< noise floor */
876         };
877 } cca_chan_qual_event_t;
878
879
880 /* interference sources */
881 enum interference_source {
882         ITFR_NONE = 0,          /**< interference */
883         ITFR_PHONE,             /**< wireless phone */
884         ITFR_VIDEO_CAMERA,      /**< wireless video camera */
885         ITFR_MICROWAVE_OVEN,    /**< microwave oven */
886         ITFR_BABY_MONITOR,      /**< wireless baby monitor */
887         ITFR_BLUETOOTH,         /**< bluetooth */
888         ITFR_VIDEO_CAMERA_OR_BABY_MONITOR,      /**< wireless camera or baby monitor */
889         ITFR_BLUETOOTH_OR_BABY_MONITOR, /**< bluetooth or baby monitor */
890         ITFR_VIDEO_CAMERA_OR_PHONE,     /**< video camera or phone */
891         ITFR_UNIDENTIFIED       /**< interference from unidentified source */
892 };
893
894 /* structure for interference source report */
895 typedef struct {
896         uint32 flags;   /**< flags.  bit definitions below */
897         uint32 source;  /**< last detected interference source */
898         uint32 timestamp;       /**< second timestamp on interferenced flag change */
899 } interference_source_rep_t;
900
901 #define WLC_CNTRY_BUF_SZ        4               /**< Country string is 3 bytes + NUL */
902
903
904 typedef struct wl_country {
905         char country_abbrev[WLC_CNTRY_BUF_SZ];  /**< nul-terminated country code used in
906                                                  * the Country IE
907                                                  */
908         int32 rev;                              /**< revision specifier for ccode
909                                                  * on set, -1 indicates unspecified.
910                                                  * on get, rev >= 0
911                                                  */
912         char ccode[WLC_CNTRY_BUF_SZ];           /**< nul-terminated built-in country code.
913                                                  * variable length, but fixed size in
914                                                  * struct allows simple allocation for
915                                                  * expected country strings <= 3 chars.
916                                                  */
917 } wl_country_t;
918
919 #define CCODE_INFO_VERSION 1
920
921 typedef enum wl_ccode_role {
922         WLC_CCODE_ROLE_ACTIVE = 0,
923         WLC_CCODE_ROLE_HOST,
924         WLC_CCODE_ROLE_80211D_ASSOC,
925         WLC_CCODE_ROLE_80211D_SCAN,
926         WLC_CCODE_ROLE_DEFAULT,
927         WLC_CCODE_LAST
928 } wl_ccode_role_t;
929 #define WLC_NUM_CCODE_INFO WLC_CCODE_LAST
930
931 typedef struct wl_ccode_entry {
932         uint16 reserved;
933         uint8 band;
934         uint8 role;
935         char    ccode[WLC_CNTRY_BUF_SZ];
936 } wl_ccode_entry_t;
937
938 typedef struct wl_ccode_info {
939         uint16 version;
940         uint16 count;   /* Number of ccodes entries in the set */
941         wl_ccode_entry_t ccodelist[1];
942 } wl_ccode_info_t;
943 #define WL_CCODE_INFO_FIXED_LEN OFFSETOF(wl_ccode_info_t, ccodelist)
944
945 typedef struct wl_channels_in_country {
946         uint32 buflen;
947         uint32 band;
948         char country_abbrev[WLC_CNTRY_BUF_SZ];
949         uint32 count;
950         uint32 channel[1];
951 } wl_channels_in_country_t;
952
953 typedef struct wl_country_list {
954         uint32 buflen;
955         uint32 band_set;
956         uint32 band;
957         uint32 count;
958         char country_abbrev[1];
959 } wl_country_list_t;
960
961 typedef struct wl_rm_req_elt {
962         int8    type;
963         int8    flags;
964         chanspec_t      chanspec;
965         uint32  token;          /**< token for this measurement */
966         uint32  tsf_h;          /**< TSF high 32-bits of Measurement start time */
967         uint32  tsf_l;          /**< TSF low 32-bits */
968         uint32  dur;            /**< TUs */
969 } wl_rm_req_elt_t;
970
971 typedef struct wl_rm_req {
972         uint32  token;          /**< overall measurement set token */
973         uint32  count;          /**< number of measurement requests */
974         void    *cb;            /**< completion callback function: may be NULL */
975         void    *cb_arg;        /**< arg to completion callback function */
976         wl_rm_req_elt_t req[1]; /**< variable length block of requests */
977 } wl_rm_req_t;
978 #define WL_RM_REQ_FIXED_LEN     OFFSETOF(wl_rm_req_t, req)
979
980 typedef struct wl_rm_rep_elt {
981         int8    type;
982         int8    flags;
983         chanspec_t      chanspec;
984         uint32  token;          /**< token for this measurement */
985         uint32  tsf_h;          /**< TSF high 32-bits of Measurement start time */
986         uint32  tsf_l;          /**< TSF low 32-bits */
987         uint32  dur;            /**< TUs */
988         uint32  len;            /**< byte length of data block */
989         uint8   data[1];        /**< variable length data block */
990 } wl_rm_rep_elt_t;
991 #define WL_RM_REP_ELT_FIXED_LEN 24      /**< length excluding data block */
992
993 #define WL_RPI_REP_BIN_NUM 8
994 typedef struct wl_rm_rpi_rep {
995         uint8   rpi[WL_RPI_REP_BIN_NUM];
996         int8    rpi_max[WL_RPI_REP_BIN_NUM];
997 } wl_rm_rpi_rep_t;
998
999 typedef struct wl_rm_rep {
1000         uint32  token;          /**< overall measurement set token */
1001         uint32  len;            /**< length of measurement report block */
1002         wl_rm_rep_elt_t rep[1]; /**< variable length block of reports */
1003 } wl_rm_rep_t;
1004 #define WL_RM_REP_FIXED_LEN     8
1005
1006
1007 typedef enum sup_auth_status {
1008         /* Basic supplicant authentication states */
1009         WLC_SUP_DISCONNECTED = 0,
1010         WLC_SUP_CONNECTING,
1011         WLC_SUP_IDREQUIRED,
1012         WLC_SUP_AUTHENTICATING,
1013         WLC_SUP_AUTHENTICATED,
1014         WLC_SUP_KEYXCHANGE,
1015         WLC_SUP_KEYED,
1016         WLC_SUP_TIMEOUT,
1017         WLC_SUP_LAST_BASIC_STATE,
1018
1019         /* Extended supplicant authentication states */
1020         /* Waiting to receive handshake msg M1 */
1021         WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
1022         /* Preparing to send handshake msg M2 */
1023         WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
1024         /* Waiting to receive handshake msg M3 */
1025         WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
1026         WLC_SUP_KEYXCHANGE_PREP_M4,     /**< Preparing to send handshake msg M4 */
1027         WLC_SUP_KEYXCHANGE_WAIT_G1,     /**< Waiting to receive handshake msg G1 */
1028         WLC_SUP_KEYXCHANGE_PREP_G2      /**< Preparing to send handshake msg G2 */
1029 } sup_auth_status_t;
1030
1031 typedef struct wl_wsec_key {
1032         uint32          index;          /**< key index */
1033         uint32          len;            /**< key length */
1034         uint8           data[DOT11_MAX_KEY_SIZE];       /**< key data */
1035         uint32          pad_1[18];
1036         uint32          algo;           /**< CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
1037         uint32          flags;          /**< misc flags */
1038         uint32          pad_2[2];
1039         int             pad_3;
1040         int             iv_initialized; /**< has IV been initialized already? */
1041         int             pad_4;
1042         /* Rx IV */
1043         struct {
1044                 uint32  hi;             /**< upper 32 bits of IV */
1045                 uint16  lo;             /**< lower 16 bits of IV */
1046         } rxiv;
1047         uint32          pad_5[2];
1048         struct ether_addr ea;           /**< per station */
1049 } wl_wsec_key_t;
1050
1051 #define WSEC_MIN_PSK_LEN        8
1052 #define WSEC_MAX_PSK_LEN        64
1053
1054 /* Flag for key material needing passhash'ing */
1055 #define WSEC_PASSPHRASE         (1<<0)
1056
1057 /* receptacle for WLC_SET_WSEC_PMK parameter */
1058 typedef struct {
1059         ushort  key_len;                /**< octets in key material */
1060         ushort  flags;                  /**< key handling qualification */
1061         uint8   key[WSEC_MAX_PSK_LEN];  /**< PMK material */
1062 } wsec_pmk_t;
1063
1064 typedef struct _pmkid {
1065         struct ether_addr       BSSID;
1066         uint8                   PMKID[WPA2_PMKID_LEN];
1067 } pmkid_t;
1068
1069 typedef struct _pmkid_list {
1070         uint32  npmkid;
1071         pmkid_t pmkid[1];
1072 } pmkid_list_t;
1073
1074 typedef struct _pmkid_cand {
1075         struct ether_addr       BSSID;
1076         uint8                   preauth;
1077 } pmkid_cand_t;
1078
1079 typedef struct _pmkid_cand_list {
1080         uint32  npmkid_cand;
1081         pmkid_cand_t    pmkid_cand[1];
1082 } pmkid_cand_list_t;
1083
1084 #define WL_STA_ANT_MAX          4       /**< max possible rx antennas */
1085
1086 typedef struct wl_assoc_info {
1087         uint32          req_len;
1088         uint32          resp_len;
1089         uint32          flags;
1090         struct dot11_assoc_req req;
1091         struct ether_addr reassoc_bssid; /* used in reassoc's */
1092         struct dot11_assoc_resp resp;
1093 } wl_assoc_info_t;
1094
1095 typedef struct wl_led_info {
1096         uint32      index;      /* led index */
1097         uint32      behavior;
1098         uint8       activehi;
1099 } wl_led_info_t;
1100
1101
1102 /* srom read/write struct passed through ioctl */
1103 typedef struct {
1104         uint    byteoff;        /**< byte offset */
1105         uint    nbytes;         /**< number of bytes */
1106         uint16  buf[1];
1107 } srom_rw_t;
1108
1109 #define CISH_FLAG_PCIECIS       (1 << 15)       /* write CIS format bit for PCIe CIS */
1110 /* similar cis (srom or otp) struct [iovar: may not be aligned] */
1111 typedef struct {
1112         uint16  source;         /**< cis source */
1113         uint16  flags;          /**< flags */
1114         uint32  byteoff;        /**< byte offset */
1115         uint32  nbytes;         /**< number of bytes */
1116         /* data follows here */
1117 } cis_rw_t;
1118
1119 /* R_REG and W_REG struct passed through ioctl */
1120 typedef struct {
1121         uint32  byteoff;        /**< byte offset of the field in d11regs_t */
1122         uint32  val;            /**< read/write value of the field */
1123         uint32  size;           /**< sizeof the field */
1124         uint    band;           /**< band (optional) */
1125 } rw_reg_t;
1126
1127 /* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */
1128 /* PCL - Power Control Loop */
1129 typedef struct {
1130         uint16  auto_ctrl;      /**< WL_ATTEN_XX */
1131         uint16  bb;             /**< Baseband attenuation */
1132         uint16  radio;          /**< Radio attenuation */
1133         uint16  txctl1;         /**< Radio TX_CTL1 value */
1134 } atten_t;
1135
1136 /* Per-AC retry parameters */
1137 struct wme_tx_params_s {
1138         uint8  short_retry;
1139         uint8  short_fallback;
1140         uint8  long_retry;
1141         uint8  long_fallback;
1142         uint16 max_rate;  /* In units of 512 Kbps */
1143 };
1144
1145 typedef struct wme_tx_params_s wme_tx_params_t;
1146
1147 #define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
1148
1149 /* Used to get specific link/ac parameters */
1150 typedef struct {
1151         int32 ac;
1152         uint8 val;
1153         struct ether_addr ea;
1154 } link_val_t;
1155
1156
1157 #define WL_PM_MUTE_TX_VER 1
1158
1159 typedef struct wl_pm_mute_tx {
1160         uint16 version;         /**< version */
1161         uint16 len;             /**< length */
1162         uint16 deadline;        /**< deadline timer (in milliseconds) */
1163         uint8  enable;          /**< set to 1 to enable mode; set to 0 to disable it */
1164 } wl_pm_mute_tx_t;
1165
1166
1167 typedef struct {
1168         uint16                  ver;            /**< version of this struct */
1169         uint16                  len;            /**< length in bytes of this structure */
1170         uint16                  cap;            /**< sta's advertised capabilities */
1171         uint32                  flags;          /**< flags defined below */
1172         uint32                  idle;           /**< time since data pkt rx'd from sta */
1173         struct ether_addr       ea;             /**< Station address */
1174         wl_rateset_t            rateset;        /**< rateset in use */
1175         uint32                  in;             /**< seconds elapsed since associated */
1176         uint32                  listen_interval_inms; /* Min Listen interval in ms for this STA */
1177         uint32                  tx_pkts;        /**< # of user packets transmitted (unicast) */
1178         uint32                  tx_failures;    /**< # of user packets failed */
1179         uint32                  rx_ucast_pkts;  /**< # of unicast packets received */
1180         uint32                  rx_mcast_pkts;  /**< # of multicast packets received */
1181         uint32                  tx_rate;        /**< Rate used by last tx frame */
1182         uint32                  rx_rate;        /**< Rate of last successful rx frame */
1183         uint32                  rx_decrypt_succeeds;    /**< # of packet decrypted successfully */
1184         uint32                  rx_decrypt_failures;    /**< # of packet decrypted unsuccessfully */
1185         uint32                  tx_tot_pkts;    /**< # of user tx pkts (ucast + mcast) */
1186         uint32                  rx_tot_pkts;    /**< # of data packets recvd (uni + mcast) */
1187         uint32                  tx_mcast_pkts;  /**< # of mcast pkts txed */
1188         uint64                  tx_tot_bytes;   /**< data bytes txed (ucast + mcast) */
1189         uint64                  rx_tot_bytes;   /**< data bytes recvd (ucast + mcast) */
1190         uint64                  tx_ucast_bytes; /**< data bytes txed (ucast) */
1191         uint64                  tx_mcast_bytes; /**< # data bytes txed (mcast) */
1192         uint64                  rx_ucast_bytes; /**< data bytes recvd (ucast) */
1193         uint64                  rx_mcast_bytes; /**< data bytes recvd (mcast) */
1194         int8                    rssi[WL_STA_ANT_MAX]; /* average rssi per antenna
1195                                                                                    * of data frames
1196                                                                                    */
1197         int8                    nf[WL_STA_ANT_MAX];     /**< per antenna noise floor */
1198         uint16                  aid;            /**< association ID */
1199         uint16                  ht_capabilities;        /**< advertised ht caps */
1200         uint16                  vht_flags;              /**< converted vht flags */
1201         uint32                  tx_pkts_retried;        /**< # of frames where a retry was
1202                                                          * necessary
1203                                                          */
1204         uint32                  tx_pkts_retry_exhausted; /* # of user frames where a retry
1205                                                           * was exhausted
1206                                                           */
1207         int8                    rx_lastpkt_rssi[WL_STA_ANT_MAX]; /* Per antenna RSSI of last
1208                                                                   * received data frame.
1209                                                                   */
1210         /* TX WLAN retry/failure statistics:
1211          * Separated for host requested frames and WLAN locally generated frames.
1212          * Include unicast frame only where the retries/failures can be counted.
1213          */
1214         uint32                  tx_pkts_total;          /**< # user frames sent successfully */
1215         uint32                  tx_pkts_retries;        /**< # user frames retries */
1216         uint32                  tx_pkts_fw_total;       /**< # FW generated sent successfully */
1217         uint32                  tx_pkts_fw_retries;     /**< # retries for FW generated frames */
1218         uint32                  tx_pkts_fw_retry_exhausted;     /**< # FW generated where a retry
1219                                                                  * was exhausted
1220                                                                  */
1221         uint32                  rx_pkts_retried;        /**< # rx with retry bit set */
1222         uint32                  tx_rate_fallback;       /**< lowest fallback TX rate */
1223 } sta_info_t;
1224
1225 #define WL_OLD_STAINFO_SIZE     OFFSETOF(sta_info_t, tx_tot_pkts)
1226
1227 #define WL_STA_VER              4
1228
1229 typedef struct {
1230         uint32 auto_en;
1231         uint32 active_ant;
1232         uint32 rxcount;
1233         int32 avg_snr_per_ant0;
1234         int32 avg_snr_per_ant1;
1235         int32 avg_snr_per_ant2;
1236         uint32 swap_ge_rxcount0;
1237         uint32 swap_ge_rxcount1;
1238         uint32 swap_ge_snrthresh0;
1239         uint32 swap_ge_snrthresh1;
1240         uint32 swap_txfail0;
1241         uint32 swap_txfail1;
1242         uint32 swap_timer0;
1243         uint32 swap_timer1;
1244         uint32 swap_alivecheck0;
1245         uint32 swap_alivecheck1;
1246         uint32 rxcount_per_ant0;
1247         uint32 rxcount_per_ant1;
1248         uint32 acc_rxcount;
1249         uint32 acc_rxcount_per_ant0;
1250         uint32 acc_rxcount_per_ant1;
1251         uint32 tx_auto_en;
1252         uint32 tx_active_ant;
1253         uint32 rx_policy;
1254         uint32 tx_policy;
1255         uint32 cell_policy;
1256 } wlc_swdiv_stats_t;
1257
1258 #define WLC_NUMRATES    16      /**< max # of rates in a rateset */
1259
1260 typedef struct wlc_rateset {
1261         uint32  count;                  /**< number of rates in rates[] */
1262         uint8   rates[WLC_NUMRATES];    /**< rates in 500kbps units w/hi bit set if basic */
1263         uint8   htphy_membership;       /**< HT PHY Membership */
1264         uint8   mcs[MCSSET_LEN];        /**< supported mcs index bit map */
1265         uint16  vht_mcsmap;             /**< supported vht mcs nss bit map */
1266         uint16  vht_mcsmap_prop;        /**< supported prop vht mcs nss bit map */
1267 } wlc_rateset_t;
1268
1269 /* Used to get specific STA parameters */
1270 typedef struct {
1271         uint32  val;
1272         struct ether_addr ea;
1273 } scb_val_t;
1274
1275 /* Used by iovar versions of some ioctls, i.e. WLC_SCB_AUTHORIZE et al */
1276 typedef struct {
1277         uint32 code;
1278         scb_val_t ioctl_args;
1279 } authops_t;
1280
1281 /* channel encoding */
1282 typedef struct channel_info {
1283         int hw_channel;
1284         int target_channel;
1285         int scan_channel;
1286 } channel_info_t;
1287
1288 /* For ioctls that take a list of MAC addresses */
1289 typedef struct maclist {
1290         uint count;                     /**< number of MAC addresses */
1291         struct ether_addr ea[1];        /**< variable length array of MAC addresses */
1292 } maclist_t;
1293
1294 /* get pkt count struct passed through ioctl */
1295 typedef struct get_pktcnt {
1296         uint rx_good_pkt;
1297         uint rx_bad_pkt;
1298         uint tx_good_pkt;
1299         uint tx_bad_pkt;
1300         uint rx_ocast_good_pkt; /* unicast packets destined for others */
1301 } get_pktcnt_t;
1302
1303 /* NINTENDO2 */
1304 #define LQ_IDX_MIN              0
1305 #define LQ_IDX_MAX              1
1306 #define LQ_IDX_AVG              2
1307 #define LQ_IDX_SUM              2
1308 #define LQ_IDX_LAST             3
1309 #define LQ_STOP_MONITOR         0
1310 #define LQ_START_MONITOR        1
1311
1312 /* Get averages RSSI, Rx PHY rate and SNR values */
1313 typedef struct {
1314         int rssi[LQ_IDX_LAST];  /* Array to keep min, max, avg rssi */
1315         int snr[LQ_IDX_LAST];   /* Array to keep min, max, avg snr */
1316         int isvalid;            /* Flag indicating whether above data is valid */
1317 } wl_lq_t; /* Link Quality */
1318
1319 typedef enum wl_wakeup_reason_type {
1320         LCD_ON = 1,
1321         LCD_OFF,
1322         DRC1_WAKE,
1323         DRC2_WAKE,
1324         REASON_LAST
1325 } wl_wr_type_t;
1326
1327 typedef struct {
1328 /* Unique filter id */
1329         uint32  id;
1330
1331 /* stores the reason for the last wake up */
1332         uint8   reason;
1333 } wl_wr_t;
1334
1335 /* Get MAC specific rate histogram command */
1336 typedef struct {
1337         struct  ether_addr ea;  /**< MAC Address */
1338         uint8   ac_cat; /**< Access Category */
1339         uint8   num_pkts;       /**< Number of packet entries to be averaged */
1340 } wl_mac_ratehisto_cmd_t;       /**< MAC Specific Rate Histogram command */
1341
1342 /* Get MAC rate histogram response */
1343 typedef struct {
1344         uint32  rate[DOT11_RATE_MAX + 1];       /**< Rates */
1345         uint32  mcs[WL_RATESET_SZ_HT_IOCTL * WL_TX_CHAINS_MAX]; /**< MCS counts */
1346         uint32  vht[WL_RATESET_SZ_VHT_MCS][WL_TX_CHAINS_MAX];   /**< VHT counts */
1347         uint32  tsf_timer[2][2];        /**< Start and End time for 8bytes value */
1348         uint32  prop11n_mcs[WLC_11N_LAST_PROP_MCS - WLC_11N_FIRST_PROP_MCS + 1]; /* MCS counts */
1349 } wl_mac_ratehisto_res_t;       /**< MAC Specific Rate Histogram Response */
1350
1351 /* Linux network driver ioctl encoding */
1352 typedef struct wl_ioctl {
1353         uint cmd;       /**< common ioctl definition */
1354         void *buf;      /**< pointer to user buffer */
1355         uint len;       /**< length of user buffer */
1356         uint8 set;              /**< 1=set IOCTL; 0=query IOCTL */
1357         uint used;      /**< bytes read or written (optional) */
1358         uint needed;    /**< bytes needed (optional) */
1359 } wl_ioctl_t;
1360
1361 #ifdef CONFIG_COMPAT
1362 typedef struct compat_wl_ioctl {
1363         uint cmd;       /**< common ioctl definition */
1364         uint32 buf;     /**< pointer to user buffer */
1365         uint len;       /**< length of user buffer */
1366         uint8 set;              /**< 1=set IOCTL; 0=query IOCTL */
1367         uint used;      /**< bytes read or written (optional) */
1368         uint needed;    /**< bytes needed (optional) */
1369 } compat_wl_ioctl_t;
1370 #endif /* CONFIG_COMPAT */
1371
1372 #define WL_NUM_RATES_CCK                        4 /* 1, 2, 5.5, 11 Mbps */
1373 #define WL_NUM_RATES_OFDM                       8 /* 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
1374 #define WL_NUM_RATES_MCS_1STREAM        8 /* MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
1375 #define WL_NUM_RATES_EXTRA_VHT          2 /* Additional VHT 11AC rates */
1376 #define WL_NUM_RATES_VHT                        10
1377 #define WL_NUM_RATES_MCS32                      1
1378
1379
1380 /*
1381  * Structure for passing hardware and software
1382  * revision info up from the driver.
1383  */
1384 typedef struct wlc_rev_info {
1385         uint            vendorid;       /**< PCI vendor id */
1386         uint            deviceid;       /**< device id of chip */
1387         uint            radiorev;       /**< radio revision */
1388         uint            chiprev;        /**< chip revision */
1389         uint            corerev;        /**< core revision */
1390         uint            boardid;        /**< board identifier (usu. PCI sub-device id) */
1391         uint            boardvendor;    /**< board vendor (usu. PCI sub-vendor id) */
1392         uint            boardrev;       /**< board revision */
1393         uint            driverrev;      /**< driver version */
1394         uint            ucoderev;       /**< microcode version */
1395         uint            bus;            /**< bus type */
1396         uint            chipnum;        /**< chip number */
1397         uint            phytype;        /**< phy type */
1398         uint            phyrev;         /**< phy revision */
1399         uint            anarev;         /**< anacore rev */
1400         uint            chippkg;        /**< chip package info */
1401         uint            nvramrev;       /**< nvram revision number */
1402 } wlc_rev_info_t;
1403
1404 #define WL_REV_INFO_LEGACY_LENGTH       48
1405
1406 #define WL_BRAND_MAX 10
1407 typedef struct wl_instance_info {
1408         uint instance;
1409         char brand[WL_BRAND_MAX];
1410 } wl_instance_info_t;
1411
1412 /* structure to change size of tx fifo */
1413 typedef struct wl_txfifo_sz {
1414         uint16  magic;
1415         uint16  fifo;
1416         uint16  size;
1417 } wl_txfifo_sz_t;
1418
1419 /* Transfer info about an IOVar from the driver */
1420 /* Max supported IOV name size in bytes, + 1 for nul termination */
1421 #define WLC_IOV_NAME_LEN 30
1422 typedef struct wlc_iov_trx_s {
1423         uint8 module;
1424         uint8 type;
1425         char name[WLC_IOV_NAME_LEN];
1426 } wlc_iov_trx_t;
1427
1428 /* bump this number if you change the ioctl interface */
1429 #define WLC_IOCTL_VERSION       2
1430 #define WLC_IOCTL_VERSION_LEGACY_IOTYPES        1
1431
1432 #ifdef CONFIG_USBRNDIS_RETAIL
1433 /* struct passed in for WLC_NDCONFIG_ITEM */
1434 typedef struct {
1435         char *name;
1436         void *param;
1437 } ndconfig_item_t;
1438 #endif
1439
1440
1441
1442 #define WL_PHY_PAVARS_LEN       32      /**< Phytype, Bandrange, chain, a[0], b[0], c[0], d[0] .. */
1443
1444
1445 #define WL_PHY_PAVAR_VER        1       /**< pavars version */
1446 #define WL_PHY_PAVARS2_NUM      3       /**< a1, b0, b1 */
1447 typedef struct wl_pavars2 {
1448         uint16 ver;             /**< version of this struct */
1449         uint16 len;             /**< len of this structure */
1450         uint16 inuse;           /**< driver return 1 for a1,b0,b1 in current band range */
1451         uint16 phy_type;        /**< phy type */
1452         uint16 bandrange;
1453         uint16 chain;
1454         uint16 inpa[WL_PHY_PAVARS2_NUM];        /**< phy pavars for one band range */
1455 } wl_pavars2_t;
1456
1457 typedef struct wl_po {
1458         uint16  phy_type;       /**< Phy type */
1459         uint16  band;
1460         uint16  cckpo;
1461         uint32  ofdmpo;
1462         uint16  mcspo[8];
1463 } wl_po_t;
1464
1465 #define WL_NUM_RPCALVARS 5      /**< number of rpcal vars */
1466
1467 typedef struct wl_rpcal {
1468         uint16 value;
1469         uint16 update;
1470 } wl_rpcal_t;
1471
1472 typedef struct wl_aci_args {
1473         int enter_aci_thresh; /* Trigger level to start detecting ACI */
1474         int exit_aci_thresh; /* Trigger level to exit ACI mode */
1475         int usec_spin; /* microsecs to delay between rssi samples */
1476         int glitch_delay; /* interval between ACI scans when glitch count is consistently high */
1477         uint16 nphy_adcpwr_enter_thresh;        /**< ADC power to enter ACI mitigation mode */
1478         uint16 nphy_adcpwr_exit_thresh; /**< ADC power to exit ACI mitigation mode */
1479         uint16 nphy_repeat_ctr;         /**< Number of tries per channel to compute power */
1480         uint16 nphy_num_samples;        /**< Number of samples to compute power on one channel */
1481         uint16 nphy_undetect_window_sz; /**< num of undetects to exit ACI Mitigation mode */
1482         uint16 nphy_b_energy_lo_aci;    /**< low ACI power energy threshold for bphy */
1483         uint16 nphy_b_energy_md_aci;    /**< mid ACI power energy threshold for bphy */
1484         uint16 nphy_b_energy_hi_aci;    /**< high ACI power energy threshold for bphy */
1485         uint16 nphy_noise_noassoc_glitch_th_up; /* wl interference 4 */
1486         uint16 nphy_noise_noassoc_glitch_th_dn;
1487         uint16 nphy_noise_assoc_glitch_th_up;
1488         uint16 nphy_noise_assoc_glitch_th_dn;
1489         uint16 nphy_noise_assoc_aci_glitch_th_up;
1490         uint16 nphy_noise_assoc_aci_glitch_th_dn;
1491         uint16 nphy_noise_assoc_enter_th;
1492         uint16 nphy_noise_noassoc_enter_th;
1493         uint16 nphy_noise_assoc_rx_glitch_badplcp_enter_th;
1494         uint16 nphy_noise_noassoc_crsidx_incr;
1495         uint16 nphy_noise_assoc_crsidx_incr;
1496         uint16 nphy_noise_crsidx_decr;
1497 } wl_aci_args_t;
1498
1499 #define WL_ACI_ARGS_LEGACY_LENGTH       16      /**< bytes of pre NPHY aci args */
1500 #define WL_SAMPLECOLLECT_T_VERSION      2       /**< version of wl_samplecollect_args_t struct */
1501 typedef struct wl_samplecollect_args {
1502         /* version 0 fields */
1503         uint8 coll_us;
1504         int cores;
1505         /* add'l version 1 fields */
1506         uint16 version;     /* see definition of WL_SAMPLECOLLECT_T_VERSION */
1507         uint16 length;      /* length of entire structure */
1508         int8 trigger;
1509         uint16 timeout;
1510         uint16 mode;
1511         uint32 pre_dur;
1512         uint32 post_dur;
1513         uint8 gpio_sel;
1514         uint8 downsamp;
1515         uint8 be_deaf;
1516         uint8 agc;              /**< loop from init gain and going down */
1517         uint8 filter;           /**< override high pass corners to lowest */
1518         /* add'l version 2 fields */
1519         uint8 trigger_state;
1520         uint8 module_sel1;
1521         uint8 module_sel2;
1522         uint16 nsamps;
1523         int bitStart;
1524         uint32 gpioCapMask;
1525 } wl_samplecollect_args_t;
1526
1527 #define WL_SAMPLEDATA_T_VERSION         1       /**< version of wl_samplecollect_args_t struct */
1528 /* version for unpacked sample data, int16 {(I,Q),Core(0..N)} */
1529 #define WL_SAMPLEDATA_T_VERSION_SPEC_AN 2
1530
1531 typedef struct wl_sampledata {
1532         uint16 version; /**< structure version */
1533         uint16 size;    /**< size of structure */
1534         uint16 tag;     /**< Header/Data */
1535         uint16 length;  /**< data length */
1536         uint32 flag;    /**< bit def */
1537 } wl_sampledata_t;
1538
1539
1540 /* WL_OTA START */
1541 /* OTA Test Status */
1542 enum {
1543         WL_OTA_TEST_IDLE = 0,   /**< Default Idle state */
1544         WL_OTA_TEST_ACTIVE = 1, /**< Test Running */
1545         WL_OTA_TEST_SUCCESS = 2,        /**< Successfully Finished Test */
1546         WL_OTA_TEST_FAIL = 3    /**< Test Failed in the Middle */
1547 };
1548 /* OTA SYNC Status */
1549 enum {
1550         WL_OTA_SYNC_IDLE = 0,   /**< Idle state */
1551         WL_OTA_SYNC_ACTIVE = 1, /**< Waiting for Sync */
1552         WL_OTA_SYNC_FAIL = 2    /**< Sync pkt not recieved */
1553 };
1554
1555 /* Various error states dut can get stuck during test */
1556 enum {
1557         WL_OTA_SKIP_TEST_CAL_FAIL = 1,          /**< Phy calibration failed */
1558         WL_OTA_SKIP_TEST_SYNCH_FAIL = 2,                /**< Sync Packet not recieved */
1559         WL_OTA_SKIP_TEST_FILE_DWNLD_FAIL = 3,   /**< Cmd flow file download failed */
1560         WL_OTA_SKIP_TEST_NO_TEST_FOUND = 4,     /**< No test found in Flow file */
1561         WL_OTA_SKIP_TEST_WL_NOT_UP = 5,         /**< WL UP failed */
1562         WL_OTA_SKIP_TEST_UNKNOWN_CALL           /**< Unintentional scheduling on ota test */
1563 };
1564
1565 /* Differentiator for ota_tx and ota_rx */
1566 enum {
1567         WL_OTA_TEST_TX = 0,             /**< ota_tx */
1568         WL_OTA_TEST_RX = 1,             /**< ota_rx */
1569 };
1570
1571 /* Catch 3 modes of operation: 20Mhz, 40Mhz, 20 in 40 Mhz */
1572 enum {
1573         WL_OTA_TEST_BW_20_IN_40MHZ = 0,         /**< 20 in 40 operation */
1574         WL_OTA_TEST_BW_20MHZ = 1,               /**< 20 Mhz operation */
1575         WL_OTA_TEST_BW_40MHZ = 2,               /**< full 40Mhz operation */
1576         WL_OTA_TEST_BW_80MHZ = 3                /* full 80Mhz operation */
1577 };
1578
1579 #define HT_MCS_INUSE    0x00000080      /* HT MCS in use,indicates b0-6 holds an mcs */
1580 #define VHT_MCS_INUSE   0x00000100      /* VHT MCS in use,indicates b0-6 holds an mcs */
1581 #define OTA_RATE_MASK 0x0000007f        /* rate/mcs value */
1582 #define OTA_STF_SISO    0
1583 #define OTA_STF_CDD             1
1584 #define OTA_STF_STBC    2
1585 #define OTA_STF_SDM             3
1586
1587 typedef struct ota_rate_info {
1588         uint8 rate_cnt;                                 /**< Total number of rates */
1589         uint16 rate_val_mbps[WL_OTA_TEST_MAX_NUM_RATE]; /**< array of rates from 1mbps to 130mbps */
1590                                                         /**< for legacy rates : ratein mbps * 2 */
1591                                                         /**< for HT rates : mcs index */
1592 } ota_rate_info_t;
1593
1594 typedef struct ota_power_info {
1595         int8 pwr_ctrl_on;       /**< power control on/off */
1596         int8 start_pwr;         /**< starting power/index */
1597         int8 delta_pwr;         /**< delta power/index */
1598         int8 end_pwr;           /**< end power/index */
1599 } ota_power_info_t;
1600
1601 typedef struct ota_packetengine {
1602         uint16 delay;           /* Inter-packet delay */
1603                                 /**< for ota_tx, delay is tx ifs in micro seconds */
1604                                 /* for ota_rx, delay is wait time in milliseconds */
1605         uint16 nframes;         /* Number of frames */
1606         uint16 length;          /* Packet length */
1607 } ota_packetengine_t;
1608
1609 /* Test info vector */
1610 typedef struct wl_ota_test_args {
1611         uint8 cur_test;                 /**< test phase */
1612         uint8 chan;                     /**< channel */
1613         uint8 bw;                       /**< bandwidth */
1614         uint8 control_band;             /**< control band */
1615         uint8 stf_mode;                 /**< stf mode */
1616         ota_rate_info_t rt_info;        /**< Rate info */
1617         ota_packetengine_t pkteng;      /**< packeteng info */
1618         uint8 txant;                    /**< tx antenna */
1619         uint8 rxant;                    /**< rx antenna */
1620         ota_power_info_t pwr_info;      /**< power sweep info */
1621         uint8 wait_for_sync;            /**< wait for sync or not */
1622         uint8 ldpc;
1623         uint8 sgi;
1624         /* Update WL_OTA_TESTVEC_T_VERSION for adding new members to this structure */
1625 } wl_ota_test_args_t;
1626
1627 #define WL_OTA_TESTVEC_T_VERSION                1       /* version of wl_ota_test_vector_t struct */
1628 typedef struct wl_ota_test_vector {
1629         uint16 version;
1630         wl_ota_test_args_t test_arg[WL_OTA_TEST_MAX_NUM_SEQ];   /**< Test argument struct */
1631         uint16 test_cnt;                                        /**< Total no of test */
1632         uint8 file_dwnld_valid;                                 /**< File successfully downloaded */
1633         uint8 sync_timeout;                                     /**< sync packet timeout */
1634         int8 sync_fail_action;                                  /**< sync fail action */
1635         struct ether_addr sync_mac;                             /**< macaddress for sync pkt */
1636         struct ether_addr tx_mac;                               /**< macaddress for tx */
1637         struct ether_addr rx_mac;                               /**< macaddress for rx */
1638         int8 loop_test;                                 /**< dbg feature to loop the test */
1639         uint16 test_rxcnt;
1640         /* Update WL_OTA_TESTVEC_T_VERSION for adding new members to this structure */
1641 } wl_ota_test_vector_t;
1642
1643
1644 /* struct copied back form dongle to host to query the status */
1645 typedef struct wl_ota_test_status {
1646         int16 cur_test_cnt;             /**< test phase */
1647         int8 skip_test_reason;          /**< skip test reasoin */
1648         wl_ota_test_args_t test_arg;    /**< cur test arg details */
1649         uint16 test_cnt;                /**< total no of test downloaded */
1650         uint8 file_dwnld_valid;         /**< file successfully downloaded ? */
1651         uint8 sync_timeout;             /**< sync timeout */
1652         int8 sync_fail_action;          /**< sync fail action */
1653         struct ether_addr sync_mac;     /**< macaddress for sync pkt */
1654         struct ether_addr tx_mac;       /**< tx mac address */
1655         struct ether_addr rx_mac;       /**< rx mac address */
1656         uint8  test_stage;              /**< check the test status */
1657         int8 loop_test;         /**< Debug feature to puts test enfine in a loop */
1658         uint8 sync_status;              /**< sync status */
1659 } wl_ota_test_status_t;
1660 typedef struct wl_ota_rx_rssi {
1661         uint16  pktcnt;         /* Pkt count used for this rx test */
1662         chanspec_t chanspec;    /* Channel info on which the packets are received */
1663         int16   rssi;           /* Average RSSI of the first 50% packets received */
1664 } wl_ota_rx_rssi_t;
1665
1666 #define WL_OTARSSI_T_VERSION            1       /* version of wl_ota_test_rssi_t struct */
1667 #define WL_OTA_TEST_RSSI_FIXED_SIZE     OFFSETOF(wl_ota_test_rssi_t, rx_rssi)
1668
1669 typedef struct wl_ota_test_rssi {
1670         uint8 version;
1671         uint8   testcnt;                /* total measured RSSI values, valid on output only */
1672         wl_ota_rx_rssi_t rx_rssi[1]; /* Variable length array of wl_ota_rx_rssi_t */
1673 } wl_ota_test_rssi_t;
1674
1675 /* WL_OTA END */
1676
1677 /* wl_radar_args_t */
1678 typedef struct {
1679         int npulses;    /**< required number of pulses at n * t_int */
1680         int ncontig;    /**< required number of pulses at t_int */
1681         int min_pw;     /**< minimum pulse width (20 MHz clocks) */
1682         int max_pw;     /**< maximum pulse width (20 MHz clocks) */
1683         uint16 thresh0; /**< Radar detection, thresh 0 */
1684         uint16 thresh1; /**< Radar detection, thresh 1 */
1685         uint16 blank;   /**< Radar detection, blank control */
1686         uint16 fmdemodcfg;      /**< Radar detection, fmdemod config */
1687         int npulses_lp;  /* Radar detection, minimum long pulses */
1688         int min_pw_lp; /* Minimum pulsewidth for long pulses */
1689         int max_pw_lp; /* Maximum pulsewidth for long pulses */
1690         int min_fm_lp; /* Minimum fm for long pulses */
1691         int max_span_lp;  /* Maximum deltat for long pulses */
1692         int min_deltat; /* Minimum spacing between pulses */
1693         int max_deltat; /* Maximum spacing between pulses */
1694         uint16 autocorr;        /**< Radar detection, autocorr on or off */
1695         uint16 st_level_time;   /**< Radar detection, start_timing level */
1696         uint16 t2_min; /* minimum clocks needed to remain in state 2 */
1697         uint32 version; /* version */
1698         uint32 fra_pulse_err;   /**< sample error margin for detecting French radar pulsed */
1699         int npulses_fra;  /* Radar detection, minimum French pulses set */
1700         int npulses_stg2;  /* Radar detection, minimum staggered-2 pulses set */
1701         int npulses_stg3;  /* Radar detection, minimum staggered-3 pulses set */
1702         uint16 percal_mask;     /**< defines which period cal is masked from radar detection */
1703         int quant;      /**< quantization resolution to pulse positions */
1704         uint32 min_burst_intv_lp;       /**< minimum burst to burst interval for bin3 radar */
1705         uint32 max_burst_intv_lp;       /**< maximum burst to burst interval for bin3 radar */
1706         int nskip_rst_lp;       /**< number of skipped pulses before resetting lp buffer */
1707         int max_pw_tol; /**< maximum tolerance allowd in detected pulse width for radar detection */
1708         uint16 feature_mask; /* 16-bit mask to specify enabled features */
1709 } wl_radar_args_t;
1710
1711 #define WL_RADAR_ARGS_VERSION 2
1712
1713 typedef struct {
1714         uint32 version; /* version */
1715         uint16 thresh0_20_lo;   /* Radar detection, thresh 0 (range 5250-5350MHz) for BW 20MHz */
1716         uint16 thresh1_20_lo;   /* Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
1717         uint16 thresh0_40_lo;   /* Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
1718         uint16 thresh1_40_lo;   /* Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
1719         uint16 thresh0_80_lo;   /* Radar detection, thresh 0 (range 5250-5350MHz) for BW 80MHz */
1720         uint16 thresh1_80_lo;   /* Radar detection, thresh 1 (range 5250-5350MHz) for BW 80MHz */
1721         uint16 thresh0_20_hi;   /* Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
1722         uint16 thresh1_20_hi;   /* Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
1723         uint16 thresh0_40_hi;   /* Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
1724         uint16 thresh1_40_hi;   /* Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
1725         uint16 thresh0_80_hi;   /* Radar detection, thresh 0 (range 5470-5725MHz) for BW 80MHz */
1726         uint16 thresh1_80_hi;   /* Radar detection, thresh 1 (range 5470-5725MHz) for BW 80MHz */
1727 #ifdef WL11AC160
1728         uint16 thresh0_160_lo;  /* Radar detection, thresh 0 (range 5250-5350MHz) for BW 160MHz */
1729         uint16 thresh1_160_lo;  /* Radar detection, thresh 1 (range 5250-5350MHz) for BW 160MHz */
1730         uint16 thresh0_160_hi;  /* Radar detection, thresh 0 (range 5470-5725MHz) for BW 160MHz */
1731         uint16 thresh1_160_hi;  /* Radar detection, thresh 1 (range 5470-5725MHz) for BW 160MHz */
1732 #endif /* WL11AC160 */
1733 } wl_radar_thr_t;
1734
1735 #define WL_RADAR_THR_VERSION    2
1736
1737 /* RSSI per antenna */
1738 typedef struct {
1739         uint32  version;                /**< version field */
1740         uint32  count;                  /**< number of valid antenna rssi */
1741         int8 rssi_ant[WL_RSSI_ANT_MAX]; /**< rssi per antenna */
1742 } wl_rssi_ant_t;
1743
1744 /* data structure used in 'dfs_status' wl interface, which is used to query dfs status */
1745 typedef struct {
1746         uint state;             /**< noted by WL_DFS_CACSTATE_XX. */
1747         uint duration;          /**< time spent in ms in state. */
1748         /* as dfs enters ISM state, it removes the operational channel from quiet channel
1749          * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
1750          */
1751         chanspec_t chanspec_cleared;
1752         /* chanspec cleared used to be a uint, add another to uint16 to maintain size */
1753         uint16 pad;
1754 } wl_dfs_status_t;
1755
1756 typedef struct {
1757         uint state;             /* noted by WL_DFS_CACSTATE_XX */
1758         uint duration;          /* time spent in ms in state */
1759         chanspec_t chanspec;    /* chanspec of this core */
1760         chanspec_t chanspec_last_cleared; /* chanspec last cleared for operation by scanning */
1761         uint16 sub_type;        /* currently just the index of the core or the respective PLL */
1762         uint16 pad;
1763 } wl_dfs_sub_status_t;
1764
1765 #define WL_DFS_STATUS_ALL_VERSION       (1)
1766 typedef struct {
1767         uint16 version;         /* version field; current max version 1 */
1768         uint16 num_sub_status;
1769         wl_dfs_sub_status_t  dfs_sub_status[1]; /* struct array of length num_sub_status */
1770 } wl_dfs_status_all_t;
1771
1772 #define WL_DFS_AP_MOVE_VERSION  (1)
1773 typedef struct wl_dfs_ap_move_status {
1774         int8 version;            /* version field; current max version 1 */
1775         int8 move_status;        /* DFS move status */
1776         chanspec_t chanspec;     /* New AP Chanspec */
1777         wl_dfs_status_all_t scan_status; /* status; see dfs_status_all for wl_dfs_status_all_t */
1778 } wl_dfs_ap_move_status_t;
1779
1780
1781 /* data structure used in 'radar_status' wl interface, which is use to query radar det status */
1782 typedef struct {
1783         bool detected;
1784         int count;
1785         bool pretended;
1786         uint32 radartype;
1787         uint32 timenow;
1788         uint32 timefromL;
1789         int lp_csect_single;
1790         int detected_pulse_index;
1791         int nconsecq_pulses;
1792         chanspec_t ch;
1793         int pw[10];
1794         int intv[10];
1795         int fm[10];
1796 } wl_radar_status_t;
1797
1798 #define NUM_PWRCTRL_RATES 12
1799
1800 typedef struct {
1801         uint8 txpwr_band_max[NUM_PWRCTRL_RATES];        /**< User set target */
1802         uint8 txpwr_limit[NUM_PWRCTRL_RATES];           /**< reg and local power limit */
1803         uint8 txpwr_local_max;                          /**< local max according to the AP */
1804         uint8 txpwr_local_constraint;                   /**< local constraint according to the AP */
1805         uint8 txpwr_chan_reg_max;                       /**< Regulatory max for this channel */
1806         uint8 txpwr_target[2][NUM_PWRCTRL_RATES];       /**< Latest target for 2.4 and 5 Ghz */
1807         uint8 txpwr_est_Pout[2];                        /**< Latest estimate for 2.4 and 5 Ghz */
1808         uint8 txpwr_opo[NUM_PWRCTRL_RATES];             /**< On G phy, OFDM power offset */
1809         uint8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];    /**< Max CCK power for this band (SROM) */
1810         uint8 txpwr_bphy_ofdm_max;                      /**< Max OFDM power for this band (SROM) */
1811         uint8 txpwr_aphy_max[NUM_PWRCTRL_RATES];        /**< Max power for A band (SROM) */
1812         int8  txpwr_antgain[2];                         /**< Ant gain for each band - from SROM */
1813         uint8 txpwr_est_Pout_gofdm;                     /**< Pwr estimate for 2.4 OFDM */
1814 } tx_power_legacy_t;
1815
1816 #define WL_TX_POWER_RATES_LEGACY    45
1817 #define WL_TX_POWER_MCS20_FIRST         12
1818 #define WL_TX_POWER_MCS20_NUM           16
1819 #define WL_TX_POWER_MCS40_FIRST         28
1820 #define WL_TX_POWER_MCS40_NUM           17
1821
1822 typedef struct {
1823         uint32 flags;
1824         chanspec_t chanspec;                 /* txpwr report for this channel */
1825         chanspec_t local_chanspec;           /* channel on which we are associated */
1826         uint8 local_max;                 /* local max according to the AP */
1827         uint8 local_constraint;              /* local constraint according to the AP */
1828         int8  antgain[2];                /* Ant gain for each band - from SROM */
1829         uint8 rf_cores;                  /* count of RF Cores being reported */
1830         uint8 est_Pout[4];                           /* Latest tx power out estimate per RF
1831                                                           * chain without adjustment
1832                                                           */
1833         uint8 est_Pout_cck;                          /* Latest CCK tx power out estimate */
1834         uint8 user_limit[WL_TX_POWER_RATES_LEGACY];  /* User limit */
1835         uint8 reg_limit[WL_TX_POWER_RATES_LEGACY];   /* Regulatory power limit */
1836         uint8 board_limit[WL_TX_POWER_RATES_LEGACY]; /* Max power board can support (SROM) */
1837         uint8 target[WL_TX_POWER_RATES_LEGACY];      /* Latest target power */
1838 } tx_power_legacy2_t;
1839
1840 #define WL_NUM_2x2_ELEMENTS             4
1841 #define WL_NUM_3x3_ELEMENTS             6
1842 #define WL_NUM_4x4_ELEMENTS             10
1843
1844 typedef struct {
1845         uint16 ver;                             /**< version of this struct */
1846         uint16 len;                             /**< length in bytes of this structure */
1847         uint32 flags;
1848         chanspec_t chanspec;                    /**< txpwr report for this channel */
1849         chanspec_t local_chanspec;              /**< channel on which we are associated */
1850         uint32     buflen;                      /**< ppr buffer length */
1851         uint8      pprbuf[1];                   /**< Latest target power buffer */
1852 } wl_txppr_t;
1853
1854 #define WL_TXPPR_VERSION        1
1855 #define WL_TXPPR_LENGTH (sizeof(wl_txppr_t))
1856 #define TX_POWER_T_VERSION      45
1857 /* number of ppr serialization buffers, it should be reg, board and target */
1858 #define WL_TXPPR_SER_BUF_NUM    (3)
1859
1860 typedef struct chanspec_txpwr_max {
1861         chanspec_t chanspec;   /* chanspec */
1862         uint8 txpwr_max;       /* max txpwr in all the rates */
1863         uint8 padding;
1864 } chanspec_txpwr_max_t;
1865
1866 typedef struct  wl_chanspec_txpwr_max {
1867         uint16 ver;                     /**< version of this struct */
1868         uint16 len;                     /**< length in bytes of this structure */
1869         uint32 count;           /**< number of elements of (chanspec, txpwr_max) pair */
1870         chanspec_txpwr_max_t txpwr[1];  /**< array of (chanspec, max_txpwr) pair */
1871 } wl_chanspec_txpwr_max_t;
1872
1873 #define WL_CHANSPEC_TXPWR_MAX_VER       1
1874 #define WL_CHANSPEC_TXPWR_MAX_LEN       (sizeof(wl_chanspec_txpwr_max_t))
1875
1876 typedef struct tx_inst_power {
1877         uint8 txpwr_est_Pout[2];                        /**< Latest estimate for 2.4 and 5 Ghz */
1878         uint8 txpwr_est_Pout_gofdm;                     /**< Pwr estimate for 2.4 OFDM */
1879 } tx_inst_power_t;
1880
1881 #define WL_NUM_TXCHAIN_MAX      4
1882 typedef struct wl_txchain_pwr_offsets {
1883         int8 offset[WL_NUM_TXCHAIN_MAX];        /**< quarter dBm signed offset for each chain */
1884 } wl_txchain_pwr_offsets_t;
1885 /* maximum channels returned by the get valid channels iovar */
1886 #define WL_NUMCHANNELS          64
1887
1888 /*
1889  * Join preference iovar value is an array of tuples. Each tuple has a one-byte type,
1890  * a one-byte length, and a variable length value.  RSSI type tuple must be present
1891  * in the array.
1892  *
1893  * Types are defined in "join preference types" section.
1894  *
1895  * Length is the value size in octets. It is reserved for WL_JOIN_PREF_WPA type tuple
1896  * and must be set to zero.
1897  *
1898  * Values are defined below.
1899  *
1900  * 1. RSSI - 2 octets
1901  * offset 0: reserved
1902  * offset 1: reserved
1903  *
1904  * 2. WPA - 2 + 12 * n octets (n is # tuples defined below)
1905  * offset 0: reserved
1906  * offset 1: # of tuples
1907  * offset 2: tuple 1
1908  * offset 14: tuple 2
1909  * ...
1910  * offset 2 + 12 * (n - 1) octets: tuple n
1911  *
1912  * struct wpa_cfg_tuple {
1913  *   uint8 akm[DOT11_OUI_LEN+1];     akm suite
1914  *   uint8 ucipher[DOT11_OUI_LEN+1]; unicast cipher suite
1915  *   uint8 mcipher[DOT11_OUI_LEN+1]; multicast cipher suite
1916  * };
1917  *
1918  * multicast cipher suite can be specified as a specific cipher suite or WL_WPA_ACP_MCS_ANY.
1919  *
1920  * 3. BAND - 2 octets
1921  * offset 0: reserved
1922  * offset 1: see "band preference" and "band types"
1923  *
1924  * 4. BAND RSSI - 2 octets
1925  * offset 0: band types
1926  * offset 1: +ve RSSI boost value in dB
1927  */
1928
1929 struct tsinfo_arg {
1930         uint8 octets[3];
1931 };
1932
1933 #define RATE_CCK_1MBPS 0
1934 #define RATE_CCK_2MBPS 1
1935 #define RATE_CCK_5_5MBPS 2
1936 #define RATE_CCK_11MBPS 3
1937
1938 #define RATE_LEGACY_OFDM_6MBPS 0
1939 #define RATE_LEGACY_OFDM_9MBPS 1
1940 #define RATE_LEGACY_OFDM_12MBPS 2
1941 #define RATE_LEGACY_OFDM_18MBPS 3
1942 #define RATE_LEGACY_OFDM_24MBPS 4
1943 #define RATE_LEGACY_OFDM_36MBPS 5
1944 #define RATE_LEGACY_OFDM_48MBPS 6
1945 #define RATE_LEGACY_OFDM_54MBPS 7
1946
1947 #define WL_BSSTRANS_RSSI_RATE_MAP_VERSION 1
1948
1949 typedef struct wl_bsstrans_rssi {
1950         int8 rssi_2g;   /**< RSSI in dbm for 2.4 G */
1951         int8 rssi_5g;   /**< RSSI in dbm for 5G, unused for cck */
1952 } wl_bsstrans_rssi_t;
1953
1954 #define RSSI_RATE_MAP_MAX_STREAMS 4     /**< max streams supported */
1955
1956 /* RSSI to rate mapping, all 20Mhz, no SGI */
1957 typedef struct wl_bsstrans_rssi_rate_map {
1958         uint16 ver;
1959         uint16 len; /* length of entire structure */
1960         wl_bsstrans_rssi_t cck[WL_NUM_RATES_CCK]; /* 2.4G only */
1961         wl_bsstrans_rssi_t ofdm[WL_NUM_RATES_OFDM]; /* 6 to 54mbps */
1962         wl_bsstrans_rssi_t phy_n[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_MCS_1STREAM]; /* MCS0-7 */
1963         wl_bsstrans_rssi_t phy_ac[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_VHT]; /* MCS0-9 */
1964 } wl_bsstrans_rssi_rate_map_t;
1965
1966 #define WL_BSSTRANS_ROAMTHROTTLE_VERSION 1
1967
1968 /* Configure number of scans allowed per throttle period */
1969 typedef struct wl_bsstrans_roamthrottle {
1970         uint16 ver;
1971         uint16 period;
1972         uint16 scans_allowed;
1973 } wl_bsstrans_roamthrottle_t;
1974
1975 #define NFIFO                   6       /**< # tx/rx fifopairs */
1976 #define NREINITREASONCOUNT      8
1977 #define REINITREASONIDX(_x)     (((_x) < NREINITREASONCOUNT) ? (_x) : 0)
1978
1979 #define WL_CNT_T_VERSION        30      /**< current version of wl_cnt_t struct */
1980 #define WL_CNT_VERSION_6        6
1981 #define WL_CNT_VERSION_11       11
1982
1983 #define WLC_WITH_XTLV_CNT
1984
1985 /*
1986  * tlv IDs uniquely identifies counter component
1987  * packed into wl_cmd_t container
1988  */
1989 enum wl_cnt_xtlv_id {
1990         WL_CNT_XTLV_WLC = 0x100,                /**< WLC layer counters */
1991         WL_CNT_XTLV_CNTV_LE10_UCODE = 0x200,    /**< wl counter ver < 11 UCODE MACSTAT */
1992         WL_CNT_XTLV_LT40_UCODE_V1 = 0x300,      /**< corerev < 40 UCODE MACSTAT */
1993         WL_CNT_XTLV_GE40_UCODE_V1 = 0x400,      /**< corerev >= 40 UCODE MACSTAT */
1994         WL_CNT_XTLV_GE64_UCODEX_V1 = 0x800      /* corerev >= 64 UCODEX MACSTAT */
1995 };
1996
1997 /* The number of variables in wl macstat cnt struct.
1998  * (wl_cnt_ge40mcst_v1_t, wl_cnt_lt40mcst_v1_t, wl_cnt_v_le10_mcst_t)
1999  */
2000 #define WL_CNT_MCST_VAR_NUM 64
2001 /* sizeof(wl_cnt_ge40mcst_v1_t), sizeof(wl_cnt_lt40mcst_v1_t), and sizeof(wl_cnt_v_le10_mcst_t) */
2002 #define WL_CNT_MCST_STRUCT_SZ ((uint)sizeof(uint32) * WL_CNT_MCST_VAR_NUM)
2003
2004 #define INVALID_CNT_VAL (uint32)(-1)
2005 #define WL_CNT_MCXST_STRUCT_SZ ((uint)sizeof(wl_cnt_ge64mcxst_v1_t))
2006
2007 #define WL_XTLV_CNTBUF_MAX_SIZE ((uint)(OFFSETOF(wl_cnt_info_t, data)) +        \
2008                 (uint)BCM_XTLV_HDR_SIZE + (uint)sizeof(wl_cnt_wlc_t) +          \
2009                 (uint)BCM_XTLV_HDR_SIZE + WL_CNT_MCST_STRUCT_SZ +              \
2010                 (uint)BCM_XTLV_HDR_SIZE + WL_CNT_MCXST_STRUCT_SZ)
2011
2012 #define WL_CNTBUF_MAX_SIZE MAX(WL_XTLV_CNTBUF_MAX_SIZE, (uint)sizeof(wl_cnt_ver_11_t))
2013
2014 /* Top structure of counters IOVar buffer */
2015 typedef struct {
2016         uint16  version;        /**< see definition of WL_CNT_T_VERSION */
2017         uint16  datalen;        /**< length of data including all paddings. */
2018         uint8   data [1];       /**< variable length payload:
2019                                  * 1 or more bcm_xtlv_t type of tuples.
2020                                  * each tuple is padded to multiple of 4 bytes.
2021                                  * 'datalen' field of this structure includes all paddings.
2022                                  */
2023 } wl_cnt_info_t;
2024
2025 /* wlc layer counters */
2026 typedef struct {
2027         /* transmit stat counters */
2028         uint32  txframe;        /**< tx data frames */
2029         uint32  txbyte;         /**< tx data bytes */
2030         uint32  txretrans;      /**< tx mac retransmits */
2031         uint32  txerror;        /**< tx data errors (derived: sum of others) */
2032         uint32  txctl;          /**< tx management frames */
2033         uint32  txprshort;      /**< tx short preamble frames */
2034         uint32  txserr;         /**< tx status errors */
2035         uint32  txnobuf;        /**< tx out of buffers errors */
2036         uint32  txnoassoc;      /**< tx discard because we're not associated */
2037         uint32  txrunt;         /**< tx runt frames */
2038         uint32  txchit;         /**< tx header cache hit (fastpath) */
2039         uint32  txcmiss;        /**< tx header cache miss (slowpath) */
2040
2041         /* transmit chip error counters */
2042         uint32  txuflo;         /**< tx fifo underflows */
2043         uint32  txphyerr;       /**< tx phy errors (indicated in tx status) */
2044         uint32  txphycrs;
2045
2046         /* receive stat counters */
2047         uint32  rxframe;        /**< rx data frames */
2048         uint32  rxbyte;         /**< rx data bytes */
2049         uint32  rxerror;        /**< rx data errors (derived: sum of others) */
2050         uint32  rxctl;          /**< rx management frames */
2051         uint32  rxnobuf;        /**< rx out of buffers errors */
2052         uint32  rxnondata;      /**< rx non data frames in the data channel errors */
2053         uint32  rxbadds;        /**< rx bad DS errors */
2054         uint32  rxbadcm;        /**< rx bad control or management frames */
2055         uint32  rxfragerr;      /**< rx fragmentation errors */
2056         uint32  rxrunt;         /**< rx runt frames */
2057         uint32  rxgiant;        /**< rx giant frames */
2058         uint32  rxnoscb;        /**< rx no scb error */
2059         uint32  rxbadproto;     /**< rx invalid frames */
2060         uint32  rxbadsrcmac;    /**< rx frames with Invalid Src Mac */
2061         uint32  rxbadda;        /**< rx frames tossed for invalid da */
2062         uint32  rxfilter;       /**< rx frames filtered out */
2063
2064         /* receive chip error counters */
2065         uint32  rxoflo;         /**< rx fifo overflow errors */
2066         uint32  rxuflo[NFIFO];  /**< rx dma descriptor underflow errors */
2067
2068         uint32  d11cnt_txrts_off;       /**< d11cnt txrts value when reset d11cnt */
2069         uint32  d11cnt_rxcrc_off;       /**< d11cnt rxcrc value when reset d11cnt */
2070         uint32  d11cnt_txnocts_off;     /**< d11cnt txnocts value when reset d11cnt */
2071
2072         /* misc counters */
2073         uint32  dmade;          /**< tx/rx dma descriptor errors */
2074         uint32  dmada;          /**< tx/rx dma data errors */
2075         uint32  dmape;          /**< tx/rx dma descriptor protocol errors */
2076         uint32  reset;          /**< reset count */
2077         uint32  tbtt;           /**< cnts the TBTT int's */
2078         uint32  txdmawar;
2079         uint32  pkt_callback_reg_fail;  /**< callbacks register failure */
2080
2081         /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2082         uint32  txfrag;         /**< dot11TransmittedFragmentCount */
2083         uint32  txmulti;        /**< dot11MulticastTransmittedFrameCount */
2084         uint32  txfail;         /**< dot11FailedCount */
2085         uint32  txretry;        /**< dot11RetryCount */
2086         uint32  txretrie;       /**< dot11MultipleRetryCount */
2087         uint32  rxdup;          /**< dot11FrameduplicateCount */
2088         uint32  txrts;          /**< dot11RTSSuccessCount */
2089         uint32  txnocts;        /**< dot11RTSFailureCount */
2090         uint32  txnoack;        /**< dot11ACKFailureCount */
2091         uint32  rxfrag;         /**< dot11ReceivedFragmentCount */
2092         uint32  rxmulti;        /**< dot11MulticastReceivedFrameCount */
2093         uint32  rxcrc;          /**< dot11FCSErrorCount */
2094         uint32  txfrmsnt;       /**< dot11TransmittedFrameCount (bogus MIB?) */
2095         uint32  rxundec;        /**< dot11WEPUndecryptableCount */
2096
2097         /* WPA2 counters (see rxundec for DecryptFailureCount) */
2098         uint32  tkipmicfaill;   /**< TKIPLocalMICFailures */
2099         uint32  tkipcntrmsr;    /**< TKIPCounterMeasuresInvoked */
2100         uint32  tkipreplay;     /**< TKIPReplays */
2101         uint32  ccmpfmterr;     /**< CCMPFormatErrors */
2102         uint32  ccmpreplay;     /**< CCMPReplays */
2103         uint32  ccmpundec;      /**< CCMPDecryptErrors */
2104         uint32  fourwayfail;    /**< FourWayHandshakeFailures */
2105         uint32  wepundec;       /**< dot11WEPUndecryptableCount */
2106         uint32  wepicverr;      /**< dot11WEPICVErrorCount */
2107         uint32  decsuccess;     /**< DecryptSuccessCount */
2108         uint32  tkipicverr;     /**< TKIPICVErrorCount */
2109         uint32  wepexcluded;    /**< dot11WEPExcludedCount */
2110
2111         uint32  txchanrej;      /**< Tx frames suppressed due to channel rejection */
2112         uint32  psmwds;         /**< Count PSM watchdogs */
2113         uint32  phywatchdog;    /**< Count Phy watchdogs (triggered by ucode) */
2114
2115         /* MBSS counters, AP only */
2116         uint32  prq_entries_handled;    /**< PRQ entries read in */
2117         uint32  prq_undirected_entries; /**<    which were bcast bss & ssid */
2118         uint32  prq_bad_entries;        /**<    which could not be translated to info */
2119         uint32  atim_suppress_count;    /**< TX suppressions on ATIM fifo */
2120         uint32  bcn_template_not_ready; /**< Template marked in use on send bcn ... */
2121         uint32  bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
2122         uint32  late_tbtt_dpc;  /**< TBTT DPC did not happen in time */
2123
2124         /* per-rate receive stat counters */
2125         uint32  rx1mbps;        /* packets rx at 1Mbps */
2126         uint32  rx2mbps;        /* packets rx at 2Mbps */
2127         uint32  rx5mbps5;       /* packets rx at 5.5Mbps */
2128         uint32  rx6mbps;        /* packets rx at 6Mbps */
2129         uint32  rx9mbps;        /* packets rx at 9Mbps */
2130         uint32  rx11mbps;       /* packets rx at 11Mbps */
2131         uint32  rx12mbps;       /* packets rx at 12Mbps */
2132         uint32  rx18mbps;       /* packets rx at 18Mbps */
2133         uint32  rx24mbps;       /* packets rx at 24Mbps */
2134         uint32  rx36mbps;       /* packets rx at 36Mbps */
2135         uint32  rx48mbps;       /* packets rx at 48Mbps */
2136         uint32  rx54mbps;       /* packets rx at 54Mbps */
2137         uint32  rx108mbps;      /* packets rx at 108mbps */
2138         uint32  rx162mbps;      /* packets rx at 162mbps */
2139         uint32  rx216mbps;      /* packets rx at 216 mbps */
2140         uint32  rx270mbps;      /* packets rx at 270 mbps */
2141         uint32  rx324mbps;      /* packets rx at 324 mbps */
2142         uint32  rx378mbps;      /* packets rx at 378 mbps */
2143         uint32  rx432mbps;      /* packets rx at 432 mbps */
2144         uint32  rx486mbps;      /* packets rx at 486 mbps */
2145         uint32  rx540mbps;      /* packets rx at 540 mbps */
2146
2147         uint32  rfdisable;      /**< count of radio disables */
2148
2149         uint32  txexptime;      /**< Tx frames suppressed due to timer expiration */
2150
2151         uint32  txmpdu_sgi;     /**< count for sgi transmit */
2152         uint32  rxmpdu_sgi;     /**< count for sgi received */
2153         uint32  txmpdu_stbc;    /**< count for stbc transmit */
2154         uint32  rxmpdu_stbc;    /**< count for stbc received */
2155
2156         uint32  rxundec_mcst;   /**< dot11WEPUndecryptableCount */
2157
2158         /* WPA2 counters (see rxundec for DecryptFailureCount) */
2159         uint32  tkipmicfaill_mcst;      /**< TKIPLocalMICFailures */
2160         uint32  tkipcntrmsr_mcst;       /**< TKIPCounterMeasuresInvoked */
2161         uint32  tkipreplay_mcst;        /**< TKIPReplays */
2162         uint32  ccmpfmterr_mcst;        /**< CCMPFormatErrors */
2163         uint32  ccmpreplay_mcst;        /**< CCMPReplays */
2164         uint32  ccmpundec_mcst; /**< CCMPDecryptErrors */
2165         uint32  fourwayfail_mcst;       /**< FourWayHandshakeFailures */
2166         uint32  wepundec_mcst;  /**< dot11WEPUndecryptableCount */
2167         uint32  wepicverr_mcst; /**< dot11WEPICVErrorCount */
2168         uint32  decsuccess_mcst;        /**< DecryptSuccessCount */
2169         uint32  tkipicverr_mcst;        /**< TKIPICVErrorCount */
2170         uint32  wepexcluded_mcst;       /**< dot11WEPExcludedCount */
2171
2172         uint32  dma_hang;       /**< count for dma hang */
2173         uint32  reinit;         /**< count for reinit */
2174
2175         uint32  pstatxucast;    /**< count of ucast frames xmitted on all psta assoc */
2176         uint32  pstatxnoassoc;  /**< count of txnoassoc frames xmitted on all psta assoc */
2177         uint32  pstarxucast;    /**< count of ucast frames received on all psta assoc */
2178         uint32  pstarxbcmc;     /**< count of bcmc frames received on all psta */
2179         uint32  pstatxbcmc;     /**< count of bcmc frames transmitted on all psta */
2180
2181         uint32  cso_passthrough; /* hw cso required but passthrough */
2182         uint32  cso_normal;     /**< hw cso hdr for normal process */
2183         uint32  chained;        /**< number of frames chained */
2184         uint32  chainedsz1;     /**< number of chain size 1 frames */
2185         uint32  unchained;      /**< number of frames not chained */
2186         uint32  maxchainsz;     /**< max chain size so far */
2187         uint32  currchainsz;    /**< current chain size */
2188         uint32  pciereset;      /**< Secondary Bus Reset issued by driver */
2189         uint32  cfgrestore;     /**< configspace restore by driver */
2190         uint32  reinitreason[NREINITREASONCOUNT]; /* reinitreason counters; 0: Unknown reason */
2191         uint32  rxrtry;
2192
2193         uint32  rxmpdu_mu;      /* Number of MU MPDUs received */
2194
2195         /* detailed control/management frames */
2196         uint32  txbar;          /**< Number of TX BAR */
2197         uint32  rxbar;          /**< Number of RX BAR */
2198         uint32  txpspoll;       /**< Number of TX PS-poll */
2199         uint32  rxpspoll;       /**< Number of RX PS-poll */
2200         uint32  txnull;         /**< Number of TX NULL_DATA */
2201         uint32  rxnull;         /**< Number of RX NULL_DATA */
2202         uint32  txqosnull;      /**< Number of TX NULL_QoSDATA */
2203         uint32  rxqosnull;      /**< Number of RX NULL_QoSDATA */
2204         uint32  txassocreq;     /**< Number of TX ASSOC request */
2205         uint32  rxassocreq;     /**< Number of RX ASSOC request */
2206         uint32  txreassocreq;   /**< Number of TX REASSOC request */
2207         uint32  rxreassocreq;   /**< Number of RX REASSOC request */
2208         uint32  txdisassoc;     /**< Number of TX DISASSOC */
2209         uint32  rxdisassoc;     /**< Number of RX DISASSOC */
2210         uint32  txassocrsp;     /**< Number of TX ASSOC response */
2211         uint32  rxassocrsp;     /**< Number of RX ASSOC response */
2212         uint32  txreassocrsp;   /**< Number of TX REASSOC response */
2213         uint32  rxreassocrsp;   /**< Number of RX REASSOC response */
2214         uint32  txauth;         /**< Number of TX AUTH */
2215         uint32  rxauth;         /**< Number of RX AUTH */
2216         uint32  txdeauth;       /**< Number of TX DEAUTH */
2217         uint32  rxdeauth;       /**< Number of RX DEAUTH */
2218         uint32  txprobereq;     /**< Number of TX probe request */
2219         uint32  rxprobereq;     /**< Number of RX probe request */
2220         uint32  txprobersp;     /**< Number of TX probe response */
2221         uint32  rxprobersp;     /**< Number of RX probe response */
2222         uint32  txaction;       /**< Number of TX action frame */
2223         uint32  rxaction;       /**< Number of RX action frame */
2224 } wl_cnt_wlc_t;
2225
2226 /* MACXSTAT counters for ucodex (corerev >= 64) */
2227 typedef struct {
2228         uint32 macxsusp;
2229         uint32 m2vmsg;
2230         uint32 v2mmsg;
2231         uint32 mboxout;
2232         uint32 musnd;
2233         uint32 sfb2v;
2234 } wl_cnt_ge64mcxst_v1_t;
2235
2236 /* MACSTAT counters for ucode (corerev >= 40) */
2237 typedef struct {
2238         /* MAC counters: 32-bit version of d11.h's macstat_t */
2239         uint32  txallfrm;       /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
2240                                  * Control Management (includes retransmissions)
2241                                  */
2242         uint32  txrtsfrm;       /**< number of RTS sent out by the MAC */
2243         uint32  txctsfrm;       /**< number of CTS sent out by the MAC */
2244         uint32  txackfrm;       /**< number of ACK frames sent out */
2245         uint32  txdnlfrm;       /**< number of Null-Data transmission generated from template  */
2246         uint32  txbcnfrm;       /**< beacons transmitted */
2247         uint32  txfunfl[6];     /**< per-fifo tx underflows */
2248         uint32  txampdu;        /**< number of AMPDUs transmitted */
2249         uint32  txmpdu;         /**< number of MPDUs transmitted */
2250         uint32  txtplunfl;      /**< Template underflows (mac was too slow to transmit ACK/CTS
2251                                  * or BCN)
2252                                  */
2253         uint32  txphyerror;     /**< Transmit phy error, type of error is reported in tx-status for
2254                                  * driver enqueued frames
2255                                  */
2256         uint32  pktengrxducast; /* unicast frames rxed by the pkteng code */
2257         uint32  pktengrxdmcast; /* multicast frames rxed by the pkteng code */
2258         uint32  rxfrmtoolong;   /**< Received frame longer than legal limit (2346 bytes) */
2259         uint32  rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
2260         uint32  rxanyerr;       /**< Any RX error that is not counted by other counters. */
2261         uint32  rxbadfcs;       /**< number of frames for which the CRC check failed in the MAC */
2262         uint32  rxbadplcp;      /**< parity check of the PLCP header failed */
2263         uint32  rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
2264         uint32  rxstrt;         /**< Number of received frames with a good PLCP
2265                                  * (i.e. passing parity check)
2266                                  */
2267         uint32  rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
2268         uint32  rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
2269         uint32  rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
2270         uint32  rxrtsucast;     /**< number of unicast RTS addressed to the MAC (good FCS) */
2271         uint32  rxctsucast;     /**< number of unicast CTS addressed to the MAC (good FCS) */
2272         uint32  rxackucast;     /**< number of ucast ACKS received (good FCS) */
2273         uint32  rxdtocast; /**< number of received DATA frames (good FCS and not matching RA) */
2274         uint32  rxmgocast; /**< number of received MGMT frames (good FCS and not matching RA) */
2275         uint32  rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
2276         uint32  rxrtsocast;     /**< number of received RTS not addressed to the MAC */
2277         uint32  rxctsocast;     /**< number of received CTS not addressed to the MAC */
2278         uint32  rxdtmcast;      /**< number of RX Data multicast frames received by the MAC */
2279         uint32  rxmgmcast;      /**< number of RX Management multicast frames received by the MAC */
2280         uint32  rxctlmcast;     /**< number of RX Control multicast frames received by the MAC
2281                                  * (unlikely to see these)
2282                                  */
2283         uint32  rxbeaconmbss;   /**< beacons received from member of BSS */
2284         uint32  rxdtucastobss; /* number of unicast frames addressed to the MAC from
2285                                   * other BSS (WDS FRAME)
2286                                   */
2287         uint32  rxbeaconobss;   /**< beacons received from other BSS */
2288         uint32  rxrsptmout;     /**< number of response timeouts for transmitted frames
2289                                  * expecting a response
2290                                  */
2291         uint32  bcntxcancl;     /**< transmit beacons canceled due to receipt of beacon (IBSS) */
2292         uint32  rxnodelim;      /**< number of no valid delimiter detected by ampdu parser */
2293         uint32  rxf0ovfl;       /**< number of receive fifo 0 overflows */
2294         uint32  rxf1ovfl;       /**< number of receive fifo 1 overflows */
2295         uint32  rxhlovfl;       /**< number of length / header fifo overflows */
2296         uint32  missbcn_dbg;    /**< number of beacon missed to receive */
2297         uint32  pmqovfl;        /**< number of PMQ overflows */
2298         uint32  rxcgprqfrm;     /**< number of received Probe requests that made it into
2299                                  * the PRQ fifo
2300                                  */
2301         uint32  rxcgprsqovfl;   /**< Rx Probe Request Que overflow in the AP */
2302         uint32  txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
2303                                  * not get ACK
2304                                  */
2305         uint32  txcgprssuc;     /**< Tx Probe Response Success (ACK was received) */
2306         uint32  prs_timeout;    /**< number of probe requests that were dropped from the PRQ
2307                                  * fifo because a probe response could not be sent out within
2308                                  * the time limit defined in M_PRS_MAXTIME
2309                                  */
2310         uint32  txrtsfail;      /**< number of rts transmission failure that reach retry limit */
2311         uint32  txucast;        /**< number of unicast tx expecting response other than cts/cwcts */
2312         uint32  txinrtstxop;    /**< number of data frame transmissions during rts txop */
2313         uint32  rxback;         /**< blockack rxcnt */
2314         uint32  txback;         /**< blockack txcnt */
2315         uint32  bphy_rxcrsglitch;       /**< PHY count of bphy glitches */
2316         uint32  rxdrop20s;      /**< drop secondary cnt */
2317         uint32  rxtoolate;      /**< receive too late */
2318         uint32  bphy_badplcp;   /**< number of bad PLCP reception on BPHY rate */
2319 } wl_cnt_ge40mcst_v1_t;
2320
2321 /* MACSTAT counters for ucode (corerev < 40) */
2322 typedef struct {
2323         /* MAC counters: 32-bit version of d11.h's macstat_t */
2324         uint32  txallfrm;       /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
2325                                  * Control Management (includes retransmissions)
2326                                  */
2327         uint32  txrtsfrm;       /**< number of RTS sent out by the MAC */
2328         uint32  txctsfrm;       /**< number of CTS sent out by the MAC */
2329         uint32  txackfrm;       /**< number of ACK frames sent out */
2330         uint32  txdnlfrm;       /**< number of Null-Data transmission generated from template  */
2331         uint32  txbcnfrm;       /**< beacons transmitted */
2332         uint32  txfunfl[6];     /**< per-fifo tx underflows */
2333         uint32  txampdu;        /**< number of AMPDUs transmitted */
2334         uint32  txmpdu;         /**< number of MPDUs transmitted */
2335         uint32  txtplunfl;      /**< Template underflows (mac was too slow to transmit ACK/CTS
2336                                  * or BCN)
2337                                  */
2338         uint32  txphyerror;     /**< Transmit phy error, type of error is reported in tx-status for
2339                                  * driver enqueued frames
2340                                  */
2341         uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
2342         uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
2343         uint32  rxfrmtoolong;   /**< Received frame longer than legal limit (2346 bytes) */
2344         uint32  rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
2345         uint32  rxanyerr;       /**< Any RX error that is not counted by other counters. */
2346         uint32  rxbadfcs;       /**< number of frames for which the CRC check failed in the MAC */
2347         uint32  rxbadplcp;      /**< parity check of the PLCP header failed */
2348         uint32  rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
2349         uint32  rxstrt;         /**< Number of received frames with a good PLCP
2350                                  * (i.e. passing parity check)
2351                                  */
2352         uint32  rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
2353         uint32  rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
2354         uint32  rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
2355         uint32  rxrtsucast;     /**< number of unicast RTS addressed to the MAC (good FCS) */
2356         uint32  rxctsucast;     /**< number of unicast CTS addressed to the MAC (good FCS) */
2357         uint32  rxackucast;     /**< number of ucast ACKS received (good FCS) */
2358         uint32  rxdtocast;  /**< number of received DATA frames (good FCS and not matching RA) */
2359         uint32  rxmgocast;  /**< number of received MGMT frames (good FCS and not matching RA) */
2360         uint32  rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
2361         uint32  rxrtsocast;     /**< number of received RTS not addressed to the MAC */
2362         uint32  rxctsocast;     /**< number of received CTS not addressed to the MAC */
2363         uint32  rxdtmcast;      /**< number of RX Data multicast frames received by the MAC */
2364         uint32  rxmgmcast;      /**< number of RX Management multicast frames received by the MAC */
2365         uint32  rxctlmcast;     /**< number of RX Control multicast frames received by the MAC
2366                                  * (unlikely to see these)
2367                                  */
2368         uint32  rxbeaconmbss;   /**< beacons received from member of BSS */
2369         uint32  rxdtucastobss; /* number of unicast frames addressed to the MAC from
2370                                   * other BSS (WDS FRAME)
2371                                   */
2372         uint32  rxbeaconobss;   /**< beacons received from other BSS */
2373         uint32  rxrsptmout;     /**< number of response timeouts for transmitted frames
2374                                  * expecting a response
2375                                  */
2376         uint32  bcntxcancl;     /**< transmit beacons canceled due to receipt of beacon (IBSS) */
2377         uint32  rxnodelim;      /**< number of no valid delimiter detected by ampdu parser */
2378         uint32  rxf0ovfl;       /**< number of receive fifo 0 overflows */
2379         uint32  dbgoff46;
2380         uint32  dbgoff47;
2381         uint32  dbgoff48;       /**< Used for counting txstatus queue overflow (corerev <= 4)  */
2382         uint32  pmqovfl;        /**< number of PMQ overflows */
2383         uint32  rxcgprqfrm;     /**< number of received Probe requests that made it into
2384                                  * the PRQ fifo
2385                                  */
2386         uint32  rxcgprsqovfl;   /**< Rx Probe Request Que overflow in the AP */
2387         uint32  txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
2388                                  * not get ACK
2389                                  */
2390         uint32  txcgprssuc;     /**< Tx Probe Response Success (ACK was received) */
2391         uint32  prs_timeout;    /**< number of probe requests that were dropped from the PRQ
2392                                  * fifo because a probe response could not be sent out within
2393                                  * the time limit defined in M_PRS_MAXTIME
2394                                  */
2395         uint32  txrtsfail;      /**< number of rts transmission failure that reach retry limit */
2396         uint32  txucast;        /**< number of unicast tx expecting response other than cts/cwcts */
2397         uint32  txinrtstxop;    /**< number of data frame transmissions during rts txop */
2398         uint32  rxback;         /**< blockack rxcnt */
2399         uint32  txback;         /**< blockack txcnt */
2400         uint32  bphy_rxcrsglitch;       /**< PHY count of bphy glitches */
2401         uint32  phywatch;
2402         uint32  rxtoolate;      /**< receive too late */
2403         uint32  bphy_badplcp;   /**< number of bad PLCP reception on BPHY rate */
2404 } wl_cnt_lt40mcst_v1_t;
2405
2406 /* MACSTAT counters for "wl counter" version <= 10 */
2407 typedef struct {
2408         /* MAC counters: 32-bit version of d11.h's macstat_t */
2409         uint32  txallfrm;       /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
2410                                  * Control Management (includes retransmissions)
2411                                  */
2412         uint32  txrtsfrm;       /**< number of RTS sent out by the MAC */
2413         uint32  txctsfrm;       /**< number of CTS sent out by the MAC */
2414         uint32  txackfrm;       /**< number of ACK frames sent out */
2415         uint32  txdnlfrm;       /**< number of Null-Data transmission generated from template  */
2416         uint32  txbcnfrm;       /**< beacons transmitted */
2417         uint32  txfunfl[6];     /**< per-fifo tx underflows */
2418         uint32  txfbw;          /**< transmit at fallback bw (dynamic bw) */
2419         uint32  PAD0;           /**< number of MPDUs transmitted */
2420         uint32  txtplunfl;      /**< Template underflows (mac was too slow to transmit ACK/CTS
2421                                  * or BCN)
2422                                  */
2423         uint32  txphyerror;     /**< Transmit phy error, type of error is reported in tx-status for
2424                                  * driver enqueued frames
2425                                  */
2426         uint32  pktengrxducast; /* unicast frames rxed by the pkteng code */
2427         uint32  pktengrxdmcast; /* multicast frames rxed by the pkteng code */
2428         uint32  rxfrmtoolong;   /**< Received frame longer than legal limit (2346 bytes) */
2429         uint32  rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
2430         uint32  rxinvmachdr;    /**< Either the protocol version != 0 or frame type not
2431                                  * data/control/management
2432                                  */
2433         uint32  rxbadfcs;       /**< number of frames for which the CRC check failed in the MAC */
2434         uint32  rxbadplcp;      /**< parity check of the PLCP header failed */
2435         uint32  rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
2436         uint32  rxstrt;         /**< Number of received frames with a good PLCP
2437                                  * (i.e. passing parity check)
2438                                  */
2439         uint32  rxdfrmucastmbss; /* number of received DATA frames with good FCS and matching RA */
2440         uint32  rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
2441         uint32  rxcfrmucast; /**< number of received CNTRL frames with good FCS and matching RA */
2442         uint32  rxrtsucast;  /**< number of unicast RTS addressed to the MAC (good FCS) */
2443         uint32  rxctsucast;  /**< number of unicast CTS addressed to the MAC (good FCS) */
2444         uint32  rxackucast;     /**< number of ucast ACKS received (good FCS) */
2445         uint32  rxdfrmocast; /**< number of received DATA frames (good FCS and not matching RA) */
2446         uint32  rxmfrmocast; /**< number of received MGMT frames (good FCS and not matching RA) */
2447         uint32  rxcfrmocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
2448         uint32  rxrtsocast;     /**< number of received RTS not addressed to the MAC */
2449         uint32  rxctsocast;     /**< number of received CTS not addressed to the MAC */
2450         uint32  rxdfrmmcast;    /**< number of RX Data multicast frames received by the MAC */
2451         uint32  rxmfrmmcast;    /**< number of RX Management multicast frames received by the MAC */
2452         uint32  rxcfrmmcast;    /**< number of RX Control multicast frames received by the MAC
2453                                  * (unlikely to see these)
2454                                  */
2455         uint32  rxbeaconmbss;   /**< beacons received from member of BSS */
2456         uint32  rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
2457                                   * other BSS (WDS FRAME)
2458                                   */
2459         uint32  rxbeaconobss;   /**< beacons received from other BSS */
2460         uint32  rxrsptmout;     /**< number of response timeouts for transmitted frames
2461                                  * expecting a response
2462                                  */
2463         uint32  bcntxcancl;     /**< transmit beacons canceled due to receipt of beacon (IBSS) */
2464         uint32  PAD1;
2465         uint32  rxf0ovfl;       /**< number of receive fifo 0 overflows */
2466         uint32  rxf1ovfl;       /**< Number of receive fifo 1 overflows (obsolete) */
2467         uint32  rxf2ovfl;       /**< Number of receive fifo 2 overflows (obsolete) */
2468         uint32  txsfovfl;       /**< Number of transmit status fifo overflows (obsolete) */
2469         uint32  pmqovfl;        /**< number of PMQ overflows */
2470         uint32  rxcgprqfrm;     /**< number of received Probe requests that made it into
2471                                  * the PRQ fifo
2472                                  */
2473         uint32  rxcgprsqovfl;   /**< Rx Probe Request Que overflow in the AP */
2474         uint32  txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
2475                                  * not get ACK
2476                                  */
2477         uint32  txcgprssuc;     /**< Tx Probe Response Success (ACK was received) */
2478         uint32  prs_timeout;    /**< number of probe requests that were dropped from the PRQ
2479                                  * fifo because a probe response could not be sent out within
2480                                  * the time limit defined in M_PRS_MAXTIME
2481                                  */
2482         uint32  rxnack;         /**< obsolete */
2483         uint32  frmscons;       /**< obsolete */
2484         uint32  txnack;         /**< obsolete */
2485         uint32  rxback;         /**< blockack rxcnt */
2486         uint32  txback;         /**< blockack txcnt */
2487         uint32  bphy_rxcrsglitch;       /**< PHY count of bphy glitches */
2488         uint32  rxdrop20s;      /**< drop secondary cnt */
2489         uint32  rxtoolate;      /**< receive too late */
2490         uint32  bphy_badplcp;   /**< number of bad PLCP reception on BPHY rate */
2491 } wl_cnt_v_le10_mcst_t;
2492
2493 typedef struct {
2494         uint16  version;        /**< see definition of WL_CNT_T_VERSION */
2495         uint16  length;         /**< length of entire structure */
2496
2497         /* transmit stat counters */
2498         uint32  txframe;        /**< tx data frames */
2499         uint32  txbyte;         /**< tx data bytes */
2500         uint32  txretrans;      /**< tx mac retransmits */
2501         uint32  txerror;        /**< tx data errors (derived: sum of others) */
2502         uint32  txctl;          /**< tx management frames */
2503         uint32  txprshort;      /**< tx short preamble frames */
2504         uint32  txserr;         /**< tx status errors */
2505         uint32  txnobuf;        /**< tx out of buffers errors */
2506         uint32  txnoassoc;      /**< tx discard because we're not associated */
2507         uint32  txrunt;         /**< tx runt frames */
2508         uint32  txchit;         /**< tx header cache hit (fastpath) */
2509         uint32  txcmiss;        /**< tx header cache miss (slowpath) */
2510
2511         /* transmit chip error counters */
2512         uint32  txuflo;         /**< tx fifo underflows */
2513         uint32  txphyerr;       /**< tx phy errors (indicated in tx status) */
2514         uint32  txphycrs;
2515
2516         /* receive stat counters */
2517         uint32  rxframe;        /**< rx data frames */
2518         uint32  rxbyte;         /**< rx data bytes */
2519         uint32  rxerror;        /**< rx data errors (derived: sum of others) */
2520         uint32  rxctl;          /**< rx management frames */
2521         uint32  rxnobuf;        /**< rx out of buffers errors */
2522         uint32  rxnondata;      /**< rx non data frames in the data channel errors */
2523         uint32  rxbadds;        /**< rx bad DS errors */
2524         uint32  rxbadcm;        /**< rx bad control or management frames */
2525         uint32  rxfragerr;      /**< rx fragmentation errors */
2526         uint32  rxrunt;         /**< rx runt frames */
2527         uint32  rxgiant;        /**< rx giant frames */
2528         uint32  rxnoscb;        /**< rx no scb error */
2529         uint32  rxbadproto;     /**< rx invalid frames */
2530         uint32  rxbadsrcmac;    /**< rx frames with Invalid Src Mac */
2531         uint32  rxbadda;        /**< rx frames tossed for invalid da */
2532         uint32  rxfilter;       /**< rx frames filtered out */
2533
2534         /* receive chip error counters */
2535         uint32  rxoflo;         /**< rx fifo overflow errors */
2536         uint32  rxuflo[NFIFO];  /**< rx dma descriptor underflow errors */
2537
2538         uint32  d11cnt_txrts_off;       /**< d11cnt txrts value when reset d11cnt */
2539         uint32  d11cnt_rxcrc_off;       /**< d11cnt rxcrc value when reset d11cnt */
2540         uint32  d11cnt_txnocts_off;     /**< d11cnt txnocts value when reset d11cnt */
2541
2542         /* misc counters */
2543         uint32  dmade;          /**< tx/rx dma descriptor errors */
2544         uint32  dmada;          /**< tx/rx dma data errors */
2545         uint32  dmape;          /**< tx/rx dma descriptor protocol errors */
2546         uint32  reset;          /**< reset count */
2547         uint32  tbtt;           /**< cnts the TBTT int's */
2548         uint32  txdmawar;
2549         uint32  pkt_callback_reg_fail;  /**< callbacks register failure */
2550
2551         /* MAC counters: 32-bit version of d11.h's macstat_t */
2552         uint32  txallfrm;       /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
2553                                  * Control Management (includes retransmissions)
2554                                  */
2555         uint32  txrtsfrm;       /**< number of RTS sent out by the MAC */
2556         uint32  txctsfrm;       /**< number of CTS sent out by the MAC */
2557         uint32  txackfrm;       /**< number of ACK frames sent out */
2558         uint32  txdnlfrm;       /**< Not used */
2559         uint32  txbcnfrm;       /**< beacons transmitted */
2560         uint32  txfunfl[6];     /**< per-fifo tx underflows */
2561         uint32  rxtoolate;      /**< receive too late */
2562         uint32  txfbw;          /**< transmit at fallback bw (dynamic bw) */
2563         uint32  txtplunfl;      /**< Template underflows (mac was too slow to transmit ACK/CTS
2564                                  * or BCN)
2565                                  */
2566         uint32  txphyerror;     /**< Transmit phy error, type of error is reported in tx-status for
2567                                  * driver enqueued frames
2568                                  */
2569         uint32  rxfrmtoolong;   /**< Received frame longer than legal limit (2346 bytes) */
2570         uint32  rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
2571         uint32  rxinvmachdr;    /**< Either the protocol version != 0 or frame type not
2572                                  * data/control/management
2573                                  */
2574         uint32  rxbadfcs;       /**< number of frames for which the CRC check failed in the MAC */
2575         uint32  rxbadplcp;      /**< parity check of the PLCP header failed */
2576         uint32  rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
2577         uint32  rxstrt;         /**< Number of received frames with a good PLCP
2578                                  * (i.e. passing parity check)
2579                                  */
2580         uint32  rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
2581         uint32  rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
2582         uint32  rxcfrmucast; /**< number of received CNTRL frames with good FCS and matching RA */
2583         uint32  rxrtsucast;     /**< number of unicast RTS addressed to the MAC (good FCS) */
2584         uint32  rxctsucast;     /**< number of unicast CTS addressed to the MAC (good FCS) */
2585         uint32  rxackucast;     /**< number of ucast ACKS received (good FCS) */
2586         uint32  rxdfrmocast; /**< number of received DATA frames (good FCS and not matching RA) */
2587         uint32  rxmfrmocast; /**< number of received MGMT frames (good FCS and not matching RA) */
2588         uint32  rxcfrmocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
2589         uint32  rxrtsocast;     /**< number of received RTS not addressed to the MAC */
2590         uint32  rxctsocast;     /**< number of received CTS not addressed to the MAC */
2591         uint32  rxdfrmmcast;    /**< number of RX Data multicast frames received by the MAC */
2592         uint32  rxmfrmmcast;    /**< number of RX Management multicast frames received by the MAC */
2593         uint32  rxcfrmmcast;    /**< number of RX Control multicast frames received by the MAC
2594                                  * (unlikely to see these)
2595                                  */
2596         uint32  rxbeaconmbss;   /**< beacons received from member of BSS */
2597         uint32  rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
2598                                   * other BSS (WDS FRAME)
2599                                   */
2600         uint32  rxbeaconobss;   /**< beacons received from other BSS */
2601         uint32  rxrsptmout;     /**< Number of response timeouts for transmitted frames
2602                                  * expecting a response
2603                                  */
2604         uint32  bcntxcancl;     /**< transmit beacons canceled due to receipt of beacon (IBSS) */
2605         uint32  rxf0ovfl;       /**< Number of receive fifo 0 overflows */
2606         uint32  rxf1ovfl;       /**< Number of receive fifo 1 overflows (obsolete) */
2607         uint32  rxf2ovfl;       /**< Number of receive fifo 2 overflows (obsolete) */
2608         uint32  txsfovfl;       /**< Number of transmit status fifo overflows (obsolete) */
2609         uint32  pmqovfl;        /**< Number of PMQ overflows */
2610         uint32  rxcgprqfrm;     /**< Number of received Probe requests that made it into
2611                                  * the PRQ fifo
2612                                  */
2613         uint32  rxcgprsqovfl;   /**< Rx Probe Request Que overflow in the AP */
2614         uint32  txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
2615                                  * not get ACK
2616                                  */
2617         uint32  txcgprssuc;     /**< Tx Probe Response Success (ACK was received) */
2618         uint32  prs_timeout;    /**< Number of probe requests that were dropped from the PRQ
2619                                  * fifo because a probe response could not be sent out within
2620                                  * the time limit defined in M_PRS_MAXTIME
2621                                  */
2622         uint32  rxnack;         /**< obsolete */
2623         uint32  frmscons;       /**< obsolete */
2624         uint32  txnack;         /**< obsolete */
2625         uint32  rxback;         /**< blockack rxcnt */
2626         uint32  txback;         /**< blockack txcnt */
2627
2628         /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2629         uint32  txfrag;         /**< dot11TransmittedFragmentCount */
2630         uint32  txmulti;        /**< dot11MulticastTransmittedFrameCount */
2631         uint32  txfail;         /**< dot11FailedCount */
2632         uint32  txretry;        /**< dot11RetryCount */
2633         uint32  txretrie;       /**< dot11MultipleRetryCount */
2634         uint32  rxdup;          /**< dot11FrameduplicateCount */
2635         uint32  txrts;          /**< dot11RTSSuccessCount */
2636         uint32  txnocts;        /**< dot11RTSFailureCount */
2637         uint32  txnoack;        /**< dot11ACKFailureCount */
2638         uint32  rxfrag;         /**< dot11ReceivedFragmentCount */
2639         uint32  rxmulti;        /**< dot11MulticastReceivedFrameCount */
2640         uint32  rxcrc;          /**< dot11FCSErrorCount */
2641         uint32  txfrmsnt;       /**< dot11TransmittedFrameCount (bogus MIB?) */
2642         uint32  rxundec;        /**< dot11WEPUndecryptableCount */
2643
2644         /* WPA2 counters (see rxundec for DecryptFailureCount) */
2645         uint32  tkipmicfaill;   /**< TKIPLocalMICFailures */
2646         uint32  tkipcntrmsr;    /**< TKIPCounterMeasuresInvoked */
2647         uint32  tkipreplay;     /**< TKIPReplays */
2648         uint32  ccmpfmterr;     /**< CCMPFormatErrors */
2649         uint32  ccmpreplay;     /**< CCMPReplays */
2650         uint32  ccmpundec;      /**< CCMPDecryptErrors */
2651         uint32  fourwayfail;    /**< FourWayHandshakeFailures */
2652         uint32  wepundec;       /**< dot11WEPUndecryptableCount */
2653         uint32  wepicverr;      /**< dot11WEPICVErrorCount */
2654         uint32  decsuccess;     /**< DecryptSuccessCount */
2655         uint32  tkipicverr;     /**< TKIPICVErrorCount */
2656         uint32  wepexcluded;    /**< dot11WEPExcludedCount */
2657
2658         uint32  txchanrej;      /**< Tx frames suppressed due to channel rejection */
2659         uint32  psmwds;         /**< Count PSM watchdogs */
2660         uint32  phywatchdog;    /**< Count Phy watchdogs (triggered by ucode) */
2661
2662         /* MBSS counters, AP only */
2663         uint32  prq_entries_handled;    /**< PRQ entries read in */
2664         uint32  prq_undirected_entries; /**<    which were bcast bss & ssid */
2665         uint32  prq_bad_entries;        /**<    which could not be translated to info */
2666         uint32  atim_suppress_count;    /**< TX suppressions on ATIM fifo */
2667         uint32  bcn_template_not_ready; /**< Template marked in use on send bcn ... */
2668         uint32  bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
2669         uint32  late_tbtt_dpc;  /**< TBTT DPC did not happen in time */
2670
2671         /* per-rate receive stat counters */
2672         uint32  rx1mbps;        /* packets rx at 1Mbps */
2673         uint32  rx2mbps;        /* packets rx at 2Mbps */
2674         uint32  rx5mbps5;       /* packets rx at 5.5Mbps */
2675         uint32  rx6mbps;        /* packets rx at 6Mbps */
2676         uint32  rx9mbps;        /* packets rx at 9Mbps */
2677         uint32  rx11mbps;       /* packets rx at 11Mbps */
2678         uint32  rx12mbps;       /* packets rx at 12Mbps */
2679         uint32  rx18mbps;       /* packets rx at 18Mbps */
2680         uint32  rx24mbps;       /* packets rx at 24Mbps */
2681         uint32  rx36mbps;       /* packets rx at 36Mbps */
2682         uint32  rx48mbps;       /* packets rx at 48Mbps */
2683         uint32  rx54mbps;       /* packets rx at 54Mbps */
2684         uint32  rx108mbps;      /* packets rx at 108mbps */
2685         uint32  rx162mbps;      /* packets rx at 162mbps */
2686         uint32  rx216mbps;      /* packets rx at 216 mbps */
2687         uint32  rx270mbps;      /* packets rx at 270 mbps */
2688         uint32  rx324mbps;      /* packets rx at 324 mbps */
2689         uint32  rx378mbps;      /* packets rx at 378 mbps */
2690         uint32  rx432mbps;      /* packets rx at 432 mbps */
2691         uint32  rx486mbps;      /* packets rx at 486 mbps */
2692         uint32  rx540mbps;      /* packets rx at 540 mbps */
2693
2694         /* pkteng rx frame stats */
2695         uint32  pktengrxducast; /* unicast frames rxed by the pkteng code */
2696         uint32  pktengrxdmcast; /* multicast frames rxed by the pkteng code */
2697
2698         uint32  rfdisable;      /**< count of radio disables */
2699         uint32  bphy_rxcrsglitch;       /**< PHY count of bphy glitches */
2700         uint32  bphy_badplcp;
2701
2702         uint32  txexptime;      /**< Tx frames suppressed due to timer expiration */
2703
2704         uint32  txmpdu_sgi;     /**< count for sgi transmit */
2705         uint32  rxmpdu_sgi;     /**< count for sgi received */
2706         uint32  txmpdu_stbc;    /**< count for stbc transmit */
2707         uint32  rxmpdu_stbc;    /**< count for stbc received */
2708
2709         uint32  rxundec_mcst;   /**< dot11WEPUndecryptableCount */
2710
2711         /* WPA2 counters (see rxundec for DecryptFailureCount) */
2712         uint32  tkipmicfaill_mcst;      /**< TKIPLocalMICFailures */
2713         uint32  tkipcntrmsr_mcst;       /**< TKIPCounterMeasuresInvoked */
2714         uint32  tkipreplay_mcst;        /**< TKIPReplays */
2715         uint32  ccmpfmterr_mcst;        /**< CCMPFormatErrors */
2716         uint32  ccmpreplay_mcst;        /**< CCMPReplays */
2717         uint32  ccmpundec_mcst; /**< CCMPDecryptErrors */
2718         uint32  fourwayfail_mcst;       /**< FourWayHandshakeFailures */
2719         uint32  wepundec_mcst;  /**< dot11WEPUndecryptableCount */
2720         uint32  wepicverr_mcst; /**< dot11WEPICVErrorCount */
2721         uint32  decsuccess_mcst;        /**< DecryptSuccessCount */
2722         uint32  tkipicverr_mcst;        /**< TKIPICVErrorCount */
2723         uint32  wepexcluded_mcst;       /**< dot11WEPExcludedCount */
2724
2725         uint32  dma_hang;       /**< count for dma hang */
2726         uint32  reinit;         /**< count for reinit */
2727
2728         uint32  pstatxucast;    /**< count of ucast frames xmitted on all psta assoc */
2729         uint32  pstatxnoassoc;  /**< count of txnoassoc frames xmitted on all psta assoc */
2730         uint32  pstarxucast;    /**< count of ucast frames received on all psta assoc */
2731         uint32  pstarxbcmc;     /**< count of bcmc frames received on all psta */
2732         uint32  pstatxbcmc;     /**< count of bcmc frames transmitted on all psta */
2733
2734         uint32  cso_passthrough; /* hw cso required but passthrough */
2735         uint32  cso_normal;     /**< hw cso hdr for normal process */
2736         uint32  chained;        /**< number of frames chained */
2737         uint32  chainedsz1;     /**< number of chain size 1 frames */
2738         uint32  unchained;      /**< number of frames not chained */
2739         uint32  maxchainsz;     /**< max chain size so far */
2740         uint32  currchainsz;    /**< current chain size */
2741         uint32  rxdrop20s;      /**< drop secondary cnt */
2742         uint32  pciereset;      /**< Secondary Bus Reset issued by driver */
2743         uint32  cfgrestore;     /**< configspace restore by driver */
2744         uint32  reinitreason[NREINITREASONCOUNT]; /* reinitreason counters; 0: Unknown reason */
2745         uint32  rxrtry;         /**< num of received packets with retry bit on */
2746         uint32  txmpdu;         /**< macstat cnt only valid in ver 11. number of MPDUs txed.  */
2747         uint32  rxnodelim;      /**< macstat cnt only valid in ver 11.
2748                                  * number of occasions that no valid delimiter is detected
2749                                  * by ampdu parser.
2750                                  */
2751         uint32  rxmpdu_mu;      /* Number of MU MPDUs received */
2752
2753         /* detailed control/management frames */
2754         uint32  txbar;          /**< Number of TX BAR */
2755         uint32  rxbar;          /**< Number of RX BAR */
2756         uint32  txpspoll;       /**< Number of TX PS-poll */
2757         uint32  rxpspoll;       /**< Number of RX PS-poll */
2758         uint32  txnull;         /**< Number of TX NULL_DATA */
2759         uint32  rxnull;         /**< Number of RX NULL_DATA */
2760         uint32  txqosnull;      /**< Number of TX NULL_QoSDATA */
2761         uint32  rxqosnull;      /**< Number of RX NULL_QoSDATA */
2762         uint32  txassocreq;     /**< Number of TX ASSOC request */
2763         uint32  rxassocreq;     /**< Number of RX ASSOC request */
2764         uint32  txreassocreq;   /**< Number of TX REASSOC request */
2765         uint32  rxreassocreq;   /**< Number of RX REASSOC request */
2766         uint32  txdisassoc;     /**< Number of TX DISASSOC */
2767         uint32  rxdisassoc;     /**< Number of RX DISASSOC */
2768         uint32  txassocrsp;     /**< Number of TX ASSOC response */
2769         uint32  rxassocrsp;     /**< Number of RX ASSOC response */
2770         uint32  txreassocrsp;   /**< Number of TX REASSOC response */
2771         uint32  rxreassocrsp;   /**< Number of RX REASSOC response */
2772         uint32  txauth;         /**< Number of TX AUTH */
2773         uint32  rxauth;         /**< Number of RX AUTH */
2774         uint32  txdeauth;       /**< Number of TX DEAUTH */
2775         uint32  rxdeauth;       /**< Number of RX DEAUTH */
2776         uint32  txprobereq;     /**< Number of TX probe request */
2777         uint32  rxprobereq;     /**< Number of RX probe request */
2778         uint32  txprobersp;     /**< Number of TX probe response */
2779         uint32  rxprobersp;     /**< Number of RX probe response */
2780         uint32  txaction;       /**< Number of TX action frame */
2781         uint32  rxaction;       /**< Number of RX action frame */
2782
2783 } wl_cnt_ver_11_t;
2784
2785 typedef struct {
2786         uint16  version;    /* see definition of WL_CNT_T_VERSION */
2787         uint16  length;     /* length of entire structure */
2788
2789         /* transmit stat counters */
2790         uint32  txframe;    /* tx data frames */
2791         uint32  txbyte;     /* tx data bytes */
2792         uint32  txretrans;  /* tx mac retransmits */
2793         uint32  txerror;    /* tx data errors (derived: sum of others) */
2794         uint32  txctl;      /* tx management frames */
2795         uint32  txprshort;  /* tx short preamble frames */
2796         uint32  txserr;     /* tx status errors */
2797         uint32  txnobuf;    /* tx out of buffers errors */
2798         uint32  txnoassoc;  /* tx discard because we're not associated */
2799         uint32  txrunt;     /* tx runt frames */
2800         uint32  txchit;     /* tx header cache hit (fastpath) */
2801         uint32  txcmiss;    /* tx header cache miss (slowpath) */
2802
2803         /* transmit chip error counters */
2804         uint32  txuflo;     /* tx fifo underflows */
2805         uint32  txphyerr;   /* tx phy errors (indicated in tx status) */
2806         uint32  txphycrs;
2807
2808         /* receive stat counters */
2809         uint32  rxframe;    /* rx data frames */
2810         uint32  rxbyte;     /* rx data bytes */
2811         uint32  rxerror;    /* rx data errors (derived: sum of others) */
2812         uint32  rxctl;      /* rx management frames */
2813         uint32  rxnobuf;    /* rx out of buffers errors */
2814         uint32  rxnondata;  /* rx non data frames in the data channel errors */
2815         uint32  rxbadds;    /* rx bad DS errors */
2816         uint32  rxbadcm;    /* rx bad control or management frames */
2817         uint32  rxfragerr;  /* rx fragmentation errors */
2818         uint32  rxrunt;     /* rx runt frames */
2819         uint32  rxgiant;    /* rx giant frames */
2820         uint32  rxnoscb;    /* rx no scb error */
2821         uint32  rxbadproto; /* rx invalid frames */
2822         uint32  rxbadsrcmac;    /* rx frames with Invalid Src Mac */
2823         uint32  rxbadda;    /* rx frames tossed for invalid da */
2824         uint32  rxfilter;   /* rx frames filtered out */
2825
2826         /* receive chip error counters */
2827         uint32  rxoflo;     /* rx fifo overflow errors */
2828         uint32  rxuflo[NFIFO];  /* rx dma descriptor underflow errors */
2829
2830         uint32  d11cnt_txrts_off;   /* d11cnt txrts value when reset d11cnt */
2831         uint32  d11cnt_rxcrc_off;   /* d11cnt rxcrc value when reset d11cnt */
2832         uint32  d11cnt_txnocts_off; /* d11cnt txnocts value when reset d11cnt */
2833
2834         /* misc counters */
2835         uint32  dmade;      /* tx/rx dma descriptor errors */
2836         uint32  dmada;      /* tx/rx dma data errors */
2837         uint32  dmape;      /* tx/rx dma descriptor protocol errors */
2838         uint32  reset;      /* reset count */
2839         uint32  tbtt;       /* cnts the TBTT int's */
2840         uint32  txdmawar;
2841         uint32  pkt_callback_reg_fail;  /* callbacks register failure */
2842
2843         /* MAC counters: 32-bit version of d11.h's macstat_t */
2844         uint32  txallfrm;   /* total number of frames sent, incl. Data, ACK, RTS, CTS,
2845                              * Control Management (includes retransmissions)
2846                              */
2847         uint32  txrtsfrm;   /* number of RTS sent out by the MAC */
2848         uint32  txctsfrm;   /* number of CTS sent out by the MAC */
2849         uint32  txackfrm;   /* number of ACK frames sent out */
2850         uint32  txdnlfrm;   /* Not used */
2851         uint32  txbcnfrm;   /* beacons transmitted */
2852         uint32  txfunfl[6]; /* per-fifo tx underflows */
2853         uint32  rxtoolate;      /* receive too late */
2854         uint32  txfbw;      /* transmit at fallback bw (dynamic bw) */
2855         uint32  txtplunfl;  /* Template underflows (mac was too slow to transmit ACK/CTS
2856                              * or BCN)
2857                              */
2858         uint32  txphyerror; /* Transmit phy error, type of error is reported in tx-status for
2859                              * driver enqueued frames
2860                              */
2861         uint32  rxfrmtoolong;   /* Received frame longer than legal limit (2346 bytes) */
2862         uint32  rxfrmtooshrt;   /* Received frame did not contain enough bytes for its frame type */
2863         uint32  rxinvmachdr;    /* Either the protocol version != 0 or frame type not
2864                                  * data/control/management
2865                            */
2866         uint32  rxbadfcs;   /* number of frames for which the CRC check failed in the MAC */
2867         uint32  rxbadplcp;  /* parity check of the PLCP header failed */
2868         uint32  rxcrsglitch;    /* PHY was able to correlate the preamble but not the header */
2869         uint32  rxstrt;     /* Number of received frames with a good PLCP
2870                              * (i.e. passing parity check)
2871                              */
2872         uint32  rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
2873         uint32  rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
2874         uint32  rxcfrmucast;    /* number of received CNTRL frames with good FCS and matching RA */
2875         uint32  rxrtsucast; /* number of unicast RTS addressed to the MAC (good FCS) */
2876         uint32  rxctsucast; /* number of unicast CTS addressed to the MAC (good FCS) */
2877         uint32  rxackucast; /* number of ucast ACKS received (good FCS) */
2878         uint32  rxdfrmocast;    /* number of received DATA frames (good FCS and not matching RA) */
2879         uint32  rxmfrmocast;    /* number of received MGMT frames (good FCS and not matching RA) */
2880         uint32  rxcfrmocast;    /* number of received CNTRL frame (good FCS and not matching RA) */
2881         uint32  rxrtsocast; /* number of received RTS not addressed to the MAC */
2882         uint32  rxctsocast; /* number of received CTS not addressed to the MAC */
2883         uint32  rxdfrmmcast;    /* number of RX Data multicast frames received by the MAC */
2884         uint32  rxmfrmmcast;    /* number of RX Management multicast frames received by the MAC */
2885         uint32  rxcfrmmcast;    /* number of RX Control multicast frames received by the MAC
2886                                  * (unlikely to see these)
2887                                  */
2888         uint32  rxbeaconmbss;   /* beacons received from member of BSS */
2889         uint32  rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
2890                                   * other BSS (WDS FRAME)
2891                                   */
2892         uint32  rxbeaconobss;   /* beacons received from other BSS */
2893         uint32  rxrsptmout; /* Number of response timeouts for transmitted frames
2894                              * expecting a response
2895                              */
2896         uint32  bcntxcancl; /* transmit beacons canceled due to receipt of beacon (IBSS) */
2897         uint32  rxf0ovfl;   /* Number of receive fifo 0 overflows */
2898         uint32  rxf1ovfl;   /* Number of receive fifo 1 overflows (obsolete) */
2899         uint32  rxf2ovfl;   /* Number of receive fifo 2 overflows (obsolete) */
2900         uint32  txsfovfl;   /* Number of transmit status fifo overflows (obsolete) */
2901         uint32  pmqovfl;    /* Number of PMQ overflows */
2902         uint32  rxcgprqfrm; /* Number of received Probe requests that made it into
2903                              * the PRQ fifo
2904                              */
2905         uint32  rxcgprsqovfl;   /* Rx Probe Request Que overflow in the AP */
2906         uint32  txcgprsfail;    /* Tx Probe Response Fail. AP sent probe response but did
2907                                  * not get ACK
2908                                  */
2909         uint32  txcgprssuc; /* Tx Probe Response Success (ACK was received) */
2910         uint32  prs_timeout;    /* Number of probe requests that were dropped from the PRQ
2911                                  * fifo because a probe response could not be sent out within
2912                                  * the time limit defined in M_PRS_MAXTIME
2913                                  */
2914         uint32  rxnack;
2915         uint32  frmscons;
2916         uint32  txnack;         /* obsolete */
2917         uint32  rxback;         /* blockack rxcnt */
2918         uint32  txback;         /* blockack txcnt */
2919
2920         /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2921         uint32  txfrag;     /* dot11TransmittedFragmentCount */
2922         uint32  txmulti;    /* dot11MulticastTransmittedFrameCount */
2923         uint32  txfail;     /* dot11FailedCount */
2924         uint32  txretry;    /* dot11RetryCount */
2925         uint32  txretrie;   /* dot11MultipleRetryCount */
2926         uint32  rxdup;      /* dot11FrameduplicateCount */
2927         uint32  txrts;      /* dot11RTSSuccessCount */
2928         uint32  txnocts;    /* dot11RTSFailureCount */
2929         uint32  txnoack;    /* dot11ACKFailureCount */
2930         uint32  rxfrag;     /* dot11ReceivedFragmentCount */
2931         uint32  rxmulti;    /* dot11MulticastReceivedFrameCount */
2932         uint32  rxcrc;      /* dot11FCSErrorCount */
2933         uint32  txfrmsnt;   /* dot11TransmittedFrameCount (bogus MIB?) */
2934         uint32  rxundec;    /* dot11WEPUndecryptableCount */
2935
2936         /* WPA2 counters (see rxundec for DecryptFailureCount) */
2937         uint32  tkipmicfaill;   /* TKIPLocalMICFailures */
2938         uint32  tkipcntrmsr;    /* TKIPCounterMeasuresInvoked */
2939         uint32  tkipreplay; /* TKIPReplays */
2940         uint32  ccmpfmterr; /* CCMPFormatErrors */
2941         uint32  ccmpreplay; /* CCMPReplays */
2942         uint32  ccmpundec;  /* CCMPDecryptErrors */
2943         uint32  fourwayfail;    /* FourWayHandshakeFailures */
2944         uint32  wepundec;   /* dot11WEPUndecryptableCount */
2945         uint32  wepicverr;  /* dot11WEPICVErrorCount */
2946         uint32  decsuccess; /* DecryptSuccessCount */
2947         uint32  tkipicverr; /* TKIPICVErrorCount */
2948         uint32  wepexcluded;    /* dot11WEPExcludedCount */
2949
2950         uint32  rxundec_mcst;   /* dot11WEPUndecryptableCount */
2951
2952         /* WPA2 counters (see rxundec for DecryptFailureCount) */
2953         uint32  tkipmicfaill_mcst;  /* TKIPLocalMICFailures */
2954         uint32  tkipcntrmsr_mcst;   /* TKIPCounterMeasuresInvoked */
2955         uint32  tkipreplay_mcst;    /* TKIPReplays */
2956         uint32  ccmpfmterr_mcst;    /* CCMPFormatErrors */
2957         uint32  ccmpreplay_mcst;    /* CCMPReplays */
2958         uint32  ccmpundec_mcst; /* CCMPDecryptErrors */
2959         uint32  fourwayfail_mcst;   /* FourWayHandshakeFailures */
2960         uint32  wepundec_mcst;  /* dot11WEPUndecryptableCount */
2961         uint32  wepicverr_mcst; /* dot11WEPICVErrorCount */
2962         uint32  decsuccess_mcst;    /* DecryptSuccessCount */
2963         uint32  tkipicverr_mcst;    /* TKIPICVErrorCount */
2964         uint32  wepexcluded_mcst;   /* dot11WEPExcludedCount */
2965
2966         uint32  txchanrej;  /* Tx frames suppressed due to channel rejection */
2967         uint32  txexptime;  /* Tx frames suppressed due to timer expiration */
2968         uint32  psmwds;     /* Count PSM watchdogs */
2969         uint32  phywatchdog;    /* Count Phy watchdogs (triggered by ucode) */
2970
2971         /* MBSS counters, AP only */
2972         uint32  prq_entries_handled;    /* PRQ entries read in */
2973         uint32  prq_undirected_entries; /*    which were bcast bss & ssid */
2974         uint32  prq_bad_entries;    /*    which could not be translated to info */
2975         uint32  atim_suppress_count;    /* TX suppressions on ATIM fifo */
2976         uint32  bcn_template_not_ready; /* Template marked in use on send bcn ... */
2977         uint32  bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
2978         uint32  late_tbtt_dpc;  /* TBTT DPC did not happen in time */
2979
2980         /* per-rate receive stat counters */
2981         uint32  rx1mbps;    /* packets rx at 1Mbps */
2982         uint32  rx2mbps;    /* packets rx at 2Mbps */
2983         uint32  rx5mbps5;   /* packets rx at 5.5Mbps */
2984         uint32  rx6mbps;    /* packets rx at 6Mbps */
2985         uint32  rx9mbps;    /* packets rx at 9Mbps */
2986         uint32  rx11mbps;   /* packets rx at 11Mbps */
2987         uint32  rx12mbps;   /* packets rx at 12Mbps */
2988         uint32  rx18mbps;   /* packets rx at 18Mbps */
2989         uint32  rx24mbps;   /* packets rx at 24Mbps */
2990         uint32  rx36mbps;   /* packets rx at 36Mbps */
2991         uint32  rx48mbps;   /* packets rx at 48Mbps */
2992         uint32  rx54mbps;   /* packets rx at 54Mbps */
2993         uint32  rx108mbps;  /* packets rx at 108mbps */
2994         uint32  rx162mbps;  /* packets rx at 162mbps */
2995         uint32  rx216mbps;  /* packets rx at 216 mbps */
2996         uint32  rx270mbps;  /* packets rx at 270 mbps */
2997         uint32  rx324mbps;  /* packets rx at 324 mbps */
2998         uint32  rx378mbps;  /* packets rx at 378 mbps */
2999         uint32  rx432mbps;  /* packets rx at 432 mbps */
3000         uint32  rx486mbps;  /* packets rx at 486 mbps */
3001         uint32  rx540mbps;  /* packets rx at 540 mbps */
3002
3003         /* pkteng rx frame stats */
3004         uint32  pktengrxducast; /* unicast frames rxed by the pkteng code */
3005         uint32  pktengrxdmcast; /* multicast frames rxed by the pkteng code */
3006
3007         uint32  rfdisable;  /* count of radio disables */
3008         uint32  bphy_rxcrsglitch;   /* PHY count of bphy glitches */
3009         uint32  bphy_badplcp;
3010
3011         uint32  txmpdu_sgi; /* count for sgi transmit */
3012         uint32  rxmpdu_sgi; /* count for sgi received */
3013         uint32  txmpdu_stbc;    /* count for stbc transmit */
3014         uint32  rxmpdu_stbc;    /* count for stbc received */
3015
3016         uint32  rxdrop20s;      /* drop secondary cnt */
3017 } wl_cnt_ver_6_t;
3018
3019 #define WL_DELTA_STATS_T_VERSION        2       /* current version of wl_delta_stats_t struct */
3020
3021 typedef struct {
3022         uint16 version;     /* see definition of WL_DELTA_STATS_T_VERSION */
3023         uint16 length;      /* length of entire structure */
3024
3025         /* transmit stat counters */
3026         uint32 txframe;     /* tx data frames */
3027         uint32 txbyte;      /* tx data bytes */
3028         uint32 txretrans;   /* tx mac retransmits */
3029         uint32 txfail;      /* tx failures */
3030
3031         /* receive stat counters */
3032         uint32 rxframe;     /* rx data frames */
3033         uint32 rxbyte;      /* rx data bytes */
3034
3035         /* per-rate receive stat counters */
3036         uint32  rx1mbps;        /* packets rx at 1Mbps */
3037         uint32  rx2mbps;        /* packets rx at 2Mbps */
3038         uint32  rx5mbps5;       /* packets rx at 5.5Mbps */
3039         uint32  rx6mbps;        /* packets rx at 6Mbps */
3040         uint32  rx9mbps;        /* packets rx at 9Mbps */
3041         uint32  rx11mbps;       /* packets rx at 11Mbps */
3042         uint32  rx12mbps;       /* packets rx at 12Mbps */
3043         uint32  rx18mbps;       /* packets rx at 18Mbps */
3044         uint32  rx24mbps;       /* packets rx at 24Mbps */
3045         uint32  rx36mbps;       /* packets rx at 36Mbps */
3046         uint32  rx48mbps;       /* packets rx at 48Mbps */
3047         uint32  rx54mbps;       /* packets rx at 54Mbps */
3048         uint32  rx108mbps;      /* packets rx at 108mbps */
3049         uint32  rx162mbps;      /* packets rx at 162mbps */
3050         uint32  rx216mbps;      /* packets rx at 216 mbps */
3051         uint32  rx270mbps;      /* packets rx at 270 mbps */
3052         uint32  rx324mbps;      /* packets rx at 324 mbps */
3053         uint32  rx378mbps;      /* packets rx at 378 mbps */
3054         uint32  rx432mbps;      /* packets rx at 432 mbps */
3055         uint32  rx486mbps;      /* packets rx at 486 mbps */
3056         uint32  rx540mbps;      /* packets rx at 540 mbps */
3057
3058         /* phy stats */
3059         uint32 rxbadplcp;
3060         uint32 rxcrsglitch;
3061         uint32 bphy_rxcrsglitch;
3062         uint32 bphy_badplcp;
3063
3064 } wl_delta_stats_t;
3065
3066 typedef struct {
3067         uint32 packets;
3068         uint32 bytes;
3069 } wl_traffic_stats_t;
3070
3071 typedef struct {
3072         uint16  version;        /* see definition of WL_WME_CNT_VERSION */
3073         uint16  length;         /* length of entire structure */
3074
3075         wl_traffic_stats_t tx[AC_COUNT];        /* Packets transmitted */
3076         wl_traffic_stats_t tx_failed[AC_COUNT]; /* Packets dropped or failed to transmit */
3077         wl_traffic_stats_t rx[AC_COUNT];        /* Packets received */
3078         wl_traffic_stats_t rx_failed[AC_COUNT]; /* Packets failed to receive */
3079
3080         wl_traffic_stats_t forward[AC_COUNT];   /* Packets forwarded by AP */
3081
3082         wl_traffic_stats_t tx_expired[AC_COUNT];        /* packets dropped due to lifetime expiry */
3083
3084 } wl_wme_cnt_t;
3085
3086 struct wl_msglevel2 {
3087         uint32 low;
3088         uint32 high;
3089 };
3090
3091 typedef struct wl_mkeep_alive_pkt {
3092         uint16  version; /* Version for mkeep_alive */
3093         uint16  length; /* length of fixed parameters in the structure */
3094         uint32  period_msec;
3095         uint16  len_bytes;
3096         uint8   keep_alive_id; /* 0 - 3 for N = 4 */
3097         uint8   data[1];
3098 } wl_mkeep_alive_pkt_t;
3099
3100 #define WL_MKEEP_ALIVE_VERSION          1
3101 #define WL_MKEEP_ALIVE_FIXED_LEN        OFFSETOF(wl_mkeep_alive_pkt_t, data)
3102 #define WL_MKEEP_ALIVE_PRECISION        500
3103
3104 /* TCP Keep-Alive conn struct */
3105 typedef struct wl_mtcpkeep_alive_conn_pkt {
3106         struct ether_addr saddr;                /* src mac address */
3107         struct ether_addr daddr;                /* dst mac address */
3108         struct ipv4_addr sipaddr;               /* source IP addr */
3109         struct ipv4_addr dipaddr;               /* dest IP addr */
3110         uint16 sport;                           /* src port */
3111         uint16 dport;                           /* dest port */
3112         uint32 seq;                             /* seq number */
3113         uint32 ack;                             /* ACK number */
3114         uint16 tcpwin;                          /* TCP window */
3115 } wl_mtcpkeep_alive_conn_pkt_t;
3116
3117 /* TCP Keep-Alive interval struct */
3118 typedef struct wl_mtcpkeep_alive_timers_pkt {
3119         uint16 interval;                /* interval timer */
3120         uint16 retry_interval;          /* retry_interval timer */
3121         uint16 retry_count;             /* retry_count */
3122 } wl_mtcpkeep_alive_timers_pkt_t;
3123
3124 typedef struct wake_info {
3125         uint32 wake_reason;
3126         uint32 wake_info_len;           /* size of packet */
3127         uchar  packet[1];
3128 } wake_info_t;
3129
3130 typedef struct wake_pkt {
3131         uint32 wake_pkt_len;            /* size of packet */
3132         uchar  packet[1];
3133 } wake_pkt_t;
3134
3135
3136 #define WL_MTCPKEEP_ALIVE_VERSION               1
3137
3138 #ifdef WLBA
3139
3140 #define WLC_BA_CNT_VERSION  1   /* current version of wlc_ba_cnt_t */
3141
3142 /* block ack related stats */
3143 typedef struct wlc_ba_cnt {
3144         uint16  version;    /* WLC_BA_CNT_VERSION */
3145         uint16  length;     /* length of entire structure */
3146
3147         /* transmit stat counters */
3148         uint32 txpdu;       /* pdus sent */
3149         uint32 txsdu;       /* sdus sent */
3150         uint32 txfc;        /* tx side flow controlled packets */
3151         uint32 txfci;       /* tx side flow control initiated */
3152         uint32 txretrans;   /* retransmitted pdus */
3153         uint32 txbatimer;   /* ba resend due to timer */
3154         uint32 txdrop;      /* dropped packets */
3155         uint32 txaddbareq;  /* addba req sent */
3156         uint32 txaddbaresp; /* addba resp sent */
3157         uint32 txdelba;     /* delba sent */
3158         uint32 txba;        /* ba sent */
3159         uint32 txbar;       /* bar sent */
3160         uint32 txpad[4];    /* future */
3161
3162         /* receive side counters */
3163         uint32 rxpdu;       /* pdus recd */
3164         uint32 rxqed;       /* pdus buffered before sending up */
3165         uint32 rxdup;       /* duplicate pdus */
3166         uint32 rxnobuf;     /* pdus discarded due to no buf */
3167         uint32 rxaddbareq;  /* addba req recd */
3168         uint32 rxaddbaresp; /* addba resp recd */
3169         uint32 rxdelba;     /* delba recd */
3170         uint32 rxba;        /* ba recd */
3171         uint32 rxbar;       /* bar recd */
3172         uint32 rxinvba;     /* invalid ba recd */
3173         uint32 rxbaholes;   /* ba recd with holes */
3174         uint32 rxunexp;     /* unexpected packets */
3175         uint32 rxpad[4];    /* future */
3176 } wlc_ba_cnt_t;
3177 #endif /* WLBA */
3178
3179 /* structure for per-tid ampdu control */
3180 struct ampdu_tid_control {
3181         uint8 tid;                      /* tid */
3182         uint8 enable;                   /* enable/disable */
3183 };
3184
3185 /* struct for ampdu tx/rx aggregation control */
3186 struct ampdu_aggr {
3187         int8 aggr_override;     /* aggr overrided by dongle. Not to be set by host. */
3188         uint16 conf_TID_bmap;   /* bitmap of TIDs to configure */
3189         uint16 enab_TID_bmap;   /* enable/disable per TID */
3190 };
3191
3192 /* structure for identifying ea/tid for sending addba/delba */
3193 struct ampdu_ea_tid {
3194         struct ether_addr ea;           /* Station address */
3195         uint8 tid;                      /* tid */
3196         uint8 initiator;        /* 0 is recipient, 1 is originator */
3197 };
3198 /* structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
3199 struct ampdu_retry_tid {
3200         uint8 tid;      /* tid */
3201         uint8 retry;    /* retry value */
3202 };
3203
3204 #define BDD_FNAME_LEN       32  /* Max length of friendly name */
3205 typedef struct bdd_fname {
3206         uint8 len;          /* length of friendly name */
3207         uchar name[BDD_FNAME_LEN];  /* friendly name */
3208 } bdd_fname_t;
3209
3210 /* structure for addts arguments */
3211 /* For ioctls that take a list of TSPEC */
3212 struct tslist {
3213         int count;                      /* number of tspecs */
3214         struct tsinfo_arg tsinfo[1];    /* variable length array of tsinfo */
3215 };
3216
3217 #ifdef WLTDLS
3218 /* structure for tdls iovars */
3219 typedef struct tdls_iovar {
3220         struct ether_addr ea;           /* Station address */
3221         uint8 mode;                     /* mode: depends on iovar */
3222         chanspec_t chanspec;
3223         uint32 pad;                     /* future */
3224 } tdls_iovar_t;
3225
3226 #define TDLS_WFD_IE_SIZE                512
3227 /* structure for tdls wfd ie */
3228 typedef struct tdls_wfd_ie_iovar {
3229         struct ether_addr ea;           /* Station address */
3230         uint8 mode;
3231         uint16 length;
3232         uint8 data[TDLS_WFD_IE_SIZE];
3233 } tdls_wfd_ie_iovar_t;
3234 #endif /* WLTDLS */
3235
3236 /* structure for addts/delts arguments */
3237 typedef struct tspec_arg {
3238         uint16 version;                 /* see definition of TSPEC_ARG_VERSION */
3239         uint16 length;                  /* length of entire structure */
3240         uint flag;                      /* bit field */
3241         /* TSPEC Arguments */
3242         struct tsinfo_arg tsinfo;       /* TS Info bit field */
3243         uint16 nom_msdu_size;           /* (Nominal or fixed) MSDU Size (bytes) */
3244         uint16 max_msdu_size;           /* Maximum MSDU Size (bytes) */
3245         uint min_srv_interval;          /* Minimum Service Interval (us) */
3246         uint max_srv_interval;          /* Maximum Service Interval (us) */
3247         uint inactivity_interval;       /* Inactivity Interval (us) */
3248         uint suspension_interval;       /* Suspension Interval (us) */
3249         uint srv_start_time;            /* Service Start Time (us) */
3250         uint min_data_rate;             /* Minimum Data Rate (bps) */
3251         uint mean_data_rate;            /* Mean Data Rate (bps) */
3252         uint peak_data_rate;            /* Peak Data Rate (bps) */
3253         uint max_burst_size;            /* Maximum Burst Size (bytes) */
3254         uint delay_bound;               /* Delay Bound (us) */
3255         uint min_phy_rate;              /* Minimum PHY Rate (bps) */
3256         uint16 surplus_bw;              /* Surplus Bandwidth Allowance (range 1.0 to 8.0) */
3257         uint16 medium_time;             /* Medium Time (32 us/s periods) */
3258         uint8 dialog_token;             /* dialog token */
3259 } tspec_arg_t;
3260
3261 /* tspec arg for desired station */
3262 typedef struct tspec_per_sta_arg {
3263         struct ether_addr ea;
3264         struct tspec_arg ts;
3265 } tspec_per_sta_arg_t;
3266
3267 /* structure for max bandwidth for each access category */
3268 typedef struct wme_max_bandwidth {
3269         uint32  ac[AC_COUNT];   /* max bandwidth for each access category */
3270 } wme_max_bandwidth_t;
3271
3272 #define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
3273
3274 /* current version of wl_tspec_arg_t struct */
3275 #define TSPEC_ARG_VERSION               2       /* current version of wl_tspec_arg_t struct */
3276 #define TSPEC_ARG_LENGTH                55      /* argument length from tsinfo to medium_time */
3277 #define TSPEC_DEFAULT_DIALOG_TOKEN      42      /* default dialog token */
3278 #define TSPEC_DEFAULT_SBW_FACTOR        0x3000  /* default surplus bw */
3279
3280
3281 #define WL_WOWL_KEEPALIVE_MAX_PACKET_SIZE  80
3282 #define WLC_WOWL_MAX_KEEPALIVE  2
3283
3284 /* Packet lifetime configuration per ac */
3285 typedef struct wl_lifetime {
3286         uint32 ac;              /* access class */
3287         uint32 lifetime;    /* Packet lifetime value in ms */
3288 } wl_lifetime_t;
3289
3290
3291 /* Channel Switch Announcement param */
3292 typedef struct wl_chan_switch {
3293         uint8 mode;             /* value 0 or 1 */
3294         uint8 count;            /* count # of beacons before switching */
3295         chanspec_t chspec;      /* chanspec */
3296         uint8 reg;              /* regulatory class */
3297         uint8 frame_type;               /* csa frame type, unicast or broadcast */
3298 } wl_chan_switch_t;
3299
3300 enum {
3301         PFN_LIST_ORDER,
3302         PFN_RSSI
3303 };
3304
3305 enum {
3306         DISABLE,
3307         ENABLE
3308 };
3309
3310 enum {
3311         OFF_ADAPT,
3312         SMART_ADAPT,
3313         STRICT_ADAPT,
3314         SLOW_ADAPT
3315 };
3316
3317 #define SORT_CRITERIA_BIT               0
3318 #define AUTO_NET_SWITCH_BIT             1
3319 #define ENABLE_BKGRD_SCAN_BIT           2
3320 #define IMMEDIATE_SCAN_BIT              3
3321 #define AUTO_CONNECT_BIT                4
3322 #define ENABLE_BD_SCAN_BIT              5
3323 #define ENABLE_ADAPTSCAN_BIT            6
3324 #define IMMEDIATE_EVENT_BIT             8
3325 #define SUPPRESS_SSID_BIT               9
3326 #define ENABLE_NET_OFFLOAD_BIT          10
3327 /* report found/lost events for SSID and BSSID networks seperately */
3328 #define REPORT_SEPERATELY_BIT           11
3329
3330 #define SORT_CRITERIA_MASK      0x0001
3331 #define AUTO_NET_SWITCH_MASK    0x0002
3332 #define ENABLE_BKGRD_SCAN_MASK  0x0004
3333 #define IMMEDIATE_SCAN_MASK     0x0008
3334 #define AUTO_CONNECT_MASK       0x0010
3335
3336 #define ENABLE_BD_SCAN_MASK     0x0020
3337 #define ENABLE_ADAPTSCAN_MASK   0x00c0
3338 #define IMMEDIATE_EVENT_MASK    0x0100
3339 #define SUPPRESS_SSID_MASK      0x0200
3340 #define ENABLE_NET_OFFLOAD_MASK 0x0400
3341 /* report found/lost events for SSID and BSSID networks seperately */
3342 #define REPORT_SEPERATELY_MASK  0x0800
3343
3344 #define PFN_VERSION                     2
3345 #define PFN_SCANRESULT_VERSION          1
3346 #define MAX_PFN_LIST_COUNT              16
3347
3348 #define PFN_COMPLETE                    1
3349 #define PFN_INCOMPLETE                  0
3350
3351 #define DEFAULT_BESTN                   2
3352 #define DEFAULT_MSCAN                   0
3353 #define DEFAULT_REPEAT                  10
3354 #define DEFAULT_EXP                     2
3355
3356 #define PFN_PARTIAL_SCAN_BIT            0
3357 #define PFN_PARTIAL_SCAN_MASK           1
3358 #define PFN_SWC_RSSI_WINDOW_MAX   8
3359 #define PFN_SWC_MAX_NUM_APS       16
3360 #define PFN_HOTLIST_MAX_NUM_APS   64
3361
3362 /* PFN network info structure */
3363 typedef struct wl_pfn_subnet_info {
3364         struct ether_addr BSSID;
3365         uint8   channel; /* channel number only */
3366         uint8   SSID_len;
3367         uint8   SSID[32];
3368 } wl_pfn_subnet_info_t;
3369
3370 typedef struct wl_pfn_net_info {
3371         wl_pfn_subnet_info_t pfnsubnet;
3372         int16   RSSI; /* receive signal strength (in dBm) */
3373         uint16  timestamp; /* age in seconds */
3374 } wl_pfn_net_info_t;
3375
3376 typedef struct wl_pfn_lnet_info {
3377         wl_pfn_subnet_info_t pfnsubnet; /* BSSID + channel + SSID len + SSID */
3378         uint16  flags; /* partial scan, etc */
3379         int16   RSSI; /* receive signal strength (in dBm) */
3380         uint32  timestamp; /* age in miliseconds */
3381         uint16  rtt0; /* estimated distance to this AP in centimeters */
3382         uint16  rtt1; /* standard deviation of the distance to this AP in centimeters */
3383 } wl_pfn_lnet_info_t;
3384
3385 typedef struct wl_pfn_lscanresults {
3386         uint32 version;
3387         uint32 status;
3388         uint32 count;
3389         wl_pfn_lnet_info_t netinfo[1];
3390 } wl_pfn_lscanresults_t;
3391
3392 /* this is used to report on 1-* pfn scan results */
3393 typedef struct wl_pfn_scanresults {
3394         uint32 version;
3395         uint32 status;
3396         uint32 count;
3397         wl_pfn_net_info_t netinfo[1];
3398 } wl_pfn_scanresults_t;
3399
3400 typedef struct wl_pfn_significant_net {
3401         uint16 flags;
3402         uint16 channel;
3403         struct ether_addr BSSID;
3404         int8 rssi[PFN_SWC_RSSI_WINDOW_MAX];
3405 } wl_pfn_significant_net_t;
3406
3407
3408 typedef struct wl_pfn_swc_results {
3409         uint32 version;
3410         uint32 pkt_count;
3411         uint32 total_count;
3412         wl_pfn_significant_net_t list[1];
3413 } wl_pfn_swc_results_t;
3414
3415 /* used to report exactly one scan result */
3416 /* plus reports detailed scan info in bss_info */
3417 typedef struct wl_pfn_scanresult {
3418         uint32 version;
3419         uint32 status;
3420         uint32 count;
3421         wl_pfn_net_info_t netinfo;
3422         wl_bss_info_t bss_info;
3423 } wl_pfn_scanresult_t;
3424
3425 /* PFN data structure */
3426 typedef struct wl_pfn_param {
3427         int32 version;                  /* PNO parameters version */
3428         int32 scan_freq;                /* Scan frequency */
3429         int32 lost_network_timeout;     /* Timeout in sec. to declare
3430                                                                 * discovered network as lost
3431                                                                 */
3432         int16 flags;                    /* Bit field to control features
3433                                                         * of PFN such as sort criteria auto
3434                                                         * enable switch and background scan
3435                                                         */
3436         int16 rssi_margin;              /* Margin to avoid jitter for choosing a
3437                                                         * PFN based on RSSI sort criteria
3438                                                         */
3439         uint8 bestn; /* number of best networks in each scan */
3440         uint8 mscan; /* number of scans recorded */
3441         uint8 repeat; /* Minimum number of scan intervals
3442                                      *before scan frequency changes in adaptive scan
3443                                      */
3444         uint8 exp; /* Exponent of 2 for maximum scan interval */
3445         int32 slow_freq; /* slow scan period */
3446 } wl_pfn_param_t;
3447
3448 typedef struct wl_pfn_bssid {
3449         struct ether_addr  macaddr;
3450         /* Bit4: suppress_lost, Bit3: suppress_found */
3451         uint16             flags;
3452 } wl_pfn_bssid_t;
3453
3454 typedef struct wl_pfn_significant_bssid {
3455         struct ether_addr       macaddr;
3456         int8    rssi_low_threshold;
3457         int8    rssi_high_threshold;
3458 } wl_pfn_significant_bssid_t;
3459 #define WL_PFN_SUPPRESSFOUND_MASK       0x08
3460 #define WL_PFN_SUPPRESSLOST_MASK        0x10
3461 #define WL_PFN_RSSI_MASK                0xff00
3462 #define WL_PFN_RSSI_SHIFT               8
3463
3464 typedef struct wl_pfn_cfg {
3465         uint32  reporttype;
3466         int32   channel_num;
3467         uint16  channel_list[WL_NUMCHANNELS];
3468         uint32  flags;
3469 } wl_pfn_cfg_t;
3470
3471 #define CH_BUCKET_REPORT_REGULAR                0
3472 #define CH_BUCKET_REPORT_FULL_RESULT            2
3473 #define CH_BUCKET_GSCAN                         4
3474
3475
3476 typedef struct wl_pfn_gscan_channel_bucket {
3477         uint16 bucket_end_index;
3478         uint8 bucket_freq_multiple;
3479         uint8 report_flag;
3480 } wl_pfn_gscan_channel_bucket_t;
3481
3482 #define GSCAN_SEND_ALL_RESULTS_MASK    (1 << 0)
3483 #define GSCAN_CFG_FLAGS_ONLY_MASK      (1 << 7)
3484
3485 typedef struct wl_pfn_gscan_cfg {
3486         /* BIT0 1 = send probes/beacons to HOST
3487         * BIT2 Reserved
3488          * Add any future flags here
3489          * BIT7 1 = no other useful cfg sent
3490          */
3491         uint8 flags;
3492         /* Buffer filled threshold in % to generate an event */
3493         uint8   buffer_threshold;
3494         /* No. of BSSIDs with "change" to generate an evt
3495          * change - crosses rssi threshold/lost
3496          */
3497         uint8   swc_nbssid_threshold;
3498         /* Max=8 (for now) Size of rssi cache buffer */
3499         uint8  swc_rssi_window_size;
3500         uint16  count_of_channel_buckets;
3501         uint16  lost_ap_window;
3502         wl_pfn_gscan_channel_bucket_t channel_bucket[1];
3503 } wl_pfn_gscan_cfg_t;
3504
3505
3506 #define WL_PFN_REPORT_ALLNET    0
3507 #define WL_PFN_REPORT_SSIDNET   1
3508 #define WL_PFN_REPORT_BSSIDNET  2
3509 #define WL_PFN_CFG_FLAGS_PROHIBITED     0x00000001      /* Accept and use prohibited channels */
3510 #define WL_PFN_CFG_FLAGS_RESERVED       0xfffffffe      /* Remaining reserved for future use */
3511
3512 typedef struct wl_pfn {
3513         wlc_ssid_t              ssid;                   /* ssid name and its length */
3514         int32                   flags;                  /* bit2: hidden */
3515         int32                   infra;                  /* BSS Vs IBSS */
3516         int32                   auth;                   /* Open Vs Closed */
3517         int32                   wpa_auth;               /* WPA type */
3518         int32                   wsec;                   /* wsec value */
3519 } wl_pfn_t;
3520
3521 typedef struct wl_pfn_list {
3522         uint32          version;
3523         uint32          enabled;
3524         uint32          count;
3525         wl_pfn_t        pfn[1];
3526 } wl_pfn_list_t;
3527
3528 #define WL_PFN_MAC_OUI_ONLY_MASK      1
3529 #define WL_PFN_SET_MAC_UNASSOC_MASK   2
3530 /* To configure pfn_macaddr */
3531 typedef struct wl_pfn_macaddr_cfg {
3532         uint8 version;
3533         uint8 flags;
3534         struct ether_addr macaddr;
3535 } wl_pfn_macaddr_cfg_t;
3536 #define WL_PFN_MACADDR_CFG_VER 1
3537 typedef BWL_PRE_PACKED_STRUCT struct pfn_olmsg_params_t {
3538         wlc_ssid_t ssid;
3539         uint32  cipher_type;
3540         uint32  auth_type;
3541         uint8   channels[4];
3542 } BWL_POST_PACKED_STRUCT pfn_olmsg_params;
3543
3544 #define WL_PFN_HIDDEN_BIT               2
3545 #define WL_PFN_HIDDEN_MASK              0x4
3546
3547 #ifndef BESTN_MAX
3548 #define BESTN_MAX                       3
3549 #endif
3550
3551 #ifndef MSCAN_MAX
3552 #define MSCAN_MAX                       90
3553 #endif
3554
3555 /*
3556  * WLFCTS definition
3557  */
3558 typedef struct wl_txstatus_additional_info {
3559         uint32 rspec;
3560         uint32 enq_ts;
3561         uint32 last_ts;
3562         uint32 entry_ts;
3563         uint16 seq;
3564         uint8  rts_cnt;
3565         uint8  tx_cnt;
3566 } wl_txstatus_additional_info_t;
3567
3568 /* Service discovery */
3569 typedef struct {
3570         uint8   transaction_id; /* Transaction id */
3571         uint8   protocol;       /* Service protocol type */
3572         uint16  query_len;      /* Length of query */
3573         uint16  response_len;   /* Length of response */
3574         uint8   qrbuf[1];
3575 } wl_p2po_qr_t;
3576
3577 typedef struct {
3578         uint16                  period;                 /* extended listen period */
3579         uint16                  interval;               /* extended listen interval */
3580         uint16                  count;                  /* count to repeat */
3581         uint16                  pad;                    /* pad for 32bit align */
3582 } wl_p2po_listen_t;
3583
3584 /* GAS state machine tunable parameters.  Structure field values of 0 means use the default. */
3585 typedef struct wl_gas_config {
3586         uint16 max_retransmit;          /* Max # of firmware/driver retransmits on no Ack
3587                                          * from peer (on top of the ucode retries).
3588                                          */
3589         uint16 response_timeout;        /* Max time to wait for a GAS-level response
3590                                          * after sending a packet.
3591                                          */
3592         uint16 max_comeback_delay;      /* Max GAS response comeback delay.
3593                                          * Exceeding this fails the GAS exchange.
3594                                          */
3595         uint16 max_retries;             /* Max # of GAS state machine retries on failure
3596                                          * of a GAS frame exchange.
3597                                          */
3598 } wl_gas_config_t;
3599
3600 /* P2P Find Offload parameters */
3601 typedef BWL_PRE_PACKED_STRUCT struct wl_p2po_find_config {
3602         uint16 version;                 /* Version of this struct */
3603         uint16 length;                  /* sizeof(wl_p2po_find_config_t) */
3604         int32 search_home_time;         /* P2P search state home time when concurrent
3605                                          * connection exists.  -1 for default.
3606                                          */
3607         uint8 num_social_channels;
3608                         /* Number of social channels up to WL_P2P_SOCIAL_CHANNELS_MAX.
3609                          * 0 means use default social channels.
3610                          */
3611         uint8 flags;
3612         uint16 social_channels[1];      /* Variable length array of social channels */
3613 } BWL_POST_PACKED_STRUCT wl_p2po_find_config_t;
3614 #define WL_P2PO_FIND_CONFIG_VERSION 2   /* value for version field */
3615
3616 /* wl_p2po_find_config_t flags */
3617 #define P2PO_FIND_FLAG_SCAN_ALL_APS 0x01        /* Whether to scan for all APs in the p2po_find
3618                                                  * periodic scans of all channels.
3619                                                  * 0 means scan for only P2P devices.
3620                                                  * 1 means scan for P2P devices plus non-P2P APs.
3621                                                  */
3622
3623
3624 /* For adding a WFDS service to seek */
3625 typedef BWL_PRE_PACKED_STRUCT struct {
3626         uint32 seek_hdl;                /* unique id chosen by host */
3627         uint8 addr[6];                  /* Seek service from a specific device with this
3628                                          * MAC address, all 1's for any device.
3629                                          */
3630         uint8 service_hash[P2P_WFDS_HASH_LEN];
3631         uint8 service_name_len;
3632         uint8 service_name[MAX_WFDS_SEEK_SVC_NAME_LEN];
3633                                         /* Service name to seek, not null terminated */
3634         uint8 service_info_req_len;
3635         uint8 service_info_req[1];      /* Service info request, not null terminated.
3636                                          * Variable length specified by service_info_req_len.
3637                                          * Maximum length is MAX_WFDS_SEEK_SVC_INFO_LEN.
3638                                          */
3639 } BWL_POST_PACKED_STRUCT wl_p2po_wfds_seek_add_t;
3640
3641 /* For deleting a WFDS service to seek */
3642 typedef BWL_PRE_PACKED_STRUCT struct {
3643         uint32 seek_hdl;                /* delete service specified by id */
3644 } BWL_POST_PACKED_STRUCT wl_p2po_wfds_seek_del_t;
3645
3646
3647 /* For adding a WFDS service to advertise */
3648 typedef BWL_PRE_PACKED_STRUCT struct {
3649         uint32 advertise_hdl;           /* unique id chosen by host */
3650         uint8 service_hash[P2P_WFDS_HASH_LEN];
3651         uint32 advertisement_id;
3652         uint16 service_config_method;
3653         uint8 service_name_len;
3654         uint8 service_name[MAX_WFDS_SVC_NAME_LEN];
3655                                         /* Service name , not null terminated */
3656         uint8 service_status;
3657         uint16 service_info_len;
3658         uint8 service_info[1];          /* Service info, not null terminated.
3659                                          * Variable length specified by service_info_len.
3660                                          * Maximum length is MAX_WFDS_ADV_SVC_INFO_LEN.
3661                                          */
3662 } BWL_POST_PACKED_STRUCT wl_p2po_wfds_advertise_add_t;
3663
3664 /* For deleting a WFDS service to advertise */
3665 typedef BWL_PRE_PACKED_STRUCT struct {
3666         uint32 advertise_hdl;   /* delete service specified by hdl */
3667 } BWL_POST_PACKED_STRUCT wl_p2po_wfds_advertise_del_t;
3668
3669 /* P2P Offload discovery mode for the p2po_state iovar */
3670 typedef enum {
3671         WL_P2PO_DISC_STOP,
3672         WL_P2PO_DISC_LISTEN,
3673         WL_P2PO_DISC_DISCOVERY
3674 } disc_mode_t;
3675
3676 /* ANQP offload */
3677
3678 #define ANQPO_MAX_QUERY_SIZE            256
3679 typedef struct {
3680         uint16 max_retransmit;          /* ~0 use default, max retransmit on no ACK from peer */
3681         uint16 response_timeout;        /* ~0 use default, msec to wait for resp after tx packet */
3682         uint16 max_comeback_delay;      /* ~0 use default, max comeback delay in resp else fail */
3683         uint16 max_retries;                     /* ~0 use default, max retries on failure */
3684         uint16 query_len;                       /* length of ANQP query */
3685         uint8 query_data[1];            /* ANQP encoded query (max ANQPO_MAX_QUERY_SIZE) */
3686 } wl_anqpo_set_t;
3687
3688 typedef struct {
3689         uint16 channel;                         /* channel of the peer */
3690         struct ether_addr addr;         /* addr of the peer */
3691 } wl_anqpo_peer_t;
3692
3693 #define ANQPO_MAX_PEER_LIST                     64
3694 typedef struct {
3695         uint16 count;                           /* number of peers in list */
3696         wl_anqpo_peer_t peer[1];        /* max ANQPO_MAX_PEER_LIST */
3697 } wl_anqpo_peer_list_t;
3698
3699 #define ANQPO_MAX_IGNORE_SSID           64
3700 typedef struct {
3701         bool is_clear;                          /* set to clear list (not used on GET) */
3702         uint16 count;                           /* number of SSID in list */
3703         wlc_ssid_t ssid[1];                     /* max ANQPO_MAX_IGNORE_SSID */
3704 } wl_anqpo_ignore_ssid_list_t;
3705
3706 #define ANQPO_MAX_IGNORE_BSSID          64
3707 typedef struct {
3708         bool is_clear;                          /* set to clear list (not used on GET) */
3709         uint16 count;                           /* number of addr in list */
3710         struct ether_addr bssid[1];     /* max ANQPO_MAX_IGNORE_BSSID */
3711 } wl_anqpo_ignore_bssid_list_t;
3712
3713
3714 struct toe_ol_stats_t {
3715         /* Num of tx packets that don't need to be checksummed */
3716         uint32 tx_summed;
3717
3718         /* Num of tx packets where checksum is filled by offload engine */
3719         uint32 tx_iph_fill;
3720         uint32 tx_tcp_fill;
3721         uint32 tx_udp_fill;
3722         uint32 tx_icmp_fill;
3723
3724         /*  Num of rx packets where toe finds out if checksum is good or bad */
3725         uint32 rx_iph_good;
3726         uint32 rx_iph_bad;
3727         uint32 rx_tcp_good;
3728         uint32 rx_tcp_bad;
3729         uint32 rx_udp_good;
3730         uint32 rx_udp_bad;
3731         uint32 rx_icmp_good;
3732         uint32 rx_icmp_bad;
3733
3734         /* Num of tx packets in which csum error is injected */
3735         uint32 tx_tcp_errinj;
3736         uint32 tx_udp_errinj;
3737         uint32 tx_icmp_errinj;
3738
3739         /* Num of rx packets in which csum error is injected */
3740         uint32 rx_tcp_errinj;
3741         uint32 rx_udp_errinj;
3742         uint32 rx_icmp_errinj;
3743 };
3744
3745 /* Arp offload statistic counts */
3746 struct arp_ol_stats_t {
3747         uint32  host_ip_entries;        /* Host IP table addresses (more than one if multihomed) */
3748         uint32  host_ip_overflow;       /* Host IP table additions skipped due to overflow */
3749
3750         uint32  arp_table_entries;      /* ARP table entries */
3751         uint32  arp_table_overflow;     /* ARP table additions skipped due to overflow */
3752
3753         uint32  host_request;           /* ARP requests from host */
3754         uint32  host_reply;             /* ARP replies from host */
3755         uint32  host_service;           /* ARP requests from host serviced by ARP Agent */
3756
3757         uint32  peer_request;           /* ARP requests received from network */
3758         uint32  peer_request_drop;      /* ARP requests from network that were dropped */
3759         uint32  peer_reply;             /* ARP replies received from network */
3760         uint32  peer_reply_drop;        /* ARP replies from network that were dropped */
3761         uint32  peer_service;           /* ARP request from host serviced by ARP Agent */
3762 };
3763
3764 /* NS offload statistic counts */
3765 struct nd_ol_stats_t {
3766         uint32  host_ip_entries;    /* Host IP table addresses (more than one if multihomed) */
3767         uint32  host_ip_overflow;   /* Host IP table additions skipped due to overflow */
3768         uint32  peer_request;       /* NS requests received from network */
3769         uint32  peer_request_drop;  /* NS requests from network that were dropped */
3770         uint32  peer_reply_drop;    /* NA replies from network that were dropped */
3771         uint32  peer_service;       /* NS request from host serviced by firmware */
3772 };
3773
3774 /*
3775  * Keep-alive packet offloading.
3776  */
3777
3778 /* NAT keep-alive packets format: specifies the re-transmission period, the packet
3779  * length, and packet contents.
3780  */
3781 typedef struct wl_keep_alive_pkt {
3782         uint32  period_msec;    /* Retransmission period (0 to disable packet re-transmits) */
3783         uint16  len_bytes;      /* Size of packet to transmit (0 to disable packet re-transmits) */
3784         uint8   data[1];        /* Variable length packet to transmit.  Contents should include
3785                                  * entire ethernet packet (enet header, IP header, UDP header,
3786                                  * and UDP payload) in network byte order.
3787                                  */
3788 } wl_keep_alive_pkt_t;
3789
3790 #define WL_KEEP_ALIVE_FIXED_LEN         OFFSETOF(wl_keep_alive_pkt_t, data)
3791
3792
3793 /*
3794  * Dongle pattern matching filter.
3795  */
3796
3797 #define MAX_WAKE_PACKET_CACHE_BYTES 128 /* Maximum cached wake packet */
3798
3799 #define MAX_WAKE_PACKET_BYTES       (DOT11_A3_HDR_LEN +                     \
3800                                      DOT11_QOS_LEN +                        \
3801                                      sizeof(struct dot11_llc_snap_header) + \
3802                                      ETHER_MAX_DATA)
3803
3804 typedef struct pm_wake_packet {
3805         uint32  status;         /* Is the wake reason a packet (if all the other field's valid) */
3806         uint32  pattern_id;     /* Pattern ID that matched */
3807         uint32  original_packet_size;
3808         uint32  saved_packet_size;
3809         uchar   packet[MAX_WAKE_PACKET_CACHE_BYTES];
3810 } pm_wake_packet_t;
3811
3812 /* Packet filter types. Currently, only pattern matching is supported. */
3813 typedef enum wl_pkt_filter_type {
3814         WL_PKT_FILTER_TYPE_PATTERN_MATCH=0,     /* Pattern matching filter */
3815         WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH=1, /* Magic packet match */
3816         WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH=2, /* A pattern list (match all to match filter) */
3817         WL_PKT_FILTER_TYPE_ENCRYPTED_PATTERN_MATCH=3, /* SECURE WOWL magic / net pattern match */
3818 } wl_pkt_filter_type_t;
3819
3820 #define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
3821
3822 /* String mapping for types that may be used by applications or debug */
3823 #define WL_PKT_FILTER_TYPE_NAMES \
3824         { "PATTERN", WL_PKT_FILTER_TYPE_PATTERN_MATCH },       \
3825         { "MAGIC",   WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH }, \
3826         { "PATLIST", WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH }
3827
3828 /* Secured WOWL packet was encrypted, need decrypted before check filter match */
3829 typedef struct wl_pkt_decrypter {
3830         uint8* (*dec_cb)(void* dec_ctx, const void *sdu, int sending);
3831         void*  dec_ctx;
3832 } wl_pkt_decrypter_t;
3833
3834 /* Pattern matching filter. Specifies an offset within received packets to
3835  * start matching, the pattern to match, the size of the pattern, and a bitmask
3836  * that indicates which bits within the pattern should be matched.
3837  */
3838 typedef struct wl_pkt_filter_pattern {
3839         uint32  offset;         /* Offset within received packet to start pattern matching.
3840                                  * Offset '0' is the first byte of the ethernet header.
3841                                  */
3842         uint32  size_bytes;     /* Size of the pattern.  Bitmask must be the same size. */
3843         uint8   mask_and_pattern[1]; /* Variable length mask and pattern data.  mask starts
3844                                       * at offset 0.  Pattern immediately follows mask. for
3845                                       * secured pattern, put the descrypter pointer to the
3846                                       * beginning, mask and pattern postponed correspondingly
3847                                       */
3848 } wl_pkt_filter_pattern_t;
3849
3850 /* A pattern list is a numerically specified list of modified pattern structures. */
3851 typedef struct wl_pkt_filter_pattern_listel {
3852         uint16 rel_offs;        /* Offset to begin match (relative to 'base' below) */
3853         uint16 base_offs;       /* Base for offset (defined below) */
3854         uint16 size_bytes;      /* Size of mask/pattern */
3855         uint16 match_flags;     /* Addition flags controlling the match */
3856         uint8  mask_and_data[1]; /* Variable length mask followed by data, each size_bytes */
3857 } wl_pkt_filter_pattern_listel_t;
3858
3859 typedef struct wl_pkt_filter_pattern_list {
3860         uint8 list_cnt;         /* Number of elements in the list */
3861         uint8 PAD1[1];          /* Reserved (possible version: reserved) */
3862         uint16 totsize;         /* Total size of this pattern list (includes this struct) */
3863         wl_pkt_filter_pattern_listel_t patterns[1]; /* Variable number of list elements */
3864 } wl_pkt_filter_pattern_list_t;
3865
3866 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
3867 typedef struct wl_pkt_filter {
3868         uint32  id;             /* Unique filter id, specified by app. */
3869         uint32  type;           /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
3870         uint32  negate_match;   /* Negate the result of filter matches */
3871         union {                 /* Filter definitions */
3872                 wl_pkt_filter_pattern_t pattern;        /* Pattern matching filter */
3873                 wl_pkt_filter_pattern_list_t patlist; /* List of patterns to match */
3874         } u;
3875 } wl_pkt_filter_t;
3876
3877 /* IOVAR "tcp_keep_set" parameter. Used to install tcp keep_alive stuff. */
3878 typedef struct wl_tcp_keep_set {
3879         uint32  val1;
3880         uint32  val2;
3881 } wl_tcp_keep_set_t;
3882
3883 #define WL_PKT_FILTER_FIXED_LEN           OFFSETOF(wl_pkt_filter_t, u)
3884 #define WL_PKT_FILTER_PATTERN_FIXED_LEN   OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
3885 #define WL_PKT_FILTER_PATTERN_LIST_FIXED_LEN OFFSETOF(wl_pkt_filter_pattern_list_t, patterns)
3886 #define WL_PKT_FILTER_PATTERN_LISTEL_FIXED_LEN  \
3887                         OFFSETOF(wl_pkt_filter_pattern_listel_t, mask_and_data)
3888
3889 /* IOVAR "pkt_filter_enable" parameter. */
3890 typedef struct wl_pkt_filter_enable {
3891         uint32  id;             /* Unique filter id */
3892         uint32  enable;         /* Enable/disable bool */
3893 } wl_pkt_filter_enable_t;
3894
3895 /* IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
3896 typedef struct wl_pkt_filter_list {
3897         uint32  num;            /* Number of installed packet filters */
3898         wl_pkt_filter_t filter[1];      /* Variable array of packet filters. */
3899 } wl_pkt_filter_list_t;
3900
3901 #define WL_PKT_FILTER_LIST_FIXED_LEN      OFFSETOF(wl_pkt_filter_list_t, filter)
3902
3903 /* IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
3904 typedef struct wl_pkt_filter_stats {
3905         uint32  num_pkts_matched;       /* # filter matches for specified filter id */
3906         uint32  num_pkts_forwarded;     /* # packets fwded from dongle to host for all filters */
3907         uint32  num_pkts_discarded;     /* # packets discarded by dongle for all filters */
3908 } wl_pkt_filter_stats_t;
3909
3910 /* IOVAR "pkt_filter_ports" parameter.  Configure TCP/UDP port filters. */
3911 typedef struct wl_pkt_filter_ports {
3912         uint8 version;          /* Be proper */
3913         uint8 reserved;         /* Be really proper */
3914         uint16 count;           /* Number of ports following */
3915         /* End of fixed data */
3916         uint16 ports[1];        /* Placeholder for ports[<count>] */
3917 } wl_pkt_filter_ports_t;
3918
3919 #define WL_PKT_FILTER_PORTS_FIXED_LEN   OFFSETOF(wl_pkt_filter_ports_t, ports)
3920
3921 #define WL_PKT_FILTER_PORTS_VERSION     0
3922 #define WL_PKT_FILTER_PORTS_MAX         128
3923
3924 #define RSN_REPLAY_LEN 8
3925 typedef struct _gtkrefresh {
3926         uchar   KCK[RSN_KCK_LENGTH];
3927         uchar   KEK[RSN_KEK_LENGTH];
3928         uchar   ReplayCounter[RSN_REPLAY_LEN];
3929 } gtk_keyinfo_t, *pgtk_keyinfo_t;
3930
3931 /* Sequential Commands ioctl */
3932 typedef struct wl_seq_cmd_ioctl {
3933         uint32 cmd;             /* common ioctl definition */
3934         uint32 len;             /* length of user buffer */
3935 } wl_seq_cmd_ioctl_t;
3936
3937 #define WL_SEQ_CMD_ALIGN_BYTES  4
3938
3939 /* These are the set of get IOCTLs that should be allowed when using
3940  * IOCTL sequence commands. These are issued implicitly by wl.exe each time
3941  * it is invoked. We never want to buffer these, or else wl.exe will stop working.
3942  */
3943 #define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
3944         (((cmd) == WLC_GET_MAGIC)               || \
3945          ((cmd) == WLC_GET_VERSION)             || \
3946          ((cmd) == WLC_GET_AP)                  || \
3947          ((cmd) == WLC_GET_INSTANCE))
3948
3949 typedef struct wl_pkteng {
3950         uint32 flags;
3951         uint32 delay;                   /* Inter-packet delay */
3952         uint32 nframes;                 /* Number of frames */
3953         uint32 length;                  /* Packet length */
3954         uint8  seqno;                   /* Enable/disable sequence no. */
3955         struct ether_addr dest;         /* Destination address */
3956         struct ether_addr src;          /* Source address */
3957 } wl_pkteng_t;
3958
3959 typedef struct wl_pkteng_stats {
3960         uint32 lostfrmcnt;              /* RX PER test: no of frames lost (skip seqno) */
3961         int32 rssi;                     /* RSSI */
3962         int32 snr;                      /* signal to noise ratio */
3963         uint16 rxpktcnt[NUM_80211_RATES+1];
3964         uint8 rssi_qdb;                 /* qdB portion of the computed rssi */
3965 } wl_pkteng_stats_t;
3966
3967 typedef struct wl_txcal_params {
3968         wl_pkteng_t pkteng;
3969         uint8 gidx_start;
3970         int8 gidx_step;
3971         uint8 gidx_stop;
3972 } wl_txcal_params_t;
3973
3974
3975 typedef enum {
3976         wowl_pattern_type_bitmap = 0,
3977         wowl_pattern_type_arp,
3978         wowl_pattern_type_na
3979 } wowl_pattern_type_t;
3980
3981 typedef struct wl_wowl_pattern {
3982         uint32              masksize;           /* Size of the mask in #of bytes */
3983         uint32              offset;             /* Pattern byte offset in packet */
3984         uint32              patternoffset;      /* Offset of start of pattern in the structure */
3985         uint32              patternsize;        /* Size of the pattern itself in #of bytes */
3986         uint32              id;                 /* id */
3987         uint32              reasonsize;         /* Size of the wakeup reason code */
3988         wowl_pattern_type_t type;               /* Type of pattern */
3989         /* Mask follows the structure above */
3990         /* Pattern follows the mask is at 'patternoffset' from the start */
3991 } wl_wowl_pattern_t;
3992
3993 typedef struct wl_wowl_pattern_list {
3994         uint                    count;
3995         wl_wowl_pattern_t       pattern[1];
3996 } wl_wowl_pattern_list_t;
3997
3998 typedef struct wl_wowl_wakeind {
3999         uint8   pci_wakeind;    /* Whether PCI PMECSR PMEStatus bit was set */
4000         uint32  ucode_wakeind;  /* What wakeup-event indication was set by ucode */
4001 } wl_wowl_wakeind_t;
4002
4003 typedef struct {
4004         uint32          pktlen;             /* size of packet */
4005         void            *sdu;
4006 } tcp_keepalive_wake_pkt_infop_t;
4007
4008 /* per AC rate control related data structure */
4009 typedef struct wl_txrate_class {
4010         uint8           init_rate;
4011         uint8           min_rate;
4012         uint8           max_rate;
4013 } wl_txrate_class_t;
4014
4015 /* structure for Overlap BSS scan arguments */
4016 typedef struct wl_obss_scan_arg {
4017         int16   passive_dwell;
4018         int16   active_dwell;
4019         int16   bss_widthscan_interval;
4020         int16   passive_total;
4021         int16   active_total;
4022         int16   chanwidth_transition_delay;
4023         int16   activity_threshold;
4024 } wl_obss_scan_arg_t;
4025
4026 #define WL_OBSS_SCAN_PARAM_LEN  sizeof(wl_obss_scan_arg_t)
4027
4028 /* RSSI event notification configuration. */
4029 typedef struct wl_rssi_event {
4030         uint32 rate_limit_msec;         /* # of events posted to application will be limited to
4031                                          * one per specified period (0 to disable rate limit).
4032                                          */
4033         uint8 num_rssi_levels;          /* Number of entries in rssi_levels[] below */
4034         int8 rssi_levels[MAX_RSSI_LEVELS];      /* Variable number of RSSI levels. An event
4035                                                  * will be posted each time the RSSI of received
4036                                                  * beacons/packets crosses a level.
4037                                                  */
4038 } wl_rssi_event_t;
4039
4040 /* CCA based channel quality event configuration */
4041 #define WL_CHAN_QUAL_CCA        0
4042 #define WL_CHAN_QUAL_NF         1
4043 #define WL_CHAN_QUAL_NF_LTE     2
4044 #define WL_CHAN_QUAL_TOTAL      3
4045
4046 #define MAX_CHAN_QUAL_LEVELS    8
4047
4048 typedef struct wl_chan_qual_metric {
4049         uint8 id;                               /* metric ID */
4050         uint8 num_levels;                       /* Number of entries in rssi_levels[] below */
4051         uint16 flags;
4052         int16 htol[MAX_CHAN_QUAL_LEVELS];       /* threshold level array: hi-to-lo */
4053         int16 ltoh[MAX_CHAN_QUAL_LEVELS];       /* threshold level array: lo-to-hi */
4054 } wl_chan_qual_metric_t;
4055
4056 typedef struct wl_chan_qual_event {
4057         uint32 rate_limit_msec;         /* # of events posted to application will be limited to
4058                                          * one per specified period (0 to disable rate limit).
4059                                          */
4060         uint16 flags;
4061         uint16 num_metrics;
4062         wl_chan_qual_metric_t metric[WL_CHAN_QUAL_TOTAL];       /* metric array */
4063 } wl_chan_qual_event_t;
4064
4065 typedef struct wl_action_obss_coex_req {
4066         uint8 info;
4067         uint8 num;
4068         uint8 ch_list[1];
4069 } wl_action_obss_coex_req_t;
4070
4071
4072 /* IOVar parameter block for small MAC address array with type indicator */
4073 #define WL_IOV_MAC_PARAM_LEN  4
4074
4075 #define WL_IOV_PKTQ_LOG_PRECS 16
4076
4077 typedef BWL_PRE_PACKED_STRUCT struct {
4078         uint32 num_addrs;
4079         char   addr_type[WL_IOV_MAC_PARAM_LEN];
4080         struct ether_addr ea[WL_IOV_MAC_PARAM_LEN];
4081 } BWL_POST_PACKED_STRUCT wl_iov_mac_params_t;
4082
4083 /* This is extra info that follows wl_iov_mac_params_t */
4084 typedef BWL_PRE_PACKED_STRUCT struct {
4085         uint32 addr_info[WL_IOV_MAC_PARAM_LEN];
4086 } BWL_POST_PACKED_STRUCT wl_iov_mac_extra_params_t;
4087
4088 /* Combined structure */
4089 typedef struct {
4090         wl_iov_mac_params_t params;
4091         wl_iov_mac_extra_params_t extra_params;
4092 } wl_iov_mac_full_params_t;
4093
4094 /* Parameter block for PKTQ_LOG statistics */
4095 #define PKTQ_LOG_COUNTERS_V4 \
4096         /* packets requested to be stored */ \
4097         uint32 requested; \
4098         /* packets stored */ \
4099         uint32 stored; \
4100         /* packets saved, because a lowest priority queue has given away one packet */ \
4101         uint32 saved; \
4102         /* packets saved, because an older packet from the same queue has been dropped */ \
4103         uint32 selfsaved; \
4104         /* packets dropped, because pktq is full with higher precedence packets */ \
4105         uint32 full_dropped; \
4106          /* packets dropped because pktq per that precedence is full */ \
4107         uint32 dropped; \
4108         /* packets dropped, in order to save one from a queue of a highest priority */ \
4109         uint32 sacrificed; \
4110         /* packets droped because of hardware/transmission error */ \
4111         uint32 busy; \
4112         /* packets re-sent because they were not received */ \
4113         uint32 retry; \
4114         /* packets retried again (ps pretend) prior to moving power save mode */ \
4115         uint32 ps_retry; \
4116          /* suppressed packet count */ \
4117         uint32 suppress; \
4118         /* packets finally dropped after retry limit */ \
4119         uint32 retry_drop; \
4120         /* the high-water mark of the queue capacity for packets - goes to zero as queue fills */ \
4121         uint32 max_avail; \
4122         /* the high-water mark of the queue utilisation for packets - ('inverse' of max_avail) */ \
4123         uint32 max_used; \
4124          /* the maximum capacity of the queue */ \
4125         uint32 queue_capacity; \
4126         /* count of rts attempts that failed to receive cts */ \
4127         uint32 rtsfail; \
4128         /* count of packets sent (acked) successfully */ \
4129         uint32 acked; \
4130         /* running total of phy rate of packets sent successfully */ \
4131         uint32 txrate_succ; \
4132         /* running total of phy 'main' rate */ \
4133         uint32 txrate_main; \
4134         /* actual data transferred successfully */ \
4135         uint32 throughput; \
4136         /* time difference since last pktq_stats */ \
4137         uint32 time_delta;
4138
4139 typedef struct {
4140         PKTQ_LOG_COUNTERS_V4
4141 } pktq_log_counters_v04_t;
4142
4143 /* v5 is the same as V4 with extra parameter */
4144 typedef struct {
4145         PKTQ_LOG_COUNTERS_V4
4146         /* cumulative time to transmit */
4147         uint32 airtime;
4148 } pktq_log_counters_v05_t;
4149
4150 typedef struct {
4151         uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
4152         pktq_log_counters_v04_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
4153         uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
4154         uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
4155         char                 headings[1];
4156 } pktq_log_format_v04_t;
4157
4158 typedef struct {
4159         uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
4160         pktq_log_counters_v05_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
4161         uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
4162         uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
4163         char                 headings[1];
4164 } pktq_log_format_v05_t;
4165
4166
4167 typedef struct {
4168         uint32               version;
4169         wl_iov_mac_params_t  params;
4170         union {
4171                 pktq_log_format_v04_t v04;
4172                 pktq_log_format_v05_t v05;
4173         } pktq_log;
4174 } wl_iov_pktq_log_t;
4175
4176 /* PKTQ_LOG_AUTO, PKTQ_LOG_DEF_PREC flags introduced in v05, they are ignored by v04 */
4177 #define PKTQ_LOG_AUTO     (1 << 31)
4178 #define PKTQ_LOG_DEF_PREC (1 << 30)
4179
4180
4181 #define LEGACY1_WL_PFN_MACADDR_CFG_VER 0
4182
4183 #define WL_PFN_MAC_OUI_ONLY_MASK      1
4184 #define WL_PFN_SET_MAC_UNASSOC_MASK   2
4185 #define WL_PFN_RESTRICT_LA_MAC_MASK   4
4186 #define WL_PFN_MACADDR_FLAG_MASK     0x7
4187
4188
4189 /*
4190  * SCB_BS_DATA iovar definitions start.
4191  */
4192 #define SCB_BS_DATA_STRUCT_VERSION      1
4193
4194 /* The actual counters maintained for each station */
4195 typedef BWL_PRE_PACKED_STRUCT struct {
4196         /* The following counters are a subset of what pktq_stats provides per precedence. */
4197         uint32 retry;          /* packets re-sent because they were not received */
4198         uint32 retry_drop;     /* packets finally dropped after retry limit */
4199         uint32 rtsfail;        /* count of rts attempts that failed to receive cts */
4200         uint32 acked;          /* count of packets sent (acked) successfully */
4201         uint32 txrate_succ;    /* running total of phy rate of packets sent successfully */
4202         uint32 txrate_main;    /* running total of phy 'main' rate */
4203         uint32 throughput;     /* actual data transferred successfully */
4204         uint32 time_delta;     /* time difference since last pktq_stats */
4205         uint32 airtime;        /* cumulative total medium access delay in useconds */
4206 } BWL_POST_PACKED_STRUCT iov_bs_data_counters_t;
4207
4208 /* The structure for individual station information. */
4209 typedef BWL_PRE_PACKED_STRUCT struct {
4210         struct ether_addr       station_address;        /* The station MAC address */
4211         uint16                  station_flags;          /* Bit mask of flags, for future use. */
4212         iov_bs_data_counters_t  station_counters;       /* The actual counter values */
4213 } BWL_POST_PACKED_STRUCT iov_bs_data_record_t;
4214
4215 typedef BWL_PRE_PACKED_STRUCT struct {
4216         uint16  structure_version;      /* Structure version number (for wl/wlu matching) */
4217         uint16  structure_count;        /* Number of iov_bs_data_record_t records following */
4218         iov_bs_data_record_t    structure_record[1];    /* 0 - structure_count records */
4219 } BWL_POST_PACKED_STRUCT iov_bs_data_struct_t;
4220
4221 /* Bitmask of options that can be passed in to the iovar. */
4222 enum {
4223         SCB_BS_DATA_FLAG_NO_RESET = (1<<0)      /* Do not clear the counters after reading */
4224 };
4225 /*
4226  * SCB_BS_DATA iovar definitions end.
4227  */
4228
4229 typedef struct wlc_extlog_cfg {
4230         int max_number;
4231         uint16 module;  /* bitmap */
4232         uint8 level;
4233         uint8 flag;
4234         uint16 version;
4235 } wlc_extlog_cfg_t;
4236
4237 typedef struct log_record {
4238         uint32 time;
4239         uint16 module;
4240         uint16 id;
4241         uint8 level;
4242         uint8 sub_unit;
4243         uint8 seq_num;
4244         int32 arg;
4245         char str[MAX_ARGSTR_LEN];
4246 } log_record_t;
4247
4248 typedef struct wlc_extlog_req {
4249         uint32 from_last;
4250         uint32 num;
4251 } wlc_extlog_req_t;
4252
4253 typedef struct wlc_extlog_results {
4254         uint16 version;
4255         uint16 record_len;
4256         uint32 num;
4257         log_record_t logs[1];
4258 } wlc_extlog_results_t;
4259
4260 typedef struct log_idstr {
4261         uint16  id;
4262         uint16  flag;
4263         uint8   arg_type;
4264         const char      *fmt_str;
4265 } log_idstr_t;
4266
4267 #define FMTSTRF_USER            1
4268
4269 /* flat ID definitions
4270  * New definitions HAVE TO BE ADDED at the end of the table. Otherwise, it will
4271  * affect backward compatibility with pre-existing apps
4272  */
4273 typedef enum {
4274         FMTSTR_DRIVER_UP_ID = 0,
4275         FMTSTR_DRIVER_DOWN_ID = 1,
4276         FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
4277         FMTSTR_NO_PROGRESS_ID = 3,
4278         FMTSTR_RFDISABLE_ID = 4,
4279         FMTSTR_REG_PRINT_ID = 5,
4280         FMTSTR_EXPTIME_ID = 6,
4281         FMTSTR_JOIN_START_ID = 7,
4282         FMTSTR_JOIN_COMPLETE_ID = 8,
4283         FMTSTR_NO_NETWORKS_ID = 9,
4284         FMTSTR_SECURITY_MISMATCH_ID = 10,
4285         FMTSTR_RATE_MISMATCH_ID = 11,
4286         FMTSTR_AP_PRUNED_ID = 12,
4287         FMTSTR_KEY_INSERTED_ID = 13,
4288         FMTSTR_DEAUTH_ID = 14,
4289         FMTSTR_DISASSOC_ID = 15,
4290         FMTSTR_LINK_UP_ID = 16,
4291         FMTSTR_LINK_DOWN_ID = 17,
4292         FMTSTR_RADIO_HW_OFF_ID = 18,
4293         FMTSTR_RADIO_HW_ON_ID = 19,
4294         FMTSTR_EVENT_DESC_ID = 20,
4295         FMTSTR_PNP_SET_POWER_ID = 21,
4296         FMTSTR_RADIO_SW_OFF_ID = 22,
4297         FMTSTR_RADIO_SW_ON_ID = 23,
4298         FMTSTR_PWD_MISMATCH_ID = 24,
4299         FMTSTR_FATAL_ERROR_ID = 25,
4300         FMTSTR_AUTH_FAIL_ID = 26,
4301         FMTSTR_ASSOC_FAIL_ID = 27,
4302         FMTSTR_IBSS_FAIL_ID = 28,
4303         FMTSTR_EXTAP_FAIL_ID = 29,
4304         FMTSTR_MAX_ID
4305 } log_fmtstr_id_t;
4306
4307 #ifdef DONGLEOVERLAYS
4308 typedef struct {
4309         uint32 flags_idx;       /* lower 8 bits: overlay index; upper 24 bits: flags */
4310         uint32 offset;          /* offset into overlay region to write code */
4311         uint32 len;                     /* overlay code len */
4312         /* overlay code follows this struct */
4313 } wl_ioctl_overlay_t;
4314 #endif /* DONGLEOVERLAYS */
4315
4316 /* 11k Neighbor Report element (unversioned, deprecated) */
4317 typedef struct nbr_element {
4318         uint8 id;
4319         uint8 len;
4320         struct ether_addr bssid;
4321         uint32 bssid_info;
4322         uint8 reg;
4323         uint8 channel;
4324         uint8 phytype;
4325         uint8 pad;
4326 } nbr_element_t;
4327
4328 #define WL_RRM_NBR_RPT_VER              1
4329 /* 11k Neighbor Report element */
4330 typedef struct nbr_rpt_elem {
4331         uint8 version;
4332         uint8 id;
4333         uint8 len;
4334         uint8 pad;
4335         struct ether_addr bssid;
4336         uint8 pad_1[2];
4337         uint32 bssid_info;
4338         uint8 reg;
4339         uint8 channel;
4340         uint8 phytype;
4341         uint8 pad_2;
4342         wlc_ssid_t ssid;
4343         uint8 bss_trans_preference;
4344         uint8 pad_3[3];
4345 } nbr_rpt_elem_t;
4346
4347 typedef enum event_msgs_ext_command {
4348         EVENTMSGS_NONE          =       0,
4349         EVENTMSGS_SET_BIT       =       1,
4350         EVENTMSGS_RESET_BIT     =       2,
4351         EVENTMSGS_SET_MASK      =       3
4352 } event_msgs_ext_command_t;
4353
4354 #define EVENTMSGS_VER 1
4355 #define EVENTMSGS_EXT_STRUCT_SIZE       OFFSETOF(eventmsgs_ext_t, mask[0])
4356
4357 /* len- for SET it would be mask size from the application to the firmware */
4358 /*              for GET it would be actual firmware mask size */
4359 /* maxgetsize - is only used for GET. indicate max mask size that the */
4360 /*                              application can read from the firmware */
4361 typedef struct eventmsgs_ext
4362 {
4363         uint8   ver;
4364         uint8   command;
4365         uint8   len;
4366         uint8   maxgetsize;
4367         uint8   mask[1];
4368 } eventmsgs_ext_t;
4369
4370 typedef BWL_PRE_PACKED_STRUCT struct pcie_bus_tput_params {
4371         /* no of host dma descriptors programmed by the firmware before a commit */
4372         uint16          max_dma_descriptors;
4373
4374         uint16          host_buf_len; /* length of host buffer */
4375         dmaaddr_t       host_buf_addr; /* physical address for bus_throughput_buf */
4376 } BWL_POST_PACKED_STRUCT pcie_bus_tput_params_t;
4377 typedef BWL_PRE_PACKED_STRUCT struct pcie_bus_tput_stats {
4378         uint16          time_taken; /* no of secs the test is run */
4379         uint16          nbytes_per_descriptor; /* no of bytes of data dma ed per descriptor */
4380
4381         /* no of desciptors fo which dma is sucessfully completed within the test time */
4382         uint32          count;
4383 } BWL_POST_PACKED_STRUCT pcie_bus_tput_stats_t;
4384
4385 #define MAX_ROAMOFFL_BSSID_NUM  100
4386
4387 typedef BWL_PRE_PACKED_STRUCT struct roamoffl_bssid_list {
4388         int32 cnt;
4389         struct ether_addr bssid[1];
4390 } BWL_POST_PACKED_STRUCT roamoffl_bssid_list_t;
4391
4392 /* no default structure packing */
4393 #include <packed_section_end.h>
4394
4395 typedef struct keepalives_max_idle {
4396         uint16  keepalive_count;        /* nmbr of keepalives per bss_max_idle period */
4397         uint8   mkeepalive_index;       /* mkeepalive_index for keepalive frame to be used */
4398         uint8   PAD;                    /* to align next field */
4399         uint16  max_interval;           /* seconds */
4400 } keepalives_max_idle_t;
4401
4402 #define PM_IGNORE_BCMC_PROXY_ARP (1 << 0)
4403 #define PM_IGNORE_BCMC_ALL_DMS_ACCEPTED (1 << 1)
4404
4405 /* require strict packing */
4406 #include <packed_section_start.h>
4407
4408 /* ##### Power Stats section ##### */
4409
4410 #define WL_PWRSTATS_VERSION     2
4411
4412 /* Input structure for pwrstats IOVAR */
4413 typedef BWL_PRE_PACKED_STRUCT struct wl_pwrstats_query {
4414         uint16 length;          /* Number of entries in type array. */
4415         uint16 type[1];         /* Types (tags) to retrieve.
4416                                  * Length 0 (no types) means get all.
4417                                  */
4418 } BWL_POST_PACKED_STRUCT wl_pwrstats_query_t;
4419
4420 /* This structure is for version 2; version 1 will be deprecated in by FW */
4421 typedef BWL_PRE_PACKED_STRUCT struct wl_pwrstats {
4422         uint16 version;               /* Version = 2 is TLV format */
4423         uint16 length;                /* Length of entire structure */
4424         uint8 data[1];                /* TLV data, a series of structures,
4425                                        * each starting with type and length.
4426                                        *
4427                                        * Padded as necessary so each section
4428                                        * starts on a 4-byte boundary.
4429                                        *
4430                                        * Both type and len are uint16, but the
4431                                        * upper nibble of length is reserved so
4432                                        * valid len values are 0-4095.
4433                                        */
4434 } BWL_POST_PACKED_STRUCT wl_pwrstats_t;
4435 #define WL_PWR_STATS_HDRLEN     OFFSETOF(wl_pwrstats_t, data)
4436
4437 /* Type values for the data section */
4438 #define WL_PWRSTATS_TYPE_PHY            0 /* struct wl_pwr_phy_stats */
4439 #define WL_PWRSTATS_TYPE_SCAN           1 /* struct wl_pwr_scan_stats */
4440 #define WL_PWRSTATS_TYPE_USB_HSIC       2 /* struct wl_pwr_usb_hsic_stats */
4441 #define WL_PWRSTATS_TYPE_PM_AWAKE1      3 /* struct wl_pwr_pm_awake_stats_v1 */
4442 #define WL_PWRSTATS_TYPE_CONNECTION     4 /* struct wl_pwr_connect_stats; assoc and key-exch time */
4443 #define WL_PWRSTATS_TYPE_PCIE           6 /* struct wl_pwr_pcie_stats */
4444 #define WL_PWRSTATS_TYPE_PM_AWAKE2      7 /* struct wl_pwr_pm_awake_stats_v2 */
4445
4446 /* Bits for wake reasons */
4447 #define WLC_PMD_WAKE_SET                0x1
4448 #define WLC_PMD_PM_AWAKE_BCN            0x2
4449 #define WLC_PMD_BTA_ACTIVE              0x4
4450 #define WLC_PMD_SCAN_IN_PROGRESS        0x8
4451 #define WLC_PMD_RM_IN_PROGRESS          0x10
4452 #define WLC_PMD_AS_IN_PROGRESS          0x20
4453 #define WLC_PMD_PM_PEND                 0x40
4454 #define WLC_PMD_PS_POLL                 0x80
4455 #define WLC_PMD_CHK_UNALIGN_TBTT        0x100
4456 #define WLC_PMD_APSD_STA_UP             0x200
4457 #define WLC_PMD_TX_PEND_WAR             0x400
4458 #define WLC_PMD_GPTIMER_STAY_AWAKE      0x800
4459 #define WLC_PMD_PM2_RADIO_SOFF_PEND     0x2000
4460 #define WLC_PMD_NON_PRIM_STA_UP         0x4000
4461 #define WLC_PMD_AP_UP                   0x8000
4462
4463 typedef BWL_PRE_PACKED_STRUCT struct wlc_pm_debug {
4464         uint32 timestamp;            /* timestamp in millisecond */
4465         uint32 reason;               /* reason(s) for staying awake */
4466 } BWL_POST_PACKED_STRUCT wlc_pm_debug_t;
4467
4468 /* WL_PWRSTATS_TYPE_PM_AWAKE1 structures (for 6.25 firmware) */
4469 #define WLC_STA_AWAKE_STATES_MAX_V1     30
4470 #define WLC_PMD_EVENT_MAX_V1            32
4471 /* Data sent as part of pwrstats IOVAR (and EXCESS_PM_WAKE event) */
4472 typedef BWL_PRE_PACKED_STRUCT struct pm_awake_data_v1 {
4473         uint32 curr_time;       /* ms */
4474         uint32 hw_macc;         /* HW maccontrol */
4475         uint32 sw_macc;         /* SW maccontrol */
4476         uint32 pm_dur;          /* Total sleep time in PM, msecs */
4477         uint32 mpc_dur;         /* Total sleep time in MPC, msecs */
4478
4479         /* int32 drifts = remote - local; +ve drift => local-clk slow */
4480         int32 last_drift;       /* Most recent TSF drift from beacon */
4481         int32 min_drift;        /* Min TSF drift from beacon in magnitude */
4482         int32 max_drift;        /* Max TSF drift from beacon in magnitude */
4483
4484         uint32 avg_drift;       /* Avg TSF drift from beacon */
4485
4486         /* Wake history tracking */
4487         uint8  pmwake_idx;                                 /* for stepping through pm_state */
4488         wlc_pm_debug_t pm_state[WLC_STA_AWAKE_STATES_MAX_V1]; /* timestamped wake bits */
4489         uint32 pmd_event_wake_dur[WLC_PMD_EVENT_MAX_V1];      /* cumulative usecs per wake reason */
4490         uint32 drift_cnt;       /* Count of drift readings over which avg_drift was computed */
4491 } BWL_POST_PACKED_STRUCT pm_awake_data_v1_t;
4492
4493 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pm_awake_stats_v1 {
4494         uint16 type;         /* WL_PWRSTATS_TYPE_PM_AWAKE */
4495         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4496
4497         pm_awake_data_v1_t awake_data;
4498         uint32 frts_time;       /* Cumulative ms spent in frts since driver load */
4499         uint32 frts_end_cnt;    /* No of times frts ended since driver load */
4500 } BWL_POST_PACKED_STRUCT wl_pwr_pm_awake_stats_v1_t;
4501
4502 /* WL_PWRSTATS_TYPE_PM_AWAKE2 structures */
4503 /* Data sent as part of pwrstats IOVAR */
4504 typedef BWL_PRE_PACKED_STRUCT struct pm_awake_data_v2 {
4505         uint32 curr_time;       /* ms */
4506         uint32 hw_macc;         /* HW maccontrol */
4507         uint32 sw_macc;         /* SW maccontrol */
4508         uint32 pm_dur;          /* Total sleep time in PM, msecs */
4509         uint32 mpc_dur;         /* Total sleep time in MPC, msecs */
4510
4511         /* int32 drifts = remote - local; +ve drift => local-clk slow */
4512         int32 last_drift;       /* Most recent TSF drift from beacon */
4513         int32 min_drift;        /* Min TSF drift from beacon in magnitude */
4514         int32 max_drift;        /* Max TSF drift from beacon in magnitude */
4515
4516         uint32 avg_drift;       /* Avg TSF drift from beacon */
4517
4518         /* Wake history tracking */
4519
4520         /* pmstate array (type wlc_pm_debug_t) start offset */
4521         uint16 pm_state_offset;
4522         /* pmstate number of array entries */
4523         uint16 pm_state_len;
4524
4525         /* array (type uint32) start offset */
4526         uint16 pmd_event_wake_dur_offset;
4527         /* pmd_event_wake_dur number of array entries */
4528         uint16 pmd_event_wake_dur_len;
4529
4530         uint32 drift_cnt;       /* Count of drift readings over which avg_drift was computed */
4531         uint8  pmwake_idx;      /* for stepping through pm_state */
4532         uint8  pad[3];
4533         uint32 frts_time;       /* Cumulative ms spent in frts since driver load */
4534         uint32 frts_end_cnt;    /* No of times frts ended since driver load */
4535 } BWL_POST_PACKED_STRUCT pm_awake_data_v2_t;
4536
4537 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pm_awake_stats_v2 {
4538         uint16 type;         /* WL_PWRSTATS_TYPE_PM_AWAKE */
4539         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4540
4541         pm_awake_data_v2_t awake_data;
4542 } BWL_POST_PACKED_STRUCT wl_pwr_pm_awake_stats_v2_t;
4543
4544 /* Original bus structure is for HSIC */
4545 typedef BWL_PRE_PACKED_STRUCT struct bus_metrics {
4546         uint32 suspend_ct;      /* suspend count */
4547         uint32 resume_ct;       /* resume count */
4548         uint32 disconnect_ct;   /* disconnect count */
4549         uint32 reconnect_ct;    /* reconnect count */
4550         uint32 active_dur;      /* msecs in bus, usecs for user */
4551         uint32 suspend_dur;     /* msecs in bus, usecs for user */
4552         uint32 disconnect_dur;  /* msecs in bus, usecs for user */
4553 } BWL_POST_PACKED_STRUCT bus_metrics_t;
4554
4555 /* Bus interface info for USB/HSIC */
4556 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_usb_hsic_stats {
4557         uint16 type;         /* WL_PWRSTATS_TYPE_USB_HSIC */
4558         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4559
4560         bus_metrics_t hsic;     /* stats from hsic bus driver */
4561 } BWL_POST_PACKED_STRUCT wl_pwr_usb_hsic_stats_t;
4562
4563 typedef BWL_PRE_PACKED_STRUCT struct pcie_bus_metrics {
4564         uint32 d3_suspend_ct;   /* suspend count */
4565         uint32 d0_resume_ct;    /* resume count */
4566         uint32 perst_assrt_ct;  /* PERST# assert count */
4567         uint32 perst_deassrt_ct;        /* PERST# de-assert count */
4568         uint32 active_dur;      /* msecs */
4569         uint32 d3_suspend_dur;  /* msecs */
4570         uint32 perst_dur;       /* msecs */
4571         uint32 l0_cnt;          /* L0 entry count */
4572         uint32 l0_usecs;        /* L0 duration in usecs */
4573         uint32 l1_cnt;          /* L1 entry count */
4574         uint32 l1_usecs;        /* L1 duration in usecs */
4575         uint32 l1_1_cnt;        /* L1_1ss entry count */
4576         uint32 l1_1_usecs;      /* L1_1ss duration in usecs */
4577         uint32 l1_2_cnt;        /* L1_2ss entry count */
4578         uint32 l1_2_usecs;      /* L1_2ss duration in usecs */
4579         uint32 l2_cnt;          /* L2 entry count */
4580         uint32 l2_usecs;        /* L2 duration in usecs */
4581         uint32 timestamp;       /* Timestamp on when stats are collected */
4582         uint32 num_h2d_doorbell;        /* # of doorbell interrupts - h2d */
4583         uint32 num_d2h_doorbell;        /* # of doorbell interrupts - d2h */
4584         uint32 num_submissions; /* # of submissions */
4585         uint32 num_completions; /* # of completions */
4586         uint32 num_rxcmplt;     /* # of rx completions */
4587         uint32 num_rxcmplt_drbl;        /* of drbl interrupts for rx complt. */
4588         uint32 num_txstatus;    /* # of tx completions */
4589         uint32 num_txstatus_drbl;       /* of drbl interrupts for tx complt. */
4590         uint32 ltr_active_ct;   /* # of times chip went to LTR ACTIVE */
4591         uint32 ltr_active_dur;  /* # of msecs chip was in LTR ACTIVE */
4592         uint32 ltr_sleep_ct;    /* # of times chip went to LTR SLEEP */
4593         uint32 ltr_sleep_dur;   /* # of msecs chip was in LTR SLEEP */
4594         uint32 deepsleep_count; /* # of times chip went to deepsleep */
4595         uint32 deepsleep_dur;   /* # of msecs chip was in deepsleep */
4596 } BWL_POST_PACKED_STRUCT pcie_bus_metrics_t;
4597
4598 /* Bus interface info for PCIE */
4599 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pcie_stats {
4600         uint16 type;         /* WL_PWRSTATS_TYPE_PCIE */
4601         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4602         pcie_bus_metrics_t pcie;        /* stats from pcie bus driver */
4603 } BWL_POST_PACKED_STRUCT wl_pwr_pcie_stats_t;
4604
4605 /* Scan information history per category */
4606 typedef BWL_PRE_PACKED_STRUCT struct scan_data {
4607         uint32 count;           /* Number of scans performed */
4608         uint32 dur;             /* Total time (in us) used */
4609 } BWL_POST_PACKED_STRUCT scan_data_t;
4610
4611 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_scan_stats {
4612         uint16 type;         /* WL_PWRSTATS_TYPE_SCAN */
4613         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4614
4615         /* Scan history */
4616         scan_data_t user_scans;   /* User-requested scans: (i/e/p)scan */
4617         scan_data_t assoc_scans;  /* Scans initiated by association requests */
4618         scan_data_t roam_scans;   /* Scans initiated by the roam engine */
4619         scan_data_t pno_scans[8]; /* For future PNO bucketing (BSSID, SSID, etc) */
4620         scan_data_t other_scans;  /* Scan engine usage not assigned to the above */
4621 } BWL_POST_PACKED_STRUCT wl_pwr_scan_stats_t;
4622
4623 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_connect_stats {
4624         uint16 type;         /* WL_PWRSTATS_TYPE_SCAN */
4625         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4626
4627         /* Connection (Association + Key exchange) data */
4628         uint32 count;   /* Number of connections performed */
4629         uint32 dur;             /* Total time (in ms) used */
4630 } BWL_POST_PACKED_STRUCT wl_pwr_connect_stats_t;
4631
4632 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_phy_stats {
4633         uint16 type;        /* WL_PWRSTATS_TYPE_PHY */
4634         uint16 len;         /* Up to 4K-1, top 4 bits are reserved */
4635         uint32 tx_dur;      /* TX Active duration in us */
4636         uint32 rx_dur;      /* RX Active duration in us */
4637 } BWL_POST_PACKED_STRUCT wl_pwr_phy_stats_t;
4638
4639
4640 /* ##### End of Power Stats section ##### */
4641
4642 /* IPV4 Arp offloads for ndis context */
4643 BWL_PRE_PACKED_STRUCT struct hostip_id {
4644         struct ipv4_addr ipa;
4645         uint8 id;
4646 } BWL_POST_PACKED_STRUCT;
4647
4648 /* Return values */
4649 #define ND_REPLY_PEER           0x1     /* Reply was sent to service NS request from peer */
4650 #define ND_REQ_SINK                     0x2     /* Input packet should be discarded */
4651 #define ND_FORCE_FORWARD        0X3     /* For the dongle to forward req to HOST */
4652
4653 /* Neighbor Solicitation Response Offload IOVAR param */
4654 typedef BWL_PRE_PACKED_STRUCT struct nd_param {
4655         struct ipv6_addr        host_ip[2];
4656         struct ipv6_addr        solicit_ip;
4657         struct ipv6_addr        remote_ip;
4658         uint8   host_mac[ETHER_ADDR_LEN];
4659         uint32  offload_id;
4660 } BWL_POST_PACKED_STRUCT nd_param_t;
4661
4662 typedef BWL_PRE_PACKED_STRUCT struct wl_pfn_roam_thresh {
4663         uint32 pfn_alert_thresh; /* time in ms */
4664         uint32 roam_alert_thresh; /* time in ms */
4665 } BWL_POST_PACKED_STRUCT wl_pfn_roam_thresh_t;
4666
4667
4668 /* Reasons for wl_pmalert_t */
4669 #define PM_DUR_EXCEEDED                 (1<<0)
4670 #define MPC_DUR_EXCEEDED                (1<<1)
4671 #define ROAM_ALERT_THRESH_EXCEEDED      (1<<2)
4672 #define PFN_ALERT_THRESH_EXCEEDED       (1<<3)
4673 #define CONST_AWAKE_DUR_ALERT           (1<<4)
4674 #define CONST_AWAKE_DUR_RECOVERY        (1<<5)
4675
4676 #define MIN_PM_ALERT_LEN 9
4677
4678 /* Data sent in EXCESS_PM_WAKE event */
4679 #define WL_PM_ALERT_VERSION 3
4680
4681 #define MAX_P2P_BSS_DTIM_PRD 4
4682
4683 /* This structure is for version 3; version 2 will be deprecated in by FW */
4684 typedef BWL_PRE_PACKED_STRUCT struct wl_pmalert {
4685         uint16 version;         /* Version = 3 is TLV format */
4686         uint16 length;          /* Length of entire structure */
4687         uint32 reasons;         /* reason(s) for pm_alert */
4688         uint8 data[1];          /* TLV data, a series of structures,
4689                                  * each starting with type and length.
4690                                  *
4691                                  * Padded as necessary so each section
4692                                  * starts on a 4-byte boundary.
4693                                  *
4694                                  * Both type and len are uint16, but the
4695                                  * upper nibble of length is reserved so
4696                                  * valid len values are 0-4095.
4697                                 */
4698 } BWL_POST_PACKED_STRUCT wl_pmalert_t;
4699
4700 /* Type values for the data section */
4701 #define WL_PMALERT_FIXED        0 /* struct wl_pmalert_fixed_t, fixed fields */
4702 #define WL_PMALERT_PMSTATE      1 /* struct wl_pmalert_pmstate_t, variable */
4703 #define WL_PMALERT_EVENT_DUR    2 /* struct wl_pmalert_event_dur_t, variable */
4704 #define WL_PMALERT_UCODE_DBG    3 /* struct wl_pmalert_ucode_dbg_t, variable */
4705 #define WL_PMALERT_PS_ALLOWED_HIST      4 /* struct wl_pmalert_ps_allowed_history, variable */
4706 #define WL_PMALERT_EXT_UCODE_DBG        5 /* struct wl_pmalert_ext_ucode_dbg_t, variable */
4707 #define WL_PMALERT_EPM_START_EVENT_DUR  6 /* struct wl_pmalert_event_dur_t, variable */
4708
4709 typedef BWL_PRE_PACKED_STRUCT struct wl_pmalert_fixed {
4710         uint16 type;         /* WL_PMALERT_FIXED */
4711         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4712         uint32 prev_stats_time; /* msecs */
4713         uint32 curr_time;       /* ms */
4714         uint32 prev_pm_dur;     /* msecs */
4715         uint32 pm_dur;          /* Total sleep time in PM, msecs */
4716         uint32 prev_mpc_dur;    /* msecs */
4717         uint32 mpc_dur;         /* Total sleep time in MPC, msecs */
4718         uint32 hw_macc;         /* HW maccontrol */
4719         uint32 sw_macc;         /* SW maccontrol */
4720
4721         /* int32 drifts = remote - local; +ve drift -> local-clk slow */
4722         int32 last_drift;       /* Most recent TSF drift from beacon */
4723         int32 min_drift;        /* Min TSF drift from beacon in magnitude */
4724         int32 max_drift;        /* Max TSF drift from beacon in magnitude */
4725
4726         uint32 avg_drift;       /* Avg TSF drift from beacon */
4727         uint32 drift_cnt;       /* Count of drift readings over which avg_drift was computed */
4728         uint32 frts_time;       /* Cumulative ms spent in data frts since driver load */
4729         uint32 frts_end_cnt;    /* No of times frts ended since driver load */
4730         uint32 prev_frts_dur;   /* Data frts duration at start of pm-period */
4731         uint32 cal_dur;         /* Cumulative ms spent in calibration */
4732         uint32 prev_cal_dur;    /* cal duration at start of pm-period */
4733 } BWL_POST_PACKED_STRUCT wl_pmalert_fixed_t;
4734
4735 typedef BWL_PRE_PACKED_STRUCT struct wl_pmalert_pmstate {
4736         uint16 type;         /* WL_PMALERT_PMSTATE */
4737         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4738
4739         uint8 pmwake_idx;   /* for stepping through pm_state */
4740         uint8 pad[3];
4741         /* Array of pmstate; len of array is based on tlv len */
4742         wlc_pm_debug_t pmstate[1];
4743 } BWL_POST_PACKED_STRUCT wl_pmalert_pmstate_t;
4744
4745 typedef BWL_PRE_PACKED_STRUCT struct wl_pmalert_event_dur {
4746         uint16 type;         /* WL_PMALERT_EVENT_DUR */
4747         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4748
4749         /* Array of event_dur, len of array is based on tlv len */
4750         uint32 event_dur[1];
4751 } BWL_POST_PACKED_STRUCT wl_pmalert_event_dur_t;
4752
4753 typedef BWL_PRE_PACKED_STRUCT struct wl_pmalert_ucode_dbg {
4754         uint16 type;         /* WL_PMALERT_UCODE_DBG */
4755         uint16 len;          /* Up to 4K-1, top 4 bits are reserved */
4756         uint32 macctrl;
4757         uint16 m_p2p_hps;
4758         uint32 psm_brc;
4759         uint32 ifsstat;
4760         uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
4761         uint32 psmdebug[20];
4762         uint32 phydebug[20];
4763 } BWL_POST_PACKED_STRUCT wl_pmalert_ucode_dbg_t;
4764
4765
4766 /* Structures and constants used for "vndr_ie" IOVar interface */
4767 #define VNDR_IE_CMD_LEN         4       /* length of the set command string:
4768                                          * "add", "del" (+ NUL)
4769                                          */
4770
4771 #define VNDR_IE_INFO_HDR_LEN    (sizeof(uint32))
4772
4773 typedef BWL_PRE_PACKED_STRUCT struct {
4774         uint32 pktflag;                 /* bitmask indicating which packet(s) contain this IE */
4775         vndr_ie_t vndr_ie_data;         /* vendor IE data */
4776 } BWL_POST_PACKED_STRUCT vndr_ie_info_t;
4777
4778 typedef BWL_PRE_PACKED_STRUCT struct {
4779         int iecount;                    /* number of entries in the vndr_ie_list[] array */
4780         vndr_ie_info_t vndr_ie_list[1]; /* variable size list of vndr_ie_info_t structs */
4781 } BWL_POST_PACKED_STRUCT vndr_ie_buf_t;
4782
4783 typedef BWL_PRE_PACKED_STRUCT struct {
4784         char cmd[VNDR_IE_CMD_LEN];      /* vndr_ie IOVar set command : "add", "del" + NUL */
4785         vndr_ie_buf_t vndr_ie_buffer;   /* buffer containing Vendor IE list information */
4786 } BWL_POST_PACKED_STRUCT vndr_ie_setbuf_t;
4787
4788 /* tag_ID/length/value_buffer tuple */
4789 typedef BWL_PRE_PACKED_STRUCT struct {
4790         uint8   id;
4791         uint8   len;
4792         uint8   data[1];
4793 } BWL_POST_PACKED_STRUCT tlv_t;
4794
4795 typedef BWL_PRE_PACKED_STRUCT struct {
4796         uint32 pktflag;                 /* bitmask indicating which packet(s) contain this IE */
4797         tlv_t ie_data;          /* IE data */
4798 } BWL_POST_PACKED_STRUCT ie_info_t;
4799
4800 typedef BWL_PRE_PACKED_STRUCT struct {
4801         int iecount;                    /* number of entries in the ie_list[] array */
4802         ie_info_t ie_list[1];   /* variable size list of ie_info_t structs */
4803 } BWL_POST_PACKED_STRUCT ie_buf_t;
4804
4805 typedef BWL_PRE_PACKED_STRUCT struct {
4806         char cmd[VNDR_IE_CMD_LEN];      /* ie IOVar set command : "add" + NUL */
4807         ie_buf_t ie_buffer;     /* buffer containing IE list information */
4808 } BWL_POST_PACKED_STRUCT ie_setbuf_t;
4809
4810 typedef BWL_PRE_PACKED_STRUCT struct {
4811         uint32 pktflag;         /* bitmask indicating which packet(s) contain this IE */
4812         uint8 id;               /* IE type */
4813 } BWL_POST_PACKED_STRUCT ie_getbuf_t;
4814
4815 /* structures used to define format of wps ie data from probe requests */
4816 /* passed up to applications via iovar "prbreq_wpsie" */
4817 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_hdr {
4818         struct ether_addr staAddr;
4819         uint16 ieLen;
4820 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_hdr_t;
4821
4822 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
4823         sta_prbreq_wps_ie_hdr_t hdr;
4824         uint8 ieData[1];
4825 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
4826
4827 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
4828         uint32 totLen;
4829         uint8 ieDataList[1];
4830 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
4831
4832
4833 #ifdef WLMEDIA_TXFAILEVENT
4834 typedef BWL_PRE_PACKED_STRUCT struct {
4835         char   dest[ETHER_ADDR_LEN]; /* destination MAC */
4836         uint8  prio;            /* Packet Priority */
4837         uint8  flags;           /* Flags           */
4838         uint32 tsf_l;           /* TSF timer low   */
4839         uint32 tsf_h;           /* TSF timer high  */
4840         uint16 rates;           /* Main Rates      */
4841         uint16 txstatus;        /* TX Status       */
4842 } BWL_POST_PACKED_STRUCT txfailinfo_t;
4843 #endif /* WLMEDIA_TXFAILEVENT */
4844
4845 typedef BWL_PRE_PACKED_STRUCT struct {
4846         uint32 flags;
4847         chanspec_t chanspec;                    /* txpwr report for this channel */
4848         chanspec_t local_chanspec;              /* channel on which we are associated */
4849         uint8 local_max;                        /* local max according to the AP */
4850         uint8 local_constraint;                 /* local constraint according to the AP */
4851         int8  antgain[2];                       /* Ant gain for each band - from SROM */
4852         uint8 rf_cores;                         /* count of RF Cores being reported */
4853         uint8 est_Pout[4];                      /* Latest tx power out estimate per RF chain */
4854         uint8 est_Pout_act[4]; /* Latest tx power out estimate per RF chain w/o adjustment */
4855         uint8 est_Pout_cck;                     /* Latest CCK tx power out estimate */
4856         uint8 tx_power_max[4];          /* Maximum target power among all rates */
4857         uint tx_power_max_rate_ind[4];          /* Index of the rate with the max target power */
4858         int8 sar;                                       /* SAR limit for display by wl executable */
4859         int8 channel_bandwidth;         /* 20, 40 or 80 MHz bandwidth? */
4860         uint8 version;                          /* Version of the data format wlu <--> driver */
4861         uint8 display_core;                     /* Displayed curpower core */
4862         int8 target_offsets[4];         /* Target power offsets for current rate per core */
4863         uint32 last_tx_ratespec;        /* Ratespec for last transmition */
4864         uint   user_target;             /* user limit */
4865         uint32 ppr_len;         /* length of each ppr serialization buffer */
4866         int8 SARLIMIT[MAX_STREAMS_SUPPORTED];
4867         uint8  pprdata[1];              /* ppr serialization buffer */
4868 } BWL_POST_PACKED_STRUCT tx_pwr_rpt_t;
4869
4870 typedef BWL_PRE_PACKED_STRUCT struct {
4871         struct ipv4_addr        ipv4_addr;
4872         struct ether_addr nexthop;
4873 } BWL_POST_PACKED_STRUCT ibss_route_entry_t;
4874 typedef BWL_PRE_PACKED_STRUCT struct {
4875         uint32 num_entry;
4876         ibss_route_entry_t route_entry[1];
4877 } BWL_POST_PACKED_STRUCT ibss_route_tbl_t;
4878
4879 #define MAX_IBSS_ROUTE_TBL_ENTRY        64
4880
4881 #define TXPWR_TARGET_VERSION  0
4882 typedef BWL_PRE_PACKED_STRUCT struct {
4883         int32 version;          /* version number */
4884         chanspec_t chanspec;    /* txpwr report for this channel */
4885         int8 txpwr[WL_STA_ANT_MAX]; /* Max tx target power, in qdb */
4886         uint8 rf_cores;         /* count of RF Cores being reported */
4887 } BWL_POST_PACKED_STRUCT txpwr_target_max_t;
4888
4889 #define BSS_PEER_INFO_PARAM_CUR_VER     0
4890 /* Input structure for IOV_BSS_PEER_INFO */
4891 typedef BWL_PRE_PACKED_STRUCT   struct {
4892         uint16                  version;
4893         struct  ether_addr ea;  /* peer MAC address */
4894 } BWL_POST_PACKED_STRUCT bss_peer_info_param_t;
4895
4896 #define BSS_PEER_INFO_CUR_VER           0
4897
4898 typedef BWL_PRE_PACKED_STRUCT struct {
4899         uint16                  version;
4900         struct ether_addr       ea;
4901         int32                   rssi;
4902         uint32                  tx_rate;        /* current tx rate */
4903         uint32                  rx_rate;        /* current rx rate */
4904         wl_rateset_t            rateset;        /* rateset in use */
4905         uint32                  age;            /* age in seconds */
4906 } BWL_POST_PACKED_STRUCT bss_peer_info_t;
4907
4908 #define BSS_PEER_LIST_INFO_CUR_VER      0
4909
4910 typedef BWL_PRE_PACKED_STRUCT struct {
4911         uint16                  version;
4912         uint16                  bss_peer_info_len;      /* length of bss_peer_info_t */
4913         uint32                  count;                  /* number of peer info */
4914         bss_peer_info_t         peer_info[1];           /* peer info */
4915 } BWL_POST_PACKED_STRUCT bss_peer_list_info_t;
4916
4917 #define BSS_PEER_LIST_INFO_FIXED_LEN OFFSETOF(bss_peer_list_info_t, peer_info)
4918
4919 #define AIBSS_BCN_FORCE_CONFIG_VER_0    0
4920
4921 /* structure used to configure AIBSS beacon force xmit */
4922 typedef BWL_PRE_PACKED_STRUCT struct {
4923         uint16  version;
4924         uint16  len;
4925         uint32 initial_min_bcn_dur;     /* dur in ms to check a bcn in bcn_flood period */
4926         uint32 min_bcn_dur;     /* dur in ms to check a bcn after bcn_flood period */
4927         uint32 bcn_flood_dur; /* Initial bcn xmit period in ms */
4928 } BWL_POST_PACKED_STRUCT aibss_bcn_force_config_t;
4929
4930 #define AIBSS_TXFAIL_CONFIG_VER_0    0
4931 #define AIBSS_TXFAIL_CONFIG_VER_1    1
4932 #define AIBSS_TXFAIL_CONFIG_CUR_VER             AIBSS_TXFAIL_CONFIG_VER_1
4933
4934 /* structure used to configure aibss tx fail event */
4935 typedef BWL_PRE_PACKED_STRUCT struct {
4936         uint16  version;
4937         uint16  len;
4938         uint32 bcn_timeout;     /* dur in seconds to receive 1 bcn */
4939         uint32 max_tx_retry;     /* no of consecutive no acks to send txfail event */
4940         uint32 max_atim_failure; /* no of consecutive atim failure */
4941 } BWL_POST_PACKED_STRUCT aibss_txfail_config_t;
4942
4943 typedef BWL_PRE_PACKED_STRUCT struct wl_aibss_if {
4944         uint16 version;
4945         uint16 len;
4946         uint32 flags;
4947         struct ether_addr addr;
4948         chanspec_t chspec;
4949 } BWL_POST_PACKED_STRUCT wl_aibss_if_t;
4950
4951 typedef BWL_PRE_PACKED_STRUCT struct wlc_ipfo_route_entry {
4952         struct ipv4_addr ip_addr;
4953         struct ether_addr nexthop;
4954 } BWL_POST_PACKED_STRUCT wlc_ipfo_route_entry_t;
4955
4956 typedef BWL_PRE_PACKED_STRUCT struct wlc_ipfo_route_tbl {
4957         uint32 num_entry;
4958         wlc_ipfo_route_entry_t route_entry[1];
4959 } BWL_POST_PACKED_STRUCT wlc_ipfo_route_tbl_t;
4960
4961 #define WL_IPFO_ROUTE_TBL_FIXED_LEN 4
4962 #define WL_MAX_IPFO_ROUTE_TBL_ENTRY     64
4963
4964 /* no strict structure packing */
4965 #include <packed_section_end.h>
4966
4967         /* Global ASSERT Logging */
4968 #define ASSERTLOG_CUR_VER       0x0100
4969 #define MAX_ASSRTSTR_LEN        64
4970
4971         typedef struct assert_record {
4972                 uint32 time;
4973                 uint8 seq_num;
4974                 char str[MAX_ASSRTSTR_LEN];
4975         } assert_record_t;
4976
4977         typedef struct assertlog_results {
4978                 uint16 version;
4979                 uint16 record_len;
4980                 uint32 num;
4981                 assert_record_t logs[1];
4982         } assertlog_results_t;
4983
4984 #define LOGRRC_FIX_LEN  8
4985 #define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
4986
4987
4988         /* chanim acs record */
4989         typedef struct {
4990                 bool valid;
4991                 uint8 trigger;
4992                 chanspec_t selected_chspc;
4993                 int8 bgnoise;
4994                 uint32 glitch_cnt;
4995                 uint8 ccastats;
4996                 uint8 chan_idle;
4997                 uint timestamp;
4998         } chanim_acs_record_t;
4999
5000         typedef struct {
5001                 chanim_acs_record_t acs_record[CHANIM_ACS_RECORD];
5002                 uint8 count;
5003                 uint timestamp;
5004         } wl_acs_record_t;
5005
5006         typedef struct chanim_stats {
5007                 uint32 glitchcnt;               /* normalized as per second count */
5008                 uint32 badplcp;                 /* normalized as per second count */
5009                 uint8 ccastats[CCASTATS_MAX];   /* normalized as 0-255 */
5010                 int8 bgnoise;                   /* background noise level (in dBm) */
5011                 chanspec_t chanspec;            /* ctrl chanspec of the interface */
5012                 uint32 timestamp;               /* time stamp at which the stats are collected */
5013                 uint32 bphy_glitchcnt;          /* normalized as per second count */
5014                 uint32 bphy_badplcp;            /* normalized as per second count */
5015                 uint8 chan_idle;                /* normalized as 0~255 */
5016         } chanim_stats_t;
5017
5018 #define WL_CHANIM_STATS_VERSION 2
5019
5020 typedef struct {
5021         uint32 buflen;
5022         uint32 version;
5023         uint32 count;
5024         chanim_stats_t stats[1];
5025 } wl_chanim_stats_t;
5026
5027 #define WL_CHANIM_STATS_FIXED_LEN OFFSETOF(wl_chanim_stats_t, stats)
5028
5029 /* Noise measurement metrics. */
5030 #define NOISE_MEASURE_KNOISE    0x1
5031
5032 /* scb probe parameter */
5033 typedef struct {
5034         uint32 scb_timeout;
5035         uint32 scb_activity_time;
5036         uint32 scb_max_probe;
5037 } wl_scb_probe_t;
5038
5039 /* structure/defines for selective mgmt frame (smf) stats support */
5040
5041 #define SMFS_VERSION 1
5042 /* selected mgmt frame (smf) stats element */
5043 typedef struct wl_smfs_elem {
5044         uint32 count;
5045         uint16 code;  /* SC or RC code */
5046 } wl_smfs_elem_t;
5047
5048 typedef struct wl_smf_stats {
5049         uint32 version;
5050         uint16 length;  /* reserved for future usage */
5051         uint8 type;
5052         uint8 codetype;
5053         uint32 ignored_cnt;
5054         uint32 malformed_cnt;
5055         uint32 count_total; /* count included the interested group */
5056         wl_smfs_elem_t elem[1];
5057 } wl_smf_stats_t;
5058
5059 #define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);
5060
5061 enum {
5062         SMFS_CODETYPE_SC,
5063         SMFS_CODETYPE_RC
5064 };
5065
5066 typedef enum smfs_type {
5067         SMFS_TYPE_AUTH,
5068         SMFS_TYPE_ASSOC,
5069         SMFS_TYPE_REASSOC,
5070         SMFS_TYPE_DISASSOC_TX,
5071         SMFS_TYPE_DISASSOC_RX,
5072         SMFS_TYPE_DEAUTH_TX,
5073         SMFS_TYPE_DEAUTH_RX,
5074         SMFS_TYPE_MAX
5075 } smfs_type_t;
5076
5077 #ifdef PHYMON
5078
5079 #define PHYMON_VERSION 1
5080
5081 typedef struct wl_phycal_core_state {
5082         /* Tx IQ/LO calibration coeffs */
5083         int16 tx_iqlocal_a;
5084         int16 tx_iqlocal_b;
5085         int8 tx_iqlocal_ci;
5086         int8 tx_iqlocal_cq;
5087         int8 tx_iqlocal_di;
5088         int8 tx_iqlocal_dq;
5089         int8 tx_iqlocal_ei;
5090         int8 tx_iqlocal_eq;
5091         int8 tx_iqlocal_fi;
5092         int8 tx_iqlocal_fq;
5093
5094         /* Rx IQ calibration coeffs */
5095         int16 rx_iqcal_a;
5096         int16 rx_iqcal_b;
5097
5098         uint8 tx_iqlocal_pwridx; /* Tx Power Index for Tx IQ/LO calibration */
5099         uint32 papd_epsilon_table[64]; /* PAPD epsilon table */
5100         int16 papd_epsilon_offset; /* PAPD epsilon offset */
5101         uint8 curr_tx_pwrindex; /* Tx power index */
5102         int8 idle_tssi; /* Idle TSSI */
5103         int8 est_tx_pwr; /* Estimated Tx Power (dB) */
5104         int8 est_rx_pwr; /* Estimated Rx Power (dB) from RSSI */
5105         uint16 rx_gaininfo; /* Rx gain applied on last Rx pkt */
5106         uint16 init_gaincode; /* initgain required for ACI */
5107         int8 estirr_tx;
5108         int8 estirr_rx;
5109
5110 } wl_phycal_core_state_t;
5111
5112 typedef struct wl_phycal_state {
5113         int version;
5114         int8 num_phy_cores; /* number of cores */
5115         int8 curr_temperature; /* on-chip temperature sensor reading */
5116         chanspec_t chspec; /* channspec for this state */
5117         bool aci_state; /* ACI state: ON/OFF */
5118         uint16 crsminpower; /* crsminpower required for ACI */
5119         uint16 crsminpowerl; /* crsminpowerl required for ACI */
5120         uint16 crsminpoweru; /* crsminpoweru required for ACI */
5121         wl_phycal_core_state_t phycal_core[1];
5122 } wl_phycal_state_t;
5123
5124 #define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
5125 #endif /* PHYMON */
5126
5127 /* discovery state */
5128 typedef struct wl_p2p_disc_st {
5129         uint8 state;    /* see state */
5130         chanspec_t chspec;      /* valid in listen state */
5131         uint16 dwell;   /* valid in listen state, in ms */
5132 } wl_p2p_disc_st_t;
5133
5134 /* scan request */
5135 typedef struct wl_p2p_scan {
5136         uint8 type;             /* 'S' for WLC_SCAN, 'E' for "escan" */
5137         uint8 reserved[3];
5138         /* scan or escan parms... */
5139 } wl_p2p_scan_t;
5140
5141 /* i/f request */
5142 typedef struct wl_p2p_if {
5143         struct ether_addr addr;
5144         uint8 type;     /* see i/f type */
5145         chanspec_t chspec;      /* for p2p_ifadd GO */
5146 } wl_p2p_if_t;
5147
5148 /* i/f query */
5149 typedef struct wl_p2p_ifq {
5150         uint bsscfgidx;
5151         char ifname[BCM_MSG_IFNAME_MAX];
5152 } wl_p2p_ifq_t;
5153
5154 /* OppPS & CTWindow */
5155 typedef struct wl_p2p_ops {
5156         uint8 ops;      /* 0: disable 1: enable */
5157         uint8 ctw;      /* >= 10 */
5158 } wl_p2p_ops_t;
5159
5160 /* absence and presence request */
5161 typedef struct wl_p2p_sched_desc {
5162         uint32 start;
5163         uint32 interval;
5164         uint32 duration;
5165         uint32 count;   /* see count */
5166 } wl_p2p_sched_desc_t;
5167
5168 typedef struct wl_p2p_sched {
5169         uint8 type;     /* see schedule type */
5170         uint8 action;   /* see schedule action */
5171         uint8 option;   /* see schedule option */
5172         wl_p2p_sched_desc_t desc[1];
5173 } wl_p2p_sched_t;
5174
5175 typedef struct wl_p2p_wfds_hash {
5176         uint32  advt_id;
5177         uint16  nw_cfg_method;
5178         uint8   wfds_hash[6];
5179         uint8   name_len;
5180         uint8   service_name[MAX_WFDS_SVC_NAME_LEN];
5181 } wl_p2p_wfds_hash_t;
5182
5183 typedef struct wl_bcmdcs_data {
5184         uint reason;
5185         chanspec_t chspec;
5186 } wl_bcmdcs_data_t;
5187
5188
5189 /* NAT configuration */
5190 typedef struct {
5191         uint32 ipaddr;          /* interface ip address */
5192         uint32 ipaddr_mask;     /* interface ip address mask */
5193         uint32 ipaddr_gateway;  /* gateway ip address */
5194         uint8 mac_gateway[6];   /* gateway mac address */
5195         uint32 ipaddr_dns;      /* DNS server ip address, valid only for public if */
5196         uint8 mac_dns[6];       /* DNS server mac address,  valid only for public if */
5197         uint8 GUID[38];         /* interface GUID */
5198 } nat_if_info_t;
5199
5200 typedef struct {
5201         uint op;                /* operation code */
5202         bool pub_if;            /* set for public if, clear for private if */
5203         nat_if_info_t if_info;  /* interface info */
5204 } nat_cfg_t;
5205
5206 typedef struct {
5207         int state;      /* NAT state returned */
5208 } nat_state_t;
5209
5210
5211 #define BTA_STATE_LOG_SZ        64
5212
5213 /* BTAMP Statemachine states */
5214 enum {
5215         HCIReset = 1,
5216         HCIReadLocalAMPInfo,
5217         HCIReadLocalAMPASSOC,
5218         HCIWriteRemoteAMPASSOC,
5219         HCICreatePhysicalLink,
5220         HCIAcceptPhysicalLinkRequest,
5221         HCIDisconnectPhysicalLink,
5222         HCICreateLogicalLink,
5223         HCIAcceptLogicalLink,
5224         HCIDisconnectLogicalLink,
5225         HCILogicalLinkCancel,
5226         HCIAmpStateChange,
5227         HCIWriteLogicalLinkAcceptTimeout
5228 };
5229
5230 typedef struct flush_txfifo {
5231         uint32 txfifobmp;
5232         uint32 hwtxfifoflush;
5233         struct ether_addr ea;
5234 } flush_txfifo_t;
5235
5236 enum {
5237         SPATIAL_MODE_2G_IDX = 0,
5238         SPATIAL_MODE_5G_LOW_IDX,
5239         SPATIAL_MODE_5G_MID_IDX,
5240         SPATIAL_MODE_5G_HIGH_IDX,
5241         SPATIAL_MODE_5G_UPPER_IDX,
5242         SPATIAL_MODE_MAX_IDX
5243 };
5244
5245 #define WLC_TXCORE_MAX  4       /* max number of txcore supports */
5246 #define WLC_SUBBAND_MAX 4       /* max number of sub-band supports */
5247 typedef struct {
5248         uint8   band2g[WLC_TXCORE_MAX];
5249         uint8   band5g[WLC_SUBBAND_MAX][WLC_TXCORE_MAX];
5250 } sar_limit_t;
5251
5252 #define WLC_TXCAL_CORE_MAX 2    /* max number of txcore supports for txcal */
5253 #define MAX_NUM_TXCAL_MEAS 128
5254 #define MAX_NUM_PWR_STEP 40
5255 #define TXCAL_ROUNDING_FIX 1
5256 typedef struct wl_txcal_meas {
5257 #ifdef TXCAL_ROUNDING_FIX
5258         uint16 tssi[WLC_TXCAL_CORE_MAX][MAX_NUM_TXCAL_MEAS];
5259 #else
5260         uint8 tssi[WLC_TXCAL_CORE_MAX][MAX_NUM_TXCAL_MEAS];
5261 #endif /* TXCAL_ROUNDING_FIX */
5262         int16 pwr[WLC_TXCAL_CORE_MAX][MAX_NUM_TXCAL_MEAS];
5263         uint8 valid_cnt;
5264 } wl_txcal_meas_t;
5265
5266 typedef struct wl_txcal_power_tssi {
5267         uint8 set_core;
5268         uint8 channel;
5269         int16 tempsense[WLC_TXCAL_CORE_MAX];
5270         int16 pwr_start[WLC_TXCAL_CORE_MAX];
5271         uint8 pwr_start_idx[WLC_TXCAL_CORE_MAX];
5272         uint8 num_entries[WLC_TXCAL_CORE_MAX];
5273         uint8 tssi[WLC_TXCAL_CORE_MAX][MAX_NUM_PWR_STEP];
5274         bool gen_tbl;
5275 } wl_txcal_power_tssi_t;
5276
5277 /* IOVAR "mempool" parameter. Used to retrieve a list of memory pool statistics. */
5278 typedef struct wl_mempool_stats {
5279         int     num;            /* Number of memory pools */
5280         bcm_mp_stats_t s[1];    /* Variable array of memory pool stats. */
5281 } wl_mempool_stats_t;
5282
5283 typedef struct {
5284         uint32 ipaddr;
5285         uint32 ipaddr_netmask;
5286         uint32 ipaddr_gateway;
5287 } nwoe_ifconfig_t;
5288
5289 /* Traffic management priority classes */
5290 typedef enum trf_mgmt_priority_class {
5291         trf_mgmt_priority_low           = 0,        /* Maps to 802.1p BK */
5292         trf_mgmt_priority_medium        = 1,        /* Maps to 802.1p BE */
5293         trf_mgmt_priority_high          = 2,        /* Maps to 802.1p VI */
5294         trf_mgmt_priority_nochange      = 3,        /* do not update the priority */
5295         trf_mgmt_priority_invalid       = (trf_mgmt_priority_nochange + 1)
5296 } trf_mgmt_priority_class_t;
5297
5298 /* Traffic management configuration parameters */
5299 typedef struct trf_mgmt_config {
5300         uint32  trf_mgmt_enabled;                           /* 0 - disabled, 1 - enabled */
5301         uint32  flags;                                      /* See TRF_MGMT_FLAG_xxx defines */
5302         uint32  host_ip_addr;                               /* My IP address to determine subnet */
5303         uint32  host_subnet_mask;                           /* My subnet mask */
5304         uint32  downlink_bandwidth;                         /* In units of kbps */
5305         uint32  uplink_bandwidth;                           /* In units of kbps */
5306         uint32  min_tx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /* Minimum guaranteed tx bandwidth */
5307         uint32  min_rx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /* Minimum guaranteed rx bandwidth */
5308 } trf_mgmt_config_t;
5309
5310 /* Traffic management filter */
5311 typedef struct trf_mgmt_filter {
5312         struct ether_addr           dst_ether_addr;         /* His L2 address */
5313         uint32                      dst_ip_addr;            /* His IP address */
5314         uint16                      dst_port;               /* His L4 port */
5315         uint16                      src_port;               /* My L4 port */
5316         uint16                      prot;                   /* L4 protocol (only TCP or UDP) */
5317         uint16                      flags;                  /* TBD. For now, this must be zero. */
5318         trf_mgmt_priority_class_t   priority;               /* Priority for filtered packets */
5319         uint32                      dscp;                   /* DSCP */
5320 } trf_mgmt_filter_t;
5321
5322 /* Traffic management filter list (variable length) */
5323 typedef struct trf_mgmt_filter_list     {
5324         uint32              num_filters;
5325         trf_mgmt_filter_t   filter[1];
5326 } trf_mgmt_filter_list_t;
5327
5328 /* Traffic management global info used for all queues */
5329 typedef struct trf_mgmt_global_info {
5330         uint32  maximum_bytes_per_second;
5331         uint32  maximum_bytes_per_sampling_period;
5332         uint32  total_bytes_consumed_per_second;
5333         uint32  total_bytes_consumed_per_sampling_period;
5334         uint32  total_unused_bytes_per_sampling_period;
5335 } trf_mgmt_global_info_t;
5336
5337 /* Traffic management shaping info per priority queue */
5338 typedef struct trf_mgmt_shaping_info {
5339         uint32  gauranteed_bandwidth_percentage;
5340         uint32  guaranteed_bytes_per_second;
5341         uint32  guaranteed_bytes_per_sampling_period;
5342         uint32  num_bytes_produced_per_second;
5343         uint32  num_bytes_consumed_per_second;
5344         uint32  num_queued_packets;                         /* Number of packets in queue */
5345         uint32  num_queued_bytes;                           /* Number of bytes in queue */
5346 } trf_mgmt_shaping_info_t;
5347
5348 /* Traffic management shaping info array */
5349 typedef struct trf_mgmt_shaping_info_array {
5350         trf_mgmt_global_info_t   tx_global_shaping_info;
5351         trf_mgmt_shaping_info_t  tx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
5352         trf_mgmt_global_info_t   rx_global_shaping_info;
5353         trf_mgmt_shaping_info_t  rx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
5354 } trf_mgmt_shaping_info_array_t;
5355
5356
5357 /* Traffic management statistical counters */
5358 typedef struct trf_mgmt_stats {
5359         uint32  num_processed_packets;      /* Number of packets processed */
5360         uint32  num_processed_bytes;        /* Number of bytes processed */
5361         uint32  num_discarded_packets;      /* Number of packets discarded from queue */
5362 } trf_mgmt_stats_t;
5363
5364 /* Traffic management statisics array */
5365 typedef struct trf_mgmt_stats_array {
5366         trf_mgmt_stats_t  tx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
5367         trf_mgmt_stats_t  rx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
5368 } trf_mgmt_stats_array_t;
5369
5370 typedef struct powersel_params {
5371         /* LPC Params exposed via IOVAR */
5372         int32           tp_ratio_thresh;  /* Throughput ratio threshold */
5373         uint8           rate_stab_thresh; /* Thresh for rate stability based on nupd */
5374         uint8           pwr_stab_thresh; /* Number of successes before power step down */
5375         uint8           pwr_sel_exp_time; /* Time lapse for expiry of database */
5376 } powersel_params_t;
5377
5378 typedef struct lpc_params {
5379         /* LPC Params exposed via IOVAR */
5380         uint8           rate_stab_thresh; /* Thresh for rate stability based on nupd */
5381         uint8           pwr_stab_thresh; /* Number of successes before power step down */
5382         uint8           lpc_exp_time; /* Time lapse for expiry of database */
5383         uint8           pwrup_slow_step; /* Step size for slow step up */
5384         uint8           pwrup_fast_step; /* Step size for fast step up */
5385         uint8           pwrdn_slow_step; /* Step size for slow step down */
5386 } lpc_params_t;
5387
5388 /* tx pkt delay statistics */
5389 #define SCB_RETRY_SHORT_DEF     7       /* Default Short retry Limit */
5390 #define WLPKTDLY_HIST_NBINS     16      /* number of bins used in the Delay histogram */
5391
5392 /* structure to store per-AC delay statistics */
5393 typedef struct scb_delay_stats {
5394         uint32 txmpdu_lost;     /* number of MPDUs lost */
5395         uint32 txmpdu_cnt[SCB_RETRY_SHORT_DEF]; /* retry times histogram */
5396         uint32 delay_sum[SCB_RETRY_SHORT_DEF]; /* cumulative packet latency */
5397         uint32 delay_min;       /* minimum packet latency observed */
5398         uint32 delay_max;       /* maximum packet latency observed */
5399         uint32 delay_avg;       /* packet latency average */
5400         uint32 delay_hist[WLPKTDLY_HIST_NBINS]; /* delay histogram */
5401 } scb_delay_stats_t;
5402
5403 /* structure for txdelay event */
5404 typedef struct txdelay_event {
5405         uint8   status;
5406         int             rssi;
5407         chanim_stats_t          chanim_stats;
5408         scb_delay_stats_t       delay_stats[AC_COUNT];
5409 } txdelay_event_t;
5410
5411 /* structure for txdelay parameters */
5412 typedef struct txdelay_params {
5413         uint16  ratio;  /* Avg Txdelay Delta */
5414         uint8   cnt;    /* Sample cnt */
5415         uint8   period; /* Sample period */
5416         uint8   tune;   /* Debug */
5417 } txdelay_params_t;
5418
5419 enum {
5420         WNM_SERVICE_DMS = 1,
5421         WNM_SERVICE_FMS = 2,
5422         WNM_SERVICE_TFS = 3
5423 };
5424
5425 /* Definitions for WNM/NPS TCLAS */
5426 typedef struct wl_tclas {
5427         uint8 user_priority;
5428         uint8 fc_len;
5429         dot11_tclas_fc_t fc;
5430 } wl_tclas_t;
5431
5432 #define WL_TCLAS_FIXED_SIZE     OFFSETOF(wl_tclas_t, fc)
5433
5434 typedef struct wl_tclas_list {
5435         uint32 num;
5436         wl_tclas_t tclas[1];
5437 } wl_tclas_list_t;
5438
5439 /* Definitions for WNM/NPS Traffic Filter Service */
5440 typedef struct wl_tfs_req {
5441         uint8 tfs_id;
5442         uint8 tfs_actcode;
5443         uint8 tfs_subelem_id;
5444         uint8 send;
5445 } wl_tfs_req_t;
5446
5447 typedef struct wl_tfs_filter {
5448         uint8 status;                   /* Status returned by the AP */
5449         uint8 tclas_proc;               /* TCLAS processing value (0:and, 1:or)  */
5450         uint8 tclas_cnt;                /* count of all wl_tclas_t in tclas array */
5451         uint8 tclas[1];                 /* VLA of wl_tclas_t */
5452 } wl_tfs_filter_t;
5453 #define WL_TFS_FILTER_FIXED_SIZE        OFFSETOF(wl_tfs_filter_t, tclas)
5454
5455 typedef struct wl_tfs_fset {
5456         struct ether_addr ea;           /* Address of AP/STA involved with this filter set */
5457         uint8 tfs_id;                   /* TFS ID field chosen by STA host */
5458         uint8 status;                   /* Internal status TFS_STATUS_xxx */
5459         uint8 actcode;                  /* Action code DOT11_TFS_ACTCODE_xxx */
5460         uint8 token;                    /* Token used in last request frame */
5461         uint8 notify;                   /* Notify frame sent/received because of this set */
5462         uint8 filter_cnt;               /* count of all wl_tfs_filter_t in filter array */
5463         uint8 filter[1];                /* VLA of wl_tfs_filter_t */
5464 } wl_tfs_fset_t;
5465 #define WL_TFS_FSET_FIXED_SIZE          OFFSETOF(wl_tfs_fset_t, filter)
5466
5467 enum {
5468         TFS_STATUS_DISABLED = 0,        /* TFS filter set disabled by user */
5469         TFS_STATUS_DISABLING = 1,       /* Empty request just sent to AP */
5470         TFS_STATUS_VALIDATED = 2,       /* Filter set validated by AP (but maybe not enabled!) */
5471         TFS_STATUS_VALIDATING = 3,      /* Filter set just sent to AP */
5472         TFS_STATUS_NOT_ASSOC = 4,       /* STA not associated */
5473         TFS_STATUS_NOT_SUPPORT = 5,     /* TFS not supported by AP */
5474         TFS_STATUS_DENIED = 6,          /* Filter set refused by AP (=> all sets are disabled!) */
5475 };
5476
5477 typedef struct wl_tfs_status {
5478         uint8 fset_cnt;                 /* count of all wl_tfs_fset_t in fset array */
5479         wl_tfs_fset_t fset[1];          /* VLA of wl_tfs_fset_t */
5480 } wl_tfs_status_t;
5481
5482 typedef struct wl_tfs_set {
5483         uint8 send;                     /* Immediatly register registered sets on AP side */
5484         uint8 tfs_id;                   /* ID of a specific set (existing or new), or nul for all */
5485         uint8 actcode;                  /* Action code for this filter set */
5486         uint8 tclas_proc;               /* TCLAS processing operator for this filter set */
5487 } wl_tfs_set_t;
5488
5489 typedef struct wl_tfs_term {
5490         uint8 del;                      /* Delete internal set once confirmation received */
5491         uint8 tfs_id;                   /* ID of a specific set (existing), or nul for all */
5492 } wl_tfs_term_t;
5493
5494
5495 #define DMS_DEP_PROXY_ARP (1 << 0)
5496
5497 /* Definitions for WNM/NPS Directed Multicast Service */
5498 enum {
5499         DMS_STATUS_DISABLED = 0,        /* DMS desc disabled by user */
5500         DMS_STATUS_ACCEPTED = 1,        /* Request accepted by AP */
5501         DMS_STATUS_NOT_ASSOC = 2,       /* STA not associated */
5502         DMS_STATUS_NOT_SUPPORT = 3,     /* DMS not supported by AP */
5503         DMS_STATUS_DENIED = 4,          /* Request denied by AP */
5504         DMS_STATUS_TERM = 5,            /* Request terminated by AP */
5505         DMS_STATUS_REMOVING = 6,        /* Remove request just sent */
5506         DMS_STATUS_ADDING = 7,          /* Add request just sent */
5507         DMS_STATUS_ERROR = 8,           /* Non compliant AP behvior */
5508         DMS_STATUS_IN_PROGRESS = 9, /* Request just sent */
5509         DMS_STATUS_REQ_MISMATCH = 10 /* Conditions for sending DMS req not met */
5510 };
5511
5512 typedef struct wl_dms_desc {
5513         uint8 user_id;
5514         uint8 status;
5515         uint8 token;
5516         uint8 dms_id;
5517         uint8 tclas_proc;
5518         uint8 mac_len;          /* length of all ether_addr in data array, 0 if STA */
5519         uint8 tclas_len;        /* length of all wl_tclas_t in data array */
5520         uint8 data[1];          /* VLA of 'ether_addr' and 'wl_tclas_t' (in this order ) */
5521 } wl_dms_desc_t;
5522
5523 #define WL_DMS_DESC_FIXED_SIZE  OFFSETOF(wl_dms_desc_t, data)
5524
5525 typedef struct wl_dms_status {
5526         uint32 cnt;
5527         wl_dms_desc_t desc[1];
5528 } wl_dms_status_t;
5529
5530 typedef struct wl_dms_set {
5531         uint8 send;
5532         uint8 user_id;
5533         uint8 tclas_proc;
5534 } wl_dms_set_t;
5535
5536 typedef struct wl_dms_term {
5537         uint8 del;
5538         uint8 user_id;
5539 } wl_dms_term_t;
5540
5541 typedef struct wl_service_term {
5542         uint8 service;
5543         union {
5544                 wl_dms_term_t dms;
5545         } u;
5546 } wl_service_term_t;
5547
5548 /* Definitions for WNM/NPS BSS Transistion */
5549 typedef struct wl_bsstrans_req {
5550         uint16 tbtt;                    /* time of BSS to end of life, in unit of TBTT */
5551         uint16 dur;                     /* time of BSS to keep off, in unit of minute */
5552         uint8 reqmode;                  /* request mode of BSS transition request */
5553         uint8 unicast;                  /* request by unicast or by broadcast */
5554 } wl_bsstrans_req_t;
5555
5556 enum {
5557         BSSTRANS_RESP_AUTO = 0,         /* Currently equivalent to ENABLE */
5558         BSSTRANS_RESP_DISABLE = 1,      /* Never answer BSS Trans Req frames */
5559         BSSTRANS_RESP_ENABLE = 2,       /* Always answer Req frames with preset data */
5560         BSSTRANS_RESP_WAIT = 3,         /* Send ind, wait and/or send preset data (NOT IMPL) */
5561         BSSTRANS_RESP_IMMEDIATE = 4     /* After an ind, set data and send resp (NOT IMPL) */
5562 };
5563
5564 typedef struct wl_bsstrans_resp {
5565         uint8 policy;
5566         uint8 status;
5567         uint8 delay;
5568         struct ether_addr target;
5569 } wl_bsstrans_resp_t;
5570
5571 /* "wnm_bsstrans_policy" argument programs behavior after BSSTRANS Req reception.
5572  * BSS-Transition feature is used by multiple programs such as NPS-PF, VE-PF,
5573  * Band-steering, Hotspot 2.0 and customer requirements. Each PF and its test plan
5574  * mandates different behavior on receiving BSS-transition request. To accomodate
5575  * such divergent behaviors these policies have been created.
5576  */
5577 enum {
5578         WL_BSSTRANS_POLICY_ROAM_ALWAYS = 0,     /* Roam (or disassociate) in all cases */
5579         WL_BSSTRANS_POLICY_ROAM_IF_MODE = 1,    /* Roam only if requested by Request Mode field */
5580         WL_BSSTRANS_POLICY_ROAM_IF_PREF = 2,    /* Roam only if Preferred BSS provided */
5581         WL_BSSTRANS_POLICY_WAIT = 3,            /* Wait for deauth and send Accepted status */
5582         WL_BSSTRANS_POLICY_PRODUCT = 4,         /* Policy for real product use cases (non-pf) */
5583 };
5584
5585 /* Definitions for WNM/NPS TIM Broadcast */
5586 typedef struct wl_timbc_offset {
5587         int16 offset;           /* offset in us */
5588         uint16 fix_intv;        /* override interval sent from STA */
5589         uint16 rate_override;   /* use rate override to send high rate TIM broadcast frame */
5590         uint8 tsf_present;      /* show timestamp in TIM broadcast frame */
5591 } wl_timbc_offset_t;
5592
5593 typedef struct wl_timbc_set {
5594         uint8 interval;         /* Interval in DTIM wished or required. */
5595         uint8 flags;            /* Bitfield described below */
5596         uint16 rate_min;        /* Minimum rate required for High/Low TIM frames. Optionnal */
5597         uint16 rate_max;        /* Maximum rate required for High/Low TIM frames. Optionnal */
5598 } wl_timbc_set_t;
5599
5600 enum {
5601         WL_TIMBC_SET_TSF_REQUIRED = 1,  /* Enable TIMBC only if TSF in TIM frames */
5602         WL_TIMBC_SET_NO_OVERRIDE = 2,   /* ... if AP does not override interval */
5603         WL_TIMBC_SET_PROXY_ARP = 4,     /* ... if AP support Proxy ARP */
5604         WL_TIMBC_SET_DMS_ACCEPTED = 8   /* ... if all DMS desc have been accepted */
5605 };
5606
5607 typedef struct wl_timbc_status {
5608         uint8 status_sta;               /* Status from internal state machine (check below) */
5609         uint8 status_ap;                /* From AP response frame (check 8.4.2.86 from 802.11) */
5610         uint8 interval;
5611         uint8 pad;
5612         int32 offset;
5613         uint16 rate_high;
5614         uint16 rate_low;
5615 } wl_timbc_status_t;
5616
5617 enum {
5618         WL_TIMBC_STATUS_DISABLE = 0,            /* TIMBC disabled by user */
5619         WL_TIMBC_STATUS_REQ_MISMATCH = 1,       /* AP settings do no match user requirements */
5620         WL_TIMBC_STATUS_NOT_ASSOC = 2,          /* STA not associated */
5621         WL_TIMBC_STATUS_NOT_SUPPORT = 3,        /* TIMBC not supported by AP */
5622         WL_TIMBC_STATUS_DENIED = 4,             /* Req to disable TIMBC sent to AP */
5623         WL_TIMBC_STATUS_ENABLE = 5              /* TIMBC enabled */
5624 };
5625
5626 /* Definitions for PM2 Dynamic Fast Return To Sleep */
5627 typedef struct wl_pm2_sleep_ret_ext {
5628         uint8 logic;                    /* DFRTS logic: see WL_DFRTS_LOGIC_* below */
5629         uint16 low_ms;                  /* Low FRTS timeout */
5630         uint16 high_ms;                 /* High FRTS timeout */
5631         uint16 rx_pkts_threshold;       /* switching threshold: # rx pkts */
5632         uint16 tx_pkts_threshold;       /* switching threshold: # tx pkts */
5633         uint16 txrx_pkts_threshold;     /* switching threshold: # (tx+rx) pkts */
5634         uint32 rx_bytes_threshold;      /* switching threshold: # rx bytes */
5635         uint32 tx_bytes_threshold;      /* switching threshold: # tx bytes */
5636         uint32 txrx_bytes_threshold;    /* switching threshold: # (tx+rx) bytes */
5637 } wl_pm2_sleep_ret_ext_t;
5638
5639 #define WL_DFRTS_LOGIC_OFF      0       /* Feature is disabled */
5640 #define WL_DFRTS_LOGIC_OR       1       /* OR all non-zero threshold conditions */
5641 #define WL_DFRTS_LOGIC_AND      2       /* AND all non-zero threshold conditions */
5642
5643 /* Values for the passive_on_restricted_mode iovar.  When set to non-zero, this iovar
5644  * disables automatic conversions of a channel from passively scanned to
5645  * actively scanned.  These values only have an effect for country codes such
5646  * as XZ where some 5 GHz channels are defined to be passively scanned.
5647  */
5648 #define WL_PASSACTCONV_DISABLE_NONE     0       /* Enable permanent and temporary conversions */
5649 #define WL_PASSACTCONV_DISABLE_ALL      1       /* Disable permanent and temporary conversions */
5650 #define WL_PASSACTCONV_DISABLE_PERM     2       /* Disable only permanent conversions */
5651
5652 /* Definitions for Reliable Multicast */
5653 #define WL_RMC_CNT_VERSION         1
5654 #define WL_RMC_TR_VERSION          1
5655 #define WL_RMC_MAX_CLIENT          32
5656 #define WL_RMC_FLAG_INBLACKLIST    1
5657 #define WL_RMC_FLAG_ACTIVEACKER    2
5658 #define WL_RMC_FLAG_RELMCAST       4
5659 #define WL_RMC_MAX_TABLE_ENTRY     4
5660
5661 #define WL_RMC_VER                 1
5662 #define WL_RMC_INDEX_ACK_ALL       255
5663 #define WL_RMC_NUM_OF_MC_STREAMS   4
5664 #define WL_RMC_MAX_TRS_PER_GROUP   1
5665 #define WL_RMC_MAX_TRS_IN_ACKALL   1
5666 #define WL_RMC_ACK_MCAST0          0x02
5667 #define WL_RMC_ACK_MCAST_ALL       0x01
5668 #define WL_RMC_ACTF_TIME_MIN       300   /* time in ms */
5669 #define WL_RMC_ACTF_TIME_MAX       20000 /* time in ms */
5670 #define WL_RMC_MAX_NUM_TRS         32    /* maximun transmitters allowed */
5671 #define WL_RMC_ARTMO_MIN           350   /* time in ms */
5672 #define WL_RMC_ARTMO_MAX           40000         /* time in ms */
5673
5674 /* RMC events in action frames */
5675 enum rmc_opcodes {
5676         RELMCAST_ENTRY_OP_DISABLE = 0,   /* Disable multi-cast group */
5677         RELMCAST_ENTRY_OP_DELETE  = 1,   /* Delete multi-cast group */
5678         RELMCAST_ENTRY_OP_ENABLE  = 2,   /* Enable multi-cast group */
5679         RELMCAST_ENTRY_OP_ACK_ALL = 3    /* Enable ACK ALL bit in AMT */
5680 };
5681
5682 /* RMC operational modes */
5683 enum rmc_modes {
5684         WL_RMC_MODE_RECEIVER    = 0,     /* Receiver mode by default */
5685         WL_RMC_MODE_TRANSMITTER = 1,     /* Transmitter mode using wl ackreq */
5686         WL_RMC_MODE_INITIATOR   = 2      /* Initiator mode using wl ackreq */
5687 };
5688
5689 /* Each RMC mcast client info */
5690 typedef struct wl_relmcast_client {
5691         uint8 flag;                     /* status of client such as AR, R, or blacklisted */
5692         int16 rssi;                     /* rssi value of RMC client */
5693         struct ether_addr addr;         /* mac address of RMC client */
5694 } wl_relmcast_client_t;
5695
5696 /* RMC Counters */
5697 typedef struct wl_rmc_cnts {
5698         uint16  version;                /* see definition of WL_CNT_T_VERSION */
5699         uint16  length;                 /* length of entire structure */
5700         uint16  dupcnt;                 /* counter for duplicate rmc MPDU */
5701         uint16  ackreq_err;             /* counter for wl ackreq error    */
5702         uint16  af_tx_err;              /* error count for action frame transmit   */
5703         uint16  null_tx_err;            /* error count for rmc null frame transmit */
5704         uint16  af_unicast_tx_err;      /* error count for rmc unicast frame transmit */
5705         uint16  mc_no_amt_slot;         /* No mcast AMT entry available */
5706         /* Unused. Keep for rom compatibility */
5707         uint16  mc_no_glb_slot;         /* No mcast entry available in global table */
5708         uint16  mc_not_mirrored;        /* mcast group is not mirrored */
5709         uint16  mc_existing_tr;         /* mcast group is already taken by transmitter */
5710         uint16  mc_exist_in_amt;        /* mcast group is already programmed in amt */
5711         /* Unused. Keep for rom compatibility */
5712         uint16  mc_not_exist_in_gbl;    /* mcast group is not in global table */
5713         uint16  mc_not_exist_in_amt;    /* mcast group is not in AMT table */
5714         uint16  mc_utilized;            /* mcast addressed is already taken */
5715         uint16  mc_taken_other_tr;      /* multi-cast addressed is already taken */
5716         uint32  rmc_rx_frames_mac;      /* no of mc frames received from mac */
5717         uint32  rmc_tx_frames_mac;      /* no of mc frames transmitted to mac */
5718         uint32  mc_null_ar_cnt;         /* no. of times NULL AR is received */
5719         uint32  mc_ar_role_selected;    /* no. of times took AR role */
5720         uint32  mc_ar_role_deleted;     /* no. of times AR role cancelled */
5721         uint32  mc_noacktimer_expired;  /* no. of times noack timer expired */
5722         uint16  mc_no_wl_clk;           /* no wl clk detected when trying to access amt */
5723         uint16  mc_tr_cnt_exceeded;     /* No of transmitters in the network exceeded */
5724 } wl_rmc_cnts_t;
5725
5726 /* RMC Status */
5727 typedef struct wl_relmcast_st {
5728         uint8         ver;              /* version of RMC */
5729         uint8         num;              /* number of clients detected by transmitter */
5730         wl_relmcast_client_t clients[WL_RMC_MAX_CLIENT];
5731         uint16        err;              /* error status (used in infra) */
5732         uint16        actf_time;        /* action frame time period */
5733 } wl_relmcast_status_t;
5734
5735 /* Entry for each STA/node */
5736 typedef struct wl_rmc_entry {
5737         /* operation on multi-cast entry such add,
5738          * delete, ack-all
5739          */
5740         int8    flag;
5741         struct ether_addr addr;         /* multi-cast group mac address */
5742 } wl_rmc_entry_t;
5743
5744 /* RMC table */
5745 typedef struct wl_rmc_entry_table {
5746         uint8   index;                  /* index to a particular mac entry in table */
5747         uint8   opcode;                 /* opcodes or operation on entry */
5748         wl_rmc_entry_t entry[WL_RMC_MAX_TABLE_ENTRY];
5749 } wl_rmc_entry_table_t;
5750
5751 typedef struct wl_rmc_trans_elem {
5752         struct ether_addr tr_mac;       /* transmitter mac */
5753         struct ether_addr ar_mac;       /* ar mac */
5754         uint16 artmo;                   /* AR timeout */
5755         uint8 amt_idx;                  /* amt table entry */
5756         uint16 flag;                    /* entry will be acked, not acked, programmed, full etc */
5757 } wl_rmc_trans_elem_t;
5758
5759 /* RMC transmitters */
5760 typedef struct wl_rmc_trans_in_network {
5761         uint8         ver;              /* version of RMC */
5762         uint8         num_tr;           /* number of transmitters in the network */
5763         wl_rmc_trans_elem_t trs[WL_RMC_MAX_NUM_TRS];
5764 } wl_rmc_trans_in_network_t;
5765
5766 /* To update vendor specific ie for RMC */
5767 typedef struct wl_rmc_vsie {
5768         uint8   oui[DOT11_OUI_LEN];
5769         uint16  payload;        /* IE Data Payload */
5770 } wl_rmc_vsie_t;
5771
5772
5773 /* structures  & defines for proximity detection  */
5774 enum proxd_method {
5775         PROXD_UNDEFINED_METHOD = 0,
5776         PROXD_RSSI_METHOD = 1,
5777         PROXD_TOF_METHOD = 2
5778 };
5779
5780 /* structures for proximity detection device role */
5781 #define WL_PROXD_MODE_DISABLE   0
5782 #define WL_PROXD_MODE_NEUTRAL   1
5783 #define WL_PROXD_MODE_INITIATOR 2
5784 #define WL_PROXD_MODE_TARGET    3
5785
5786 #define WL_PROXD_ACTION_STOP            0
5787 #define WL_PROXD_ACTION_START           1
5788
5789 #define WL_PROXD_FLAG_TARGET_REPORT     0x1
5790 #define WL_PROXD_FLAG_REPORT_FAILURE    0x2
5791 #define WL_PROXD_FLAG_INITIATOR_REPORT  0x4
5792 #define WL_PROXD_FLAG_NOCHANSWT         0x8
5793 #define WL_PROXD_FLAG_NETRUAL           0x10
5794 #define WL_PROXD_FLAG_INITIATOR_RPTRTT  0x20
5795 #define WL_PROXD_FLAG_ONEWAY            0x40
5796 #define WL_PROXD_FLAG_SEQ_EN            0x80
5797
5798 #define WL_PROXD_RANDOM_WAKEUP  0x8000
5799 #define WL_PROXD_MAXREPORT      8
5800
5801 typedef struct wl_proxd_iovar {
5802         uint16  method;         /* Proxmity Detection method */
5803         uint16  mode;           /* Mode (neutral, initiator, target) */
5804 } wl_proxd_iovar_t;
5805
5806 /*
5807  * structures for proximity detection parameters
5808  * consists of two parts, common and method specific params
5809  * common params should be placed at the beginning
5810  */
5811
5812 /* require strict packing */
5813 #include <packed_section_start.h>
5814
5815 typedef BWL_PRE_PACKED_STRUCT struct    wl_proxd_params_common  {
5816         chanspec_t      chanspec;       /* channel spec */
5817         int16           tx_power;       /* tx power of Proximity Detection(PD) frames (in dBm) */
5818         uint16          tx_rate;        /* tx rate of PD rames  (in 500kbps units) */
5819         uint16          timeout;        /* timeout value */
5820         uint16          interval;       /* interval between neighbor finding attempts (in TU) */
5821         uint16          duration;       /* duration of neighbor finding attempts (in ms) */
5822 } BWL_POST_PACKED_STRUCT wl_proxd_params_common_t;
5823
5824 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_params_rssi_method {
5825         chanspec_t      chanspec;       /* chanspec for home channel */
5826         int16           tx_power;       /* tx power of Proximity Detection frames (in dBm) */
5827         uint16          tx_rate;        /* tx rate of PD frames, 500kbps units */
5828         uint16          timeout;        /* state machine wait timeout of the frames (in ms) */
5829         uint16          interval;       /* interval between neighbor finding attempts (in TU) */
5830         uint16          duration;       /* duration of neighbor finding attempts (in ms) */
5831                                         /* method specific ones go after this line */
5832         int16           rssi_thresh;    /* RSSI threshold (in dBm) */
5833         uint16          maxconvergtmo;  /* max wait converge timeout (in ms) */
5834 } wl_proxd_params_rssi_method_t;
5835
5836 #define Q1_NS                   25      /* Q1 time units */
5837
5838 #define TOF_BW_NUM              3       /* number of bandwidth that the TOF can support */
5839 #define TOF_BW_SEQ_NUM          (TOF_BW_NUM+2)  /* number of total index */
5840 enum tof_bw_index {
5841         TOF_BW_20MHZ_INDEX = 0,
5842         TOF_BW_40MHZ_INDEX = 1,
5843         TOF_BW_80MHZ_INDEX = 2,
5844         TOF_BW_SEQTX_INDEX = 3,
5845         TOF_BW_SEQRX_INDEX = 4
5846 };
5847
5848 #define BANDWIDTH_BASE  20      /* base value of bandwidth */
5849 #define TOF_BW_20MHZ    (BANDWIDTH_BASE << TOF_BW_20MHZ_INDEX)
5850 #define TOF_BW_40MHZ    (BANDWIDTH_BASE << TOF_BW_40MHZ_INDEX)
5851 #define TOF_BW_80MHZ    (BANDWIDTH_BASE << TOF_BW_80MHZ_INDEX)
5852 #define TOF_BW_10MHZ    10
5853
5854 #define NFFT_BASE               64      /* base size of fft */
5855 #define TOF_NFFT_20MHZ  (NFFT_BASE << TOF_BW_20MHZ_INDEX)
5856 #define TOF_NFFT_40MHZ  (NFFT_BASE << TOF_BW_40MHZ_INDEX)
5857 #define TOF_NFFT_80MHZ  (NFFT_BASE << TOF_BW_80MHZ_INDEX)
5858
5859 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_params_tof_method {
5860         chanspec_t      chanspec;       /* chanspec for home channel */
5861         int16           tx_power;       /* tx power of Proximity Detection(PD) frames (in dBm) */
5862         uint16          tx_rate;        /* tx rate of PD rames  (in 500kbps units) */
5863         uint16          timeout;        /* state machine wait timeout of the frames (in ms) */
5864         uint16          interval;       /* interval between neighbor finding attempts (in TU) */
5865         uint16          duration;       /* duration of neighbor finding attempts (in ms) */
5866         /* specific for the method go after this line */
5867         struct ether_addr tgt_mac;      /* target mac addr for TOF method */
5868         uint16          ftm_cnt;        /* number of the frames txed by initiator */
5869         uint16          retry_cnt;      /* number of retransmit attampts for ftm frames */
5870         int16           vht_rate;       /* ht or vht rate */
5871         /* add more params required for other methods can be added here  */
5872 } BWL_POST_PACKED_STRUCT wl_proxd_params_tof_method_t;
5873
5874 typedef struct wl_proxd_seq_config
5875 {
5876         int16 N_tx_log2;
5877         int16 N_rx_log2;
5878         int16 N_tx_scale;
5879         int16 N_rx_scale;
5880         int16 w_len;
5881         int16 w_offset;
5882 } wl_proxd_seq_config_t;
5883
5884
5885 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_params_tof_tune {
5886         uint32          Ki;                     /* h/w delay K factor for initiator */
5887         uint32          Kt;                     /* h/w delay K factor for target */
5888         int16           vhtack;                 /* enable/disable VHT ACK */
5889         int16           N_log2[TOF_BW_SEQ_NUM]; /* simple threshold crossing */
5890         int16           w_offset[TOF_BW_NUM];   /* offset of threshold crossing window(per BW) */
5891         int16           w_len[TOF_BW_NUM];      /* length of threshold crossing window(per BW) */
5892         int32           maxDT;                  /* max time difference of T4/T1 or T3/T2 */
5893         int32           minDT;                  /* min time difference of T4/T1 or T3/T2 */
5894         uint8           totalfrmcnt;    /* total count of transfered measurement frames */
5895         uint16          rsv_media;              /* reserve media value for TOF */
5896         uint32          flags;                  /* flags */
5897         uint8           core;                   /* core to use for tx */
5898         uint8           force_K;                /* set to force value of K  */
5899         int16           N_scale[TOF_BW_SEQ_NUM]; /* simple threshold crossing */
5900         uint8           sw_adj;                 /* enable sw assisted timestamp adjustment */
5901         uint8           hw_adj;                 /* enable hw assisted timestamp adjustment */
5902         uint8           seq_en;                 /* enable ranging sequence */
5903         uint8           ftm_cnt[TOF_BW_SEQ_NUM]; /* number of ftm frames based on bandwidth */
5904         int16           N_log2_2g;              /* simple threshold crossing for 2g channel */
5905         int16           N_scale_2g;             /* simple threshold crossing for 2g channel */
5906         wl_proxd_seq_config_t seq_5g20;
5907 } BWL_POST_PACKED_STRUCT wl_proxd_params_tof_tune_t;
5908
5909 typedef struct wl_proxd_params_iovar {
5910         uint16  method;                 /* Proxmity Detection method */
5911         union {
5912                 /* common params for pdsvc */
5913                 wl_proxd_params_common_t        cmn_params;     /* common parameters */
5914                 /*  method specific */
5915                 wl_proxd_params_rssi_method_t   rssi_params;    /* RSSI method parameters */
5916                 wl_proxd_params_tof_method_t    tof_params;     /* TOF meothod parameters */
5917                 /* tune parameters */
5918                 wl_proxd_params_tof_tune_t      tof_tune;       /* TOF tune parameters */
5919         } u;                            /* Method specific optional parameters */
5920 } wl_proxd_params_iovar_t;
5921
5922 #define PROXD_COLLECT_GET_STATUS        0
5923 #define PROXD_COLLECT_SET_STATUS        1
5924 #define PROXD_COLLECT_QUERY_HEADER      2
5925 #define PROXD_COLLECT_QUERY_DATA        3
5926 #define PROXD_COLLECT_QUERY_DEBUG       4
5927 #define PROXD_COLLECT_REMOTE_REQUEST    5
5928 #define PROXD_COLLECT_DONE                      6
5929
5930 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_query {
5931         uint32          method;         /* method */
5932         uint8           request;        /* Query request. */
5933         uint8           status;         /* 0 -- disable, 1 -- enable collection, */
5934                                         /* 2 -- enable collection & debug */
5935         uint16          index;          /* The current frame index [0 to total_frames - 1]. */
5936         uint16          mode;           /* Initiator or Target */
5937         bool            busy;           /* tof sm is busy */
5938         bool            remote;         /* Remote collect data */
5939 } BWL_POST_PACKED_STRUCT wl_proxd_collect_query_t;
5940
5941 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_header {
5942         uint16          total_frames;                   /* The totral frames for this collect. */
5943         uint16          nfft;                           /* nfft value */
5944         uint16          bandwidth;                      /* bandwidth */
5945         uint16          channel;                        /* channel number */
5946         uint32          chanspec;                       /* channel spec */
5947         uint32          fpfactor;                       /* avb timer value factor */
5948         uint16          fpfactor_shift;                 /* avb timer value shift bits */
5949         int32           distance;                       /* distance calculated by fw */
5950         uint32          meanrtt;                        /* mean of RTTs */
5951         uint32          modertt;                        /* mode of RTTs */
5952         uint32          medianrtt;                      /* median of RTTs */
5953         uint32          sdrtt;                          /* standard deviation of RTTs */
5954         uint32          clkdivisor;                     /* clock divisor */
5955         uint16          chipnum;                        /* chip type */
5956         uint8           chiprev;                        /* chip revision */
5957         uint8           phyver;                         /* phy version */
5958         struct ether_addr       loaclMacAddr;           /* local mac address */
5959         struct ether_addr       remoteMacAddr;          /* remote mac address */
5960         wl_proxd_params_tof_tune_t params;
5961 } BWL_POST_PACKED_STRUCT wl_proxd_collect_header_t;
5962
5963
5964 #ifdef WL_NAN
5965 /*  ********************** NAN wl interface struct types and defs ******************** */
5966
5967 #define WL_NAN_IOCTL_VERSION    0x1
5968 #define NAN_IOC_BUFSZ  256 /**< some sufficient ioc buff size for our module */
5969 #define NAN_IOC_BUFSZ_EXT  1024 /* some sufficient ioc buff size for dump commands */
5970
5971 /*   wl_nan_sub_cmd may also be used in dhd  */
5972 typedef struct wl_nan_sub_cmd wl_nan_sub_cmd_t;
5973 typedef int (cmd_handler_t)(void *wl, const wl_nan_sub_cmd_t *cmd, char **argv);
5974 /* nan cmd list entry  */
5975 struct wl_nan_sub_cmd {
5976         char *name;
5977         uint8  version;         /* cmd  version */
5978         uint16 id;                      /* id for the dongle f/w switch/case  */
5979         uint16 type;            /* base type of argument */
5980         cmd_handler_t *handler; /* cmd handler  */
5981 };
5982
5983 /* container for nan iovtls & events */
5984 typedef BWL_PRE_PACKED_STRUCT struct wl_nan_ioc {
5985         uint16  version;        /* interface command or event version */
5986         uint16  id;                     /* nan ioctl cmd  ID  */
5987         uint16  len;            /* total length of all tlv records in data[]  */
5988         uint16  pad;            /* pad to be 32 bit aligment */
5989         uint8   data [1];       /* var len payload of bcm_xtlv_t type */
5990 } BWL_POST_PACKED_STRUCT wl_nan_ioc_t;
5991
5992 typedef struct wl_nan_status {
5993         uint8 inited;
5994         uint8 joined;
5995         uint8 role;
5996         uint8 hop_count;
5997         uint32 chspec;
5998         uint8 amr[8];                   /* Anchor Master Rank */
5999         uint32 cnt_pend_txfrm;          /* pending TX frames */
6000         uint32 cnt_bcn_tx;              /* TX disc/sync beacon count */
6001         uint32 cnt_bcn_rx;              /* RX disc/sync beacon count */
6002         uint32 cnt_svc_disc_tx;         /* TX svc disc frame count */
6003         uint32 cnt_svc_disc_rx;         /* RX svc disc frame count */
6004         struct ether_addr cid;
6005         uint32 chspec_5g;
6006 } wl_nan_status_t;
6007
6008 typedef struct wl_nan_count {
6009         uint32 cnt_bcn_tx;              /* TX disc/sync beacon count */
6010         uint32 cnt_bcn_rx;              /* RX disc/sync beacon count */
6011         uint32 cnt_svc_disc_tx;         /* TX svc disc frame count */
6012         uint32 cnt_svc_disc_rx;         /* RX svc disc frame count */
6013 } wl_nan_count_t;
6014
6015 /* various params and ctl swithce for nan_debug instance  */
6016 typedef struct nan_debug_params {
6017         uint8   enabled; /* runtime debuging enabled */
6018         uint8   collect; /* enables debug svc sdf monitor mode  */
6019         uint16  cmd;    /* debug cmd to perform a debug action */
6020         uint32  msglevel; /* msg level if enabled */
6021         uint16  status;
6022 } nan_debug_params_t;
6023
6024 /* time slot */
6025 #define NAN_MAX_TIMESLOT        32
6026 typedef struct nan_timeslot {
6027         uint32  abitmap; /* available bitmap */
6028         uint32 chanlist[NAN_MAX_TIMESLOT];
6029 } nan_timeslot_t;
6030
6031 /* nan passive scan params */
6032 #define NAN_SCAN_MAX_CHCNT 8
6033 typedef struct nan_scan_params {
6034         uint16 scan_time;
6035         uint16 home_time;
6036         uint16 ms_intvl; /* interval between merge scan */
6037         uint16 ms_dur;  /* duration of merge scan */
6038         uint16 chspec_num;
6039         uint8 pad[2];
6040         chanspec_t chspec_list[NAN_SCAN_MAX_CHCNT]; /* act. used 3, 5 rfu */
6041 } nan_scan_params_t;
6042
6043 enum wl_nan_role {
6044         WL_NAN_ROLE_AUTO = 0,
6045         WL_NAN_ROLE_NON_MASTER_NON_SYNC = 1,
6046         WL_NAN_ROLE_NON_MASTER_SYNC = 2,
6047         WL_NAN_ROLE_MASTER = 3,
6048         WL_NAN_ROLE_ANCHOR_MASTER = 4
6049 };
6050 #define NAN_MASTER_RANK_LEN 8
6051 /* nan cmd IDs */
6052 enum wl_nan_cmds {
6053          /* nan cfg /disc & dbg ioctls */
6054         WL_NAN_CMD_ENABLE = 1,
6055         WL_NAN_CMD_ATTR = 2,
6056         WL_NAN_CMD_NAN_JOIN = 3,
6057         WL_NAN_CMD_LEAVE = 4,
6058         WL_NAN_CMD_MERGE = 5,
6059         WL_NAN_CMD_STATUS = 6,
6060         WL_NAN_CMD_TSRESERVE = 7,
6061         WL_NAN_CMD_TSSCHEDULE = 8,
6062         WL_NAN_CMD_TSRELEASE = 9,
6063         WL_NAN_CMD_OUI = 10,
6064
6065         WL_NAN_CMD_COUNT = 15,
6066         WL_NAN_CMD_CLEARCOUNT = 16,
6067
6068         /*  discovery engine commands */
6069         WL_NAN_CMD_PUBLISH = 20,
6070         WL_NAN_CMD_SUBSCRIBE = 21,
6071         WL_NAN_CMD_CANCEL_PUBLISH = 22,
6072         WL_NAN_CMD_CANCEL_SUBSCRIBE = 23,
6073         WL_NAN_CMD_TRANSMIT = 24,
6074         WL_NAN_CMD_CONNECTION = 25,
6075         WL_NAN_CMD_SHOW = 26,
6076         WL_NAN_CMD_STOP = 27,   /* stop nan for a given cluster ID  */
6077         /*  nan debug iovars & cmds  */
6078         WL_NAN_CMD_SCAN_PARAMS = 46,
6079         WL_NAN_CMD_SCAN = 47,
6080         WL_NAN_CMD_SCAN_RESULTS = 48,
6081         WL_NAN_CMD_EVENT_MASK = 49,
6082         WL_NAN_CMD_EVENT_CHECK = 50,
6083         WL_NAN_CMD_DUMP = 51,
6084         WL_NAN_CMD_CLEAR = 52,
6085         WL_NAN_CMD_RSSI = 53,
6086
6087         WL_NAN_CMD_DEBUG = 60,
6088         WL_NAN_CMD_TEST1 = 61,
6089         WL_NAN_CMD_TEST2 = 62,
6090         WL_NAN_CMD_TEST3 = 63,
6091         WL_NAN_CMD_DISC_RESULTS = 64
6092 };
6093
6094 /*
6095  * tlv IDs uniquely identifies  cmd parameters
6096  * packed into wl_nan_ioc_t container
6097  */
6098 enum wl_nan_cmd_xtlv_id {
6099         /* 0x00 ~ 0xFF: standard TLV ID whose data format is the same as NAN attribute TLV */
6100         WL_NAN_XTLV_ZERO = 0,           /* used as tlv buf end marker */
6101 #ifdef NAN_STD_TLV                              /* rfu, don't use yet */
6102         WL_NAN_XTLV_MASTER_IND = 1, /* == NAN_ATTR_MASTER_IND, */
6103         WL_NAN_XTLV_CLUSTER = 2,        /* == NAN_ATTR_CLUSTER, */
6104         WL_NAN_XTLV_VENDOR = 221,       /* == NAN_ATTR_VENDOR, */
6105 #endif
6106         /* 0x02 ~ 0xFF: reserved. In case to use with the same data format as NAN attribute TLV */
6107         /* 0x100 ~ : private TLV ID defined just for NAN command */
6108         /* common types */
6109         WL_NAN_XTLV_MAC_ADDR = 0x102,   /* used in various cmds */
6110         WL_NAN_XTLV_REASON = 0x103,
6111         WL_NAN_XTLV_ENABLED = 0x104,
6112         /* explicit types, primarily for discovery engine iovars  */
6113         WL_NAN_XTLV_SVC_PARAMS = 0x120,     /* Contains required params: wl_nan_disc_params_t */
6114         WL_NAN_XTLV_MATCH_RX = 0x121,       /* Matching filter to evaluate on receive */
6115         WL_NAN_XTLV_MATCH_TX = 0x122,       /* Matching filter to send */
6116         WL_NAN_XTLV_SVC_INFO = 0x123,       /* Service specific info */
6117         WL_NAN_XTLV_SVC_NAME = 0x124,       /* Optional UTF-8 service name, for debugging. */
6118         WL_NAN_XTLV_INSTANCE_ID = 0x125,    /* Identifies unique publish or subscribe instance */
6119         WL_NAN_XTLV_PRIORITY = 0x126,       /* used in transmit cmd context */
6120         WL_NAN_XTLV_REQUESTOR_ID = 0x127,       /* Requestor instance ID */
6121         WL_NAN_XTLV_VNDR = 0x128,               /* Vendor specific attribute */
6122         WL_NAN_XTLV_SR_FILTER = 0x129,          /* Service Response Filter */
6123         WL_NAN_XTLV_FOLLOWUP = 0x130,   /* Service Info for Follow-Up SDF */
6124         WL_NAN_XTLV_PEER_INSTANCE_ID = 0x131, /* Used to parse remote instance Id */
6125         /* explicit types, primarily for NAN MAC iovars   */
6126         WL_NAN_XTLV_DW_LEN = 0x140,            /* discovery win length */
6127         WL_NAN_XTLV_BCN_INTERVAL = 0x141,      /* beacon interval, both sync and descovery bcns?  */
6128         WL_NAN_XTLV_CLUSTER_ID = 0x142,
6129         WL_NAN_XTLV_IF_ADDR = 0x143,
6130         WL_NAN_XTLV_MC_ADDR = 0x144,
6131         WL_NAN_XTLV_ROLE = 0x145,
6132         WL_NAN_XTLV_START = 0x146,
6133
6134         WL_NAN_XTLV_MASTER_PREF = 0x147,
6135         WL_NAN_XTLV_DW_INTERVAL = 0x148,
6136         WL_NAN_XTLV_PTBTT_OVERRIDE = 0x149,
6137         /*  nan status command xtlvs  */
6138         WL_NAN_XTLV_MAC_INITED = 0x14a,
6139         WL_NAN_XTLV_MAC_ENABLED = 0x14b,
6140         WL_NAN_XTLV_MAC_CHANSPEC = 0x14c,
6141         WL_NAN_XTLV_MAC_AMR = 0x14d,    /* anchormaster rank u8 amr[8] */
6142         WL_NAN_XTLV_MAC_HOPCNT = 0x14e,
6143         WL_NAN_XTLV_MAC_AMBTT = 0x14f,
6144         WL_NAN_XTLV_MAC_TXRATE = 0x150,
6145         WL_NAN_XTLV_MAC_STATUS = 0x151,  /* xtlv payload is nan_status_t */
6146         WL_NAN_XTLV_NAN_SCANPARAMS = 0x152,  /* payload is nan_scan_params_t */
6147         WL_NAN_XTLV_DEBUGPARAMS = 0x153,  /* payload is nan_scan_params_t */
6148         WL_NAN_XTLV_SUBSCR_ID = 0x154,   /* subscriber id  */
6149         WL_NAN_XTLV_PUBLR_ID = 0x155,   /* publisher id */
6150         WL_NAN_XTLV_EVENT_MASK = 0x156,
6151         WL_NAN_XTLV_MASTER_RANK = 0x158,
6152         WL_NAN_XTLV_WARM_UP_TIME = 0x159,
6153         WL_NAN_XTLV_PM_OPTION = 0x15a,
6154         WL_NAN_XTLV_OUI = 0x15b,        /* NAN OUI */
6155         WL_NAN_XTLV_MAC_COUNT = 0x15c,  /* xtlv payload is nan_count_t */
6156         /* nan timeslot management */
6157         WL_NAN_XTLV_TSRESERVE = 0x160,
6158         WL_NAN_XTLV_TSRELEASE = 0x161,
6159         WL_NAN_XTLV_IDLE_DW_TIMEOUT = 0x162,
6160         WL_NAN_XTLV_IDLE_DW_LEN = 0x163,
6161         WL_NAN_XTLV_RND_FACTOR = 0x164,
6162         WL_NAN_XTLV_SVC_DISC_TXTIME = 0x165,     /* svc disc frame tx time in DW */
6163         WL_NAN_XTLV_OPERATING_BAND = 0x166,
6164         WL_NAN_XTLV_STOP_BCN_TX = 0x167,
6165         WL_NAN_XTLV_CONCUR_SCAN = 0x168,
6166         WL_NAN_XTLV_DUMP_CLR_TYPE = 0x175, /* wl nan dump/clear subtype */
6167         WL_NAN_XTLV_PEER_RSSI = 0x176, /* xtlv payload for wl nan dump rssi */
6168         WL_NAN_XTLV_MAC_CHANSPEC_1 = 0x17A,     /* to get chanspec[1] */
6169         WL_NAN_XTLV_DISC_RESULTS = 0x17B,        /* get disc results */
6170         WL_NAN_XTLV_MAC_STATS = 0x17C /* xtlv payload for wl nan dump stats */
6171 };
6172
6173 /* Flag bits for Publish and Subscribe (wl_nan_disc_params_t flags) */
6174 #define WL_NAN_RANGE_LIMITED           0x0040
6175 /* Bits specific to Publish */
6176 /* Unsolicited transmissions */
6177 #define WL_NAN_PUB_UNSOLICIT           0x1000
6178 /* Solicited transmissions */
6179 #define WL_NAN_PUB_SOLICIT             0x2000
6180 #define WL_NAN_PUB_BOTH                0x3000
6181 /* Set for broadcast solicited transmission
6182  * Do not set for unicast solicited transmission
6183  */
6184 #define WL_NAN_PUB_BCAST               0x4000
6185 /* Generate event on each solicited transmission */
6186 #define WL_NAN_PUB_EVENT               0x8000
6187 /* Used for one-time solicited Publish functions to indicate transmision occurred */
6188 #define WL_NAN_PUB_SOLICIT_PENDING      0x10000
6189 /* Follow-up frames */
6190 #define WL_NAN_FOLLOWUP                 0x20000
6191 /* Bits specific to Subscribe */
6192 /* Active subscribe mode (Leave unset for passive) */
6193 #define WL_NAN_SUB_ACTIVE              0x1000
6194
6195 /* Special values for time to live (ttl) parameter */
6196 #define WL_NAN_TTL_UNTIL_CANCEL 0xFFFFFFFF
6197 /* Publish -  runs until first transmission
6198  * Subscribe - runs until first  DiscoveryResult event
6199  */
6200 #define WL_NAN_TTL_FIRST        0
6201
6202 /* The service hash (service id) is exactly this many bytes. */
6203 #define WL_NAN_SVC_HASH_LEN     6
6204
6205 /* Number of hash functions per bloom filter */
6206 #define WL_NAN_HASHES_PER_BLOOM 4
6207
6208 /* Instance ID type (unique identifier) */
6209 typedef uint8 wl_nan_instance_id_t;
6210
6211 /* no. of max last disc results */
6212 #define WL_NAN_MAX_DISC_RESULTS 3
6213
6214 /** Mandatory parameters for publish/subscribe iovars - NAN_TLV_SVC_PARAMS */
6215 typedef struct wl_nan_disc_params_s {
6216         /* Periodicity of unsolicited/query transmissions, in DWs */
6217         uint32 period;
6218         /* Time to live in DWs */
6219         uint32 ttl;
6220         /* Flag bits */
6221         uint32 flags;
6222         /* Publish or subscribe service id, i.e. hash of the service name */
6223         uint8 svc_hash[WL_NAN_SVC_HASH_LEN];
6224         /* pad to make 4 byte alignment, can be used for something else in the future */
6225         uint8 pad;
6226         /* Publish or subscribe id */
6227         wl_nan_instance_id_t instance_id;
6228 } wl_nan_disc_params_t;
6229
6230 /* recent discovery results */
6231 typedef struct wl_nan_disc_result_s
6232 {
6233         wl_nan_instance_id_t instance_id;       /* instance id of pub/sub req */
6234         wl_nan_instance_id_t peer_instance_id;  /* peer instance id of pub/sub req/resp */
6235         uint8 svc_hash[WL_NAN_SVC_HASH_LEN];    /* service descp string */
6236         struct ether_addr peer_mac;     /* peer mac address */
6237 } wl_nan_disc_result_t;
6238
6239 /* list of recent discovery results */
6240 typedef struct wl_nan_disc_results_s
6241 {
6242         wl_nan_disc_result_t disc_result[WL_NAN_MAX_DISC_RESULTS];
6243 } wl_nan_disc_results_list_t;
6244
6245 /*
6246 * desovery interface event structures *
6247 */
6248
6249 /* NAN Ranging */
6250
6251 /* Bit defines for global flags */
6252 #define WL_NAN_RANGING_ENABLE           1 /* enable RTT */
6253 #define WL_NAN_RANGING_RANGED           2 /* Report to host if ranged as target */
6254 typedef struct nan_ranging_config {
6255         uint32 chanspec;                /* Ranging chanspec */
6256         uint16 timeslot;                /* NAN RTT start time slot  1-511 */
6257         uint16 duration;                /* NAN RTT duration in ms */
6258         struct ether_addr allow_mac;    /* peer initiated ranging: the allowed peer mac
6259                                          * address, a unicast (for one peer) or
6260                                          * a broadcast for all. Setting it to all zeros
6261                                          * means responding to none,same as not setting
6262                                          * the flag bit NAN_RANGING_RESPOND
6263                                          */
6264         uint16 flags;
6265 } wl_nan_ranging_config_t;
6266
6267 /* list of peers for self initiated ranging */
6268 /* Bit defines for per peer flags */
6269 #define WL_NAN_RANGING_REPORT (1<<0)    /* Enable reporting range to target */
6270 typedef struct nan_ranging_peer {
6271         uint32 chanspec;                /* desired chanspec for this peer */
6272         uint32 abitmap;                 /* available bitmap */
6273         struct ether_addr ea;           /* peer MAC address */
6274         uint8 frmcnt;                   /* frame count */
6275         uint8 retrycnt;                 /* retry count */
6276         uint16 flags;                   /* per peer flags, report or not */
6277 } wl_nan_ranging_peer_t;
6278 typedef struct nan_ranging_list {
6279         uint8 count;                    /* number of MAC addresses */
6280         uint8 num_peers_done;           /* host set to 0, when read, shows number of peers
6281                                          * completed, success or fail
6282                                          */
6283         uint8 num_dws;                  /* time period to do the ranging, specified in dws */
6284         uint8 reserve;                  /* reserved field */
6285         wl_nan_ranging_peer_t rp[1];    /* variable length array of peers */
6286 } wl_nan_ranging_list_t;
6287
6288 /* ranging results, a list for self initiated ranging and one for peer initiated ranging */
6289 /* There will be one structure for each peer */
6290 #define WL_NAN_RANGING_STATUS_SUCCESS           1
6291 #define WL_NAN_RANGING_STATUS_FAIL                      2
6292 #define WL_NAN_RANGING_STATUS_TIMEOUT           3
6293 #define WL_NAN_RANGING_STATUS_ABORT             4 /* with partial results if sounding count > 0 */
6294 typedef struct nan_ranging_result {
6295         uint8 status;                   /* 1: Success, 2: Fail 3: Timeout 4: Aborted */
6296         uint8 sounding_count;           /* number of measurements completed (0 = failure) */
6297         struct ether_addr ea;           /* initiator MAC address */
6298         uint32 chanspec;                /* Chanspec where the ranging was done */
6299         uint32 timestamp;               /* 32bits of the TSF timestamp ranging was completed at */
6300         uint32 distance;                /* mean distance in meters expressed as Q4 number.
6301                                          * Only valid when sounding_count > 0. Examples:
6302                                          * 0x08 = 0.5m
6303                                          * 0x10 = 1m
6304                                          * 0x18 = 1.5m
6305                                          * set to 0xffffffff to indicate invalid number
6306                                          */
6307         int32 rtt_var;                  /* standard deviation in 10th of ns of RTTs measured.
6308                                          * Only valid when sounding_count > 0
6309                                          */
6310         struct ether_addr tgtea;        /* target MAC address */
6311 } wl_nan_ranging_result_t;
6312 typedef struct nan_ranging_event_data {
6313         uint8 mode;                     /* 1: Result of host initiated ranging */
6314                                         /* 2: Result of peer initiated ranging */
6315         uint8 reserved;
6316         uint8 success_count;            /* number of peers completed successfully */
6317         uint8 count;                    /* number of peers in the list */
6318         wl_nan_ranging_result_t rr[1];  /* variable array of ranging peers */
6319 } wl_nan_ranging_event_data_t;
6320 enum {
6321         WL_NAN_RSSI_DATA = 1,
6322         WL_NAN_STATS_DATA = 2,
6323 /*
6324  * ***** ADD before this line ****
6325  */
6326         WL_NAN_INVALID
6327 };
6328
6329 typedef struct wl_nan_stats {
6330         /* general */
6331         uint32 cnt_dw; /* DW slots */
6332         uint32 cnt_disc_bcn_sch; /* disc beacon slots */
6333         uint32 cnt_amr_exp; /* count of ambtt expiries resetting roles */
6334         uint32 cnt_bcn_upd; /* count of beacon template updates */
6335         uint32 cnt_bcn_tx; /* count of sync & disc bcn tx */
6336         uint32 cnt_bcn_rx; /* count of sync & disc bcn rx */
6337         uint32 cnt_sync_bcn_tx; /* count of sync bcn tx within DW */
6338         uint32 cnt_disc_bcn_tx; /* count of disc bcn tx */
6339         uint32 cnt_sdftx_bcmc; /* count of bcast/mcast sdf tx */
6340         uint32 cnt_sdftx_uc; /* count of unicast sdf tx */
6341         uint32 cnt_sdftx_fail; /* count of unicast sdf tx fails */
6342         uint32 cnt_sdf_rx; /* count of  sdf rx */
6343         /* NAN roles */
6344         uint32 cnt_am; /* anchor master */
6345         uint32 cnt_master; /* master */
6346         uint32 cnt_nms; /* non master sync */
6347         uint32 cnt_nmns; /* non master non sync */
6348         /* TX */
6349         uint32 cnt_err_txtime; /* error in txtime */
6350         uint32 cnt_err_unsch_tx; /* tx while not in DW/ disc bcn slot */
6351         uint32 cnt_err_bcn_tx; /*  beacon tx error */
6352         uint32 cnt_sync_bcn_tx_miss; /* no. of times time delta between 2 cosequetive
6353                                                 * sync beacons is more than dw interval
6354                                                 */
6355         /* SCANS */
6356         uint32 cnt_mrg_scan; /* count of merge scans completed */
6357         uint32 cnt_err_ms_rej; /* number of merge scan failed */
6358         uint32 cnt_scan_results; /* no. of nan beacons scanned */
6359         uint32 cnt_join_scan_rej; /* no. of join scans rejected */
6360         uint32 cnt_nan_scan_abort; /* no. of join scans rejected */
6361         /* enable/disable */
6362         uint32 cnt_nan_enab; /* no. of times nan feature got enabled */
6363         uint32 cnt_nan_disab; /* no. of times nan feature got disabled */
6364 } wl_nan_stats_t;
6365
6366 #define WL_NAN_MAC_MAX_NAN_PEERS 6
6367 #define WL_NAN_MAC_MAX_RSSI_DATA_PER_PEER  10
6368
6369 typedef struct wl_nan_nbr_rssi {
6370         uint8 rx_chan; /* channel number on which bcn rcvd */
6371         int rssi_raw;  /* received rssi value */
6372         int rssi_avg;  /* normalized rssi value */
6373 } wl_nan_peer_rssi_t;
6374
6375 typedef struct wl_nan_peer_rssi_entry {
6376         struct ether_addr mac;  /* peer mac address */
6377         uint8 flags;   /* TODO:rssi data order: latest first, oldest first etc */
6378         uint8 rssi_cnt;   /* rssi data sample present */
6379         wl_nan_peer_rssi_t rssi[WL_NAN_MAC_MAX_RSSI_DATA_PER_PEER]; /* RSSI data frm peer */
6380 } wl_nan_peer_rssi_entry_t;
6381
6382 #define WL_NAN_PEER_RSSI      0x1
6383 #define WL_NAN_PEER_RSSI_LIST 0x2
6384
6385 typedef struct wl_nan_nbr_rssi_data {
6386         uint8 flags;   /* this is a list or single rssi data */
6387         uint8 peer_cnt; /* number of peers */
6388         uint16 pad; /* padding */
6389         wl_nan_peer_rssi_entry_t peers[1]; /* peers data list */
6390 } wl_nan_peer_rssi_data_t;
6391
6392 /* ********************* end of NAN section ******************************** */
6393 #endif /* WL_NAN */
6394
6395
6396 #define RSSI_THRESHOLD_SIZE 16
6397 #define MAX_IMP_RESP_SIZE 256
6398
6399 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_rssi_bias {
6400         int32           version;                        /* version */
6401         int32           threshold[RSSI_THRESHOLD_SIZE]; /* threshold */
6402         int32           peak_offset;                    /* peak offset */
6403         int32           bias;                           /* rssi bias */
6404         int32           gd_delta;                       /* GD - GD_ADJ */
6405         int32           imp_resp[MAX_IMP_RESP_SIZE];    /* (Hi*Hi)+(Hr*Hr) */
6406 } BWL_POST_PACKED_STRUCT wl_proxd_rssi_bias_t;
6407
6408 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_rssi_bias_avg {
6409         int32           avg_threshold[RSSI_THRESHOLD_SIZE];     /* avg threshold */
6410         int32           avg_peak_offset;                        /* avg peak offset */
6411         int32           avg_rssi;                               /* avg rssi */
6412         int32           avg_bias;                               /* avg bias */
6413 } BWL_POST_PACKED_STRUCT wl_proxd_rssi_bias_avg_t;
6414
6415 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_info {
6416         uint16          type;    /* type: 0 channel table, 1 channel smoothing table, 2 and 3 seq */
6417         uint16          index;          /* The current frame index, from 1 to total_frames. */
6418         uint16          tof_cmd;        /* M_TOF_CMD      */
6419         uint16          tof_rsp;        /* M_TOF_RSP      */
6420         uint16          tof_avb_rxl;    /* M_TOF_AVB_RX_L */
6421         uint16          tof_avb_rxh;    /* M_TOF_AVB_RX_H */
6422         uint16          tof_avb_txl;    /* M_TOF_AVB_TX_L */
6423         uint16          tof_avb_txh;    /* M_TOF_AVB_TX_H */
6424         uint16          tof_id;         /* M_TOF_ID */
6425         uint8           tof_frame_type;
6426         uint8           tof_frame_bw;
6427         int8            tof_rssi;
6428         int32           tof_cfo;
6429         int32           gd_adj_ns;      /* gound delay */
6430         int32           gd_h_adj_ns;    /* group delay + threshold crossing */
6431 #ifdef RSSI_REFINE
6432         wl_proxd_rssi_bias_t rssi_bias; /* RSSI refinement info */
6433 #endif
6434         int16           nfft;           /* number of samples stored in H */
6435
6436 } BWL_POST_PACKED_STRUCT wl_proxd_collect_info_t;
6437
6438 #define k_tof_collect_H_pad  1
6439 #define k_tof_collect_H_size (256+16+k_tof_collect_H_pad)
6440 #define k_tof_collect_Hraw_size (2*k_tof_collect_H_size)
6441 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_data {
6442         wl_proxd_collect_info_t  info;
6443         uint32  H[k_tof_collect_H_size]; /* raw data read from phy used to adjust timestamps */
6444
6445 } BWL_POST_PACKED_STRUCT wl_proxd_collect_data_t;
6446
6447 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_debug_data {
6448         uint8           count;          /* number of packets */
6449         uint8           stage;          /* state machone stage */
6450         uint8           received;       /* received or txed */
6451         uint8           paket_type;     /* packet type */
6452         uint8           category;       /* category field */
6453         uint8           action;         /* action field */
6454         uint8           token;          /* token number */
6455         uint8           follow_token;   /* following token number */
6456         uint16          index;          /* index of the packet */
6457         uint16          tof_cmd;        /* M_TOF_CMD */
6458         uint16          tof_rsp;        /* M_TOF_RSP */
6459         uint16          tof_avb_rxl;    /* M_TOF_AVB_RX_L */
6460         uint16          tof_avb_rxh;    /* M_TOF_AVB_RX_H */
6461         uint16          tof_avb_txl;    /* M_TOF_AVB_TX_L */
6462         uint16          tof_avb_txh;    /* M_TOF_AVB_TX_H */
6463         uint16          tof_id;         /* M_TOF_ID */
6464         uint16          tof_status0;    /* M_TOF_STATUS_0 */
6465         uint16          tof_status2;    /* M_TOF_STATUS_2 */
6466         uint16          tof_chsm0;      /* M_TOF_CHNSM_0 */
6467         uint16          tof_phyctl0;    /* M_TOF_PHYCTL0 */
6468         uint16          tof_phyctl1;    /* M_TOF_PHYCTL1 */
6469         uint16          tof_phyctl2;    /* M_TOF_PHYCTL2 */
6470         uint16          tof_lsig;       /* M_TOF_LSIG */
6471         uint16          tof_vhta0;      /* M_TOF_VHTA0 */
6472         uint16          tof_vhta1;      /* M_TOF_VHTA1 */
6473         uint16          tof_vhta2;      /* M_TOF_VHTA2 */
6474         uint16          tof_vhtb0;      /* M_TOF_VHTB0 */
6475         uint16          tof_vhtb1;      /* M_TOF_VHTB1 */
6476         uint16          tof_apmductl;   /* M_TOF_AMPDU_CTL */
6477         uint16          tof_apmdudlim;  /* M_TOF_AMPDU_DLIM */
6478         uint16          tof_apmdulen;   /* M_TOF_AMPDU_LEN */
6479 } BWL_POST_PACKED_STRUCT wl_proxd_debug_data_t;
6480
6481 /* version of the wl_wsec_info structure */
6482 #define WL_WSEC_INFO_VERSION 0x01
6483
6484 /* start enum value for BSS properties */
6485 #define WL_WSEC_INFO_BSS_BASE 0x0100
6486
6487 /* size of len and type fields of wl_wsec_info_tlv_t struct */
6488 #define WL_WSEC_INFO_TLV_HDR_LEN OFFSETOF(wl_wsec_info_tlv_t, data)
6489
6490 /* Allowed wl_wsec_info properties; not all of them may be supported. */
6491 typedef enum {
6492         WL_WSEC_INFO_NONE = 0,
6493         WL_WSEC_INFO_MAX_KEYS = 1,
6494         WL_WSEC_INFO_NUM_KEYS = 2,
6495         WL_WSEC_INFO_NUM_HW_KEYS = 3,
6496         WL_WSEC_INFO_MAX_KEY_IDX = 4,
6497         WL_WSEC_INFO_NUM_REPLAY_CNTRS = 5,
6498         WL_WSEC_INFO_SUPPORTED_ALGOS = 6,
6499         WL_WSEC_INFO_MAX_KEY_LEN = 7,
6500         WL_WSEC_INFO_FLAGS = 8,
6501         /* add global/per-wlc properties above */
6502         WL_WSEC_INFO_BSS_FLAGS = (WL_WSEC_INFO_BSS_BASE + 1),
6503         WL_WSEC_INFO_BSS_WSEC = (WL_WSEC_INFO_BSS_BASE + 2),
6504         WL_WSEC_INFO_BSS_TX_KEY_ID = (WL_WSEC_INFO_BSS_BASE + 3),
6505         WL_WSEC_INFO_BSS_ALGO = (WL_WSEC_INFO_BSS_BASE + 4),
6506         WL_WSEC_INFO_BSS_KEY_LEN = (WL_WSEC_INFO_BSS_BASE + 5),
6507         /* add per-BSS properties above */
6508         WL_WSEC_INFO_MAX = 0xffff
6509 } wl_wsec_info_type_t;
6510
6511 /* tlv used to return wl_wsec_info properties */
6512 typedef struct {
6513         uint16 type;
6514         uint16 len;             /* data length */
6515         uint8 data[1];  /* data follows */
6516 } wl_wsec_info_tlv_t;
6517
6518 /* input/output data type for wsec_info iovar */
6519 typedef struct wl_wsec_info {
6520         uint8 version; /* structure version */
6521         uint8 pad[2];
6522         uint8 num_tlvs;
6523         wl_wsec_info_tlv_t tlvs[1]; /* tlv data follows */
6524 } wl_wsec_info_t;
6525
6526 /*
6527  * scan MAC definitions
6528  */
6529
6530 /* common iovar struct */
6531 typedef struct wl_scanmac {
6532         uint16 subcmd_id;       /* subcommand id */
6533         uint16 len;             /* total length of data[] */
6534         uint8 data[1];          /* subcommand data */
6535 } wl_scanmac_t;
6536
6537 /* subcommand ids */
6538 #define WL_SCANMAC_SUBCMD_ENABLE   0
6539 #define WL_SCANMAC_SUBCMD_BSSCFG   1   /* only GET supported */
6540 #define WL_SCANMAC_SUBCMD_CONFIG   2
6541
6542 /* scanmac enable data struct */
6543 typedef struct wl_scanmac_enable {
6544         uint8 enable;   /* 1 - enable, 0 - disable */
6545         uint8 pad[3];   /* 4-byte struct alignment */
6546 } wl_scanmac_enable_t;
6547
6548 /* scanmac bsscfg data struct */
6549 typedef struct wl_scanmac_bsscfg {
6550         uint32 bsscfg;  /* bsscfg index */
6551 } wl_scanmac_bsscfg_t;
6552
6553 /* scanmac config data struct */
6554 typedef struct wl_scanmac_config {
6555         struct ether_addr mac;  /* 6 bytes of MAC address or MAC prefix (i.e. OUI) */
6556         struct ether_addr random_mask;  /* randomized bits on each scan */
6557         uint16 scan_bitmap;     /* scans to use this MAC address */
6558         uint8 pad[2];   /* 4-byte struct alignment */
6559 } wl_scanmac_config_t;
6560
6561 /* scan bitmap */
6562 #define WL_SCANMAC_SCAN_UNASSOC         (0x01 << 0)     /* unassociated scans */
6563 #define WL_SCANMAC_SCAN_ASSOC_ROAM      (0x01 << 1)     /* associated roam scans */
6564 #define WL_SCANMAC_SCAN_ASSOC_PNO       (0x01 << 2)     /* associated PNO scans */
6565 #define WL_SCANMAC_SCAN_ASSOC_HOST      (0x01 << 3)     /* associated host scans */
6566
6567 /* no default structure packing */
6568 #include <packed_section_end.h>
6569
6570 enum rssi_reason {
6571         RSSI_REASON_UNKNOW = 0,
6572         RSSI_REASON_LOWRSSI = 1,
6573         RSSI_REASON_NSYC = 2,
6574         RSSI_REASON_TIMEOUT = 3
6575 };
6576
6577 enum tof_reason {
6578         TOF_REASON_OK = 0,
6579         TOF_REASON_REQEND = 1,
6580         TOF_REASON_TIMEOUT = 2,
6581         TOF_REASON_NOACK = 3,
6582         TOF_REASON_INVALIDAVB = 4,
6583         TOF_REASON_INITIAL = 5,
6584         TOF_REASON_ABORT = 6
6585 };
6586
6587 enum rssi_state {
6588         RSSI_STATE_POLL = 0,
6589         RSSI_STATE_TPAIRING = 1,
6590         RSSI_STATE_IPAIRING = 2,
6591         RSSI_STATE_THANDSHAKE = 3,
6592         RSSI_STATE_IHANDSHAKE = 4,
6593         RSSI_STATE_CONFIRMED = 5,
6594         RSSI_STATE_PIPELINE = 6,
6595         RSSI_STATE_NEGMODE = 7,
6596         RSSI_STATE_MONITOR = 8,
6597         RSSI_STATE_LAST = 9
6598 };
6599
6600 enum tof_state {
6601         TOF_STATE_IDLE   = 0,
6602         TOF_STATE_IWAITM = 1,
6603         TOF_STATE_TWAITM = 2,
6604         TOF_STATE_ILEGACY = 3,
6605         TOF_STATE_IWAITCL = 4,
6606         TOF_STATE_TWAITCL = 5,
6607         TOF_STATE_ICONFIRM = 6,
6608         TOF_STATE_IREPORT = 7
6609 };
6610
6611 enum tof_mode_type {
6612         TOF_LEGACY_UNKNOWN      = 0,
6613         TOF_LEGACY_AP           = 1,
6614         TOF_NONLEGACY_AP        = 2
6615 };
6616
6617 enum tof_way_type {
6618         TOF_TYPE_ONE_WAY = 0,
6619         TOF_TYPE_TWO_WAY = 1,
6620         TOF_TYPE_REPORT = 2
6621 };
6622
6623 enum tof_rate_type {
6624         TOF_FRAME_RATE_VHT = 0,
6625         TOF_FRAME_RATE_LEGACY = 1
6626 };
6627
6628 #define TOF_ADJ_TYPE_NUM        4       /* number of assisted timestamp adjustment */
6629 enum tof_adj_mode {
6630         TOF_ADJ_SOFTWARE = 0,
6631         TOF_ADJ_HARDWARE = 1,
6632         TOF_ADJ_SEQ = 2,
6633         TOF_ADJ_NONE = 3
6634 };
6635
6636 #define FRAME_TYPE_NUM          4       /* number of frame type */
6637 enum frame_type {
6638         FRAME_TYPE_CCK  = 0,
6639         FRAME_TYPE_OFDM = 1,
6640         FRAME_TYPE_11N  = 2,
6641         FRAME_TYPE_11AC = 3
6642 };
6643
6644 typedef struct wl_proxd_status_iovar {
6645         uint16                  method;                         /* method */
6646         uint8                   mode;                           /* mode */
6647         uint8                   peermode;                       /* peer mode */
6648         uint8                   state;                          /* state */
6649         uint8                   reason;                         /* reason code */
6650         uint32                  distance;                       /* distance */
6651         uint32                  txcnt;                          /* tx pkt counter */
6652         uint32                  rxcnt;                          /* rx pkt counter */
6653         struct ether_addr       peer;                           /* peer mac address */
6654         int8                    avg_rssi;                       /* average rssi */
6655         int8                    hi_rssi;                        /* highest rssi */
6656         int8                    low_rssi;                       /* lowest rssi */
6657         uint32                  dbgstatus;                      /* debug status */
6658         uint16                  frame_type_cnt[FRAME_TYPE_NUM]; /* frame types */
6659         uint8                   adj_type_cnt[TOF_ADJ_TYPE_NUM]; /* adj types HW/SW */
6660 } wl_proxd_status_iovar_t;
6661
6662 #ifdef NET_DETECT
6663 typedef struct net_detect_adapter_features {
6664         bool    wowl_enabled;
6665         bool    net_detect_enabled;
6666         bool    nlo_enabled;
6667 } net_detect_adapter_features_t;
6668
6669 typedef enum net_detect_bss_type {
6670         nd_bss_any = 0,
6671         nd_ibss,
6672         nd_ess
6673 } net_detect_bss_type_t;
6674
6675 typedef struct net_detect_profile {
6676         wlc_ssid_t              ssid;
6677         net_detect_bss_type_t   bss_type;       /* Ignore for now since Phase 1 is only for ESS */
6678         uint32                  cipher_type;    /* DOT11_CIPHER_ALGORITHM enumeration values */
6679         uint32                  auth_type;      /* DOT11_AUTH_ALGORITHM enumeration values */
6680 } net_detect_profile_t;
6681
6682 typedef struct net_detect_profile_list {
6683         uint32                  num_nd_profiles;
6684         net_detect_profile_t    nd_profile[0];
6685 } net_detect_profile_list_t;
6686
6687 typedef struct net_detect_config {
6688         bool                        nd_enabled;
6689         uint32                      scan_interval;
6690         uint32                      wait_period;
6691         bool                        wake_if_connected;
6692         bool                        wake_if_disconnected;
6693         net_detect_profile_list_t   nd_profile_list;
6694 } net_detect_config_t;
6695
6696 typedef enum net_detect_wake_reason {
6697         nd_reason_unknown,
6698         nd_net_detected,
6699         nd_wowl_event,
6700         nd_ucode_error
6701 } net_detect_wake_reason_t;
6702
6703 typedef struct net_detect_wake_data {
6704         net_detect_wake_reason_t    nd_wake_reason;
6705         uint32                      nd_wake_date_length;
6706         uint8                       nd_wake_data[0];        /* Wake data (currently unused) */
6707 } net_detect_wake_data_t;
6708
6709 #endif /* NET_DETECT */
6710
6711 /* (unversioned, deprecated) */
6712 typedef struct bcnreq {
6713         uint8 bcn_mode;
6714         int dur;
6715         int channel;
6716         struct ether_addr da;
6717         uint16 random_int;
6718         wlc_ssid_t ssid;
6719         uint16 reps;
6720 } bcnreq_t;
6721
6722 #define WL_RRM_BCN_REQ_VER              1
6723 typedef struct bcn_req {
6724         uint8 version;
6725         uint8 bcn_mode;
6726         uint8 pad_1[2];
6727         int32 dur;
6728         int32 channel;
6729         struct ether_addr da;
6730         uint16 random_int;
6731         wlc_ssid_t ssid;
6732         uint16 reps;
6733         uint8 req_elements;
6734         uint8 pad_2;
6735         chanspec_list_t chspec_list;
6736 } bcn_req_t;
6737
6738 typedef struct rrmreq {
6739         struct ether_addr da;
6740         uint8 reg;
6741         uint8 chan;
6742         uint16 random_int;
6743         uint16 dur;
6744         uint16 reps;
6745 } rrmreq_t;
6746
6747 typedef struct framereq {
6748         struct ether_addr da;
6749         uint8 reg;
6750         uint8 chan;
6751         uint16 random_int;
6752         uint16 dur;
6753         struct ether_addr ta;
6754         uint16 reps;
6755 } framereq_t;
6756
6757 typedef struct statreq {
6758         struct ether_addr da;
6759         struct ether_addr peer;
6760         uint16 random_int;
6761         uint16 dur;
6762         uint8 group_id;
6763         uint16 reps;
6764 } statreq_t;
6765
6766 #define WL_RRM_RPT_VER          0
6767 #define WL_RRM_RPT_MAX_PAYLOAD  256
6768 #define WL_RRM_RPT_MIN_PAYLOAD  7
6769 #define WL_RRM_RPT_FALG_ERR     0
6770 #define WL_RRM_RPT_FALG_GRP_ID_PROPR    (1 << 0)
6771 #define WL_RRM_RPT_FALG_GRP_ID_0        (1 << 1)
6772 typedef struct {
6773         uint16 ver;             /* version */
6774         struct ether_addr addr; /* STA MAC addr */
6775         uint32 timestamp;       /* timestamp of the report */
6776         uint16 flag;            /* flag */
6777         uint16 len;             /* length of payload data */
6778         unsigned char data[WL_RRM_RPT_MAX_PAYLOAD];
6779 } statrpt_t;
6780
6781 typedef struct wlc_l2keepalive_ol_params {
6782         uint8   flags;
6783         uint8   prio;
6784         uint16  period_ms;
6785 } wlc_l2keepalive_ol_params_t;
6786
6787 typedef struct wlc_dwds_config {
6788         uint32          enable;
6789         uint32          mode; /* STA/AP interface */
6790         struct ether_addr ea;
6791 } wlc_dwds_config_t;
6792
6793 typedef struct wl_el_set_params_s {
6794         uint8 set;      /* Set number */
6795         uint32 size;    /* Size to make/expand */
6796 } wl_el_set_params_t;
6797
6798 typedef struct wl_el_tag_params_s {
6799         uint16 tag;
6800         uint8 set;
6801         uint8 flags;
6802 } wl_el_tag_params_t;
6803
6804 /* Video Traffic Interference Monitor config */
6805 #define INTFER_VERSION          1
6806 typedef struct wl_intfer_params {
6807         uint16 version;                 /* version */
6808         uint8 period;                   /* sample period */
6809         uint8 cnt;                      /* sample cnt */
6810         uint8 txfail_thresh;    /* non-TCP txfail threshold */
6811         uint8 tcptxfail_thresh; /* tcptxfail threshold */
6812 } wl_intfer_params_t;
6813
6814 typedef struct wl_staprio_cfg {
6815         struct ether_addr ea;   /* mac addr */
6816         uint8 prio;             /* scb priority */
6817 } wl_staprio_cfg_t;
6818
6819 typedef enum wl_stamon_cfg_cmd_type {
6820         STAMON_CFG_CMD_DEL = 0,
6821         STAMON_CFG_CMD_ADD = 1
6822 } wl_stamon_cfg_cmd_type_t;
6823
6824 typedef struct wlc_stamon_sta_config {
6825         wl_stamon_cfg_cmd_type_t cmd; /* 0 - delete, 1 - add */
6826         struct ether_addr ea;
6827 } wlc_stamon_sta_config_t;
6828
6829 #ifdef SR_DEBUG
6830 typedef struct /* pmu_reg */{
6831         uint32  pmu_control;
6832         uint32  pmu_capabilities;
6833         uint32  pmu_status;
6834         uint32  res_state;
6835         uint32  res_pending;
6836         uint32  pmu_timer1;
6837         uint32  min_res_mask;
6838         uint32  max_res_mask;
6839         uint32  pmu_chipcontrol1[4];
6840         uint32  pmu_regcontrol[5];
6841         uint32  pmu_pllcontrol[5];
6842         uint32  pmu_rsrc_up_down_timer[31];
6843         uint32  rsrc_dep_mask[31];
6844 } pmu_reg_t;
6845 #endif /* pmu_reg */
6846
6847 typedef struct wl_taf_define {
6848         struct ether_addr ea;   /* STA MAC or 0xFF... */
6849         uint16 version;         /* version */
6850         uint32 sch;             /* method index */
6851         uint32 prio;            /* priority */
6852         uint32 misc;            /* used for return value */
6853         char   text[1];         /* used to pass and return ascii text */
6854 } wl_taf_define_t;
6855
6856 /* Received Beacons lengths information */
6857 #define WL_LAST_BCNS_INFO_FIXED_LEN             OFFSETOF(wlc_bcn_len_hist_t, bcnlen_ring)
6858 typedef struct wlc_bcn_len_hist {
6859         uint16  ver;                            /* version field */
6860         uint16  cur_index;                      /* current pointed index in ring buffer */
6861         uint32  max_bcnlen;             /* Max beacon length received */
6862         uint32  min_bcnlen;             /* Min beacon length received */
6863         uint32  ringbuff_len;           /* Length of the ring buffer 'bcnlen_ring' */
6864         uint32  bcnlen_ring[1]; /* ring buffer storing received beacon lengths */
6865 } wlc_bcn_len_hist_t;
6866
6867 /* WDS net interface types */
6868 #define WL_WDSIFTYPE_NONE  0x0 /* The interface type is neither WDS nor DWDS. */
6869 #define WL_WDSIFTYPE_WDS   0x1 /* The interface is WDS type. */
6870 #define WL_WDSIFTYPE_DWDS  0x2 /* The interface is DWDS type. */
6871
6872 typedef struct wl_bssload_static {
6873         bool is_static;
6874         uint16 sta_count;
6875         uint8 chan_util;
6876         uint16 aac;
6877 } wl_bssload_static_t;
6878
6879
6880 /* IO Var Operations - the Value of iov_op In wlc_ap_doiovar */
6881 typedef enum wlc_ap_iov_operation {
6882         WLC_AP_IOV_OP_DELETE                   = -1,
6883         WLC_AP_IOV_OP_DISABLE                  = 0,
6884         WLC_AP_IOV_OP_ENABLE                   = 1,
6885         WLC_AP_IOV_OP_MANUAL_AP_BSSCFG_CREATE  = 2,
6886         WLC_AP_IOV_OP_MANUAL_STA_BSSCFG_CREATE = 3,
6887         WLC_AP_IOV_OP_MOVE                     = 4
6888 } wlc_ap_iov_oper_t;
6889
6890 /* LTE coex info */
6891 /* Analogue of HCI Set MWS Signaling cmd */
6892 typedef struct {
6893         uint16  mws_rx_assert_offset;
6894         uint16  mws_rx_assert_jitter;
6895         uint16  mws_rx_deassert_offset;
6896         uint16  mws_rx_deassert_jitter;
6897         uint16  mws_tx_assert_offset;
6898         uint16  mws_tx_assert_jitter;
6899         uint16  mws_tx_deassert_offset;
6900         uint16  mws_tx_deassert_jitter;
6901         uint16  mws_pattern_assert_offset;
6902         uint16  mws_pattern_assert_jitter;
6903         uint16  mws_inact_dur_assert_offset;
6904         uint16  mws_inact_dur_assert_jitter;
6905         uint16  mws_scan_freq_assert_offset;
6906         uint16  mws_scan_freq_assert_jitter;
6907         uint16  mws_prio_assert_offset_req;
6908 } wci2_config_t;
6909
6910 /* Analogue of HCI MWS Channel Params */
6911 typedef struct {
6912         uint16  mws_rx_center_freq; /* MHz */
6913         uint16  mws_tx_center_freq;
6914         uint16  mws_rx_channel_bw;  /* KHz */
6915         uint16  mws_tx_channel_bw;
6916         uint8   mws_channel_en;
6917         uint8   mws_channel_type;   /* Don't care for WLAN? */
6918 } mws_params_t;
6919
6920 /* MWS wci2 message */
6921 typedef struct {
6922         uint8   mws_wci2_data; /* BT-SIG msg */
6923         uint16  mws_wci2_interval; /* Interval in us */
6924         uint16  mws_wci2_repeat; /* No of msgs to send */
6925 } mws_wci2_msg_t;
6926
6927 typedef struct {
6928         uint32 config;  /* MODE: AUTO (-1), Disable (0), Enable (1) */
6929         uint32 status;  /* Current state: Disabled (0), Enabled (1) */
6930 } wl_config_t;
6931
6932 #define WLC_RSDB_MODE_AUTO_MASK 0x80
6933 #define WLC_RSDB_EXTRACT_MODE(val) ((int8)((val) & (~(WLC_RSDB_MODE_AUTO_MASK))))
6934
6935 #define WL_IF_STATS_T_VERSION 1 /* current version of wl_if_stats structure */
6936
6937 /* per interface counters */
6938 typedef struct wl_if_stats {
6939         uint16  version;                /* version of the structure */
6940         uint16  length;                 /* length of the entire structure */
6941         uint32  PAD;                    /* padding */
6942
6943         /* transmit stat counters */
6944         uint64  txframe;                /* tx data frames */
6945         uint64  txbyte;                 /* tx data bytes */
6946         uint64  txerror;                /* tx data errors (derived: sum of others) */
6947         uint64  txnobuf;                /* tx out of buffer errors */
6948         uint64  txrunt;                 /* tx runt frames */
6949         uint64  txfail;                 /* tx failed frames */
6950         uint64  txretry;                /* tx retry frames */
6951         uint64  txretrie;               /* tx multiple retry frames */
6952         uint64  txfrmsnt;               /* tx sent frames */
6953         uint64  txmulti;                /* tx mulitcast sent frames */
6954         uint64  txfrag;                 /* tx fragments sent */
6955
6956         /* receive stat counters */
6957         uint64  rxframe;                /* rx data frames */
6958         uint64  rxbyte;                 /* rx data bytes */
6959         uint64  rxerror;                /* rx data errors (derived: sum of others) */
6960         uint64  rxnobuf;                /* rx out of buffer errors */
6961         uint64  rxrunt;                 /* rx runt frames */
6962         uint64  rxfragerr;              /* rx fragment errors */
6963         uint64  rxmulti;                /* rx multicast frames */
6964 }
6965 wl_if_stats_t;
6966
6967 typedef struct wl_band {
6968         uint16          bandtype;               /* WL_BAND_2G, WL_BAND_5G */
6969         uint16          bandunit;               /* bandstate[] index */
6970         uint16          phytype;                /* phytype */
6971         uint16          phyrev;
6972 }
6973 wl_band_t;
6974
6975 #define WL_WLC_VERSION_T_VERSION 1 /* current version of wlc_version structure */
6976
6977 /* wlc interface version */
6978 typedef struct wl_wlc_version {
6979         uint16  version;                /* version of the structure */
6980         uint16  length;                 /* length of the entire structure */
6981
6982         /* epi version numbers */
6983         uint16  epi_ver_major;          /* epi major version number */
6984         uint16  epi_ver_minor;          /* epi minor version number */
6985         uint16  epi_rc_num;             /* epi RC number */
6986         uint16  epi_incr_num;           /* epi increment number */
6987
6988         /* wlc interface version numbers */
6989         uint16  wlc_ver_major;          /* wlc interface major version number */
6990         uint16  wlc_ver_minor;          /* wlc interface minor version number */
6991 }
6992 wl_wlc_version_t;
6993
6994 /* Version of WLC interface to be returned as a part of wl_wlc_version structure.
6995  * For the discussion related to versions update policy refer to
6996  * http://hwnbu-twiki.broadcom.com/bin/view/Mwgroup/WlShimAbstractionLayer
6997  * For now the policy is to increment WLC_VERSION_MAJOR each time
6998  * there is a change that involves both WLC layer and per-port layer.
6999  * WLC_VERSION_MINOR is currently not in use.
7000  */
7001 #define WLC_VERSION_MAJOR       3
7002 #define WLC_VERSION_MINOR       0
7003
7004 /* begin proxd definitions */
7005 #include <packed_section_start.h>
7006
7007 #define WL_PROXD_API_VERSION 0x0300     /* version 3.0 */
7008
7009 /* Minimum supported API version */
7010 #define WL_PROXD_API_MIN_VERSION 0x0300
7011
7012 /* proximity detection methods */
7013 enum {
7014         WL_PROXD_METHOD_NONE    = 0,
7015         WL_PROXD_METHOD_RSVD1   = 1, /* backward compatibility - RSSI, not supported */
7016         WL_PROXD_METHOD_TOF             = 2,
7017         WL_PROXD_METHOD_RSVD2   = 3, /* 11v only - if needed */
7018         WL_PROXD_METHOD_FTM             = 4, /* IEEE rev mc/2014 */
7019         WL_PROXD_METHOD_MAX
7020 };
7021 typedef int16 wl_proxd_method_t;
7022
7023 /* global and method configuration flags */
7024 enum {
7025         WL_PROXD_FLAG_NONE                      = 0x00000000,
7026         WL_PROXD_FLAG_RX_ENABLED        = 0x00000001, /* respond to requests */
7027         WL_PROXD_FLAG_RX_RANGE_REQ      = 0x00000002, /* 11mc range requests enabled */
7028         WL_PROXD_FLAG_TX_LCI            = 0x00000004, /* transmit location, if available */
7029         WL_PROXD_FLAG_TX_CIVIC          = 0x00000008, /* tx civic loc, if available */
7030         WL_PROXD_FLAG_RX_AUTO_BURST     = 0x00000010, /* respond to requests w/o host action */
7031         WL_PROXD_FLAG_TX_AUTO_BURST     = 0x00000020, /* continue requests w/o host action */
7032         WL_PROXD_FLAG_AVAIL_PUBLISH = 0x00000040, /* publish availability */
7033         WL_PROXD_FLAG_AVAIL_SCHEDULE = 0x00000080, /* schedule using availability */
7034         WL_PROXD_FLAG_ALL                       = 0xffffffff
7035 };
7036 typedef uint32 wl_proxd_flags_t;
7037
7038 #define WL_PROXD_FLAGS_AVAIL (WL_PROXD_FLAG_AVAIL_PUBLISH | \
7039         WL_PROXD_FLAG_AVAIL_SCHEDULE)
7040
7041 /* session flags */
7042 enum {
7043         WL_PROXD_SESSION_FLAG_NONE                      = 0x00000000,  /* no flags */
7044         WL_PROXD_SESSION_FLAG_INITIATOR         = 0x00000001,  /* local device is initiator */
7045         WL_PROXD_SESSION_FLAG_TARGET            = 0x00000002,  /* local device is target */
7046         WL_PROXD_SESSION_FLAG_ONE_WAY           = 0x00000004,  /* (initiated) 1-way rtt */
7047         WL_PROXD_SESSION_FLAG_AUTO_BURST        = 0x00000008,  /* created w/ rx_auto_burst */
7048         WL_PROXD_SESSION_FLAG_PERSIST           = 0x00000010,  /* good until cancelled */
7049         WL_PROXD_SESSION_FLAG_RTT_DETAIL        = 0x00000020,  /* rtt detail in results */
7050         WL_PROXD_SESSION_FLAG_TOF_COMPAT        = 0x00000040,  /* TOF  compatibility - TBD */
7051         WL_PROXD_SESSION_FLAG_AOA                       = 0x00000080,  /* AOA along w/ RTT */
7052         WL_PROXD_SESSION_FLAG_RX_AUTO_BURST     = 0x00000100,  /* Same as proxd flags above */
7053         WL_PROXD_SESSION_FLAG_TX_AUTO_BURST     = 0x00000200,  /* Same as proxd flags above */
7054         WL_PROXD_SESSION_FLAG_NAN_BSS           = 0x00000400,  /* Use NAN BSS, if applicable */
7055         WL_PROXD_SESSION_FLAG_TS1                       = 0x00000800,  /* e.g. FTM1 - cap or rx */
7056         WL_PROXD_SESSION_FLAG_REPORT_FAILURE= 0x00002000, /* report failure to target */
7057         WL_PROXD_SESSION_FLAG_INITIATOR_RPT     = 0x00004000, /* report distance to target */
7058         WL_PROXD_SESSION_FLAG_NOCHANSWT         = 0x00008000, /* No channel switching */
7059         WL_PROXD_SESSION_FLAG_NETRUAL           = 0x00010000, /* netrual mode */
7060         WL_PROXD_SESSION_FLAG_SEQ_EN            = 0x00020000, /* Toast */
7061         WL_PROXD_SESSION_FLAG_NO_PARAM_OVRD     = 0x00040000, /* no param override from target */
7062         WL_PROXD_SESSION_FLAG_ASAP                      = 0x00080000, /* ASAP session */
7063         WL_PROXD_SESSION_FLAG_REQ_LCI           = 0x00100000, /* transmit LCI req */
7064         WL_PROXD_SESSION_FLAG_REQ_CIV           = 0x00200000, /* transmit civic loc req */
7065         WL_PROXD_SESSION_FLAG_COLLECT           = 0x80000000,   /* debug - collect */
7066         WL_PROXD_SESSION_FLAG_ALL                       = 0xffffffff
7067 };
7068 typedef uint32 wl_proxd_session_flags_t;
7069
7070 /* time units - mc supports up to 0.1ns resolution */
7071 enum {
7072         WL_PROXD_TMU_TU                 = 0,            /* 1024us */
7073         WL_PROXD_TMU_SEC                = 1,
7074         WL_PROXD_TMU_MILLI_SEC  = 2,
7075         WL_PROXD_TMU_MICRO_SEC  = 3,
7076         WL_PROXD_TMU_NANO_SEC   = 4,
7077         WL_PROXD_TMU_PICO_SEC   = 5
7078 };
7079 typedef int16 wl_proxd_tmu_t;
7080
7081 /* time interval e.g. 10ns */
7082 typedef struct wl_proxd_intvl {
7083         uint32 intvl;
7084         wl_proxd_tmu_t tmu;
7085         uint8   pad[2];
7086 } wl_proxd_intvl_t;
7087
7088 /* commands that can apply to proxd, method or a session */
7089 enum {
7090         WL_PROXD_CMD_NONE                               = 0,
7091         WL_PROXD_CMD_GET_VERSION                = 1,
7092         WL_PROXD_CMD_ENABLE                     = 2,
7093         WL_PROXD_CMD_DISABLE                    = 3,
7094         WL_PROXD_CMD_CONFIG                     = 4,
7095         WL_PROXD_CMD_START_SESSION              = 5,
7096         WL_PROXD_CMD_BURST_REQUEST              = 6,
7097         WL_PROXD_CMD_STOP_SESSION               = 7,
7098         WL_PROXD_CMD_DELETE_SESSION     = 8,
7099         WL_PROXD_CMD_GET_RESULT                 = 9,
7100         WL_PROXD_CMD_GET_INFO                   = 10,
7101         WL_PROXD_CMD_GET_STATUS                 = 11,
7102         WL_PROXD_CMD_GET_SESSIONS               = 12,
7103         WL_PROXD_CMD_GET_COUNTERS               = 13,
7104         WL_PROXD_CMD_CLEAR_COUNTERS     = 14,
7105         WL_PROXD_CMD_COLLECT                    = 15,
7106         WL_PROXD_CMD_TUNE                               = 16,
7107         WL_PROXD_CMD_DUMP                               = 17,
7108         WL_PROXD_CMD_START_RANGING              = 18,
7109         WL_PROXD_CMD_STOP_RANGING               = 19,
7110         WL_PROXD_CMD_GET_RANGING_INFO   = 20,
7111         WL_PROXD_CMD_IS_TLV_SUPPORTED   = 21,
7112
7113         WL_PROXD_CMD_MAX
7114 };
7115 typedef int16 wl_proxd_cmd_t;
7116
7117 /* session ids:
7118  * id 0 is reserved
7119  * ids 1..0x7fff - allocated by host/app
7120  * 0x8000-0xffff - allocated by firmware, used for auto/rx
7121  */
7122 enum {
7123          WL_PROXD_SESSION_ID_GLOBAL = 0
7124 };
7125
7126 #define WL_PROXD_SID_HOST_MAX 0x7fff
7127 #define WL_PROXD_SID_HOST_ALLOC(_sid) ((_sid) > 0 && (_sid) <= WL_PROXD_SID_HOST_MAX)
7128
7129 /* maximum number sessions that can be allocated, may be less if tunable */
7130 #define WL_PROXD_MAX_SESSIONS 16
7131
7132 typedef uint16 wl_proxd_session_id_t;
7133
7134 /* status - TBD BCME_ vs proxd status - range reserved for BCME_ */
7135 enum {
7136         WL_PROXD_E_POLICY                       = -1045,
7137         WL_PROXD_E_INCOMPLETE           = -1044,
7138         WL_PROXD_E_OVERRIDDEN           = -1043,
7139         WL_PROXD_E_ASAP_FAILED          = -1042,
7140         WL_PROXD_E_NOTSTARTED           = -1041,
7141         WL_PROXD_E_INVALIDAVB           = -1040,
7142         WL_PROXD_E_INCAPABLE            = -1039,
7143         WL_PROXD_E_MISMATCH                     = -1038,
7144         WL_PROXD_E_DUP_SESSION          = -1037,
7145         WL_PROXD_E_REMOTE_FAIL          = -1036,
7146         WL_PROXD_E_REMOTE_INCAPABLE = -1035,
7147         WL_PROXD_E_SCHED_FAIL           = -1034,
7148         WL_PROXD_E_PROTO                        = -1033,
7149         WL_PROXD_E_EXPIRED                      = -1032,
7150         WL_PROXD_E_TIMEOUT                      = -1031,
7151         WL_PROXD_E_NOACK                        = -1030,
7152         WL_PROXD_E_DEFERRED                     = -1029,
7153         WL_PROXD_E_INVALID_SID          = -1028,
7154         WL_PROXD_E_REMOTE_CANCEL        = -1027,
7155         WL_PROXD_E_CANCELED                     = -1026,        /* local */
7156         WL_PROXD_E_INVALID_SESSION      = -1025,
7157         WL_PROXD_E_BAD_STATE            = -1024,
7158         WL_PROXD_E_ERROR                        = -1,
7159         WL_PROXD_E_OK                           = 0
7160 };
7161 typedef int32 wl_proxd_status_t;
7162
7163 /* session states */
7164 enum {
7165         WL_PROXD_SESSION_STATE_NONE                             = 0,
7166         WL_PROXD_SESSION_STATE_CREATED                  = 1,
7167         WL_PROXD_SESSION_STATE_CONFIGURED               = 2,
7168         WL_PROXD_SESSION_STATE_STARTED                  = 3,
7169         WL_PROXD_SESSION_STATE_DELAY                    = 4,
7170         WL_PROXD_SESSION_STATE_USER_WAIT                = 5,
7171         WL_PROXD_SESSION_STATE_SCHED_WAIT               = 6,
7172         WL_PROXD_SESSION_STATE_BURST                    = 7,
7173         WL_PROXD_SESSION_STATE_STOPPING                 = 8,
7174         WL_PROXD_SESSION_STATE_ENDED                    = 9,
7175         WL_PROXD_SESSION_STATE_DESTROYING               = -1
7176 };
7177 typedef int16 wl_proxd_session_state_t;
7178
7179 /* RTT sample flags */
7180 enum {
7181         WL_PROXD_RTT_SAMPLE_NONE                = 0x00,
7182         WL_PROXD_RTT_SAMPLE_DISCARD     = 0x01
7183 };
7184 typedef uint8 wl_proxd_rtt_sample_flags_t;
7185
7186 typedef struct wl_proxd_rtt_sample {
7187         uint8                           id;                     /* id for the sample - non-zero */
7188         wl_proxd_rtt_sample_flags_t     flags;
7189         int16                           rssi;
7190         wl_proxd_intvl_t        rtt;            /* round trip time */
7191         uint32                          ratespec;
7192 } wl_proxd_rtt_sample_t;
7193
7194 /*  result flags */
7195 enum {
7196         WL_PRXOD_RESULT_FLAG_NONE       = 0x0000,
7197         WL_PROXD_RESULT_FLAG_NLOS       = 0x0001,       /* LOS - if available */
7198         WL_PROXD_RESULT_FLAG_LOS    = 0x0002,   /* NLOS - if available */
7199         WL_PROXD_RESULT_FLAG_FATAL      = 0x0004,       /* Fatal error during burst */
7200         WL_PROXD_RESULT_FLAG_ALL        = 0xffff
7201 };
7202 typedef int16 wl_proxd_result_flags_t;
7203
7204 /* rtt measurement result */
7205 typedef struct wl_proxd_rtt_result {
7206         wl_proxd_session_id_t                   sid;
7207         wl_proxd_result_flags_t                 flags;
7208         wl_proxd_status_t                               status;
7209         struct ether_addr                               peer;
7210         wl_proxd_session_state_t                state;          /* current state */
7211         union {
7212                 wl_proxd_intvl_t                        retry_after; /* hint for errors */
7213                 wl_proxd_intvl_t                        burst_duration; /* burst duration */
7214         } u;
7215         wl_proxd_rtt_sample_t                   avg_rtt;
7216         uint32                                                  avg_dist;       /* 1/256m units */
7217         uint16                                                  sd_rtt; /* RTT standard deviation */
7218         uint8                                           num_valid_rtt; /* valid rtt cnt */
7219         uint8                                           num_ftm; /* actual num of ftm cnt */
7220         uint16                                                  burst_num;      /* in a session */
7221         uint16                                                  num_rtt;        /* 0 if no detail */
7222         wl_proxd_rtt_sample_t                   rtt[1];         /* variable */
7223 } wl_proxd_rtt_result_t;
7224
7225 /* aoa measurement result */
7226 typedef struct wl_proxd_aoa_result {
7227         wl_proxd_session_id_t                   sid;
7228         wl_proxd_result_flags_t                 flags;
7229         wl_proxd_status_t                               status;
7230         struct ether_addr                               peer;
7231         wl_proxd_session_state_t                state;
7232         uint16                                                  burst_num;
7233         uint8                                                   pad[2];
7234         /* wl_proxd_aoa_sample_t sample_avg; TBD */
7235 } BWL_POST_PACKED_STRUCT wl_proxd_aoa_result_t;
7236
7237 /* global stats */
7238 typedef struct wl_proxd_counters {
7239         uint32 tx;                                      /* tx frame count */
7240         uint32 rx;                                      /* rx frame count */
7241         uint32 burst;                           /* total number of burst */
7242         uint32 sessions;                        /* total number of sessions */
7243         uint32 max_sessions;            /* max concurrency */
7244         uint32 sched_fail;                      /* scheduling failures */
7245         uint32 timeouts;                        /* timeouts */
7246         uint32 protoerr;                        /* protocol errors */
7247         uint32 noack;                           /* tx w/o ack */
7248         uint32 txfail;                          /* any tx falure */
7249         uint32 lci_req_tx;                      /* tx LCI requests */
7250         uint32 lci_req_rx;                      /* rx LCI requests */
7251         uint32 lci_rep_tx;                      /* tx LCI reports */
7252         uint32 lci_rep_rx;                      /* rx LCI reports */
7253         uint32 civic_req_tx;            /* tx civic requests */
7254         uint32 civic_req_rx;            /* rx civic requests */
7255         uint32 civic_rep_tx;            /* tx civic reports */
7256         uint32 civic_rep_rx;            /* rx civic reports */
7257         uint32 rctx;                            /* ranging contexts created */
7258         uint32 rctx_done;                       /* count of ranging done */
7259         uint32 publish_err;     /* availability publishing errors */
7260         uint32 on_chan;         /* count of scheduler onchan */
7261         uint32 off_chan;        /* count of scheduler offchan */
7262 } wl_proxd_counters_t;
7263
7264 typedef struct wl_proxd_counters wl_proxd_session_counters_t;
7265
7266 enum {
7267         WL_PROXD_CAP_NONE               = 0x0000,
7268         WL_PROXD_CAP_ALL                = 0xffff
7269 };
7270 typedef int16 wl_proxd_caps_t;
7271
7272 /* method capabilities */
7273 enum {
7274         WL_PROXD_FTM_CAP_NONE = 0x0000,
7275         WL_PROXD_FTM_CAP_FTM1 = 0x0001
7276 };
7277 typedef uint16 wl_proxd_ftm_caps_t;
7278
7279 typedef struct BWL_PRE_PACKED_STRUCT wl_proxd_tlv_id_list {
7280         uint16                  num_ids;
7281         uint16                  ids[1];
7282 } BWL_POST_PACKED_STRUCT wl_proxd_tlv_id_list_t;
7283
7284 typedef struct wl_proxd_session_id_list {
7285         uint16 num_ids;
7286         wl_proxd_session_id_t ids[1];
7287 } wl_proxd_session_id_list_t;
7288
7289 /* tlvs returned for get_info on ftm method
7290  * configuration:
7291  *              proxd flags
7292  *      event mask
7293  *      debug mask
7294  *      session defaults (session tlvs)
7295  * status tlv - not supported for ftm method
7296  * info tlv
7297  */
7298 typedef struct wl_proxd_ftm_info {
7299         wl_proxd_ftm_caps_t caps;
7300         uint16 max_sessions;
7301         uint16 num_sessions;
7302         uint16 rx_max_burst;
7303 } wl_proxd_ftm_info_t;
7304
7305 /* tlvs returned for get_info on session
7306  * session config (tlvs)
7307  * session info tlv
7308  */
7309 typedef struct wl_proxd_ftm_session_info {
7310         uint16 sid;
7311         uint8 bss_index;
7312         uint8 pad;
7313         struct ether_addr bssid;
7314         wl_proxd_session_state_t state;
7315         wl_proxd_status_t status;
7316         uint16  burst_num;
7317 } wl_proxd_ftm_session_info_t;
7318
7319 typedef struct wl_proxd_ftm_session_status {
7320         uint16 sid;
7321         wl_proxd_session_state_t state;
7322         wl_proxd_status_t status;
7323         uint16  burst_num;
7324 } wl_proxd_ftm_session_status_t;
7325
7326 /* rrm range request */
7327 typedef struct wl_proxd_range_req {
7328         uint16                  num_repeat;
7329         uint16                  init_delay_range;       /* in TUs */
7330         uint8                   pad;
7331         uint8                   num_nbr;                        /* number of (possible) neighbors */
7332         nbr_element_t   nbr[1];
7333 } wl_proxd_range_req_t;
7334
7335 #define WL_PROXD_LCI_LAT_OFF    0
7336 #define WL_PROXD_LCI_LONG_OFF   5
7337 #define WL_PROXD_LCI_ALT_OFF    10
7338
7339 #define WL_PROXD_LCI_GET_LAT(_lci, _lat, _lat_err) { \
7340         unsigned _off = WL_PROXD_LCI_LAT_OFF; \
7341         _lat_err = (_lci)->data[(_off)] & 0x3f; \
7342         _lat = (_lci)->data[(_off)+1]; \
7343         _lat |= (_lci)->data[(_off)+2] << 8; \
7344         _lat |= (_lci)->data[_(_off)+3] << 16; \
7345         _lat |= (_lci)->data[(_off)+4] << 24; \
7346         _lat <<= 2; \
7347         _lat |= (_lci)->data[(_off)] >> 6; \
7348 }
7349
7350 #define WL_PROXD_LCI_GET_LONG(_lci, _lcilong, _long_err) { \
7351         unsigned _off = WL_PROXD_LCI_LONG_OFF; \
7352         _long_err = (_lci)->data[(_off)] & 0x3f; \
7353         _lcilong = (_lci)->data[(_off)+1]; \
7354         _lcilong |= (_lci)->data[(_off)+2] << 8; \
7355         _lcilong |= (_lci)->data[_(_off)+3] << 16; \
7356         _lcilong |= (_lci)->data[(_off)+4] << 24; \
7357         __lcilong <<= 2; \
7358         _lcilong |= (_lci)->data[(_off)] >> 6; \
7359 }
7360
7361 #define WL_PROXD_LCI_GET_ALT(_lci, _alt_type, _alt, _alt_err) { \
7362         unsigned _off = WL_PROXD_LCI_ALT_OFF; \
7363         _alt_type = (_lci)->data[_off] & 0x0f; \
7364         _alt_err = (_lci)->data[(_off)] >> 4; \
7365         _alt_err |= ((_lci)->data[(_off)+1] & 0x03) << 4; \
7366         _alt = (_lci)->data[(_off)+2]; \
7367         _alt |= (_lci)->data[(_off)+3] << 8; \
7368         _alt |= (_lci)->data[_(_off)+4] << 16; \
7369         _alt <<= 6; \
7370         _alt |= (_lci)->data[(_off) + 1] >> 2; \
7371 }
7372
7373 #define WL_PROXD_LCI_VERSION(_lci) ((_lci)->data[15] >> 6)
7374
7375 /* availability. advertising mechanism bss specific */
7376 /* availablity flags */
7377 enum {
7378         WL_PROXD_AVAIL_NONE = 0,
7379         WL_PROXD_AVAIL_NAN_PUBLISHED = 0x0001,
7380         WL_PROXD_AVAIL_SCHEDULED = 0x0002        /* scheduled by proxd */
7381 };
7382 typedef int16 wl_proxd_avail_flags_t;
7383
7384 /* time reference */
7385 enum {
7386         WL_PROXD_TREF_NONE = 0,
7387         WL_PROXD_TREF_DEV_TSF = 1,
7388         WL_PROXD_TREF_NAN_DW = 2,
7389         WL_PROXD_TREF_TBTT = 3,
7390         WL_PROXD_TREF_MAX               /* last entry */
7391 };
7392 typedef int16 wl_proxd_time_ref_t;
7393
7394 /* proxd channel-time slot */
7395 typedef struct {
7396         wl_proxd_intvl_t start;         /* from ref */
7397         wl_proxd_intvl_t duration;      /* from start */
7398         uint32  chanspec;
7399 } wl_proxd_time_slot_t;
7400
7401 typedef struct wl_proxd_avail24 {
7402         wl_proxd_avail_flags_t flags; /* for query only */
7403         wl_proxd_time_ref_t time_ref;
7404         uint16  max_slots; /* for query only */
7405         uint16  num_slots;
7406         wl_proxd_time_slot_t slots[1];  /* ROM compat - not used */
7407         wl_proxd_intvl_t        repeat;
7408         wl_proxd_time_slot_t ts0[1];
7409 } wl_proxd_avail24_t;
7410 #define WL_PROXD_AVAIL24_TIMESLOT(_avail24, _i) (&(_avail24)->ts0[(_i)])
7411 #define WL_PROXD_AVAIL24_TIMESLOT_OFFSET(_avail24) OFFSETOF(wl_proxd_avail24_t, ts0)
7412 #define WL_PROXD_AVAIL24_TIMESLOTS(_avail24) WL_PROXD_AVAIL24_TIMESLOT(_avail24, 0)
7413 #define WL_PROXD_AVAIL24_SIZE(_avail24, _num_slots) (\
7414         WL_PROXD_AVAIL24_TIMESLOT_OFFSET(_avail24) + \
7415         (_num_slots) * sizeof(*WL_PROXD_AVAIL24_TIMESLOT(_avail24, 0)))
7416
7417 typedef struct wl_proxd_avail {
7418         wl_proxd_avail_flags_t flags; /* for query only */
7419         wl_proxd_time_ref_t time_ref;
7420         uint16  max_slots; /* for query only */
7421         uint16  num_slots;
7422         wl_proxd_intvl_t        repeat;
7423         wl_proxd_time_slot_t slots[1];
7424 } wl_proxd_avail_t;
7425 #define WL_PROXD_AVAIL_TIMESLOT(_avail, _i) (&(_avail)->slots[(_i)])
7426 #define WL_PROXD_AVAIL_TIMESLOT_OFFSET(_avail) OFFSETOF(wl_proxd_avail_t, slots)
7427
7428 #define WL_PROXD_AVAIL_TIMESLOTS(_avail) WL_PROXD_AVAIL_TIMESLOT(_avail, 0)
7429 #define WL_PROXD_AVAIL_SIZE(_avail, _num_slots) (\
7430         WL_PROXD_AVAIL_TIMESLOT_OFFSET(_avail) + \
7431         (_num_slots) * sizeof(*WL_PROXD_AVAIL_TIMESLOT(_avail, 0)))
7432
7433 /* collect support TBD */
7434
7435 /* debugging */
7436 enum {
7437         WL_PROXD_DEBUG_NONE             = 0x00000000,
7438         WL_PROXD_DEBUG_LOG              = 0x00000001,
7439         WL_PROXD_DEBUG_IOV              = 0x00000002,
7440         WL_PROXD_DEBUG_EVENT    = 0x00000004,
7441         WL_PROXD_DEBUG_SESSION  = 0x00000008,
7442         WL_PROXD_DEBUG_PROTO    = 0x00000010,
7443         WL_PROXD_DEBUG_SCHED    = 0x00000020,
7444         WL_PROXD_DEBUG_RANGING  = 0x00000040,
7445         WL_PROXD_DEBUG_ALL              = 0xffffffff
7446 };
7447 typedef uint32 wl_proxd_debug_mask_t;
7448
7449 /* tlv IDs - data length 4 bytes unless overridden by type, alignment 32 bits */
7450 enum {
7451         WL_PROXD_TLV_ID_NONE                    = 0,
7452         WL_PROXD_TLV_ID_METHOD                  = 1,
7453         WL_PROXD_TLV_ID_FLAGS                   = 2,
7454         WL_PROXD_TLV_ID_CHANSPEC                = 3,    /* note: uint32 */
7455         WL_PROXD_TLV_ID_TX_POWER                = 4,
7456         WL_PROXD_TLV_ID_RATESPEC                = 5,
7457         WL_PROXD_TLV_ID_BURST_DURATION  = 6,    /* intvl - length of burst */
7458         WL_PROXD_TLV_ID_BURST_PERIOD    = 7,    /* intvl - between bursts */
7459         WL_PROXD_TLV_ID_BURST_FTM_SEP   = 8,    /* intvl - between FTMs */
7460         WL_PROXD_TLV_ID_BURST_NUM_FTM   = 9,    /* uint16 - per burst */
7461         WL_PROXD_TLV_ID_NUM_BURST               = 10,   /* uint16 */
7462         WL_PROXD_TLV_ID_FTM_RETRIES     = 11,   /* uint16 at FTM level */
7463         WL_PROXD_TLV_ID_BSS_INDEX               = 12,   /* uint8 */
7464         WL_PROXD_TLV_ID_BSSID                   = 13,
7465         WL_PROXD_TLV_ID_INIT_DELAY              = 14,   /* intvl - optional, non-standalone only */
7466         WL_PROXD_TLV_ID_BURST_TIMEOUT   = 15,   /* expect response within - intvl */
7467         WL_PROXD_TLV_ID_EVENT_MASK              = 16,   /* interested events - in/out */
7468         WL_PROXD_TLV_ID_FLAGS_MASK              = 17,   /* interested flags - in only */
7469         WL_PROXD_TLV_ID_PEER_MAC                = 18,   /* mac address of peer */
7470         WL_PROXD_TLV_ID_FTM_REQ                 = 19,   /* dot11_ftm_req */
7471         WL_PROXD_TLV_ID_LCI_REQ                 = 20,
7472         WL_PROXD_TLV_ID_LCI                     = 21,
7473         WL_PROXD_TLV_ID_CIVIC_REQ               = 22,
7474         WL_PROXD_TLV_ID_CIVIC                   = 23,
7475         WL_PROXD_TLV_ID_AVAIL24                 = 24,           /* ROM compatibility */
7476         WL_PROXD_TLV_ID_SESSION_FLAGS   = 25,
7477         WL_PROXD_TLV_ID_SESSION_FLAGS_MASK      = 26,   /* in only */
7478         WL_PROXD_TLV_ID_RX_MAX_BURST = 27,              /* uint16 - limit bursts per session */
7479         WL_PROXD_TLV_ID_RANGING_INFO    = 28,   /* ranging info */
7480         WL_PROXD_TLV_ID_RANGING_FLAGS   = 29,   /* uint16 */
7481         WL_PROXD_TLV_ID_RANGING_FLAGS_MASK      = 30,   /* uint16, in only */
7482         WL_PROXD_TLV_ID_NAN_MAP_ID          = 31,
7483         WL_PROXD_TLV_ID_DEV_ADDR            = 32,
7484         WL_PROXD_TLV_ID_AVAIL                   = 33,           /* wl_proxd_avail_t  */
7485         WL_PROXD_TLV_ID_TLV_ID        = 34,    /* uint16 tlv-id */
7486         WL_PROXD_TLV_ID_FTM_REQ_RETRIES  = 35, /* uint16 FTM request retries */
7487
7488         /* output - 512 + x */
7489         WL_PROXD_TLV_ID_STATUS                  = 512,
7490         WL_PROXD_TLV_ID_COUNTERS                = 513,
7491         WL_PROXD_TLV_ID_INFO                    = 514,
7492         WL_PROXD_TLV_ID_RTT_RESULT              = 515,
7493         WL_PROXD_TLV_ID_AOA_RESULT              = 516,
7494         WL_PROXD_TLV_ID_SESSION_INFO    = 517,
7495         WL_PROXD_TLV_ID_SESSION_STATUS  = 518,
7496         WL_PROXD_TLV_ID_SESSION_ID_LIST = 519,
7497
7498         /* debug tlvs can be added starting 1024 */
7499         WL_PROXD_TLV_ID_DEBUG_MASK      = 1024,
7500         WL_PROXD_TLV_ID_COLLECT         = 1025,         /* output only */
7501         WL_PROXD_TLV_ID_STRBUF          = 1026,
7502
7503         WL_PROXD_TLV_ID_MAX
7504 };
7505
7506 typedef struct wl_proxd_tlv {
7507         uint16 id;
7508         uint16 len;
7509         uint8  data[1];
7510 } wl_proxd_tlv_t;
7511
7512 /* proxd iovar - applies to proxd, method or session */
7513 typedef struct wl_proxd_iov {
7514         uint16                                  version;
7515         uint16                                  len;
7516         wl_proxd_cmd_t                  cmd;
7517         wl_proxd_method_t               method;
7518         wl_proxd_session_id_t   sid;
7519         uint8                                   pad[2];
7520         wl_proxd_tlv_t                  tlvs[1];        /* variable */
7521 } wl_proxd_iov_t;
7522
7523 #define WL_PROXD_IOV_HDR_SIZE OFFSETOF(wl_proxd_iov_t, tlvs)
7524
7525 /* The following event definitions may move to bcmevent.h, but sharing proxd types
7526  * across needs more invasive changes unrelated to proxd
7527  */
7528 enum {
7529         WL_PROXD_EVENT_NONE                             = 0,    /* not an event, reserved */
7530         WL_PROXD_EVENT_SESSION_CREATE   = 1,
7531         WL_PROXD_EVENT_SESSION_START    = 2,
7532         WL_PROXD_EVENT_FTM_REQ                  = 3,
7533         WL_PROXD_EVENT_BURST_START              = 4,
7534         WL_PROXD_EVENT_BURST_END                = 5,
7535         WL_PROXD_EVENT_SESSION_END              = 6,
7536         WL_PROXD_EVENT_SESSION_RESTART  = 7,
7537         WL_PROXD_EVENT_BURST_RESCHED    = 8,    /* burst rescheduled - e.g. partial TSF */
7538         WL_PROXD_EVENT_SESSION_DESTROY  = 9,
7539         WL_PROXD_EVENT_RANGE_REQ                = 10,
7540         WL_PROXD_EVENT_FTM_FRAME                = 11,
7541         WL_PROXD_EVENT_DELAY                    = 12,
7542         WL_PROXD_EVENT_VS_INITIATOR_RPT = 13,   /* (target) rx initiator-report */
7543         WL_PROXD_EVENT_RANGING                  = 14,
7544         WL_PROXD_EVENT_LCI_MEAS_REP     = 15,   /* LCI measurement report */
7545         WL_PROXD_EVENT_CIVIC_MEAS_REP   = 16,   /* civic measurement report */
7546
7547         WL_PROXD_EVENT_MAX
7548 };
7549 typedef int16 wl_proxd_event_type_t;
7550
7551 /* proxd event mask - upto 32 events for now */
7552 typedef uint32 wl_proxd_event_mask_t;
7553
7554 #define WL_PROXD_EVENT_MASK_ALL 0xfffffffe
7555 #define WL_PROXD_EVENT_MASK_EVENT(_event_type) (1 << (_event_type))
7556 #define WL_PROXD_EVENT_ENABLED(_mask, _event_type) (\
7557         ((_mask) & WL_PROXD_EVENT_MASK_EVENT(_event_type)) != 0)
7558
7559 /* proxd event - applies to proxd, method or session */
7560 typedef struct wl_proxd_event {
7561         uint16                                  version;
7562         uint16                                  len;
7563         wl_proxd_event_type_t   type;
7564         wl_proxd_method_t               method;
7565         wl_proxd_session_id_t   sid;
7566         uint8                                   pad[2];
7567         wl_proxd_tlv_t                  tlvs[1];        /* variable */
7568 } wl_proxd_event_t;
7569
7570 enum {
7571         WL_PROXD_RANGING_STATE_NONE = 0,
7572         WL_PROXD_RANGING_STATE_NOTSTARTED = 1,
7573         WL_PROXD_RANGING_STATE_INPROGRESS = 2,
7574         WL_PROXD_RANGING_STATE_DONE = 3
7575 };
7576 typedef int16 wl_proxd_ranging_state_t;
7577
7578 /* proxd ranging flags */
7579 enum {
7580         WL_PROXD_RANGING_FLAG_NONE = 0x0000,  /* no flags */
7581         WL_PROXD_RANGING_FLAG_DEL_SESSIONS_ON_STOP = 0x0001,
7582         WL_PROXD_RANGING_FLAG_ALL = 0xffff
7583 };
7584 typedef uint16 wl_proxd_ranging_flags_t;
7585
7586 struct wl_proxd_ranging_info {
7587         wl_proxd_status_t   status;
7588         wl_proxd_ranging_state_t state;
7589         wl_proxd_ranging_flags_t flags;
7590         uint16  num_sids;
7591         uint16  num_done;
7592 };
7593 typedef struct wl_proxd_ranging_info wl_proxd_ranging_info_t;
7594 #include <packed_section_end.h>
7595 /* end proxd definitions */
7596
7597 /* require strict packing */
7598 #include <packed_section_start.h>
7599 /* Data returned by the bssload_report iovar.
7600  * This is also the WLC_E_BSS_LOAD event data.
7601  */
7602 typedef BWL_PRE_PACKED_STRUCT struct wl_bssload {
7603         uint16 sta_count;               /* station count */
7604         uint16 aac;                     /* available admission capacity */
7605         uint8 chan_util;                /* channel utilization */
7606 } BWL_POST_PACKED_STRUCT wl_bssload_t;
7607
7608 /* Maximum number of configurable BSS Load levels.  The number of BSS Load
7609  * ranges is always 1 more than the number of configured levels.  eg. if
7610  * 3 levels of 10, 20, 30 are configured then this defines 4 load ranges:
7611  * 0-10, 11-20, 21-30, 31-255.  A WLC_E_BSS_LOAD event is generated each time
7612  * the utilization level crosses into another range, subject to the rate limit.
7613  */
7614 #define MAX_BSSLOAD_LEVELS 8
7615 #define MAX_BSSLOAD_RANGES (MAX_BSSLOAD_LEVELS + 1)
7616
7617 /* BSS Load event notification configuration. */
7618 typedef struct wl_bssload_cfg {
7619         uint32 rate_limit_msec; /* # of events posted to application will be limited to
7620                                  * one per specified period (0 to disable rate limit).
7621                                  */
7622         uint8 num_util_levels;  /* Number of entries in util_levels[] below */
7623         uint8 util_levels[MAX_BSSLOAD_LEVELS];
7624                                 /* Variable number of BSS Load utilization levels in
7625                                  * low to high order.  An event will be posted each time
7626                                  * a received beacon's BSS Load IE channel utilization
7627                                  * value crosses a level.
7628                                  */
7629 } wl_bssload_cfg_t;
7630
7631 /* Multiple roaming profile suport */
7632 #define WL_MAX_ROAM_PROF_BRACKETS       4
7633
7634 #define WL_MAX_ROAM_PROF_VER    1
7635
7636 #define WL_ROAM_PROF_NONE       (0 << 0)
7637 #define WL_ROAM_PROF_LAZY       (1 << 0)
7638 #define WL_ROAM_PROF_NO_CI      (1 << 1)
7639 #define WL_ROAM_PROF_SUSPEND    (1 << 2)
7640 #define WL_ROAM_PROF_SYNC_DTIM  (1 << 6)
7641 #define WL_ROAM_PROF_DEFAULT    (1 << 7)        /* backward compatible single default profile */
7642
7643 #define WL_FACTOR_TABLE_MAX_LIMIT 5
7644
7645 typedef struct wl_roam_prof {
7646         int8    roam_flags;             /* bit flags */
7647         int8    roam_trigger;           /* RSSI trigger level per profile/RSSI bracket */
7648         int8    rssi_lower;
7649         int8    roam_delta;
7650         int8    rssi_boost_thresh;      /* Min RSSI to qualify for RSSI boost */
7651         int8    rssi_boost_delta;       /* RSSI boost for AP in the other band */
7652         uint16  nfscan;                 /* nuber of full scan to start with */
7653         uint16  fullscan_period;
7654         uint16  init_scan_period;
7655         uint16  backoff_multiplier;
7656         uint16  max_scan_period;
7657         uint8           channel_usage;
7658         uint8           cu_avg_calc_dur;
7659 } wl_roam_prof_t;
7660
7661 typedef struct wl_roam_prof_band {
7662         uint32  band;                   /* Must be just one band */
7663         uint16  ver;                    /* version of this struct */
7664         uint16  len;                    /* length in bytes of this structure */
7665         wl_roam_prof_t roam_prof[WL_MAX_ROAM_PROF_BRACKETS];
7666 } wl_roam_prof_band_t;
7667
7668 /* Data structures for Interface Create/Remove  */
7669
7670 #define WL_INTERFACE_CREATE_VER (0)
7671
7672 /*
7673  * The flags filed of the wl_interface_create is designed to be
7674  * a Bit Mask. As of now only Bit 0 and Bit 1 are used as mentioned below.
7675  * The rest of the bits can be used, incase we have to provide
7676  * more information to the dongle
7677  */
7678
7679 /*
7680  * Bit 0 of flags field is used to inform whether the interface requested to
7681  * be created is STA or AP.
7682  * 0 - Create a STA interface
7683  * 1 - Create an AP interface
7684  */
7685 #define WL_INTERFACE_CREATE_STA (0 << 0)
7686 #define WL_INTERFACE_CREATE_AP  (1 << 0)
7687
7688 /*
7689  * Bit 1 of flags field is used to inform whether MAC is present in the
7690  * data structure or not.
7691  * 0 - Ignore mac_addr field
7692  * 1 - Use the mac_addr field
7693  */
7694 #define WL_INTERFACE_MAC_DONT_USE       (0 << 1)
7695 #define WL_INTERFACE_MAC_USE            (1 << 1)
7696
7697 typedef struct wl_interface_create {
7698         uint16  ver;                    /* version of this struct */
7699         uint32  flags;                  /* flags that defines the operation */
7700         struct  ether_addr   mac_addr;  /* Optional Mac address */
7701 } wl_interface_create_t;
7702
7703 typedef struct wl_interface_info {
7704         uint16  ver;                    /* version of this struct */
7705         struct ether_addr    mac_addr;  /* MAC address of the interface */
7706         char    ifname[BCM_MSG_IFNAME_MAX]; /* name of interface */
7707         uint8   bsscfgidx;              /* source bsscfg index */
7708 } wl_interface_info_t;
7709
7710 /* no default structure packing */
7711 #include <packed_section_end.h>
7712
7713 #define TBOW_MAX_SSID_LEN        32
7714 #define TBOW_MAX_PASSPHRASE_LEN  63
7715
7716 #define WL_TBOW_SETUPINFO_T_VERSION 1 /* version of tbow_setup_netinfo_t */
7717 typedef struct tbow_setup_netinfo {
7718         uint32 version;
7719         uint8 opmode;
7720         uint8 pad;
7721         uint8 macaddr[ETHER_ADDR_LEN];
7722         uint32 ssid_len;
7723         uint8 ssid[TBOW_MAX_SSID_LEN];
7724         uint8 passphrase_len;
7725         uint8 passphrase[TBOW_MAX_PASSPHRASE_LEN];
7726         chanspec_t chanspec;
7727 } tbow_setup_netinfo_t;
7728
7729 typedef enum tbow_ho_opmode {
7730         TBOW_HO_MODE_START_GO = 0,
7731         TBOW_HO_MODE_START_STA,
7732         TBOW_HO_MODE_START_GC,
7733         TBOW_HO_MODE_TEST_GO,
7734         TBOW_HO_MODE_STOP_GO = 0x10,
7735         TBOW_HO_MODE_STOP_STA,
7736         TBOW_HO_MODE_STOP_GC,
7737         TBOW_HO_MODE_TEARDOWN
7738 } tbow_ho_opmode_t;
7739
7740 /* Beacon trim feature statistics */
7741 /* Configuration params */
7742 #define M_BCNTRIM_N                             (0)     /* Enable/Disable Beacon Trim */
7743 #define M_BCNTRIM_TIMEND                (1)     /* Waiting time for TIM IE to end */
7744 #define M_BCNTRIM_TSFTLRN               (2)     /* TSF tolerance value (usecs) */
7745 /* PSM internal use */
7746 #define M_BCNTRIM_PREVBCNLEN    (3)     /* Beacon length excluding the TIM IE */
7747 #define M_BCNTRIM_N_COUNTER             (4)     /* PSM's local beacon trim counter */
7748 #define M_BCNTRIM_STATE                 (5)     /* PSM's Beacon trim status register */
7749 #define M_BCNTRIM_TIMLEN                (6)     /* TIM IE Length */
7750 #define M_BCNTRIM_BMPCTL                (7)     /* Bitmap control word */
7751 #define M_BCNTRIM_TSF_L                 (8)     /* Lower TSF word */
7752 #define M_BCNTRIM_TSF_ML                (9)     /* Lower middle TSF word */
7753 #define M_BCNTRIM_RSSI                  (10) /* Partial beacon RSSI */
7754 #define M_BCNTRIM_CHANNEL               (11) /* Partial beacon channel */
7755 /* Trimming Counters */
7756 #define M_BCNTRIM_SBCNRXED              (12) /* Self-BSSID beacon received */
7757 #define M_BCNTRIM_CANTRIM               (13) /* Num of beacons which can be trimmed */
7758 #define M_BCNTRIM_TRIMMED               (14) /* # beacons which were trimmed */
7759 #define M_BCNTRIM_BCNLENCNG             (15) /* # beacons trimmed due to length change */
7760 #define M_BCNTRIM_TSFADJ                (16) /* # beacons not trimmed due to large TSF delta */
7761 #define M_BCNTRIM_TIMNOTFOUND   (17) /* # beacons not trimmed due to TIM missing */
7762 #define M_RXTSFTMRVAL_WD0               (18)
7763 #define M_RXTSFTMRVAL_WD1               (19)
7764 #define M_RXTSFTMRVAL_WD2               (20)
7765 #define M_RXTSFTMRVAL_WD3               (21)
7766 #define BCNTRIM_STATS_NUMPARAMS (22) /* 16 bit words */
7767
7768 #define TXPWRCAP_MAX_NUM_CORES 8
7769 #define TXPWRCAP_MAX_NUM_ANTENNAS (TXPWRCAP_MAX_NUM_CORES * 2)
7770
7771 typedef struct wl_txpwrcap_tbl {
7772         uint8 num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
7773         /* Stores values for valid antennas */
7774         int8 pwrcap_cell_on[TXPWRCAP_MAX_NUM_ANTENNAS]; /* qdBm units */
7775         int8 pwrcap_cell_off[TXPWRCAP_MAX_NUM_ANTENNAS]; /* qdBm units */
7776 } wl_txpwrcap_tbl_t;
7777
7778 /* -------------- dynamic BTCOEX --------------- */
7779 /* require strict packing */
7780 #include <packed_section_start.h>
7781
7782 #define DCTL_TROWS      2       /* currently practical number of rows  */
7783 #define DCTL_TROWS_MAX  4       /*  2 extra rows RFU */
7784 /* DYNCTL profile flags */
7785 #define DCTL_FLAGS_DYNCTL       (1 << 0)        /*  1 - enabled, 0 - legacy only */
7786 #define DCTL_FLAGS_DESENSE      (1 << 1)        /* auto desense is enabled */
7787 #define DCTL_FLAGS_MSWITCH      (1 << 2)        /* mode switching is enabled */
7788 /* for now AGG on/off is handled separately  */
7789 #define DCTL_FLAGS_TX_AGG_OFF   (1 << 3) /* TBD: allow TX agg Off */
7790 #define DCTL_FLAGS_RX_AGG_OFF   (1 << 4) /* TBD: allow RX agg Off */
7791 /* used for dry run testing only */
7792 #define DCTL_FLAGS_DRYRUN       (1 << 7) /* Eenables dynctl dry run mode  */
7793 #define IS_DYNCTL_ON(prof)      ((prof->flags & DCTL_FLAGS_DYNCTL) != 0)
7794 #define IS_DESENSE_ON(prof)     ((prof->flags & DCTL_FLAGS_DESENSE) != 0)
7795 #define IS_MSWITCH_ON(prof)     ((prof->flags & DCTL_FLAGS_MSWITCH) != 0)
7796 /* desense level currently in use */
7797 #define DESENSE_OFF     0
7798 #define DFLT_DESENSE_MID        12
7799 #define DFLT_DESENSE_HIGH       2
7800
7801 /*
7802  * dynctl data points(a set of btpwr & wlrssi thresholds)
7803  * for mode & desense switching
7804  */
7805 typedef struct btc_thr_data {
7806         int8    mode;   /* used by desense sw */
7807         int8    bt_pwr; /* BT tx power threshold */
7808         int8    bt_rssi;        /* BT rssi threshold */
7809         /* wl rssi range when mode or desense change may be needed */
7810         int8    wl_rssi_high;
7811         int8    wl_rssi_low;
7812 } btc_thr_data_t;
7813
7814 /* dynctl. profile data structure  */
7815 #define DCTL_PROFILE_VER 0x01
7816 typedef BWL_PRE_PACKED_STRUCT struct  dctl_prof {
7817         uint8 version;  /* dynctl profile version */
7818         /* dynctl profile flags bit:0 - dynctl On, bit:1 dsns On, bit:2 mode sw On, */
7819         uint8 flags;  /* bit[6:3] reserved, bit7 - Dryrun (sim) - On */
7820         /*  wl desense levels to apply */
7821         uint8   dflt_dsns_level;
7822         uint8   low_dsns_level;
7823         uint8   mid_dsns_level;
7824         uint8   high_dsns_level;
7825         /* mode switching hysteresis in dBm */
7826         int8    msw_btrssi_hyster;
7827         /* default btcoex mode */
7828         uint8   default_btc_mode;
7829          /* num of active rows in mode switching table */
7830         uint8   msw_rows;
7831         /* num of rows in desense table */
7832         uint8   dsns_rows;
7833         /* dynctl mode switching data table  */
7834         btc_thr_data_t msw_data[DCTL_TROWS_MAX];
7835         /* dynctl desense switching data table */
7836         btc_thr_data_t dsns_data[DCTL_TROWS_MAX];
7837 } BWL_POST_PACKED_STRUCT dctl_prof_t;
7838
7839 /*  dynctl status info */
7840 typedef BWL_PRE_PACKED_STRUCT struct  dynctl_status {
7841         bool sim_on;    /* true if simulation is On */
7842         uint16  bt_pwr_shm; /* BT per/task power as read from ucode  */
7843         int8    bt_pwr;         /* BT pwr extracted & converted to dBm */
7844         int8    bt_rssi;        /* BT rssi in dBm */
7845         int8    wl_rssi;        /* last wl rssi reading used by btcoex */
7846         uint8   dsns_level; /* current desense level */
7847         uint8   btc_mode;   /* current btcoex mode */
7848         /* add more status items if needed,  pad to 4 BB if needed */
7849 } BWL_POST_PACKED_STRUCT dynctl_status_t;
7850
7851 /*  dynctl simulation (dryrun data) */
7852 typedef BWL_PRE_PACKED_STRUCT struct  dynctl_sim {
7853         bool sim_on;    /* simulation mode on/off */
7854         int8 btpwr;             /* simulated BT power in dBm */
7855         int8 btrssi;    /* simulated BT rssi in dBm */
7856         int8 wlrssi;    /* simulated WL rssi in dBm */
7857 } BWL_POST_PACKED_STRUCT dynctl_sim_t;
7858 /* no default structure packing */
7859 #include <packed_section_end.h>
7860
7861 /* PTK key maintained per SCB */
7862 #define RSN_TEMP_ENCR_KEY_LEN 16
7863 typedef struct wpa_ptk {
7864         uint8 kck[RSN_KCK_LENGTH]; /* EAPOL-Key Key Confirmation Key (KCK) */
7865         uint8 kek[RSN_KEK_LENGTH]; /* EAPOL-Key Key Encryption Key (KEK) */
7866         uint8 tk1[RSN_TEMP_ENCR_KEY_LEN]; /* Temporal Key 1 (TK1) */
7867         uint8 tk2[RSN_TEMP_ENCR_KEY_LEN]; /* Temporal Key 2 (TK2) */
7868 } wpa_ptk_t;
7869
7870 /* GTK key maintained per SCB */
7871 typedef struct wpa_gtk {
7872         uint32 idx;
7873         uint32 key_len;
7874         uint8  key[DOT11_MAX_KEY_SIZE];
7875 } wpa_gtk_t;
7876
7877 /* FBT Auth Response Data structure */
7878 typedef struct wlc_fbt_auth_resp {
7879         uint8 macaddr[ETHER_ADDR_LEN]; /* station mac address */
7880         uint8 pad[2];
7881         uint8 pmk_r1_name[WPA2_PMKID_LEN];
7882         wpa_ptk_t ptk; /* pairwise key */
7883         wpa_gtk_t gtk; /* group key */
7884         uint32 ie_len;
7885         uint8 status;  /* Status of parsing FBT authentication
7886                                         Request in application
7887                                         */
7888         uint8 ies[1]; /* IEs contains MDIE, RSNIE,
7889                                         FBTIE (ANonce, SNonce,R0KH-ID, R1KH-ID)
7890                                         */
7891 } wlc_fbt_auth_resp_t;
7892
7893 /* FBT Action Response frame */
7894 typedef struct wlc_fbt_action_resp {
7895         uint16 version; /* structure version */
7896         uint16 length; /* length of structure */
7897         uint8 macaddr[ETHER_ADDR_LEN]; /* station mac address */
7898         uint8 data_len;  /* len of ie from Category */
7899         uint8 data[1]; /* data contains category, action, sta address, target ap,
7900                                                 status code,fbt response frame body
7901                                                 */
7902 } wlc_fbt_action_resp_t;
7903
7904 #define MACDBG_PMAC_ADDR_INPUT_MAXNUM 16
7905 #define MACDBG_PMAC_OBJ_TYPE_LEN 8
7906
7907 typedef struct _wl_macdbg_pmac_param_t {
7908         char type[MACDBG_PMAC_OBJ_TYPE_LEN];
7909         uint8 step;
7910         uint8 num;
7911         uint32 bitmap;
7912         bool addr_raw;
7913         uint8 addr_num;
7914         uint16 addr[MACDBG_PMAC_ADDR_INPUT_MAXNUM];
7915 } wl_macdbg_pmac_param_t;
7916
7917 /* IOVAR 'svmp_mem' parameter. Used to read/clear svmp memory */
7918 typedef struct svmp_mem {
7919         uint32 addr;    /* offset to read svmp memory from vasip base address */
7920         uint16 len;     /* length in count of uint16's */
7921         uint16 val;     /* set the range of addr/len with a value */
7922 } svmp_mem_t;
7923
7924 #define WL_NAN_BAND_STR_SIZE 5       /* sizeof ("auto") */
7925
7926 /* Definitions of different NAN Bands */
7927 enum {  /* mode selection for reading/writing tx iqlo cal coefficients */
7928         NAN_BAND_AUTO,
7929         NAN_BAND_B,
7930         NAN_BAND_A,
7931         NAN_BAND_INVALID = 0xFF
7932 };
7933
7934 #if defined(WL_LINKSTAT)
7935 typedef struct {
7936         uint32 preamble;
7937         uint32 nss;
7938         uint32 bw;
7939         uint32 rateMcsIdx;
7940         uint32 reserved;
7941         uint32 bitrate;
7942 } wifi_rate;
7943
7944 typedef struct {
7945         uint16 version;
7946         uint16 length;
7947         uint32 tx_mpdu;
7948         uint32 rx_mpdu;
7949         uint32 mpdu_lost;
7950         uint32 retries;
7951         uint32 retries_short;
7952         uint32 retries_long;
7953         wifi_rate rate;
7954 } wifi_rate_stat_t;
7955
7956 typedef int32 wifi_radio;
7957
7958 typedef struct {
7959         uint16 version;
7960         uint16 length;
7961         wifi_radio radio;
7962         uint32 on_time;
7963         uint32 tx_time;
7964         uint32 rx_time;
7965         uint32 on_time_scan;
7966         uint32 on_time_nbd;
7967         uint32 on_time_gscan;
7968         uint32 on_time_roam_scan;
7969         uint32 on_time_pno_scan;
7970         uint32 on_time_hs20;
7971         uint32 num_channels;
7972         uint8 channels[1];
7973 } wifi_radio_stat;
7974 #endif /* WL_LINKSTAT */
7975
7976 #ifdef WL11ULB
7977 /* ULB Mode configured via "ulb_mode" IOVAR */
7978 enum {
7979     ULB_MODE_DISABLED = 0,
7980     ULB_MODE_STD_ALONE_MODE = 1,    /* Standalone ULB Mode */
7981     ULB_MODE_DYN_MODE = 2,      /* Dynamic ULB Mode */
7982         /* Add all other enums before this */
7983     MAX_SUPP_ULB_MODES
7984 };
7985
7986 /* ULB BWs configured via "ulb_bw" IOVAR during Standalone Mode Only.
7987  * Values of this enumeration are also used to specify 'Current Operational Bandwidth'
7988  * and 'Primary Operational Bandwidth' sub-fields in 'ULB Operations' field (used in
7989  * 'ULB Operations' Attribute or 'ULB Mode Switch' Attribute)
7990  */
7991 typedef enum {
7992     ULB_BW_DISABLED = 0,
7993     ULB_BW_10MHZ    = 1,    /* Standalone ULB BW in 10 MHz BW */
7994     ULB_BW_5MHZ = 2,    /* Standalone ULB BW in 5 MHz BW */
7995     ULB_BW_2P5MHZ   = 3,    /* Standalone ULB BW in 2.5 MHz BW */
7996         /* Add all other enums before this */
7997     MAX_SUPP_ULB_BW
7998 } ulb_bw_type_t;
7999 #endif /* WL11ULB */
8000
8001 #if defined(WLRCC)
8002 #define MAX_ROAM_CHANNEL      20
8003
8004 typedef struct {
8005         int n;
8006         chanspec_t channels[MAX_ROAM_CHANNEL];
8007 } wl_roam_channel_list_t;
8008 #endif 
8009
8010
8011 /*
8012  * Neighbor Discover Offload: enable NDO feature
8013  * Called  by ipv6 event handler when interface comes up
8014  * Set RA rate limit interval value(%)
8015  */
8016 typedef struct nd_ra_ol_limits {
8017         uint16 version;         /* version of the iovar buffer */
8018         uint16 type;            /* type of data provided */
8019         uint16 length;          /* length of the entire structure */
8020         uint16 pad1;            /* pad union to 4 byte boundary */
8021         union {
8022                 struct {
8023                         uint16 min_time;         /* seconds, min time for RA offload hold */
8024                         uint16 lifetime_percent;
8025                         /* percent, lifetime percentage for offload hold time */
8026                 } lifetime_relative;
8027                 struct {
8028                         uint16 hold_time;        /* seconds, RA offload hold time */
8029                         uint16 pad2;             /* unused */
8030                 } fixed;
8031         } limits;
8032 } nd_ra_ol_limits_t;
8033
8034 #define ND_RA_OL_LIMITS_VER 1
8035
8036 /* nd_ra_ol_limits sub-types */
8037 #define ND_RA_OL_LIMITS_REL_TYPE   0     /* relative, percent of RA lifetime */
8038 #define ND_RA_OL_LIMITS_FIXED_TYPE 1     /* fixed time */
8039
8040 /* buffer lengths for the different nd_ra_ol_limits types */
8041 #define ND_RA_OL_LIMITS_REL_TYPE_LEN   12
8042 #define ND_RA_OL_LIMITS_FIXED_TYPE_LEN  10
8043
8044 #define ND_RA_OL_SET    "SET"
8045 #define ND_RA_OL_GET    "GET"
8046 #define ND_PARAM_SIZE   50
8047 #define ND_VALUE_SIZE   5
8048 #define ND_PARAMS_DELIMETER " "
8049 #define ND_PARAM_VALUE_DELLIMETER   '='
8050 #define ND_LIMIT_STR_FMT ("%50s %50s")
8051
8052 #define ND_RA_TYPE  "TYPE"
8053 #define ND_RA_MIN_TIME  "MIN"
8054 #define ND_RA_PER   "PER"
8055 #define ND_RA_HOLD  "HOLD"
8056
8057 /*
8058  * Temperature Throttling control mode
8059  */
8060 typedef struct wl_temp_control {
8061         bool enable;
8062         uint16 control_bit;
8063 } wl_temp_control_t;
8064
8065 #endif /* _wlioctl_h_ */