• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-2017, 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 677952 2017-01-05 23:25:28Z $
31  */
32 
33 #ifndef _wlioctl_h_
34 #define    _wlioctl_h_
35 
36 #include <typedefs.h>
37 #include <ethernet.h>
38 #include <bcmip.h>
39 #include <bcmeth.h>
40 #include <bcmip.h>
41 #include <bcmipv6.h>
42 #include <bcmevent.h>
43 #include <802.11.h>
44 #include <802.11s.h>
45 #include <802.1d.h>
46 #include <bcmwifi_channels.h>
47 #include <bcmwifi_rates.h>
48 #include <wlioctl_defs.h>
49 #include <bcmipv6.h>
50 
51 #include <bcm_mpool_pub.h>
52 #include <bcmcdc.h>
53 
54 
55 typedef struct {
56     uint32 num;
57     chanspec_t list[1];
58 } chanspec_list_t;
59 
60 #define RSN_KCK_LENGTH    16
61 #define RSN_KEK_LENGTH    16
62 #define TPK_FTM_LEN        16
63 #ifndef INTF_NAME_SIZ
64 #define INTF_NAME_SIZ    16
65 #endif
66 
67 /**Used to send ioctls over the transport pipe */
68 typedef struct remote_ioctl {
69     cdc_ioctl_t    msg;
70     uint32        data_len;
71     char           intf_name[INTF_NAME_SIZ];
72 } rem_ioctl_t;
73 #define REMOTE_SIZE    sizeof(rem_ioctl_t)
74 
75 #define BCM_IOV_XTLV_VERSION 0
76 
77 #define MAX_NUM_D11CORES 2
78 
79 /**DFS Forced param */
80 typedef struct wl_dfs_forced_params {
81     chanspec_t chspec;
82     uint16 version;
83     chanspec_list_t chspec_list;
84 } wl_dfs_forced_t;
85 
86 #define DFS_PREFCHANLIST_VER 0x01
87 #define WL_CHSPEC_LIST_FIXED_SIZE    OFFSETOF(chanspec_list_t, list)
88 /* size of dfs forced param size given n channels are in the list */
89 #define WL_DFS_FORCED_PARAMS_SIZE(n) \
90     (sizeof(wl_dfs_forced_t) + (((n) < 1) ? (0) : (((n) - 1)* sizeof(chanspec_t))))
91 #define WL_DFS_FORCED_PARAMS_FIXED_SIZE \
92     (WL_CHSPEC_LIST_FIXED_SIZE + OFFSETOF(wl_dfs_forced_t, chspec_list))
93 #define WL_DFS_FORCED_PARAMS_MAX_SIZE \
94     WL_DFS_FORCED_PARAMS_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(chanspec_t))
95 
96 /**association decision information */
97 typedef struct {
98     uint8        assoc_approved;        /**< (re)association approved */
99     uint8        pad;
100     uint16        reject_reason;        /**< reason code for rejecting association */
101     struct        ether_addr   da;
102     uint8        pad1[6];
103     int64        sys_time;        /**< current system time */
104 } assoc_decision_t;
105 
106 #define DFS_SCAN_S_IDLE        -1
107 #define DFS_SCAN_S_RADAR_FREE 0
108 #define DFS_SCAN_S_RADAR_FOUND 1
109 #define DFS_SCAN_S_INPROGESS 2
110 #define DFS_SCAN_S_SCAN_ABORTED 3
111 #define DFS_SCAN_S_SCAN_MODESW_INPROGRESS 4
112 #define DFS_SCAN_S_MAX 5
113 
114 
115 #define ACTION_FRAME_SIZE 1800
116 
117 typedef struct wl_action_frame {
118     struct ether_addr     da;
119     uint16             len;
120     uint32             packetId;
121     uint8            data[ACTION_FRAME_SIZE];
122 } wl_action_frame_t;
123 
124 #define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame)
125 
126 typedef struct ssid_info
127 {
128     uint8        ssid_len;    /**< the length of SSID */
129     uint8        ssid[32];    /**< SSID string */
130 } ssid_info_t;
131 
132 typedef struct wl_af_params {
133     uint32            channel;
134     int32            dwell_time;
135     struct ether_addr    BSSID;
136     uint8 PAD[2];
137     wl_action_frame_t    action_frame;
138 } wl_af_params_t;
139 
140 #define WL_WIFI_AF_PARAMS_SIZE sizeof(struct wl_af_params)
141 
142 #define MFP_TEST_FLAG_NORMAL    0
143 #define MFP_TEST_FLAG_ANY_KEY    1
144 typedef struct wl_sa_query {
145     uint32 flag;
146     uint8  action;
147     uint8  PAD;
148     uint16 id;
149     struct ether_addr da;
150     uint16  PAD;
151 } wl_sa_query_t;
152 
153 /* EXT_STA */
154 /**association information */
155 typedef struct {
156     uint32        assoc_req;    /**< offset to association request frame */
157     uint32        assoc_req_len;    /**< association request frame length */
158     uint32        assoc_rsp;    /**< offset to association response frame */
159     uint32        assoc_rsp_len;    /**< association response frame length */
160     uint32        bcn;        /**< offset to AP beacon */
161     uint32        bcn_len;    /**< AP beacon length */
162     uint32        wsec;        /**< ucast security algo */
163     uint32        wpaie;        /**< offset to WPA ie */
164     uint8        auth_alg;    /**< 802.11 authentication mode */
165     uint8        WPA_auth;    /**< WPA: authenticated key management */
166     uint8        ewc_cap;    /**< EWC (MIMO) capable */
167     uint8        ofdm;        /**< OFDM */
168 } assoc_info_t;
169 /* defined(EXT_STA) */
170 
171 /* Flags for OBSS IOVAR Parameters */
172 #define WL_OBSS_DYN_BWSW_FLAG_ACTIVITY_PERIOD        (0x01)
173 #define WL_OBSS_DYN_BWSW_FLAG_NOACTIVITY_PERIOD      (0x02)
174 #define WL_OBSS_DYN_BWSW_FLAG_NOACTIVITY_INCR_PERIOD (0x04)
175 #define WL_OBSS_DYN_BWSW_FLAG_PSEUDO_SENSE_PERIOD    (0x08)
176 #define WL_OBSS_DYN_BWSW_FLAG_RX_CRS_PERIOD          (0x10)
177 #define WL_OBSS_DYN_BWSW_FLAG_DUR_THRESHOLD          (0x20)
178 #define WL_OBSS_DYN_BWSW_FLAG_TXOP_PERIOD            (0x40)
179 
180 /* OBSS IOVAR Version information */
181 #define WL_PROT_OBSS_CONFIG_PARAMS_VERSION 1
182 
183 #include <packed_section_start.h>
184 typedef BWL_PRE_PACKED_STRUCT struct {
185     uint8 obss_bwsw_activity_cfm_count_cfg; /**< configurable count in
186         * seconds before we confirm that OBSS is present and
187         * dynamically activate dynamic bwswitch.
188         */
189     uint8 obss_bwsw_no_activity_cfm_count_cfg; /**< configurable count in
190         * seconds before we confirm that OBSS is GONE and
191         * dynamically start pseudo upgrade. If in pseudo sense time, we
192         * will see OBSS, [means that, we false detected that OBSS-is-gone
193         * in watchdog] this count will be incremented in steps of
194         * obss_bwsw_no_activity_cfm_count_incr_cfg for confirming OBSS
195         * detection again. Note that, at present, max 30seconds is
196         * allowed like this. [OBSS_BWSW_NO_ACTIVITY_MAX_INCR_DEFAULT]
197         */
198     uint8 obss_bwsw_no_activity_cfm_count_incr_cfg; /* see above
199         */
200     uint16 obss_bwsw_pseudo_sense_count_cfg; /**< number of msecs/cnt to be in
201         * pseudo state. This is used to sense/measure the stats from lq.
202         */
203     uint8 obss_bwsw_rx_crs_threshold_cfg; /**< RX CRS default threshold */
204     uint8 obss_bwsw_dur_thres; /**< OBSS dyn bwsw trigger/RX CRS Sec */
205     uint8 obss_bwsw_txop_threshold_cfg; /**< TXOP default threshold */
206 } BWL_POST_PACKED_STRUCT wlc_obss_dynbwsw_config_t;
207 #include <packed_section_end.h>
208 
209 #include <packed_section_start.h>
210 typedef BWL_PRE_PACKED_STRUCT struct {
211     uint32 version;    /**< version field */
212     uint32 config_mask;
213     uint32 reset_mask;
214     wlc_obss_dynbwsw_config_t config_params;
215 } BWL_POST_PACKED_STRUCT obss_config_params_t;
216 #include <packed_section_end.h>
217 
218 /**bsscfg type */
219 typedef enum bsscfg_type {
220     BSSCFG_TYPE_GENERIC = 0,    /**< Generic AP/STA/IBSS BSS */
221     BSSCFG_TYPE_P2P = 1,        /**< P2P BSS */
222     /* index 2 earlier used for BTAMP */
223     BSSCFG_TYPE_PSTA = 3,
224     BSSCFG_TYPE_TDLS = 4,
225     BSSCFG_TYPE_SLOTTED_BSS = 5,
226     BSSCFG_TYPE_PROXD = 6,
227     BSSCFG_TYPE_NAN = 7,
228     BSSCFG_TYPE_MESH = 8,
229     BSSCFG_TYPE_AIBSS = 9
230 } bsscfg_type_t;
231 
232 /* bsscfg subtype */
233 typedef enum bsscfg_subtype {
234     BSSCFG_SUBTYPE_NONE = 0,
235     BSSCFG_GENERIC_STA = 1,        /* GENERIC */
236     BSSCFG_GENERIC_AP = 2,
237     BSSCFG_GENERIC_IBSS = 6,
238     BSSCFG_P2P_GC = 3,        /* P2P */
239     BSSCFG_P2P_GO = 4,
240     BSSCFG_P2P_DISC = 5,
241     /* Index 7 & 8 earlier used for BTAMP */
242     BSSCFG_SUBTYPE_AWDL = 9, /* SLOTTED_BSS_TYPE */
243     BSSCFG_SUBTYPE_NAN_MGMT = 10,
244     BSSCFG_SUBTYPE_NAN_DATA = 11,
245     BSSCFG_SUBTYPE_NAN_MGMT_DATA = 12
246 } bsscfg_subtype_t;
247 
248 typedef struct wlc_bsscfg_info {
249     uint32 type;
250     uint32 subtype;
251 } wlc_bsscfg_info_t;
252 
253 /* ULP SHM Offsets info */
254 typedef struct ulp_shm_info {
255     uint32 m_ulp_ctrl_sdio;
256     uint32 m_ulp_wakeevt_ind;
257     uint32 m_ulp_wakeind;
258 } ulp_shm_info_t;
259 
260 
261 /* Legacy structure to help keep backward compatible wl tool and tray app */
262 
263 #define    LEGACY_WL_BSS_INFO_VERSION    107    /**< older version of wl_bss_info struct */
264 
265 typedef struct wl_bss_info_107 {
266     uint32        version;        /**< version field */
267     uint32        length;            /**< byte length of data in this record,
268                          * starting at version and including IEs
269                          */
270     struct ether_addr BSSID;
271     uint16        beacon_period;        /**< units are Kusec */
272     uint16        capability;        /**< Capability information */
273     uint8        SSID_len;
274     uint8        SSID[32];
275     uint8        PAD;
276     struct {
277         uint32    count;            /**< # rates in this set */
278         uint8    rates[16];        /**< rates in 500kbps units w/hi bit set if basic */
279     } rateset;                /**< supported rates */
280     uint8        channel;        /**< Channel no. */
281     uint8        PAD;
282     uint16        atim_window;        /**< units are Kusec */
283     uint8        dtim_period;        /**< DTIM period */
284     uint8        PAD;
285     int16        RSSI;            /**< receive signal strength (in dBm) */
286     int8        phy_noise;        /**< noise (in dBm) */
287     uint8        PAD[3];
288     uint32        ie_length;        /**< byte length of Information Elements */
289     /* variable length Information Elements */
290 } wl_bss_info_107_t;
291 
292 /*
293  * Per-BSS information structure.
294  */
295 
296 #define    LEGACY2_WL_BSS_INFO_VERSION    108        /**< old version of wl_bss_info struct */
297 
298 /**
299  * BSS info structure
300  * Applications MUST CHECK ie_offset field and length field to access IEs and
301  * next bss_info structure in a vector (in wl_scan_results_t)
302  */
303 typedef struct wl_bss_info_108 {
304     uint32        version;        /**< version field */
305     uint32        length;            /**< byte length of data in this record,
306                          * starting at version and including IEs
307                          */
308     struct ether_addr BSSID;
309     uint16        beacon_period;        /**< units are Kusec */
310     uint16        capability;        /**< Capability information */
311     uint8        SSID_len;
312     uint8        SSID[32];
313     uint8        PAD[1];
314     struct {
315         uint32    count;            /**< # rates in this set */
316         uint8    rates[16];        /**< rates in 500kbps units w/hi bit set if basic */
317     } rateset;                /**< supported rates */
318     chanspec_t    chanspec;        /**< chanspec for bss */
319     uint16        atim_window;        /**< units are Kusec */
320     uint8        dtim_period;        /**< DTIM period */
321     uint8        PAD;
322     int16        RSSI;            /**< receive signal strength (in dBm) */
323     int8        phy_noise;        /**< noise (in dBm) */
324 
325     uint8        n_cap;            /**< BSS is 802.11N Capable */
326     uint8        PAD[2];
327     uint32        nbss_cap;        /**< 802.11N BSS Capabilities (based on HT_CAP_*) */
328     uint8        ctl_ch;            /**< 802.11N BSS control channel number */
329     uint8        PAD[3];
330     uint32        reserved32[1];        /**< Reserved for expansion of BSS properties */
331     uint8        flags;            /**< flags */
332     uint8        reserved[3];        /**< Reserved for expansion of BSS properties */
333     uint8        basic_mcs[MCSSET_LEN];    /**< 802.11N BSS required MCS set */
334 
335     uint16        ie_offset;        /**< offset at which IEs start, from beginning */
336     uint8        PAD[2];
337     uint32        ie_length;        /**< byte length of Information Elements */
338     /* Add new fields here */
339     /* variable length Information Elements */
340 } wl_bss_info_108_t;
341 
342 
343 #define    WL_BSS_INFO_VERSION    109        /**< current version of wl_bss_info struct */
344 
345 /**
346  * BSS info structure
347  * Applications MUST CHECK ie_offset field and length field to access IEs and
348  * next bss_info structure in a vector (in wl_scan_results_t)
349  */
350 typedef struct wl_bss_info {
351     uint32        version;        /**< version field */
352     uint32        length;            /**< byte length of data in this record,
353                          * starting at version and including IEs
354                          */
355     struct ether_addr BSSID;
356     uint16        beacon_period;        /**< units are Kusec */
357     uint16        capability;        /**< Capability information */
358     uint8        SSID_len;
359     uint8        SSID[32];
360     uint8        bcnflags;        /* additional flags w.r.t. beacon */
361     struct {
362         uint32    count;            /**< # rates in this set */
363         uint8    rates[16];        /**< rates in 500kbps units w/hi bit set if basic */
364     } rateset;                /**< supported rates */
365     chanspec_t    chanspec;        /**< chanspec for bss */
366     uint16        atim_window;        /**< units are Kusec */
367     uint8        dtim_period;        /**< DTIM period */
368     uint8        accessnet;        /* from beacon interwork IE (if bcnflags) */
369     int16        RSSI;            /**< receive signal strength (in dBm) */
370     int8        phy_noise;        /**< noise (in dBm) */
371     uint8        n_cap;            /**< BSS is 802.11N Capable */
372     uint16        freespace1;        /* make implicit padding explicit */
373     uint32        nbss_cap;        /**< 802.11N+AC BSS Capabilities */
374     uint8        ctl_ch;            /**< 802.11N BSS control channel number */
375     uint8        padding1[3];        /**< explicit struct alignment padding */
376     uint16        vht_rxmcsmap;    /**< VHT rx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
377     uint16        vht_txmcsmap;    /**< VHT tx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
378     uint8        flags;            /**< flags */
379     uint8        vht_cap;        /**< BSS is vht capable */
380     uint8        reserved[2];        /**< Reserved for expansion of BSS properties */
381     uint8        basic_mcs[MCSSET_LEN];    /**< 802.11N BSS required MCS set */
382 
383     uint16        ie_offset;        /**< offset at which IEs start, from beginning */
384     uint16        freespace2;        /* making implicit padding explicit */
385     uint32        ie_length;        /**< byte length of Information Elements */
386     int16        SNR;            /**< average SNR of during frame reception */
387     uint16        vht_mcsmap;        /**< STA's Associated vhtmcsmap */
388     uint16        vht_mcsmap_prop;    /**< STA's Associated prop vhtmcsmap */
389     uint16        vht_txmcsmap_prop;    /**< prop VHT tx mcs prop */
390     /* Add new fields here */
391     /* variable length Information Elements */
392 } wl_bss_info_t;
393 
394 #define    WL_GSCAN_FULL_RESULT_VERSION    2    /* current version of wl_gscan_result_t struct */
395 #define WL_GSCAN_INFO_FIXED_FIELD_SIZE   (sizeof(wl_gscan_bss_info_t) - sizeof(wl_bss_info_t))
396 
397 typedef struct wl_gscan_bss_info {
398     uint32      timestamp[2];
399     wl_bss_info_t info;
400     /* Do not add any more members below, fixed  */
401     /* and variable length Information Elements to follow */
402 } wl_gscan_bss_info_t;
403 
404 
405 typedef struct wl_bsscfg {
406     uint32  bsscfg_idx;
407     uint32  wsec;
408     uint32  WPA_auth;
409     uint32  wsec_index;
410     uint32  associated;
411     uint32  BSS;
412     uint32  phytest_on;
413     struct ether_addr   prev_BSSID;
414     struct ether_addr   BSSID;
415     uint32  targetbss_wpa2_flags;
416     uint32 assoc_type;
417     uint32 assoc_state;
418 } wl_bsscfg_t;
419 
420 typedef struct wl_if_add {
421     uint32  bsscfg_flags;
422     uint32  if_flags;
423     uint32  ap;
424     struct ether_addr   mac_addr;
425     uint16  PAD;
426     uint32  wlc_index;
427 } wl_if_add_t;
428 
429 typedef struct wl_bss_config {
430     uint32    atim_window;
431     uint32    beacon_period;
432     uint32    chanspec;
433 } wl_bss_config_t;
434 
435 #define WL_BSS_USER_RADAR_CHAN_SELECT    0x1    /**< User application will randomly select
436                          * radar channel.
437                          */
438 
439 #define DLOAD_HANDLER_VER        1    /**< Downloader version */
440 #define DLOAD_FLAG_VER_MASK        0xf000    /**< Downloader version mask */
441 #define DLOAD_FLAG_VER_SHIFT        12    /**< Downloader version shift */
442 
443 #define DL_CRC_NOT_INUSE    0x0001
444 #define DL_BEGIN        0x0002
445 #define DL_END            0x0004
446 
447 /* Flags for Major/Minor/Date number shift and mask */
448 #define EPI_VER_SHIFT     16
449 #define EPI_VER_MASK      0xFFFF
450 /** generic download types & flags */
451 enum {
452     DL_TYPE_UCODE = 1,
453     DL_TYPE_CLM = 2
454 };
455 
456 /** ucode type values */
457 enum {
458     UCODE_FW,
459     INIT_VALS,
460     BS_INIT_VALS
461 };
462 
463 struct wl_dload_data {
464     uint16 flag;
465     uint16 dload_type;
466     uint32 len;
467     uint32 crc;
468     uint8  data[1];
469 };
470 typedef struct wl_dload_data wl_dload_data_t;
471 
472 struct wl_ucode_info {
473     uint32 ucode_type;
474     uint32 num_chunks;
475     uint32 chunk_len;
476     uint32 chunk_num;
477     uint8  data_chunk[1];
478 };
479 typedef struct wl_ucode_info wl_ucode_info_t;
480 
481 struct wl_clm_dload_info {
482     uint32 ds_id;
483     uint32 clm_total_len;
484     uint32 num_chunks;
485     uint32 chunk_len;
486     uint32 chunk_offset;
487     uint8  data_chunk[1];
488 };
489 typedef struct wl_clm_dload_info wl_clm_dload_info_t;
490 
491 
492 typedef struct wlc_ssid {
493     uint32        SSID_len;
494     uint8        SSID[DOT11_MAX_SSID_LEN];
495 } wlc_ssid_t;
496 
497 typedef struct wlc_ssid_ext {
498     uint8      hidden;
499     uint8      PAD;
500     uint16     flags;
501     uint8      SSID_len;
502     int8       rssi_thresh;
503     uint8      SSID[DOT11_MAX_SSID_LEN];
504 } wlc_ssid_ext_t;
505 
506 #define MAX_PREFERRED_AP_NUM     5
507 typedef struct wlc_fastssidinfo {
508     uint32            SSID_channel[MAX_PREFERRED_AP_NUM];
509     wlc_ssid_t        SSID_info[MAX_PREFERRED_AP_NUM];
510 } wlc_fastssidinfo_t;
511 
512 typedef struct wnm_url {
513     uint8   len;
514     uint8   data[1];
515 } wnm_url_t;
516 
517 typedef struct chan_scandata {
518     uint8        txpower;
519     uint8        pad;
520     chanspec_t    channel;        /**< Channel num, bw, ctrl_sb and band */
521     uint32        channel_mintime;
522     uint32        channel_maxtime;
523 } chan_scandata_t;
524 
525 typedef enum wl_scan_type {
526     EXTDSCAN_FOREGROUND_SCAN,
527     EXTDSCAN_BACKGROUND_SCAN,
528     EXTDSCAN_FORCEDBACKGROUND_SCAN
529 } wl_scan_type_t;
530 
531 #define WLC_EXTDSCAN_MAX_SSID        5
532 
533 typedef struct wl_extdscan_params {
534     int8         nprobes;        /**< 0, passive, otherwise active */
535     int8        split_scan;        /**< split scan */
536     int8        band;            /**< band */
537     int8        pad;
538     wlc_ssid_t     ssid[WLC_EXTDSCAN_MAX_SSID]; /**< ssid list */
539     uint32        tx_rate;        /**< in 500ksec units */
540     wl_scan_type_t    scan_type;        /**< enum */
541     int32         channel_num;
542     chan_scandata_t channel_list[1];    /**< list of chandata structs */
543 } wl_extdscan_params_t;
544 
545 #define WL_EXTDSCAN_PARAMS_FIXED_SIZE     (sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
546 
547 #define WL_SCAN_PARAMS_SSID_MAX     10
548 
549 typedef struct wl_scan_params {
550     wlc_ssid_t ssid;        /**< default: {0, ""} */
551     struct ether_addr bssid;    /**< default: bcast */
552     int8 bss_type;            /**< default: any,
553                      * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
554                      */
555     uint8 scan_type;        /**< flags, 0 use default */
556     int32 nprobes;            /**< -1 use default, number of probes per channel */
557     int32 active_time;        /**< -1 use default, dwell time per channel for
558                      * active scanning
559                      */
560     int32 passive_time;        /**< -1 use default, dwell time per channel
561                      * for passive scanning
562                      */
563     int32 home_time;        /**< -1 use default, dwell time for the home channel
564                      * between channel scans
565                      */
566     int32 channel_num;        /**< count of channels and ssids that follow
567                      *
568                      * low half is count of channels in channel_list, 0
569                      * means default (use all available channels)
570                      *
571                      * high half is entries in wlc_ssid_t array that
572                      * follows channel_list, aligned for int32 (4 bytes)
573                      * meaning an odd channel count implies a 2-byte pad
574                      * between end of channel_list and first ssid
575                      *
576                      * if ssid count is zero, single ssid in the fixed
577                      * parameter portion is assumed, otherwise ssid in
578                      * the fixed portion is ignored
579                      */
580     uint16 channel_list[1];        /**< list of chanspecs */
581 } wl_scan_params_t;
582 
583 /** size of wl_scan_params not including variable length array */
584 #define WL_SCAN_PARAMS_FIXED_SIZE 64
585 #define WL_MAX_ROAMSCAN_DATSZ    (WL_SCAN_PARAMS_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(uint16)))
586 
587 #define ISCAN_REQ_VERSION 1
588 
589 /** incremental scan struct */
590 typedef struct wl_iscan_params {
591     uint32 version;
592     uint16 action;
593     uint16 scan_duration;
594     wl_scan_params_t params;
595 } wl_iscan_params_t;
596 
597 /** 3 fields + size of wl_scan_params, not including variable length array */
598 #define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
599 
600 typedef struct wl_scan_results {
601     uint32 buflen;
602     uint32 version;
603     uint32 count;
604     wl_bss_info_t bss_info[1];
605 } wl_scan_results_t;
606 
607 /** size of wl_scan_results not including variable length array */
608 #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
609 #define ESCAN_REQ_VERSION 1
610 
611 /** event scan reduces amount of SOC memory needed to store scan results */
612 typedef struct wl_escan_params {
613     uint32 version;
614     uint16 action;
615     uint16 sync_id;
616     wl_scan_params_t params;
617 } wl_escan_params_t;
618 
619 #define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
620 
621 /** event scan reduces amount of SOC memory needed to store scan results */
622 typedef struct wl_escan_result {
623     uint32 buflen;
624     uint32 version;
625     uint16 sync_id;
626     uint16 bss_count;
627     wl_bss_info_t bss_info[1];
628 } wl_escan_result_t;
629 
630 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
631 typedef struct wl_gscan_result {
632     uint32 buflen;
633     uint32 version;
634     uint32 scan_ch_bucket;
635     wl_gscan_bss_info_t bss_info[1];
636 } wl_gscan_result_t;
637 
638 #define WL_GSCAN_RESULTS_FIXED_SIZE (sizeof(wl_gscan_result_t) - sizeof(wl_gscan_bss_info_t))
639 /** incremental scan results struct */
640 typedef struct wl_iscan_results {
641     uint32 status;
642     wl_scan_results_t results;
643 } wl_iscan_results_t;
644 
645 /** size of wl_iscan_results not including variable length array */
646 #define WL_ISCAN_RESULTS_FIXED_SIZE \
647     (WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
648 
649 typedef struct wl_probe_params {
650     wlc_ssid_t ssid;
651     struct ether_addr bssid;
652     struct ether_addr mac;
653 } wl_probe_params_t;
654 
655 #define WL_MAXRATES_IN_SET        16    /**< max # of rates in a rateset */
656 typedef struct wl_rateset {
657     uint32    count;                /**< # rates in this set */
658     uint8    rates[WL_MAXRATES_IN_SET];    /**< rates in 500kbps units w/hi bit set if basic */
659 } wl_rateset_t;
660 
661 typedef struct wl_rateset_args {
662     uint32    count;                /**< # rates in this set */
663     uint8    rates[WL_MAXRATES_IN_SET];    /**< rates in 500kbps units w/hi bit set if basic */
664     uint8   mcs[MCSSET_LEN];            /**< supported mcs index bit map */
665     uint16 vht_mcs[VHT_CAP_MCS_MAP_NSS_MAX]; /**< supported mcs index bit map per nss */
666 } wl_rateset_args_t;
667 
668 #define TXBF_RATE_MCS_ALL        4
669 #define TXBF_RATE_VHT_ALL        4
670 #define TXBF_RATE_OFDM_ALL        8
671 
672 typedef struct wl_txbf_rateset {
673     uint8    txbf_rate_mcs[TXBF_RATE_MCS_ALL];    /**< one for each stream */
674     uint8    txbf_rate_mcs_bcm[TXBF_RATE_MCS_ALL];    /**< one for each stream */
675     uint16    txbf_rate_vht[TXBF_RATE_VHT_ALL];    /**< one for each stream */
676     uint16    txbf_rate_vht_bcm[TXBF_RATE_VHT_ALL];    /**< one for each stream */
677     uint8    txbf_rate_ofdm[TXBF_RATE_OFDM_ALL]; /**< bitmap of ofdm rates that enables txbf */
678     uint8    txbf_rate_ofdm_bcm[TXBF_RATE_OFDM_ALL]; /* bitmap of ofdm rates that enables txbf */
679     uint8    txbf_rate_ofdm_cnt;
680     uint8    txbf_rate_ofdm_cnt_bcm;
681 } wl_txbf_rateset_t;
682 
683 #define NUM_BFGAIN_ARRAY_1RX    2
684 #define NUM_BFGAIN_ARRAY_2RX    3
685 #define NUM_BFGAIN_ARRAY_3RX    4
686 #define NUM_BFGAIN_ARRAY_4RX    5
687 
688 typedef struct wl_txbf_expgainset {
689     /* bitmap for each element: B[4:0]=>c0, B[9:5]=>c1, B[14:10]=>c2, B[19:15]=>c[3-7]
690      * B[24:20]=>c[8-9], B[29:25]=>c[10-11]
691      */
692     uint32    bfgain_2x1[NUM_BFGAIN_ARRAY_1RX]; /* exp     1ss, imp 1ss */
693     uint32    bfgain_2x2[NUM_BFGAIN_ARRAY_2RX]; /* exp [1-2]ss, imp 1ss */
694     uint32    bfgain_3x1[NUM_BFGAIN_ARRAY_1RX];
695     uint32    bfgain_3x2[NUM_BFGAIN_ARRAY_2RX];
696     uint32    bfgain_3x3[NUM_BFGAIN_ARRAY_3RX]; /* exp [1-3]ss, imp 1ss */
697     uint32    bfgain_4x1[NUM_BFGAIN_ARRAY_1RX];
698     uint32    bfgain_4x2[NUM_BFGAIN_ARRAY_2RX];
699     uint32    bfgain_4x3[NUM_BFGAIN_ARRAY_3RX];
700     uint32    bfgain_4x4[NUM_BFGAIN_ARRAY_4RX]; /* exp [1-4]ss, imp 1ss */
701 } wl_txbf_expgainset_t;
702 
703 #define OFDM_RATE_MASK            0x0000007f
704 typedef uint8 ofdm_rates_t;
705 
706 typedef struct wl_rates_info {
707     wl_rateset_t rs_tgt;
708     uint32 phy_type;
709     int32 bandtype;
710     uint8 cck_only;
711     uint8 rate_mask;
712     uint8 mcsallow;
713     uint8 bw;
714     uint8 txstreams;
715     uint8 PAD[3];
716 } wl_rates_info_t;
717 
718 /**uint32 list */
719 typedef struct wl_uint32_list {
720     /** in - # of elements, out - # of entries */
721     uint32 count;
722     /** variable length uint32 list */
723     uint32 element[1];
724 } wl_uint32_list_t;
725 
726 /* WLC_SET_ALLOW_MODE values */
727 #define ALLOW_MODE_ANY_BSSID        0
728 #define ALLOW_MODE_ONLY_DESIRED_BSSID    1
729 #define ALLOW_MODE_NO_BSSID        2
730 
731 /** used for association with a specific BSSID and chanspec list */
732 typedef struct wl_assoc_params {
733     struct ether_addr bssid;    /**< 00:00:00:00:00:00: broadcast scan */
734     uint16 bssid_cnt;        /**< 0: use chanspec_num, and the single bssid,
735                     * otherwise count of chanspecs in chanspec_list
736                     * AND paired bssids following chanspec_list
737                     * also, chanspec_num has to be set to zero
738                     * for bssid list to be used
739                     */
740     int32 chanspec_num;        /**< 0: all available channels,
741                     * otherwise count of chanspecs in chanspec_list
742                     */
743     chanspec_t chanspec_list[1];    /**< list of chanspecs */
744 } wl_assoc_params_t;
745 
746 #define WL_ASSOC_PARAMS_FIXED_SIZE     OFFSETOF(wl_assoc_params_t, chanspec_list)
747 
748 /** used for reassociation/roam to a specific BSSID and channel */
749 typedef wl_assoc_params_t wl_reassoc_params_t;
750 #define WL_REASSOC_PARAMS_FIXED_SIZE    WL_ASSOC_PARAMS_FIXED_SIZE
751 
752 /** used for association to a specific BSSID and channel */
753 typedef wl_assoc_params_t wl_join_assoc_params_t;
754 #define WL_JOIN_ASSOC_PARAMS_FIXED_SIZE    WL_ASSOC_PARAMS_FIXED_SIZE
755 
756 /** used for join with or without a specific bssid and channel list */
757 typedef struct wl_join_params {
758     wlc_ssid_t ssid;
759     wl_assoc_params_t params;    /**< optional field, but it must include the fixed portion
760                      * of the wl_assoc_params_t struct when it does present.
761                      */
762 } wl_join_params_t;
763 
764 #define WL_JOIN_PARAMS_FIXED_SIZE     (OFFSETOF(wl_join_params_t, params) + \
765                      WL_ASSOC_PARAMS_FIXED_SIZE)
766 
767 typedef struct wlc_roam_exp_params {
768     int8 a_band_boost_threshold;
769     int8 a_band_penalty_threshold;
770     int8 a_band_boost_factor;
771     int8 a_band_penalty_factor;
772     int8 cur_bssid_boost;
773     int8 alert_roam_trigger_threshold;
774     int16 a_band_max_boost;
775 } wlc_roam_exp_params_t;
776 
777 #define ROAM_EXP_CFG_VERSION     1
778 
779 #define ROAM_EXP_ENABLE_FLAG             (1 << 0)
780 
781 #define ROAM_EXP_CFG_PRESENT             (1 << 1)
782 
783 typedef struct wl_roam_exp_cfg {
784     uint16 version;
785     uint16 flags;
786     wlc_roam_exp_params_t params;
787 } wl_roam_exp_cfg_t;
788 
789 typedef struct wl_bssid_pref_list {
790     struct ether_addr bssid;
791     /* Add this to modify rssi */
792     int8 rssi_factor;
793     int8 flags;
794 } wl_bssid_pref_list_t;
795 
796 #define BSSID_PREF_LIST_VERSION        1
797 #define ROAM_EXP_CLEAR_BSSID_PREF        (1 << 0)
798 
799 typedef struct wl_bssid_pref_cfg {
800     uint16 version;
801     uint16 flags;
802     uint16 count;
803     uint16 reserved;
804     wl_bssid_pref_list_t bssids[];
805 } wl_bssid_pref_cfg_t;
806 
807 #define SSID_WHITELIST_VERSION         1
808 
809 #define ROAM_EXP_CLEAR_SSID_WHITELIST    (1 << 0)
810 
811 /* Roam SSID whitelist, ssids in this list are ok to  */
812 /* be considered as targets to join when considering a roam */
813 
814 typedef struct wl_ssid_whitelist {
815     uint16 version;
816     uint16 flags;
817 
818     uint8 ssid_count;
819     uint8 reserved[3];
820     wlc_ssid_t ssids[];
821 } wl_ssid_whitelist_t;
822 
823 #define ROAM_EXP_EVENT_VERSION       1
824 
825 typedef struct wl_roam_exp_event {
826     uint16 version;
827     uint16 flags;
828     wlc_ssid_t cur_ssid;
829 } wl_roam_exp_event_t;
830 
831 /** scan params for extended join */
832 typedef struct wl_join_scan_params {
833     uint8 scan_type;        /**< 0 use default, active or passive scan */
834     uint8 PAD[3];
835     int32 nprobes;            /**< -1 use default, number of probes per channel */
836     int32 active_time;        /**< -1 use default, dwell time per channel for
837                      * active scanning
838                      */
839     int32 passive_time;        /**< -1 use default, dwell time per channel
840                      * for passive scanning
841                      */
842     int32 home_time;        /**< -1 use default, dwell time for the home channel
843                      * between channel scans
844                      */
845 } wl_join_scan_params_t;
846 
847 /** extended join params */
848 typedef struct wl_extjoin_params {
849     wlc_ssid_t ssid;        /**< {0, ""}: wildcard scan */
850     wl_join_scan_params_t scan;
851     wl_join_assoc_params_t assoc;    /**< optional field, but it must include the fixed portion
852                      * of the wl_join_assoc_params_t struct when it does
853                      * present.
854                      */
855 } wl_extjoin_params_t;
856 #define WL_EXTJOIN_PARAMS_FIXED_SIZE     (OFFSETOF(wl_extjoin_params_t, assoc) + \
857                      WL_JOIN_ASSOC_PARAMS_FIXED_SIZE)
858 
859 #define ANT_SELCFG_MAX        4    /**< max number of antenna configurations */
860 #define MAX_STREAMS_SUPPORTED    4    /**< max number of streams supported */
861 typedef struct {
862     uint8 ant_config[ANT_SELCFG_MAX];    /**< antenna configuration */
863     uint8 num_antcfg;            /**< number of available antenna configurations */
864 } wlc_antselcfg_t;
865 
866 typedef struct {
867     uint32 duration;    /**< millisecs spent sampling this channel */
868     uint32 congest_ibss;    /**< millisecs in our bss (presumably this traffic will */
869                 /**<  move if cur bss moves channels) */
870     uint32 congest_obss;    /**< traffic not in our bss */
871     uint32 interference;    /**< millisecs detecting a non 802.11 interferer. */
872     uint32 timestamp;    /**< second timestamp */
873 } cca_congest_t;
874 
875 typedef struct {
876     chanspec_t chanspec;    /**< Which channel? */
877     uint16 num_secs;    /**< How many secs worth of data */
878     cca_congest_t  secs[1];    /**< Data */
879 } cca_congest_channel_req_t;
880 typedef struct {
881     uint32 duration;    /**< millisecs spent sampling this channel */
882     uint32 congest;        /**< millisecs detecting busy CCA */
883     uint32 timestamp;    /**< second timestamp */
884 } cca_congest_simple_t;
885 
886 typedef struct {
887     uint16 status;
888     uint16 id;
889     chanspec_t chanspec;            /**< Which channel? */
890     uint16 len;
891     union {
892         cca_congest_simple_t  cca_busy;    /**< CCA busy */
893         int32 noise;            /**< noise floor */
894     };
895 } cca_chan_qual_event_t;
896 
897 typedef struct {
898     uint32 msrmnt_time;    /**< Time for Measurement (msec) */
899     uint32 msrmnt_done;    /**< flag set when measurement complete */
900     char buf[];
901 } cca_stats_n_flags;
902 
903 typedef struct {
904     uint32 msrmnt_query;    /* host to driver query for measurement done */
905     uint32 time_req;        /* time required for measurement */
906     uint8 report_opt;       /* option to print different stats in report */
907     uint8 PAD[3];
908 } cca_msrmnt_query;
909 
910 /* interference sources */
911 enum interference_source {
912     ITFR_NONE = 0,            /**< interference */
913     ITFR_PHONE,            /**< wireless phone */
914     ITFR_VIDEO_CAMERA,        /**< wireless video camera */
915     ITFR_MICROWAVE_OVEN,        /**< microwave oven */
916     ITFR_BABY_MONITOR,        /**< wireless baby monitor */
917     ITFR_BLUETOOTH,            /**< bluetooth */
918     ITFR_VIDEO_CAMERA_OR_BABY_MONITOR,    /**< wireless camera or baby monitor */
919     ITFR_BLUETOOTH_OR_BABY_MONITOR,    /**< bluetooth or baby monitor */
920     ITFR_VIDEO_CAMERA_OR_PHONE,    /**< video camera or phone */
921     ITFR_UNIDENTIFIED        /**< interference from unidentified source */
922 };
923 
924 /** structure for interference source report */
925 typedef struct {
926     uint32 flags;        /**< flags.  bit definitions below */
927     uint32 source;        /**< last detected interference source */
928     uint32 timestamp;    /**< second timestamp on interferenced flag change */
929 } interference_source_rep_t;
930 
931 #define WLC_CNTRY_BUF_SZ    4        /**< Country string is 3 bytes + NUL */
932 
933 typedef struct wl_country {
934     char country_abbrev[WLC_CNTRY_BUF_SZ];    /**< nul-terminated country code used in
935                          * the Country IE
936                          */
937     int32 rev;                /**< revision specifier for ccode
938                          * on set, -1 indicates unspecified.
939                          * on get, rev >= 0
940                          */
941     char ccode[WLC_CNTRY_BUF_SZ];        /**< nul-terminated built-in country code.
942                          * variable length, but fixed size in
943                          * struct allows simple allocation for
944                          * expected country strings <= 3 chars.
945                          */
946 } wl_country_t;
947 
948 
949 #define CCODE_INFO_VERSION 1
950 
951 typedef enum wl_ccode_role {
952     WLC_CCODE_ROLE_ACTIVE = 0,
953     WLC_CCODE_ROLE_HOST,
954     WLC_CCODE_ROLE_80211D_ASSOC,
955     WLC_CCODE_ROLE_80211D_SCAN,
956     WLC_CCODE_ROLE_DEFAULT,
957     WLC_CCODE_LAST
958 } wl_ccode_role_t;
959 #define WLC_NUM_CCODE_INFO WLC_CCODE_LAST
960 
961 typedef struct wl_ccode_entry {
962     uint16 reserved;
963     uint8 band;
964     uint8 role;
965     char    ccode[WLC_CNTRY_BUF_SZ];
966 } wl_ccode_entry_t;
967 
968 typedef struct wl_ccode_info {
969     uint16 version;
970     uint16 count;   /**< Number of ccodes entries in the set */
971     wl_ccode_entry_t ccodelist[1];
972 } wl_ccode_info_t;
973 #define WL_CCODE_INFO_FIXED_LEN    OFFSETOF(wl_ccode_info_t, ccodelist)
974 typedef struct wl_channels_in_country {
975     uint32 buflen;
976     uint32 band;
977     char country_abbrev[WLC_CNTRY_BUF_SZ];
978     uint32 count;
979     uint32 channel[1];
980 } wl_channels_in_country_t;
981 
982 typedef struct wl_country_list {
983     uint32 buflen;
984     uint32 band_set;
985     uint32 band;
986     uint32 count;
987     char country_abbrev[1];
988 } wl_country_list_t;
989 
990 typedef struct wl_rm_req_elt {
991     int8    type;
992     int8    flags;
993     chanspec_t    chanspec;
994     uint32    token;        /**< token for this measurement */
995     uint32    tsf_h;        /**< TSF high 32-bits of Measurement start time */
996     uint32    tsf_l;        /**< TSF low 32-bits */
997     uint32    dur;        /**< TUs */
998 } wl_rm_req_elt_t;
999 
1000 typedef struct wl_rm_req {
1001     uint32    token;        /**< overall measurement set token */
1002     uint32    count;        /**< number of measurement requests */
1003     void    *cb;        /**< completion callback function: may be NULL */
1004     void    *cb_arg;    /**< arg to completion callback function */
1005     wl_rm_req_elt_t    req[1];    /**< variable length block of requests */
1006 } wl_rm_req_t;
1007 #define WL_RM_REQ_FIXED_LEN    OFFSETOF(wl_rm_req_t, req)
1008 
1009 typedef struct wl_rm_rep_elt {
1010     int8    type;
1011     int8    flags;
1012     chanspec_t    chanspec;
1013     uint32    token;        /**< token for this measurement */
1014     uint32    tsf_h;        /**< TSF high 32-bits of Measurement start time */
1015     uint32    tsf_l;        /**< TSF low 32-bits */
1016     uint32    dur;        /**< TUs */
1017     uint32    len;        /**< byte length of data block */
1018     uint8    data[1];    /**< variable length data block */
1019 } wl_rm_rep_elt_t;
1020 #define WL_RM_REP_ELT_FIXED_LEN    24    /**< length excluding data block */
1021 
1022 #define WL_RPI_REP_BIN_NUM 8
1023 typedef struct wl_rm_rpi_rep {
1024     uint8    rpi[WL_RPI_REP_BIN_NUM];
1025     int8    rpi_max[WL_RPI_REP_BIN_NUM];
1026 } wl_rm_rpi_rep_t;
1027 
1028 typedef struct wl_rm_rep {
1029     uint32    token;        /**< overall measurement set token */
1030     uint32    len;        /**< length of measurement report block */
1031     wl_rm_rep_elt_t    rep[1];    /**< variable length block of reports */
1032 } wl_rm_rep_t;
1033 #define WL_RM_REP_FIXED_LEN    8
1034 typedef enum sup_auth_status {
1035     /* Basic supplicant authentication states */
1036     WLC_SUP_DISCONNECTED = 0,
1037     WLC_SUP_CONNECTING,
1038     WLC_SUP_IDREQUIRED,
1039     WLC_SUP_AUTHENTICATING,
1040     WLC_SUP_AUTHENTICATED,
1041     WLC_SUP_KEYXCHANGE,
1042     WLC_SUP_KEYED,
1043     WLC_SUP_TIMEOUT,
1044     WLC_SUP_LAST_BASIC_STATE,
1045 
1046     /* Extended supplicant authentication states */
1047     /** Waiting to receive handshake msg M1 */
1048     WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
1049     /** Preparing to send handshake msg M2 */
1050     WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
1051     /* Waiting to receive handshake msg M3 */
1052     WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
1053     WLC_SUP_KEYXCHANGE_PREP_M4,    /**< Preparing to send handshake msg M4 */
1054     WLC_SUP_KEYXCHANGE_WAIT_G1,    /**< Waiting to receive handshake msg G1 */
1055     WLC_SUP_KEYXCHANGE_PREP_G2    /**< Preparing to send handshake msg G2 */
1056 } sup_auth_status_t;
1057 
1058 typedef struct wl_wsec_key {
1059     uint32        index;        /**< key index */
1060     uint32        len;        /**< key length */
1061     uint8        data[DOT11_MAX_KEY_SIZE];    /**< key data */
1062     uint32        pad_1[18];
1063     uint32        algo;        /**< CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
1064     uint32        flags;        /**< misc flags */
1065     uint32        pad_2[2];
1066     int32        pad_3;
1067     int32        iv_initialized;    /**< has IV been initialized already? */
1068     int32        pad_4;
1069     /* Rx IV */
1070     struct {
1071         uint32    hi;        /**< upper 32 bits of IV */
1072         uint16    lo;        /**< lower 16 bits of IV */
1073         uint16    PAD;
1074     } rxiv;
1075     uint32        pad_5[2];
1076     struct ether_addr ea;        /**< per station */
1077     uint16    PAD;
1078 } wl_wsec_key_t;
1079 
1080 #define WSEC_MIN_PSK_LEN    8
1081 #define WSEC_MAX_PSK_LEN    64
1082 
1083 /** Flag for key material needing passhash'ing */
1084 #define WSEC_PASSPHRASE        (1<<0)
1085 
1086 /**receptacle for WLC_SET_WSEC_PMK parameter */
1087 typedef struct wsec_pmk {
1088     ushort    key_len;        /**< octets in key material */
1089     ushort    flags;            /**< key handling qualification */
1090     uint8    key[WSEC_MAX_PSK_LEN];    /**< PMK material */
1091 } wsec_pmk_t;
1092 
1093 typedef struct _pmkid {
1094     struct ether_addr    BSSID;
1095     uint8            PMKID[WPA2_PMKID_LEN];
1096 } pmkid_t;
1097 
1098 typedef struct _pmkid_list {
1099     uint32    npmkid;
1100     pmkid_t    pmkid[1];
1101 } pmkid_list_t;
1102 
1103 typedef struct _pmkid_cand {
1104     struct ether_addr    BSSID;
1105     uint8            preauth;
1106 } pmkid_cand_t;
1107 
1108 typedef struct _pmkid_cand_list {
1109     uint32    npmkid_cand;
1110     pmkid_cand_t    pmkid_cand[1];
1111 } pmkid_cand_list_t;
1112 
1113 #define WL_STA_ANT_MAX        4    /**< max possible rx antennas */
1114 
1115 typedef struct wl_assoc_info {
1116     uint32        req_len;
1117     uint32        resp_len;
1118     uint32        flags;
1119     struct dot11_assoc_req req;
1120     struct ether_addr reassoc_bssid; /**< used in reassoc's */
1121     struct dot11_assoc_resp resp;
1122 } wl_assoc_info_t;
1123 
1124 typedef struct wl_led_info {
1125     uint32      index;      /**< led index */
1126     uint32      behavior;
1127     uint8       activehi;
1128     uint8       PAD[3];
1129 } wl_led_info_t;
1130 
1131 
1132 /** srom read/write struct passed through ioctl */
1133 typedef struct {
1134     uint32    byteoff;    /**< byte offset */
1135     uint32    nbytes;        /**< number of bytes */
1136     uint16    buf[];
1137 } srom_rw_t;
1138 
1139 #define CISH_FLAG_PCIECIS    (1 << 15)    /**< write CIS format bit for PCIe CIS */
1140 
1141 /** similar cis (srom or otp) struct [iovar: may not be aligned] */
1142 typedef struct {
1143     uint16    source;        /**< cis source */
1144     uint16    flags;        /**< flags */
1145     uint32    byteoff;    /**< byte offset */
1146     uint32    nbytes;        /**< number of bytes */
1147     /* data follows here */
1148 } cis_rw_t;
1149 
1150 /** R_REG and W_REG struct passed through ioctl */
1151 typedef struct {
1152     uint32    byteoff;    /**< byte offset of the field in d11regs_t */
1153     uint32    val;        /**< read/write value of the field */
1154     uint32    size;        /**< sizeof the field */
1155     uint32    band;        /**< band (optional) */
1156 } rw_reg_t;
1157 
1158 /**
1159  * Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band
1160  * PCL - Power Control Loop
1161  */
1162 typedef struct {
1163     uint16    auto_ctrl;    /**< WL_ATTEN_XX */
1164     uint16    bb;        /**< Baseband attenuation */
1165     uint16    radio;        /**< Radio attenuation */
1166     uint16    txctl1;        /**< Radio TX_CTL1 value */
1167 } atten_t;
1168 
1169 /** Per-AC retry parameters */
1170 struct wme_tx_params_s {
1171     uint8  short_retry;
1172     uint8  short_fallback;
1173     uint8  long_retry;
1174     uint8  long_fallback;
1175     uint16 max_rate;  /**< In units of 512 Kbps */
1176 };
1177 
1178 typedef struct wme_tx_params_s wme_tx_params_t;
1179 
1180 #define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
1181 
1182 /**Used to get specific link/ac parameters */
1183 typedef struct {
1184     int32 ac;
1185     uint8 val;
1186     struct ether_addr ea;
1187     uint8 PAD;
1188 } link_val_t;
1189 
1190 
1191 #define WL_PM_MUTE_TX_VER 1
1192 
1193 typedef struct wl_pm_mute_tx {
1194     uint16 version;        /**< version */
1195     uint16 len;        /**< length */
1196     uint16 deadline;    /**< deadline timer (in milliseconds) */
1197     uint8  enable;        /**< set to 1 to enable mode; set to 0 to disable it */
1198     uint8 PAD;
1199 } wl_pm_mute_tx_t;
1200 
1201 
1202 /* sta_info_t version 4 */
1203 typedef struct {
1204     uint16            ver;        /**< version of this struct */
1205     uint16            len;        /**< length in bytes of this structure */
1206     uint16            cap;        /**< sta's advertised capabilities */
1207     uint16            PAD;
1208     uint32            flags;        /**< flags defined below */
1209     uint32            idle;        /**< time since data pkt rx'd from sta */
1210     struct ether_addr    ea;        /**< Station address */
1211     uint16            PAD;
1212     wl_rateset_t    rateset;    /**< rateset in use */
1213     uint32            in;        /**< seconds elapsed since associated */
1214     uint32            listen_interval_inms; /**< Min Listen interval in ms for this STA */
1215     uint32            tx_pkts;    /**< # of user packets transmitted (unicast) */
1216     uint32            tx_failures;    /**< # of user packets failed */
1217     uint32            rx_ucast_pkts;    /**< # of unicast packets received */
1218     uint32            rx_mcast_pkts;    /**< # of multicast packets received */
1219     uint32            tx_rate;    /**< Rate used by last tx frame */
1220     uint32            rx_rate;    /**< Rate of last successful rx frame */
1221     uint32            rx_decrypt_succeeds;    /**< # of packet decrypted successfully */
1222     uint32            rx_decrypt_failures;    /**< # of packet decrypted unsuccessfully */
1223     uint32            tx_tot_pkts;    /**< # of user tx pkts (ucast + mcast) */
1224     uint32            rx_tot_pkts;    /**< # of data packets recvd (uni + mcast) */
1225     uint32            tx_mcast_pkts;    /**< # of mcast pkts txed */
1226     uint64            tx_tot_bytes;    /**< data bytes txed (ucast + mcast) */
1227     uint64            rx_tot_bytes;    /**< data bytes recvd (ucast + mcast) */
1228     uint64            tx_ucast_bytes;    /**< data bytes txed (ucast) */
1229     uint64            tx_mcast_bytes;    /**< # data bytes txed (mcast) */
1230     uint64            rx_ucast_bytes;    /**< data bytes recvd (ucast) */
1231     uint64            rx_mcast_bytes;    /**< data bytes recvd (mcast) */
1232     int8            rssi[WL_STA_ANT_MAX]; /**< average rssi per antenna
1233                             * of data frames
1234                             */
1235     int8            nf[WL_STA_ANT_MAX];    /**< per antenna noise floor */
1236     uint16            aid;            /**< association ID */
1237     uint16            ht_capabilities;    /**< advertised ht caps */
1238     uint16            vht_flags;        /**< converted vht flags */
1239     uint16            PAD;
1240     uint32            tx_pkts_retried;    /**< # of frames where a retry was
1241                              * necessary
1242                              */
1243     uint32            tx_pkts_retry_exhausted; /**< # of user frames where a retry
1244                               * was exhausted
1245                               */
1246     int8            rx_lastpkt_rssi[WL_STA_ANT_MAX]; /**< Per antenna RSSI of last
1247                                   * received data frame.
1248                                   */
1249     /* TX WLAN retry/failure statistics:
1250      * Separated for host requested frames and WLAN locally generated frames.
1251      * Include unicast frame only where the retries/failures can be counted.
1252      */
1253     uint32            tx_pkts_total;        /**< # user frames sent successfully */
1254     uint32            tx_pkts_retries;    /**< # user frames retries */
1255     uint32            tx_pkts_fw_total;    /**< # FW generated sent successfully */
1256     uint32            tx_pkts_fw_retries;    /**< # retries for FW generated frames */
1257     uint32            tx_pkts_fw_retry_exhausted;    /**< # FW generated where a retry
1258                                  * was exhausted
1259                                  */
1260     uint32            rx_pkts_retried;    /**< # rx with retry bit set */
1261     uint32            tx_rate_fallback;    /**< lowest fallback TX rate */
1262     /* Fields above this line are common to sta_info_t versions 4 and 5 */
1263 
1264     uint32            rx_dur_total;    /* total user RX duration (estimated) */
1265 
1266     chanspec_t        chanspec;       /** chanspec this sta is on */
1267     uint16            PAD;
1268     wl_rateset_args_t    rateset_adv;    /* rateset along with mcs index bitmap */
1269     uint32            PAD;
1270 } sta_info_v4_t;
1271 
1272 /* Note: Version 4 is the latest version of sta_info_t.  Version 5 is abandoned.
1273  * Please add new fields to version 4, not version 5.
1274  */
1275 /* sta_info_t version 5 */
1276 typedef struct {
1277     uint16            ver;        /**< version of this struct */
1278     uint16            len;        /**< length in bytes of this structure */
1279     uint16            cap;        /**< sta's advertised capabilities */
1280     uint16            PAD;
1281     uint32            flags;        /**< flags defined below */
1282     uint32            idle;        /**< time since data pkt rx'd from sta */
1283     struct ether_addr    ea;        /**< Station address */
1284     uint16            PAD;
1285     wl_rateset_t        rateset;    /**< rateset in use */
1286     uint32            in;        /**< seconds elapsed since associated */
1287     uint32            listen_interval_inms; /**< Min Listen interval in ms for this STA */
1288     uint32            tx_pkts;    /**< # of user packets transmitted (unicast) */
1289     uint32            tx_failures;    /**< # of user packets failed */
1290     uint32            rx_ucast_pkts;    /**< # of unicast packets received */
1291     uint32            rx_mcast_pkts;    /**< # of multicast packets received */
1292     uint32            tx_rate;    /**< Rate used by last tx frame */
1293     uint32            rx_rate;    /**< Rate of last successful rx frame */
1294     uint32            rx_decrypt_succeeds;    /**< # of packet decrypted successfully */
1295     uint32            rx_decrypt_failures;    /**< # of packet decrypted unsuccessfully */
1296     uint32            tx_tot_pkts;    /**< # of user tx pkts (ucast + mcast) */
1297     uint32            rx_tot_pkts;    /**< # of data packets recvd (uni + mcast) */
1298     uint32            tx_mcast_pkts;    /**< # of mcast pkts txed */
1299     uint64            tx_tot_bytes;    /**< data bytes txed (ucast + mcast) */
1300     uint64            rx_tot_bytes;    /**< data bytes recvd (ucast + mcast) */
1301     uint64            tx_ucast_bytes;    /**< data bytes txed (ucast) */
1302     uint64            tx_mcast_bytes;    /**< # data bytes txed (mcast) */
1303     uint64            rx_ucast_bytes;    /**< data bytes recvd (ucast) */
1304     uint64            rx_mcast_bytes;    /**< data bytes recvd (mcast) */
1305     int8            rssi[WL_STA_ANT_MAX]; /**< average rssi per antenna
1306                             * of data frames
1307                             */
1308     int8            nf[WL_STA_ANT_MAX];    /**< per antenna noise floor */
1309     uint16            aid;            /**< association ID */
1310     uint16            ht_capabilities;    /**< advertised ht caps */
1311     uint16            vht_flags;        /**< converted vht flags */
1312     uint16            PAD;
1313     uint32            tx_pkts_retried;    /**< # of frames where a retry was
1314                              * necessary
1315                              */
1316     uint32            tx_pkts_retry_exhausted; /**< # of user frames where a retry
1317                               * was exhausted
1318                               */
1319     int8            rx_lastpkt_rssi[WL_STA_ANT_MAX]; /**< Per antenna RSSI of last
1320                                   * received data frame.
1321                                   */
1322     /* TX WLAN retry/failure statistics:
1323      * Separated for host requested frames and WLAN locally generated frames.
1324      * Include unicast frame only where the retries/failures can be counted.
1325      */
1326     uint32            tx_pkts_total;        /**< # user frames sent successfully */
1327     uint32            tx_pkts_retries;    /**< # user frames retries */
1328     uint32            tx_pkts_fw_total;    /**< # FW generated sent successfully */
1329     uint32            tx_pkts_fw_retries;    /**< # retries for FW generated frames */
1330     uint32            tx_pkts_fw_retry_exhausted;    /**< # FW generated where a retry
1331                                  * was exhausted
1332                                  */
1333     uint32            rx_pkts_retried;    /**< # rx with retry bit set */
1334     uint32            tx_rate_fallback;    /**< lowest fallback TX rate */
1335     /* Fields above this line are common to sta_info_t versions 4 and 5 */
1336 
1337     chanspec_t        chanspec;       /** chanspec this sta is on */
1338     uint16            PAD;
1339     wl_rateset_args_t    rateset_adv;    /* rateset along with mcs index bitmap */
1340 } sta_info_v5_t;
1341 
1342 #define WL_OLD_STAINFO_SIZE    OFFSETOF(sta_info_t, tx_tot_pkts)
1343 
1344 #define WL_STA_VER_4        4
1345 #define WL_STA_VER_5        5
1346 #define WL_STA_VER        WL_STA_VER_4
1347 
1348 #define SWDIV_STATS_VERSION_2 2
1349 #define SWDIV_STATS_CURRENT_VERSION SWDIV_STATS_VERSION_2
1350 
1351 struct wlc_swdiv_stats_v1 {
1352     uint32 auto_en;
1353     uint32 active_ant;
1354     uint32 rxcount;
1355     int32 avg_snr_per_ant0;
1356     int32 avg_snr_per_ant1;
1357     int32 avg_snr_per_ant2;
1358     uint32 swap_ge_rxcount0;
1359     uint32 swap_ge_rxcount1;
1360     uint32 swap_ge_snrthresh0;
1361     uint32 swap_ge_snrthresh1;
1362     uint32 swap_txfail0;
1363     uint32 swap_txfail1;
1364     uint32 swap_timer0;
1365     uint32 swap_timer1;
1366     uint32 swap_alivecheck0;
1367     uint32 swap_alivecheck1;
1368     uint32 rxcount_per_ant0;
1369     uint32 rxcount_per_ant1;
1370     uint32 acc_rxcount;
1371     uint32 acc_rxcount_per_ant0;
1372     uint32 acc_rxcount_per_ant1;
1373     uint32 tx_auto_en;
1374     uint32 tx_active_ant;
1375     uint32 rx_policy;
1376     uint32 tx_policy;
1377     uint32 cell_policy;
1378     uint32 swap_snrdrop0;
1379     uint32 swap_snrdrop1;
1380     uint32 mws_antsel_ovr_tx;
1381     uint32 mws_antsel_ovr_rx;
1382     uint8 swap_trig_event_id;
1383 };
1384 
1385 struct wlc_swdiv_stats_v2 {
1386     uint16    version;    /* version of the structure
1387                         * as defined by SWDIV_STATS_CURRENT_VERSION
1388                         */
1389     uint16    length;        /* length of the entire structure */
1390     uint32 auto_en;
1391     uint32 active_ant;
1392     uint32 rxcount;
1393     int32 avg_snr_per_ant0;
1394     int32 avg_snr_per_ant1;
1395     int32 avg_snr_per_ant2;
1396     uint32 swap_ge_rxcount0;
1397     uint32 swap_ge_rxcount1;
1398     uint32 swap_ge_snrthresh0;
1399     uint32 swap_ge_snrthresh1;
1400     uint32 swap_txfail0;
1401     uint32 swap_txfail1;
1402     uint32 swap_timer0;
1403     uint32 swap_timer1;
1404     uint32 swap_alivecheck0;
1405     uint32 swap_alivecheck1;
1406     uint32 rxcount_per_ant0;
1407     uint32 rxcount_per_ant1;
1408     uint32 acc_rxcount;
1409     uint32 acc_rxcount_per_ant0;
1410     uint32 acc_rxcount_per_ant1;
1411     uint32 tx_auto_en;
1412     uint32 tx_active_ant;
1413     uint32 rx_policy;
1414     uint32 tx_policy;
1415     uint32 cell_policy;
1416     uint32 swap_snrdrop0;
1417     uint32 swap_snrdrop1;
1418     uint32 mws_antsel_ovr_tx;
1419     uint32 mws_antsel_ovr_rx;
1420     uint32 swap_trig_event_id;
1421 };
1422 
1423 #define    WLC_NUMRATES    16    /**< max # of rates in a rateset */
1424 
1425 /**Used to get specific STA parameters */
1426 typedef struct {
1427     uint32    val;
1428     struct ether_addr ea;
1429     uint16    PAD;
1430 } scb_val_t;
1431 
1432 /**Used by iovar versions of some ioctls, i.e. WLC_SCB_AUTHORIZE et al */
1433 typedef struct {
1434     uint32 code;
1435     scb_val_t ioctl_args;
1436 } authops_t;
1437 
1438 /** channel encoding */
1439 typedef struct channel_info {
1440     int32 hw_channel;
1441     int32 target_channel;
1442     int32 scan_channel;
1443 } channel_info_t;
1444 
1445 /** For ioctls that take a list of MAC addresses */
1446 typedef struct maclist {
1447     uint32 count;            /**< number of MAC addresses */
1448     struct ether_addr ea[1];    /**< variable length array of MAC addresses */
1449 } maclist_t;
1450 
1451 /**get pkt count struct passed through ioctl */
1452 typedef struct get_pktcnt {
1453     uint32 rx_good_pkt;
1454     uint32 rx_bad_pkt;
1455     uint32 tx_good_pkt;
1456     uint32 tx_bad_pkt;
1457     uint32 rx_ocast_good_pkt; /**< unicast packets destined for others */
1458 } get_pktcnt_t;
1459 
1460 /* NINTENDO2 */
1461 #define LQ_IDX_MIN              0
1462 #define LQ_IDX_MAX              1
1463 #define LQ_IDX_AVG              2
1464 #define LQ_IDX_SUM              2
1465 #define LQ_IDX_LAST             3
1466 #define LQ_STOP_MONITOR         0
1467 #define LQ_START_MONITOR        1
1468 
1469 /** Get averages RSSI, Rx PHY rate and SNR values */
1470 /* Link Quality */
1471 typedef struct {
1472     int32 rssi[LQ_IDX_LAST];  /**< Array to keep min, max, avg rssi */
1473     int32 snr[LQ_IDX_LAST];   /**< Array to keep min, max, avg snr */
1474     int32 isvalid;            /**< Flag indicating whether above data is valid */
1475 } wl_lq_t;
1476 
1477 typedef enum wl_wakeup_reason_type {
1478     LCD_ON = 1,
1479     LCD_OFF,
1480     DRC1_WAKE,
1481     DRC2_WAKE,
1482     REASON_LAST
1483 } wl_wr_type_t;
1484 
1485 typedef struct {
1486     /** Unique filter id */
1487     uint32    id;
1488     /** stores the reason for the last wake up */
1489     uint8    reason;
1490     uint8    PAD[3];
1491 } wl_wr_t;
1492 
1493 /** Get MAC specific rate histogram command */
1494 typedef struct {
1495     struct    ether_addr ea;    /**< MAC Address */
1496     uint8    ac_cat;    /**< Access Category */
1497     uint8    num_pkts;    /**< Number of packet entries to be averaged */
1498 } wl_mac_ratehisto_cmd_t;
1499 /** Get MAC rate histogram response */
1500 typedef struct {
1501     uint32    rate[DOT11_RATE_MAX + 1];    /**< Rates */
1502     uint32    mcs[WL_RATESET_SZ_HT_IOCTL * WL_TX_CHAINS_MAX];    /**< MCS counts */
1503     uint32    vht[WL_RATESET_SZ_VHT_MCS][WL_TX_CHAINS_MAX];    /**< VHT counts */
1504     uint32    tsf_timer[2][2];    /**< Start and End time for 8bytes value */
1505     uint32    prop11n_mcs[WLC_11N_LAST_PROP_MCS - WLC_11N_FIRST_PROP_MCS + 1]; /** MCS counts */
1506 } wl_mac_ratehisto_res_t;
1507 
1508 /* sta_info ecounters */
1509 typedef struct {
1510     struct ether_addr   ea;                /* Station MAC addr */
1511     struct ether_addr   BSSID;            /* BSSID of the BSS */
1512     uint32              tx_pkts_fw_total;        /* # FW generated sent successfully */
1513     uint32              tx_pkts_fw_retries;        /* # retries for FW generated frames */
1514     uint32              tx_pkts_fw_retry_exhausted;    /* # FW generated which
1515                              * failed after retry
1516                              */
1517 } sta_info_ecounters_t;
1518 
1519 #define STAMON_MODULE_VER        1
1520 
1521 /**Linux network driver ioctl encoding */
1522 typedef struct wl_ioctl {
1523     uint32 cmd;    /**< common ioctl definition */
1524     void *buf;    /**< pointer to user buffer */
1525     uint32 len;    /**< length of user buffer */
1526     uint8 set;        /**< 1=set IOCTL; 0=query IOCTL */
1527     uint32 used;    /**< bytes read or written (optional) */
1528     uint32 needed;    /**< bytes needed (optional) */
1529 } wl_ioctl_t;
1530 
1531 #ifdef CONFIG_COMPAT
1532 typedef struct compat_wl_ioctl {
1533     uint32 cmd;    /**< common ioctl definition */
1534     uint32 buf;    /**< pointer to user buffer */
1535     uint32 len;    /**< length of user buffer */
1536     uint8 set;        /**< 1=set IOCTL; 0=query IOCTL */
1537     uint32 used;    /**< bytes read or written (optional) */
1538     uint32 needed;    /**< bytes needed (optional) */
1539 } compat_wl_ioctl_t;
1540 #endif /* CONFIG_COMPAT */
1541 
1542 #define WL_NUM_RATES_CCK        4 /**< 1, 2, 5.5, 11 Mbps */
1543 #define WL_NUM_RATES_OFDM        8 /**< 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
1544 #define WL_NUM_RATES_MCS_1STREAM    8 /**< MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
1545 #define WL_NUM_RATES_EXTRA_VHT        2 /**< Additional VHT 11AC rates */
1546 #define WL_NUM_RATES_VHT        10
1547 #define WL_NUM_RATES_MCS32        1
1548 
1549 
1550 /*
1551  * Structure for passing hardware and software
1552  * revision info up from the driver.
1553  */
1554 typedef struct wlc_rev_info {
1555     uint32        vendorid;    /**< PCI vendor id */
1556     uint32        deviceid;    /**< device id of chip */
1557     uint32        radiorev;    /**< radio revision */
1558     uint32        chiprev;    /**< chip revision */
1559     uint32        corerev;    /**< core revision */
1560     uint32        boardid;    /**< board identifier (usu. PCI sub-device id) */
1561     uint32        boardvendor;    /**< board vendor (usu. PCI sub-vendor id) */
1562     uint32        boardrev;    /**< board revision */
1563     uint32        driverrev;    /**< driver version */
1564     uint32        ucoderev;    /**< microcode version */
1565     uint32        bus;        /**< bus type */
1566     uint32        chipnum;    /**< chip number */
1567     uint32        phytype;    /**< phy type */
1568     uint32        phyrev;        /**< phy revision */
1569     uint32        anarev;        /**< anacore rev */
1570     uint32        chippkg;    /**< chip package info */
1571     uint32        nvramrev;    /**< nvram revision number */
1572     uint32        phyminorrev;    /**< phy minor rev */
1573     uint32        coreminorrev;    /**< core minor rev */
1574     uint32        drvrev_major;    /**< driver version: major */
1575     uint32        drvrev_minor;    /**< driver version: minor */
1576     uint32        drvrev_rc;    /**< driver version: rc */
1577     uint32        drvrev_rc_inc;    /**< driver version: rc incremental */
1578 } wlc_rev_info_t;
1579 
1580 #define WL_REV_INFO_LEGACY_LENGTH    48
1581 
1582 #define WL_BRAND_MAX 10
1583 typedef struct wl_instance_info {
1584     uint32 instance;
1585     int8 brand[WL_BRAND_MAX];
1586     int8 PAD[4-(WL_BRAND_MAX%4)];
1587 } wl_instance_info_t;
1588 
1589 /** structure to change size of tx fifo */
1590 typedef struct wl_txfifo_sz {
1591     uint16    magic;
1592     uint16    fifo;
1593     uint16    size;
1594 } wl_txfifo_sz_t;
1595 
1596 /* Transfer info about an IOVar from the driver */
1597 /**Max supported IOV name size in bytes, + 1 for nul termination */
1598 #define WLC_IOV_NAME_LEN    (32 + 1)
1599 
1600 typedef struct wlc_iov_trx_s {
1601     uint8 module;
1602     uint8 type;
1603     char name[WLC_IOV_NAME_LEN];
1604 } wlc_iov_trx_t;
1605 
1606 /** bump this number if you change the ioctl interface */
1607 #define WLC_IOCTL_VERSION    2
1608 #define WLC_IOCTL_VERSION_LEGACY_IOTYPES    1
1609 /* ifdef EXT_STA */
1610 typedef struct _wl_assoc_result {
1611     ulong associated;
1612     ulong NDIS_auth;
1613     ulong NDIS_infra;
1614 } wl_assoc_result_t;
1615 /* EXT_STA */
1616 
1617 #define WL_PHY_PAVARS_LEN    32    /**< Phytype, Bandrange, chain, a[0], b[0], c[0], d[0] .. */
1618 
1619 
1620 #define WL_PHY_PAVAR_VER    1    /**< pavars version */
1621 #define WL_PHY_PAVARS2_NUM    3    /**< a1, b0, b1 */
1622 typedef struct wl_pavars2 {
1623     uint16 ver;        /**< version of this struct */
1624     uint16 len;        /**< len of this structure */
1625     uint16 inuse;        /**< driver return 1 for a1,b0,b1 in current band range */
1626     uint16 phy_type;    /**< phy type */
1627     uint16 bandrange;
1628     uint16 chain;
1629     uint16 inpa[WL_PHY_PAVARS2_NUM];    /**< phy pavars for one band range */
1630 } wl_pavars2_t;
1631 
1632 typedef struct wl_po {
1633     uint16    phy_type;    /**< Phy type */
1634     uint16    band;
1635     uint16    cckpo;
1636     uint16    PAD;
1637     uint32    ofdmpo;
1638     uint16    mcspo[8];
1639 } wl_po_t;
1640 
1641 #define WL_NUM_RPCALVARS 5    /**< number of rpcal vars */
1642 
1643 typedef struct wl_rpcal {
1644     uint16 value;
1645     uint16 update;
1646 } wl_rpcal_t;
1647 
1648 #define WL_NUM_RPCALPHASEVARS 5    /* number of rpcal phase vars */
1649 
1650 typedef struct wl_rpcal_phase {
1651     uint16 value;
1652     uint16 update;
1653 } wl_rpcal_phase_t;
1654 
1655 typedef struct wl_aci_args {
1656     int32 enter_aci_thresh; /* Trigger level to start detecting ACI */
1657     int32 exit_aci_thresh; /* Trigger level to exit ACI mode */
1658     int32 usec_spin; /* microsecs to delay between rssi samples */
1659     int32 glitch_delay; /* interval between ACI scans when glitch count is consistently high */
1660     uint16 nphy_adcpwr_enter_thresh;    /**< ADC power to enter ACI mitigation mode */
1661     uint16 nphy_adcpwr_exit_thresh;    /**< ADC power to exit ACI mitigation mode */
1662     uint16 nphy_repeat_ctr;        /**< Number of tries per channel to compute power */
1663     uint16 nphy_num_samples;    /**< Number of samples to compute power on one channel */
1664     uint16 nphy_undetect_window_sz;    /**< num of undetects to exit ACI Mitigation mode */
1665     uint16 nphy_b_energy_lo_aci;    /**< low ACI power energy threshold for bphy */
1666     uint16 nphy_b_energy_md_aci;    /**< mid ACI power energy threshold for bphy */
1667     uint16 nphy_b_energy_hi_aci;    /**< high ACI power energy threshold for bphy */
1668     uint16 nphy_noise_noassoc_glitch_th_up; /**< wl interference 4 */
1669     uint16 nphy_noise_noassoc_glitch_th_dn;
1670     uint16 nphy_noise_assoc_glitch_th_up;
1671     uint16 nphy_noise_assoc_glitch_th_dn;
1672     uint16 nphy_noise_assoc_aci_glitch_th_up;
1673     uint16 nphy_noise_assoc_aci_glitch_th_dn;
1674     uint16 nphy_noise_assoc_enter_th;
1675     uint16 nphy_noise_noassoc_enter_th;
1676     uint16 nphy_noise_assoc_rx_glitch_badplcp_enter_th;
1677     uint16 nphy_noise_noassoc_crsidx_incr;
1678     uint16 nphy_noise_assoc_crsidx_incr;
1679     uint16 nphy_noise_crsidx_decr;
1680 } wl_aci_args_t;
1681 
1682 #define WL_ACI_ARGS_LEGACY_LENGTH    16    /**< bytes of pre NPHY aci args */
1683 #define    WL_SAMPLECOLLECT_T_VERSION    2    /**< version of wl_samplecollect_args_t struct */
1684 typedef struct wl_samplecollect_args {
1685     /* version 0 fields */
1686     uint8 coll_us;
1687     uint8 PAD[3];
1688     int32 cores;
1689     /* add'l version 1 fields */
1690     uint16 version;     /**< see definition of WL_SAMPLECOLLECT_T_VERSION */
1691     uint16 length;      /**< length of entire structure */
1692     int8 trigger;
1693     uint8 PAD;
1694     uint16 timeout;
1695     uint16 mode;
1696     uint16 PAD;
1697     uint32 pre_dur;
1698     uint32 post_dur;
1699     uint8 gpio_sel;
1700     uint8 downsamp;
1701     uint8 be_deaf;
1702     uint8 agc;        /**< loop from init gain and going down */
1703     uint8 filter;        /**< override high pass corners to lowest */
1704     /* add'l version 2 fields */
1705     uint8 trigger_state;
1706     uint8 module_sel1;
1707     uint8 module_sel2;
1708     uint16 nsamps;
1709     uint16 PAD;
1710     int32 bitStart;
1711     uint32 gpioCapMask;
1712     uint8 gpio_collection;
1713     uint8 PAD[3];
1714 } wl_samplecollect_args_t;
1715 
1716 #define    WL_SAMPLEDATA_T_VERSION        1    /**< version of wl_samplecollect_args_t struct */
1717 /* version for unpacked sample data, int16 {(I,Q),Core(0..N)} */
1718 #define    WL_SAMPLEDATA_T_VERSION_SPEC_AN 2
1719 
1720 typedef struct wl_sampledata {
1721     uint16 version;    /**< structure version */
1722     uint16 size;    /**< size of structure */
1723     uint16 tag;    /**< Header/Data */
1724     uint16 length;    /**< data length */
1725     uint32 flag;    /**< bit def */
1726 } wl_sampledata_t;
1727 
1728 
1729 /* WL_OTA START */
1730 /* OTA Test Status */
1731 enum {
1732     WL_OTA_TEST_IDLE = 0,        /**< Default Idle state */
1733     WL_OTA_TEST_ACTIVE = 1,        /**< Test Running */
1734     WL_OTA_TEST_SUCCESS = 2,    /**< Successfully Finished Test */
1735     WL_OTA_TEST_FAIL = 3        /**< Test Failed in the Middle */
1736 };
1737 
1738 /* OTA SYNC Status */
1739 enum {
1740     WL_OTA_SYNC_IDLE = 0,    /**< Idle state */
1741     WL_OTA_SYNC_ACTIVE = 1,    /**< Waiting for Sync */
1742     WL_OTA_SYNC_FAIL = 2    /**< Sync pkt not recieved */
1743 };
1744 
1745 /* Various error states dut can get stuck during test */
1746 enum {
1747     WL_OTA_SKIP_TEST_CAL_FAIL = 1,        /**< Phy calibration failed */
1748     WL_OTA_SKIP_TEST_SYNCH_FAIL = 2,    /**< Sync Packet not recieved */
1749     WL_OTA_SKIP_TEST_FILE_DWNLD_FAIL = 3,    /**< Cmd flow file download failed */
1750     WL_OTA_SKIP_TEST_NO_TEST_FOUND = 4,    /**< No test found in Flow file */
1751     WL_OTA_SKIP_TEST_WL_NOT_UP = 5,        /**< WL UP failed */
1752     WL_OTA_SKIP_TEST_UNKNOWN_CALL        /**< Unintentional scheduling on ota test */
1753 };
1754 
1755 /* Differentiator for ota_tx and ota_rx */
1756 enum {
1757     WL_OTA_TEST_TX = 0,        /**< ota_tx */
1758     WL_OTA_TEST_RX = 1,        /**< ota_rx */
1759 };
1760 
1761 /* Catch 3 modes of operation: 20Mhz, 40Mhz, 20 in 40 Mhz */
1762 enum {
1763     WL_OTA_TEST_BW_20_IN_40MHZ = 0,        /**< 20 in 40 operation */
1764     WL_OTA_TEST_BW_20MHZ = 1,        /**< 20 Mhz operation */
1765     WL_OTA_TEST_BW_40MHZ = 2,        /**< full 40Mhz operation */
1766     WL_OTA_TEST_BW_80MHZ = 3        /* full 80Mhz operation */
1767 };
1768 #define HT_MCS_INUSE    0x00000080    /* HT MCS in use,indicates b0-6 holds an mcs */
1769 #define VHT_MCS_INUSE    0x00000100    /* VHT MCS in use,indicates b0-6 holds an mcs */
1770 #define OTA_RATE_MASK 0x0000007f    /* rate/mcs value */
1771 #define OTA_STF_SISO    0
1772 #define OTA_STF_CDD        1
1773 #define OTA_STF_STBC    2
1774 #define OTA_STF_SDM        3
1775 
1776 typedef struct ota_rate_info {
1777     uint8 rate_cnt;                    /**< Total number of rates */
1778     uint8 PAD;
1779     uint16 rate_val_mbps[WL_OTA_TEST_MAX_NUM_RATE];    /**< array of rates from 1mbps to 130mbps */
1780                             /**< for legacy rates : ratein mbps * 2 */
1781                             /**< for HT rates : mcs index */
1782 } ota_rate_info_t;
1783 
1784 typedef struct ota_power_info {
1785     int8 pwr_ctrl_on;    /**< power control on/off */
1786     int8 start_pwr;        /**< starting power/index */
1787     int8 delta_pwr;        /**< delta power/index */
1788     int8 end_pwr;        /**< end power/index */
1789 } ota_power_info_t;
1790 
1791 typedef struct ota_packetengine {
1792     uint16 delay;           /**< Inter-packet delay */
1793                 /**< for ota_tx, delay is tx ifs in micro seconds */
1794                 /* for ota_rx, delay is wait time in milliseconds */
1795     uint16 nframes;         /**< Number of frames */
1796     uint16 length;          /**< Packet length */
1797 } ota_packetengine_t;
1798 
1799 /*
1800  * OTA txant/rxant parameter
1801  *    bit7-4: 4 bits swdiv_tx/rx_policy bitmask, specify antenna-policy for SW diversity
1802  *    bit3-0: 4 bits TxCore bitmask, specify cores used for transmit frames
1803  *            (maximum spatial expansion)
1804  */
1805 #define WL_OTA_TEST_ANT_MASK    0xF0
1806 #define WL_OTA_TEST_CORE_MASK    0x0F
1807 
1808 /* OTA txant/rxant 'ant_mask' field; map to Tx/Rx antenna policy for SW diversity */
1809 enum {
1810     WL_OTA_TEST_FORCE_ANT0 = 0x10,    /* force antenna to Ant 0 */
1811     WL_OTA_TEST_FORCE_ANT1 = 0x20,    /* force antenna to Ant 1 */
1812 };
1813 
1814 /* antenna/core fields access */
1815 #define WL_OTA_TEST_GET_ANT(_txant) ((_txant) & WL_OTA_TEST_ANT_MASK)
1816 #define WL_OTA_TEST_GET_CORE(_txant) ((_txant) & WL_OTA_TEST_CORE_MASK)
1817 
1818 /** Test info vector */
1819 typedef struct wl_ota_test_args {
1820     uint8 cur_test;            /**< test phase */
1821     uint8 chan;            /**< channel */
1822     uint8 bw;            /**< bandwidth */
1823     uint8 control_band;        /**< control band */
1824     uint8 stf_mode;            /**< stf mode */
1825     uint8 PAD;
1826     ota_rate_info_t rt_info;    /**< Rate info */
1827     ota_packetengine_t pkteng;    /**< packeteng info */
1828     uint8 txant;            /**< tx antenna */
1829     uint8 rxant;            /**< rx antenna */
1830     ota_power_info_t pwr_info;    /**< power sweep info */
1831     uint8 wait_for_sync;        /**< wait for sync or not */
1832     uint8 ldpc;
1833     uint8 sgi;
1834     uint8 PAD;
1835     /* Update WL_OTA_TESTVEC_T_VERSION for adding new members to this structure */
1836 } wl_ota_test_args_t;
1837 
1838 #define WL_OTA_TESTVEC_T_VERSION        1    /* version of wl_ota_test_vector_t struct */
1839 typedef struct wl_ota_test_vector {
1840     uint16 version;
1841     wl_ota_test_args_t test_arg[WL_OTA_TEST_MAX_NUM_SEQ];    /**< Test argument struct */
1842     uint16 test_cnt;                    /**< Total no of test */
1843     uint8 file_dwnld_valid;                    /**< File successfully downloaded */
1844     uint8 sync_timeout;                    /**< sync packet timeout */
1845     int8 sync_fail_action;                    /**< sync fail action */
1846     struct ether_addr sync_mac;                /**< macaddress for sync pkt */
1847     struct ether_addr tx_mac;                /**< macaddress for tx */
1848     struct ether_addr rx_mac;                /**< macaddress for rx */
1849     int8 loop_test;                    /**< dbg feature to loop the test */
1850     uint16 test_rxcnt;
1851     /* Update WL_OTA_TESTVEC_T_VERSION for adding new members to this structure */
1852 } wl_ota_test_vector_t;
1853 
1854 
1855 /** struct copied back form dongle to host to query the status */
1856 typedef struct wl_ota_test_status {
1857     int16 cur_test_cnt;        /**< test phase */
1858     int8 skip_test_reason;        /**< skip test reasoin */
1859     uint8 PAD;
1860     wl_ota_test_args_t test_arg;    /**< cur test arg details */
1861     uint16 test_cnt;        /**< total no of test downloaded */
1862     uint8 file_dwnld_valid;        /**< file successfully downloaded ? */
1863     uint8 sync_timeout;        /**< sync timeout */
1864     int8 sync_fail_action;        /**< sync fail action */
1865     struct ether_addr sync_mac;    /**< macaddress for sync pkt */
1866     struct ether_addr tx_mac;    /**< tx mac address */
1867     struct ether_addr rx_mac;    /**< rx mac address */
1868     uint8  test_stage;        /**< check the test status */
1869     int8 loop_test;            /**< Debug feature to puts test enfine in a loop */
1870     uint8 sync_status;        /**< sync status */
1871 } wl_ota_test_status_t;
1872 
1873 /* FOR ioctl that take the sta monitor information */
1874 typedef struct stamon_data {
1875     struct ether_addr  ea;
1876     uint8 PAD[2];
1877     int32 rssi;
1878 } stamon_data_t;
1879 
1880 typedef struct stamon_info {
1881     int32 version;
1882     uint32 count;
1883     stamon_data_t sta_data[1];
1884 } stamon_info_t;
1885 
1886 typedef struct wl_ota_rx_rssi {
1887     uint16    pktcnt;        /* Pkt count used for this rx test */
1888     chanspec_t chanspec;    /* Channel info on which the packets are received */
1889     int16    rssi;        /* Average RSSI of the first 50% packets received */
1890 } wl_ota_rx_rssi_t;
1891 
1892 #define    WL_OTARSSI_T_VERSION        1    /* version of wl_ota_test_rssi_t struct */
1893 #define WL_OTA_TEST_RSSI_FIXED_SIZE    OFFSETOF(wl_ota_test_rssi_t, rx_rssi)
1894 
1895 typedef struct wl_ota_test_rssi {
1896     uint8 version;
1897     uint8    testcnt;        /* total measured RSSI values, valid on output only */
1898     wl_ota_rx_rssi_t rx_rssi[1]; /* Variable length array of wl_ota_rx_rssi_t */
1899 } wl_ota_test_rssi_t;
1900 
1901 /* WL_OTA END */
1902 
1903 /**wl_radar_args_t */
1904 typedef struct {
1905     int32 npulses;    /**< required number of pulses at n * t_int */
1906     int32 ncontig;    /**< required number of pulses at t_int */
1907     int32 min_pw;    /**< minimum pulse width (20 MHz clocks) */
1908     int32 max_pw;    /**< maximum pulse width (20 MHz clocks) */
1909     uint16 thresh0;    /**< Radar detection, thresh 0 */
1910     uint16 thresh1;    /**< Radar detection, thresh 1 */
1911     uint16 blank;    /**< Radar detection, blank control */
1912     uint16 fmdemodcfg;    /**< Radar detection, fmdemod config */
1913     int32 npulses_lp;  /**< Radar detection, minimum long pulses */
1914     int32 min_pw_lp; /**< Minimum pulsewidth for long pulses */
1915     int32 max_pw_lp; /**< Maximum pulsewidth for long pulses */
1916     int32 min_fm_lp; /**< Minimum fm for long pulses */
1917     int32 max_span_lp;  /**< Maximum deltat for long pulses */
1918     int32 min_deltat; /**< Minimum spacing between pulses */
1919     int32 max_deltat; /**< Maximum spacing between pulses */
1920     uint16 autocorr;    /**< Radar detection, autocorr on or off */
1921     uint16 st_level_time;    /**< Radar detection, start_timing level */
1922     uint16 t2_min; /**< minimum clocks needed to remain in state 2 */
1923     uint8 PAD[2];
1924     uint32 version; /**< version */
1925     uint32 fra_pulse_err;    /**< sample error margin for detecting French radar pulsed */
1926     int32 npulses_fra;  /**< Radar detection, minimum French pulses set */
1927     int32 npulses_stg2;  /**< Radar detection, minimum staggered-2 pulses set */
1928     int32 npulses_stg3;  /**< Radar detection, minimum staggered-3 pulses set */
1929     uint16 percal_mask;    /**< defines which period cal is masked from radar detection */
1930     uint8 PAD[2];
1931     int32 quant;    /**< quantization resolution to pulse positions */
1932     uint32 min_burst_intv_lp;    /**< minimum burst to burst interval for bin3 radar */
1933     uint32 max_burst_intv_lp;    /**< maximum burst to burst interval for bin3 radar */
1934     int32 nskip_rst_lp;    /**< number of skipped pulses before resetting lp buffer */
1935     int32 max_pw_tol; /* maximum tolerance allowd in detected pulse width for radar detection */
1936     uint16 feature_mask; /**< 16-bit mask to specify enabled features */
1937     uint16 thresh0_sc;    /**< Radar detection, thresh 0 */
1938     uint16 thresh1_sc;    /**< Radar detection, thresh 1 */
1939     uint8 PAD[2];
1940 } wl_radar_args_t;
1941 
1942 #define WL_RADAR_ARGS_VERSION 2
1943 
1944 typedef struct {
1945     uint32 version; /**< version */
1946     uint16 thresh0_20_lo;    /**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 20MHz */
1947     uint16 thresh1_20_lo;    /**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
1948     uint16 thresh0_40_lo;    /**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
1949     uint16 thresh1_40_lo;    /**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
1950     uint16 thresh0_80_lo;    /**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 80MHz */
1951     uint16 thresh1_80_lo;    /**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 80MHz */
1952     uint16 thresh0_20_hi;    /**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
1953     uint16 thresh1_20_hi;    /**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
1954     uint16 thresh0_40_hi;    /**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
1955     uint16 thresh1_40_hi;    /**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
1956     uint16 thresh0_80_hi;    /**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 80MHz */
1957     uint16 thresh1_80_hi;    /**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 80MHz */
1958     uint16 thresh0_160_lo;    /**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 160MHz */
1959     uint16 thresh1_160_lo;    /**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 160MHz */
1960     uint16 thresh0_160_hi;    /**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 160MHz */
1961     uint16 thresh1_160_hi;    /**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 160MHz */
1962 } wl_radar_thr_t;
1963 
1964 typedef struct {
1965     uint32 version; /* version */
1966     uint16 thresh0_sc_20_lo;
1967     uint16 thresh1_sc_20_lo;
1968     uint16 thresh0_sc_40_lo;
1969     uint16 thresh1_sc_40_lo;
1970     uint16 thresh0_sc_80_lo;
1971     uint16 thresh1_sc_80_lo;
1972     uint16 thresh0_sc_20_hi;
1973     uint16 thresh1_sc_20_hi;
1974     uint16 thresh0_sc_40_hi;
1975     uint16 thresh1_sc_40_hi;
1976     uint16 thresh0_sc_80_hi;
1977     uint16 thresh1_sc_80_hi;
1978     uint16 fc_varth_sb;
1979     uint16 fc_varth_bin5_sb;
1980     uint16 notradar_enb;
1981     uint16 max_notradar_lp;
1982     uint16 max_notradar;
1983     uint16 max_notradar_lp_sc;
1984     uint16 max_notradar_sc;
1985     uint16 highpow_war_enb;
1986     uint16 highpow_sp_ratio;    //unit is 0.5
1987 } wl_radar_thr2_t;
1988 
1989 #define WL_RADAR_THR_VERSION    2
1990 
1991 typedef struct {
1992     uint32 ver;
1993     uint32 len;
1994     int32  rssi_th[3];
1995     uint8  rssi_gain_80[4];
1996     uint8  rssi_gain_160[4];
1997 } wl_dyn_switch_th_t;
1998 
1999 #define WL_PHY_DYN_SWITCH_TH_VERSION    1
2000 
2001 /** RSSI per antenna */
2002 typedef struct {
2003     uint32    version;        /**< version field */
2004     uint32    count;            /**< number of valid antenna rssi */
2005     int8 rssi_ant[WL_RSSI_ANT_MAX];    /**< rssi per antenna */
2006 } wl_rssi_ant_t;
2007 
2008 /* SNR per antenna */
2009 typedef struct {
2010     uint32  version;                /* version field */
2011     uint32  count;                    /* number of valid antenna snr */
2012     int8 snr_ant[WL_RSSI_ANT_MAX];    /* snr per antenna */
2013 } wl_snr_ant_t;
2014 
2015 
2016 /** data structure used in 'dfs_status' wl interface, which is used to query dfs status */
2017 typedef struct {
2018     uint32 state;        /**< noted by WL_DFS_CACSTATE_XX. */
2019     uint32 duration;        /**< time spent in ms in state. */
2020     /**
2021      * as dfs enters ISM state, it removes the operational channel from quiet channel
2022      * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
2023      */
2024     chanspec_t chanspec_cleared;
2025     /** chanspec cleared used to be a uint32, add another to uint16 to maintain size */
2026     uint16 pad;
2027 } wl_dfs_status_t;
2028 
2029 typedef struct {
2030     uint32 state;        /* noted by WL_DFS_CACSTATE_XX */
2031     uint32 duration;        /* time spent in ms in state */
2032     chanspec_t chanspec;    /* chanspec of this core */
2033     chanspec_t chanspec_last_cleared; /* chanspec last cleared for operation by scanning */
2034     uint16 sub_type;    /* currently just the index of the core or the respective PLL */
2035     uint16 pad;
2036 } wl_dfs_sub_status_t;
2037 
2038 #define WL_DFS_STATUS_ALL_VERSION    (1)
2039 typedef struct {
2040     uint16 version;        /* version field; current max version 1 */
2041     uint16 num_sub_status;
2042     wl_dfs_sub_status_t  dfs_sub_status[1]; /* struct array of length num_sub_status */
2043 } wl_dfs_status_all_t;
2044 
2045 #define WL_DFS_AP_MOVE_VERSION    (1)
2046 
2047 struct wl_dfs_ap_move_status_v1 {
2048     int16 dfs_status;    /* DFS scan status */
2049     chanspec_t chanspec;    /* New AP Chanspec */
2050     wl_dfs_status_t cac_status;    /* CAC status */
2051 };
2052 
2053 typedef struct wl_dfs_ap_move_status_v2 {
2054     int8 version;            /* version field; current max version 1 */
2055     int8 move_status;        /* DFS move status */
2056     chanspec_t chanspec;     /* New AP Chanspec */
2057     wl_dfs_status_all_t scan_status; /* status; see dfs_status_all for wl_dfs_status_all_t */
2058 } wl_dfs_ap_move_status_v2_t;
2059 
2060 #define WL_DFS_AP_MOVE_ABORT -1        /* Abort any dfs_ap_move in progress immediately */
2061 #define WL_DFS_AP_MOVE_STUNT -2        /* Stunt move but continue background CSA if in progress */
2062 
2063 
2064 /** data structure used in 'radar_status' wl interface, which is use to query radar det status */
2065 typedef struct {
2066     uint8 detected;
2067     uint8 PAD[3];
2068     int32 count;
2069     uint8 pretended;
2070     uint8 PAD[3];
2071     uint32 radartype;
2072     uint32 timenow;
2073     uint32 timefromL;
2074     int32  lp_csect_single;
2075     int32  detected_pulse_index;
2076     int32  nconsecq_pulses;
2077     chanspec_t ch;
2078     uint8 PAD[2];
2079     int32  pw[10];
2080     int32  intv[10];
2081     int32  fm[10];
2082 } wl_radar_status_t;
2083 
2084 #define NUM_PWRCTRL_RATES 12
2085 
2086 typedef struct {
2087     uint8 txpwr_band_max[NUM_PWRCTRL_RATES];    /**< User set target */
2088     uint8 txpwr_limit[NUM_PWRCTRL_RATES];        /**< reg and local power limit */
2089     uint8 txpwr_local_max;                /**< local max according to the AP */
2090     uint8 txpwr_local_constraint;            /**< local constraint according to the AP */
2091     uint8 txpwr_chan_reg_max;            /**< Regulatory max for this channel */
2092     uint8 txpwr_target[2][NUM_PWRCTRL_RATES];    /**< Latest target for 2.4 and 5 Ghz */
2093     uint8 txpwr_est_Pout[2];            /**< Latest estimate for 2.4 and 5 Ghz */
2094     uint8 txpwr_opo[NUM_PWRCTRL_RATES];        /**< On G phy, OFDM power offset */
2095     uint8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];    /**< Max CCK power for this band (SROM) */
2096     uint8 txpwr_bphy_ofdm_max;            /**< Max OFDM power for this band (SROM) */
2097     uint8 txpwr_aphy_max[NUM_PWRCTRL_RATES];    /**< Max power for A band (SROM) */
2098     int8  txpwr_antgain[2];                /**< Ant gain for each band - from SROM */
2099     uint8 txpwr_est_Pout_gofdm;            /**< Pwr estimate for 2.4 OFDM */
2100 } tx_power_legacy_t;
2101 
2102 #define WL_TX_POWER_RATES_LEGACY    45
2103 #define WL_TX_POWER_MCS20_FIRST         12
2104 #define WL_TX_POWER_MCS20_NUM           16
2105 #define WL_TX_POWER_MCS40_FIRST         28
2106 #define WL_TX_POWER_MCS40_NUM           17
2107 
2108 typedef struct {
2109     uint32 flags;
2110     chanspec_t chanspec;                 /**< txpwr report for this channel */
2111     chanspec_t local_chanspec;           /**< channel on which we are associated */
2112     uint8 local_max;                 /**< local max according to the AP */
2113     uint8 local_constraint;              /**< local constraint according to the AP */
2114     int8  antgain[2];                /**< Ant gain for each band - from SROM */
2115     uint8 rf_cores;                  /**< count of RF Cores being reported */
2116     uint8 est_Pout[4];                           /**< Latest tx power out estimate per RF
2117                               * chain without adjustment
2118                               */
2119     uint8 est_Pout_cck;                          /**< Latest CCK tx power out estimate */
2120     uint8 user_limit[WL_TX_POWER_RATES_LEGACY];  /**< User limit */
2121     uint8 reg_limit[WL_TX_POWER_RATES_LEGACY];   /**< Regulatory power limit */
2122     uint8 board_limit[WL_TX_POWER_RATES_LEGACY]; /**< Max power board can support (SROM) */
2123     uint8 target[WL_TX_POWER_RATES_LEGACY];      /**< Latest target power */
2124     uint8 PAD[2];
2125 } tx_power_legacy2_t;
2126 
2127 #define WL_NUM_2x2_ELEMENTS        4
2128 #define WL_NUM_3x3_ELEMENTS        6
2129 #define WL_NUM_4x4_ELEMENTS        10
2130 
2131 typedef struct {
2132     uint16 ver;                /**< version of this struct */
2133     uint16 len;                /**< length in bytes of this structure */
2134     uint32 flags;
2135     chanspec_t chanspec;            /**< txpwr report for this channel */
2136     chanspec_t local_chanspec;        /**< channel on which we are associated */
2137     uint32     buflen;            /**< ppr buffer length */
2138     uint8      pprbuf[1];            /**< Latest target power buffer */
2139 } wl_txppr_t;
2140 
2141 #define WL_TXPPR_VERSION    1
2142 #define WL_TXPPR_LENGTH    (sizeof(wl_txppr_t))
2143 #define TX_POWER_T_VERSION    45
2144 /** number of ppr serialization buffers, it should be reg, board and target */
2145 #define WL_TXPPR_SER_BUF_NUM    (3)
2146 
2147 typedef struct chanspec_txpwr_max {
2148     chanspec_t chanspec;   /**< chanspec */
2149     uint8 txpwr_max;       /**< max txpwr in all the rates */
2150     uint8 padding;
2151 } chanspec_txpwr_max_t;
2152 
2153 typedef struct  wl_chanspec_txpwr_max {
2154     uint16 ver;            /**< version of this struct */
2155     uint16 len;            /**< length in bytes of this structure */
2156     uint32 count;        /**< number of elements of (chanspec, txpwr_max) pair */
2157     chanspec_txpwr_max_t txpwr[1];    /**< array of (chanspec, max_txpwr) pair */
2158 } wl_chanspec_txpwr_max_t;
2159 
2160 #define WL_CHANSPEC_TXPWR_MAX_VER    1
2161 #define WL_CHANSPEC_TXPWR_MAX_LEN    (sizeof(wl_chanspec_txpwr_max_t))
2162 
2163 typedef struct tx_inst_power {
2164     uint8 txpwr_est_Pout[2];            /**< Latest estimate for 2.4 and 5 Ghz */
2165     uint8 txpwr_est_Pout_gofdm;            /**< Pwr estimate for 2.4 OFDM */
2166 } tx_inst_power_t;
2167 
2168 #define WL_NUM_TXCHAIN_MAX    4
2169 typedef struct wl_txchain_pwr_offsets {
2170     int8 offset[WL_NUM_TXCHAIN_MAX];    /**< quarter dBm signed offset for each chain */
2171 } wl_txchain_pwr_offsets_t;
2172 
2173 /** maximum channels returned by the get valid channels iovar */
2174 #define WL_NUMCHANNELS        64
2175 #define WL_NUMCHANNELS_MANY_CHAN 10
2176 #define WL_ITER_LIMIT_MANY_CHAN 5
2177 
2178 #define WL_MIMO_PS_CFG_VERSION_1 1
2179 
2180 typedef struct wl_mimops_cfg {
2181     uint8 version;
2182     /* active_chains: 0 for all, 1 for 1 chain. */
2183     uint8 active_chains;
2184     /* static (0) or dynamic (1).or disabled (3) Mode applies only when active_chains = 0. */
2185     uint8 mode;
2186     /* bandwidth = Full (0), 20M (1), 40M (2), 80M (3). */
2187     uint8 bandwidth;
2188     uint8 applychangesafterlearning;
2189     uint8 pad[3];
2190 } wl_mimops_cfg_t;
2191 
2192 /* This event is for tracing MIMO PS metrics snapshot calls.
2193  * It is helpful to debug out-of-sync issue between
2194  * ucode SHM values and FW snapshot calculation.
2195  * It is part of the EVENT_LOG_TAG_MIMO_PS_TRACE.
2196  */
2197 #define WL_MIMO_PS_METRICS_SNAPSHOT_TRACE_TYPE    0
2198 typedef struct wl_mimo_ps_metrics_snapshot_trace {
2199     /* type field for this TLV: */
2200     uint16  type;
2201     /* length field for this TLV */
2202     uint16  len;
2203     uint32  idle_slotcnt_mimo;    /* MIMO idle slotcnt raw SHM value */
2204     uint32  last_idle_slotcnt_mimo;    /* stored value snapshot */
2205     uint32  idle_slotcnt_siso;    /* SISO idle slotcnt raw SHM value */
2206     uint32  last_idle_slotcnt_siso;    /* stored value snapshot */
2207     uint32    rx_time_mimo;        /* Rx MIMO raw SHM value */
2208     uint32    last_rx_time_mimo;    /* stored value snapshot */
2209     uint32    rx_time_siso;        /* RX SISO raw SHM value */
2210     uint32    last_rx_time_siso;    /* stored value snapshot */
2211     uint32  tx_time_1chain;        /* Tx 1-chain raw SHM value */
2212     uint32  last_tx_time_1chain;    /* stored value snapshot */
2213     uint32    tx_time_2chain;        /* Tx 2-chain raw SHM value */
2214     uint32    last_tx_time_2chain;    /* stored value snapshot */
2215     uint32  tx_time_3chain;        /* Tx 3-chain raw SHM value */
2216     uint32  last_tx_time_3chain;    /* stored value snapshot */
2217     uint16    reason;            /* reason for snapshot call, see below */
2218     /* Does the call reset last values after delta calculation */
2219     uint16    reset_last;
2220 } wl_mimo_ps_metrics_snapshot_trace_t;
2221 /* reason codes for mimo ps metrics snapshot function calls */
2222 #define WL_MIMOPS_METRICS_SNAPSHOT_REPORT        1
2223 #define WL_MIMOPS_METRICS_SNAPSHOT_RXCHAIN_SET        2
2224 #define WL_MIMOPS_METRICS_SNAPSHOT_ARBI            3
2225 #define WL_MIMOPS_METRICS_SNAPSHOT_SLOTUPD        4
2226 #define WL_MIMOPS_METRICS_SNAPSHOT_PMBCNRX        5
2227 #define WL_MIMOPS_METRICS_SNAPSHOT_BMACINIT        6
2228 #define WL_MIMOPS_METRICS_SNAPSHOT_HT_COMPLETE        7
2229 #define WL_MIMOPS_METRICS_SNAPSHOT_OCL                  8
2230 
2231 #define WL_MIMO_PS_STATUS_VERSION_2    2
2232 typedef struct wl_mimo_ps_status {
2233     uint8 version;
2234     uint8 ap_cap;            /* The associated AP's capability (BW, MIMO/SISO). */
2235     uint8 association_status;    /* How we are associated to the AP (MIMO/SISO). */
2236     uint8 mimo_ps_state;        /* mimo_ps_cfg states: [0-5]. See below for values */
2237     uint8 mrc_state;        /* MRC state: NONE (0), ACTIVE(1) */
2238     uint8 bss_rxchain;        /* bss rxchain bitmask */
2239     uint8 bss_txchain;        /* bss txchain bitmask */
2240     uint8 bss_bw;            /* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2241     uint16 hw_state;        /* bitmask of hw state. See below for values */
2242     uint8 hw_rxchain;        /* actual HW rxchain bitmask */
2243     uint8 hw_txchain;        /* actual HW txchain bitmask */
2244     uint8 hw_bw;            /* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2245     uint8 pm_bcnrx_state;        /* actual state of ucode flag */
2246     uint8 basic_rates_present;    /* internal flag to trigger siso bcmc rx */
2247     uint8 siso_bcmc_rx_state;    /* actual state of ucode flag */
2248 } wl_mimo_ps_status_t;
2249 
2250 #define WL_MIMO_PS_STATUS_VERSION_1    1
2251 typedef struct wl_mimo_ps_status_v1 {
2252     uint8 version;
2253     uint8 ap_cap;            /* The associated AP's capability (BW, MIMO/SISO). */
2254     uint8 association_status;    /* How we are associated to the AP (MIMO/SISO). */
2255     uint8 mimo_ps_state;        /* mimo_ps_cfg states: [0-5]. See below for values */
2256     uint8 mrc_state;        /* MRC state: NONE (0), ACTIVE(1) */
2257     uint8 bss_rxchain;        /* bss rxchain bitmask */
2258     uint8 bss_txchain;        /* bss txchain bitmask */
2259     uint8 bss_bw;            /* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2260     uint16 hw_state;        /* bitmask of hw state. See below for values */
2261     uint8 hw_rxchain;        /* actual HW rxchain bitmask */
2262     uint8 hw_txchain;        /* actual HW txchain bitmask */
2263     uint8 hw_bw;            /* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2264     uint8 pad[3];
2265 } wl_mimo_ps_status_v1_t;
2266 
2267 #define WL_MIMO_PS_STATUS_AP_CAP(ap_cap)    (ap_cap & 0x0F)
2268 #define WL_MIMO_PS_STATUS_AP_CAP_BW(ap_cap)    (ap_cap >> 4)
2269 #define WL_MIMO_PS_STATUS_ASSOC_BW_SHIFT 4
2270 
2271 /* version 3: assoc status: low nibble is status enum, high other flags */
2272 #define WL_MIMO_PS_STATUS_VERSION_3            3
2273 #define WL_MIMO_PS_STATUS_ASSOC_STATUS_MASK        0x0F
2274 #define WL_MIMO_PS_STATUS_ASSOC_STATUS_VHT_WITHOUT_OMN    0x80
2275 
2276 /* mimo_ps_status: ap_cap/association status */
2277 enum {
2278     WL_MIMO_PS_STATUS_ASSOC_NONE    = 0,
2279     WL_MIMO_PS_STATUS_ASSOC_SISO    = 1,
2280     WL_MIMO_PS_STATUS_ASSOC_MIMO    = 2,
2281     WL_MIMO_PS_STATUS_ASSOC_LEGACY    = 3
2282 };
2283 
2284 /* mimo_ps_status: mimo_ps_cfg states */
2285 enum {
2286     WL_MIMO_PS_CFG_STATE_NONE            = 0,
2287     WL_MIMO_PS_CFG_STATE_INFORM_AP_INPROGRESS    = 1,
2288     WL_MIMO_PS_CFG_STATE_INFORM_AP_DONE        = 2,
2289     WL_MIMO_PS_CFG_STATE_LEARNING            = 3,
2290     WL_MIMO_PS_CFG_STATE_HW_CONFIGURE        = 4,
2291     WL_MIMO_PS_CFG_STATE_INFORM_AP_PENDING        = 5
2292 };
2293 
2294 /* mimo_ps_status: hw_state values */
2295 #define WL_MIMO_PS_STATUS_HW_STATE_NONE            0
2296 #define WL_MIMO_PS_STATUS_HW_STATE_LTECOEX        (0x1 << 0)
2297 #define WL_MIMO_PS_STATUS_HW_STATE_MIMOPS_BSS        (0x1 << 1)
2298 #define WL_MIMO_PS_STATUS_HW_STATE_AWDL_BSS        (0x1 << 2)
2299 #define WL_MIMO_PS_STATUS_HW_STATE_SCAN            (0x1 << 3)
2300 #define WL_MIMO_PS_STATUS_HW_STATE_TXPPR        (0x1 << 4)
2301 #define WL_MIMO_PS_STATUS_HW_STATE_PWRTHOTTLE        (0x1 << 5)
2302 #define WL_MIMO_PS_STATUS_HW_STATE_TMPSENSE        (0x1 << 6)
2303 #define WL_MIMO_PS_STATUS_HW_STATE_IOVAR        (0x1 << 7)
2304 #define WL_MIMO_PS_STATUS_HW_STATE_AP_BSS        (0x1 << 8)
2305 
2306 /* mimo_ps_status: mrc states */
2307 #define WL_MIMO_PS_STATUS_MRC_NONE    0
2308 #define WL_MIMO_PS_STATUS_MRC_ACTIVE    1
2309 
2310 /* mimo_ps_status: core flag states for single-core beacon and siso-bcmc rx */
2311 #define WL_MIMO_PS_STATUS_MHF_FLAG_NONE        0
2312 #define WL_MIMO_PS_STATUS_MHF_FLAG_ACTIVE    1
2313 #define WL_MIMO_PS_STATUS_MHF_FLAG_COREDOWN    2
2314 #define WL_MIMO_PS_STATUS_MHF_FLAG_INVALID    3
2315 
2316 /* Type values for the REASON */
2317 #define WL_MIMO_PS_PS_LEARNING_ABORTED          (1 << 0)
2318 #define WL_MIMO_PS_PS_LEARNING_COMPLETED        (1 << 1)
2319 #define WL_MIMO_PS_PS_LEARNING_ONGOING          (1 << 2)
2320 
2321 typedef struct wl_mimo_ps_learning_event_data {
2322     uint32 startTimeStamp;
2323     uint32 endTimeStamp;
2324     uint16 reason;
2325     struct ether_addr BSSID;
2326     uint32 totalSISO_below_rssi_threshold;
2327     uint32 totalMIMO_below_rssi_threshold;
2328     uint32 totalSISO_above_rssi_threshold;
2329     uint32 totalMIMO_above_rssi_threshold;
2330 } wl_mimo_ps_learning_event_data_t;
2331 
2332 #define WL_MIMO_PS_PS_LEARNING_CFG_ABORT    (1 << 0)
2333 #define WL_MIMO_PS_PS_LEARNING_CFG_STATUS    (1 << 1)
2334 #define WL_MIMO_PS_PS_LEARNING_CFG_CONFIG    (1 << 2)
2335 
2336 #define WL_MIMO_PS_PS_LEARNING_CFG_V1 1
2337 
2338 typedef struct wl_mimops_learning_cfg {
2339     /* flag:  bit 0 for abort */
2340     /* flag:  bit 1 for status */
2341     /* flag:  bit 2 for configuring no of packets and rssi */
2342     uint8                  flag;
2343     /* mimo ps learning version, compatible version is 0 */
2344     uint8                  version;
2345     /* if version is 0 or rssi is 0, ignored */
2346     int8                   learning_rssi_threshold;
2347     uint8                  reserved;
2348     uint32                 no_of_packets_for_learning;
2349     wl_mimo_ps_learning_event_data_t mimops_learning_data;
2350 } wl_mimops_learning_cfg_t;
2351 
2352 
2353 #define WL_OCL_STATUS_VERSION 1
2354 typedef struct ocl_status_info {
2355     uint8  version;
2356     uint8  len;
2357     uint16 fw_status;     /* Bits representing FW disable reasons */
2358     uint8  hw_status;     /* Bits for actual HW config and SISO/MIMO coremask */
2359     uint8  coremask;      /* The ocl core mask (indicating listening core) */
2360 } ocl_status_info_t;
2361 
2362 /* MWS OCL map */
2363 #define WL_MWS_OCL_OVERRIDE_VERSION 1
2364 typedef struct wl_mws_ocl_override {
2365     uint16  version;    /* Structure version */
2366     uint16    bitmap_2g; /* bitmap for 2.4G channels bits 1-13 */
2367     uint16    bitmap_5g_lo;  /* bitmap for 5G low channels by 2:
2368                 *34-48, 52-56, 60-64, 100-102
2369                 */
2370     uint16    bitmap_5g_mid; /* bitmap for 5G mid channels by 2:
2371                 * 104, 108-112, 116-120, 124-128,
2372                 * 132-136, 140, 149-151
2373                 */
2374     uint16    bitmap_5g_high; /* bitmap for 5G high channels by 2
2375                 * 153, 157-161, 165
2376                 */
2377 } wl_mws_ocl_override_t;
2378 
2379 /* Bits for fw_status */
2380 #define OCL_DISABLED_HOST        0x01   /* Host has disabled through ocl_enable */
2381 #define OCL_DISABLED_RSSI        0x02   /* Disabled because of ocl_rssi_threshold */
2382 #define OCL_DISABLED_LTEC        0x04   /* Disabled due to LTE Coex activity */
2383 #define OCL_DISABLED_SISO        0x08   /* Disabled while in SISO mode */
2384 #define OCL_DISABLED_CAL        0x10   /* Disabled during active calibration */
2385 #define OCL_DISABLED_CHANSWITCH        0x20   /* Disabled during active channel switch */
2386 #define OCL_DISABLED_ASPEND     0x40   /* Disabled due to assoc pending */
2387 
2388 /* Bits for hw_status */
2389 #define OCL_HWCFG            0x01   /* State of OCL config bit in phy HW */
2390 #define OCL_HWMIMO            0x02   /* Set if current coremask is > 1 bit */
2391 #define OCL_COREDOWN            0x80   /* Set if core is currently down */
2392 
2393 
2394 /*
2395  * Join preference iovar value is an array of tuples. Each tuple has a one-byte type,
2396  * a one-byte length, and a variable length value.  RSSI type tuple must be present
2397  * in the array.
2398  *
2399  * Types are defined in "join preference types" section.
2400  *
2401  * Length is the value size in octets. It is reserved for WL_JOIN_PREF_WPA type tuple
2402  * and must be set to zero.
2403  *
2404  * Values are defined below.
2405  *
2406  * 1. RSSI - 2 octets
2407  * offset 0: reserved
2408  * offset 1: reserved
2409  *
2410  * 2. WPA - 2 + 12 * n octets (n is # tuples defined below)
2411  * offset 0: reserved
2412  * offset 1: # of tuples
2413  * offset 2: tuple 1
2414  * offset 14: tuple 2
2415  * ...
2416  * offset 2 + 12 * (n - 1) octets: tuple n
2417  *
2418  * struct wpa_cfg_tuple {
2419  *   uint8 akm[DOT11_OUI_LEN+1];     akm suite
2420  *   uint8 ucipher[DOT11_OUI_LEN+1]; unicast cipher suite
2421  *   uint8 mcipher[DOT11_OUI_LEN+1]; multicast cipher suite
2422  * };
2423  *
2424  * multicast cipher suite can be specified as a specific cipher suite or WL_WPA_ACP_MCS_ANY.
2425  *
2426  * 3. BAND - 2 octets
2427  * offset 0: reserved
2428  * offset 1: see "band preference" and "band types"
2429  *
2430  * 4. BAND RSSI - 2 octets
2431  * offset 0: band types
2432  * offset 1: +ve RSSI boost value in dB
2433  */
2434 
2435 struct tsinfo_arg {
2436     uint8 octets[3];
2437 };
2438 
2439 #define RATE_CCK_1MBPS 0
2440 #define RATE_CCK_2MBPS 1
2441 #define RATE_CCK_5_5MBPS 2
2442 #define RATE_CCK_11MBPS 3
2443 
2444 #define RATE_LEGACY_OFDM_6MBPS 0
2445 #define RATE_LEGACY_OFDM_9MBPS 1
2446 #define RATE_LEGACY_OFDM_12MBPS 2
2447 #define RATE_LEGACY_OFDM_18MBPS 3
2448 #define RATE_LEGACY_OFDM_24MBPS 4
2449 #define RATE_LEGACY_OFDM_36MBPS 5
2450 #define RATE_LEGACY_OFDM_48MBPS 6
2451 #define RATE_LEGACY_OFDM_54MBPS 7
2452 
2453 #define WL_BSSTRANS_RSSI_RATE_MAP_VERSION 1
2454 
2455 typedef struct wl_bsstrans_rssi {
2456     int8 rssi_2g;    /**< RSSI in dbm for 2.4 G */
2457     int8 rssi_5g;    /**< RSSI in dbm for 5G, unused for cck */
2458 } wl_bsstrans_rssi_t;
2459 
2460 #define RSSI_RATE_MAP_MAX_STREAMS 4    /**< max streams supported */
2461 
2462 /** RSSI to rate mapping, all 20Mhz, no SGI */
2463 typedef struct wl_bsstrans_rssi_rate_map {
2464     uint16 ver;
2465     uint16 len; /**< length of entire structure */
2466     wl_bsstrans_rssi_t cck[WL_NUM_RATES_CCK]; /**< 2.4G only */
2467     wl_bsstrans_rssi_t ofdm[WL_NUM_RATES_OFDM]; /**< 6 to 54mbps */
2468     wl_bsstrans_rssi_t phy_n[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_MCS_1STREAM]; /* MCS0-7 */
2469     wl_bsstrans_rssi_t phy_ac[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_VHT]; /**< MCS0-9 */
2470 } wl_bsstrans_rssi_rate_map_t;
2471 
2472 #define WL_BSSTRANS_ROAMTHROTTLE_VERSION 1
2473 
2474 /** Configure number of scans allowed per throttle period */
2475 typedef struct wl_bsstrans_roamthrottle {
2476     uint16 ver;
2477     uint16 period;
2478     uint16 scans_allowed;
2479 } wl_bsstrans_roamthrottle_t;
2480 
2481 #define    NFIFO            6    /**< # tx/rx fifopairs */
2482 
2483 #if defined(BCM_DMA_CT) && !defined(BCM_DMA_CT_DISABLED)
2484 #define NFIFO_EXT        32        /* 6 traditional FIFOs + 2 rsvd + 24 MU FIFOs */
2485 #elif defined(WL11AX) && defined(WL11AX_TRIGGERQ_ENABLED)
2486 #define NFIFO_EXT        10
2487 #else
2488 #define NFIFO_EXT        NFIFO
2489 #endif
2490 
2491 /* Reinit reason codes */
2492 enum {
2493     WL_REINIT_RC_NONE             = 0,
2494     WL_REINIT_RC_PS_SYNC          = 1,
2495     WL_REINIT_RC_PSM_WD           = 2,
2496     WL_REINIT_RC_MAC_WAKE         = 3,
2497     WL_REINIT_RC_MAC_SUSPEND      = 4,
2498     WL_REINIT_RC_MAC_SPIN_WAIT    = 5,
2499     WL_REINIT_RC_AXI_BUS_ERROR    = 6,
2500     WL_REINIT_RC_DEVICE_REMOVED   = 7,
2501     WL_REINIT_RC_PCIE_FATAL_ERROR = 8,
2502     WL_REINIT_RC_OL_FW_TRAP       = 9,
2503     WL_REINIT_RC_FIFO_ERR         = 10,
2504     WL_REINIT_RC_INV_TX_STATUS    = 11,
2505     WL_REINIT_RC_MQ_ERROR         = 12,
2506     WL_REINIT_RC_PHYTXERR_THRESH  = 13,
2507     WL_REINIT_RC_USER_FORCED      = 14,
2508     WL_REINIT_RC_FULL_RESET       = 15,
2509     WL_REINIT_RC_AP_BEACON        = 16,
2510     WL_REINIT_RC_PM_EXCESSED      = 17,
2511     WL_REINIT_RC_NO_CLK           = 18,
2512     WL_REINIT_RC_SW_ASSERT        = 19,
2513     WL_REINIT_RC_PSM_JMP0         = 20,
2514     WL_REINIT_RC_PSM_RUN          = 21,
2515     WL_REINIT_RC_ENABLE_MAC       = 22,
2516     WL_REINIT_RC_SCAN_TIMEOUT     = 23,
2517     WL_REINIT_RC_JOIN_TIMEOUT     = 24,
2518     /* Below error codes are generated during D3 exit validation */
2519     WL_REINIT_RC_LINK_NOT_ACTIVE  = 25,
2520     WL_REINIT_RC_PCI_CFG_RD_FAIL  = 26,
2521     WL_REINIT_RC_INV_VEN_ID       = 27,
2522     WL_REINIT_RC_INV_DEV_ID       = 28,
2523     WL_REINIT_RC_INV_BAR0         = 29,
2524     WL_REINIT_RC_INV_BAR2         = 30,
2525     WL_REINIT_RC_AER_UC_FATAL     = 31,
2526     WL_REINIT_RC_AER_UC_NON_FATAL = 32,
2527     WL_REINIT_RC_AER_CORR         = 33,
2528     WL_REINIT_RC_AER_DEV_STS      = 34,
2529     WL_REINIT_RC_PCIe_STS         = 35,
2530     WL_REINIT_RC_MMIO_RD_FAIL     = 36,
2531     WL_REINIT_RC_MMIO_RD_INVAL    = 37,
2532     WL_REINIT_RC_MMIO_ARM_MEM_RD_FAIL = 38,
2533     WL_REINIT_RC_MMIO_ARM_MEM_INVAL   = 39,
2534     WL_REINIT_RC_SROM_LOAD_FAILED     = 40,
2535     WL_REINIT_RC_PHY_CRASH            = 41,
2536     WL_REINIT_TX_STALL                = 42,
2537     WL_REINIT_RC_TX_FLOW_CONTROL_BLOCKED    = 43,
2538     WL_REINIT_RC_RX_HC_FAIL           = 44,
2539     WL_REINIT_RC_RX_DMA_STALL         = 45,
2540     WL_REINIT_UTRACE_BUF_OVERLAP_SR      = 46,
2541     WL_REINIT_UTRACE_TPL_OUT_BOUNDS   = 47,
2542     WL_REINIT_UTRACE_TPL_OSET_STRT0   = 48,
2543     WL_REINIT_RC_PHYTXERR             = 49,
2544     WL_REINIT_RC_PSM_FATAL_SUSP       = 50,
2545     WL_REINIT_RC_TX_FIFO_SUSP         = 51,
2546     WL_REINIT_RC_MAC_ENABLE           = 52,
2547     WL_REINIT_RC_SCAN_STALLED         = 53,
2548     WL_REINIT_RC_LAST    /* This must be the last entry */
2549 };
2550 
2551 #define NREINITREASONCOUNT    8
2552 
2553 #define REINITRSNIDX(_x)    (((_x) < WL_REINIT_RC_LAST) ? (_x) : 0)
2554 
2555 #define    WL_CNT_T_VERSION    30    /**< current version of wl_cnt_t struct */
2556 #define WL_CNT_VERSION_6    6
2557 #define WL_CNT_VERSION_11    11
2558 #define WL_CNT_VERSION_XTLV    30
2559 
2560 #define WL_COUNTERS_IOV_VERSION_1    1
2561 #define WL_SUBCNTR_IOV_VER        WL_COUNTERS_IOV_VERSION_1
2562 /* First two uint16 are version and lenght fields. So offset of the first counter will be 4 */
2563 #define FIRST_COUNTER_OFFSET        0x04
2564 
2565 #define WLC_WITH_XTLV_CNT
2566 
2567 /**
2568  * tlv IDs uniquely identifies counter component
2569  * packed into wl_cmd_t container
2570  */
2571 enum wl_cnt_xtlv_id {
2572     WL_CNT_XTLV_SLICE_IDX = 0x1,        /**< Slice index */
2573     WL_CNT_XTLV_WLC = 0x100,        /**< WLC layer counters */
2574     WL_CNT_XTLV_WLC_RINIT_RSN = 0x101,    /**< WLC layer reinitreason extension */
2575     WL_CNT_XTLV_CNTV_LE10_UCODE = 0x200,    /**< wl counter ver < 11 UCODE MACSTAT */
2576     WL_CNT_XTLV_LT40_UCODE_V1 = 0x300,    /**< corerev < 40 UCODE MACSTAT */
2577     WL_CNT_XTLV_GE40_UCODE_V1 = 0x400,    /**< corerev >= 40 UCODE MACSTAT */
2578     WL_CNT_XTLV_GE64_UCODEX_V1 = 0x800    /* corerev >= 64 UCODEX MACSTAT */
2579 };
2580 
2581 /**
2582  * The number of variables in wl macstat cnt struct.
2583  * (wl_cnt_ge40mcst_v1_t, wl_cnt_lt40mcst_v1_t, wl_cnt_v_le10_mcst_t)
2584  */
2585 #define WL_CNT_MCST_VAR_NUM 64
2586 /* sizeof(wl_cnt_ge40mcst_v1_t), sizeof(wl_cnt_lt40mcst_v1_t), and sizeof(wl_cnt_v_le10_mcst_t) */
2587 #define WL_CNT_MCST_STRUCT_SZ ((uint32)sizeof(uint32) * WL_CNT_MCST_VAR_NUM)
2588 
2589 #define WL_CNT_MCXST_STRUCT_SZ ((uint32)sizeof(wl_cnt_ge64mcxst_v1_t))
2590 #define INVALID_CNT_VAL (uint32)(-1)
2591 
2592 #define WL_XTLV_CNTBUF_MAX_SIZE ((uint32)(OFFSETOF(wl_cnt_info_t, data)) +    \
2593         (uint32)BCM_XTLV_HDR_SIZE + (uint32)sizeof(wl_cnt_wlc_t) +        \
2594         (uint32)BCM_XTLV_HDR_SIZE + WL_CNT_MCST_STRUCT_SZ +              \
2595         (uint32)BCM_XTLV_HDR_SIZE + WL_CNT_MCXST_STRUCT_SZ)
2596 
2597 #define WL_CNTBUF_MAX_SIZE MAX(WL_XTLV_CNTBUF_MAX_SIZE, (uint32)sizeof(wl_cnt_ver_11_t))
2598 
2599 
2600 /** Top structure of counters IOVar buffer */
2601 typedef struct {
2602     uint16    version;    /**< see definition of WL_CNT_T_VERSION */
2603     uint16    datalen;    /**< length of data including all paddings. */
2604     uint8   data [];    /**< variable length payload:
2605                  * 1 or more bcm_xtlv_t type of tuples.
2606                  * each tuple is padded to multiple of 4 bytes.
2607                  * 'datalen' field of this structure includes all paddings.
2608                  */
2609 } wl_cnt_info_t;
2610 
2611 /* Top structure of subcounters IOVar buffer
2612  * Whenever we make any change in this structure
2613  * WL_SUBCNTR_IOV_VER should be updated accordingly
2614  * The structure definition should remain consistant b/w
2615  * FW and wl/WLM app.
2616  */
2617 typedef struct {
2618     uint16    version;      /* Version of IOVAR structure. Used for backward
2619                    * compatibility in future. Whenever we make any
2620                    * changes to this structure then value of WL_SUBCNTR_IOV_VER
2621                    * needs to be updated properly.
2622                    */
2623     uint16    length;          /* length in bytes of this structure */
2624     uint16    counters_version; /* see definition of WL_CNT_T_VERSION
2625                    * wl app will send the version of counters
2626                    * which is used to calculate the offset of counters.
2627                    * It must match the version of counters FW is using
2628                    * else FW will return error with his version of counters
2629                    * set in this field.
2630                    */
2631     uint16    num_subcounters;  /* Number of counter offset passed by wl app to FW. */
2632     uint32    data[1];      /* variable length payload:
2633                    * Offsets to the counters will be passed to FW
2634                    * throught this data field. FW will return the value of counters
2635                    * at the offsets passed by wl app in this fiels itself.
2636                    */
2637 } wl_subcnt_info_t;
2638 
2639 /** wlc layer counters */
2640 typedef struct {
2641     /* transmit stat counters */
2642     uint32    txframe;    /**< tx data frames */
2643     uint32    txbyte;        /**< tx data bytes */
2644     uint32    txretrans;    /**< tx mac retransmits */
2645     uint32    txerror;    /**< tx data errors (derived: sum of others) */
2646     uint32    txctl;        /**< tx management frames */
2647     uint32    txprshort;    /**< tx short preamble frames */
2648     uint32    txserr;        /**< tx status errors */
2649     uint32    txnobuf;    /**< tx out of buffers errors */
2650     uint32    txnoassoc;    /**< tx discard because we're not associated */
2651     uint32    txrunt;        /**< tx runt frames */
2652     uint32    txchit;        /**< tx header cache hit (fastpath) */
2653     uint32    txcmiss;    /**< tx header cache miss (slowpath) */
2654 
2655     /* transmit chip error counters */
2656     uint32    txuflo;        /**< tx fifo underflows */
2657     uint32    txphyerr;    /**< tx phy errors (indicated in tx status) */
2658     uint32    txphycrs;
2659 
2660     /* receive stat counters */
2661     uint32    rxframe;    /**< rx data frames */
2662     uint32    rxbyte;        /**< rx data bytes */
2663     uint32    rxerror;    /**< rx data errors (derived: sum of others) */
2664     uint32    rxctl;        /**< rx management frames */
2665     uint32    rxnobuf;    /**< rx out of buffers errors */
2666     uint32    rxnondata;    /**< rx non data frames in the data channel errors */
2667     uint32    rxbadds;    /**< rx bad DS errors */
2668     uint32    rxbadcm;    /**< rx bad control or management frames */
2669     uint32    rxfragerr;    /**< rx fragmentation errors */
2670     uint32    rxrunt;        /**< rx runt frames */
2671     uint32    rxgiant;    /**< rx giant frames */
2672     uint32    rxnoscb;    /**< rx no scb error */
2673     uint32    rxbadproto;    /**< rx invalid frames */
2674     uint32    rxbadsrcmac;    /**< rx frames with Invalid Src Mac */
2675     uint32    rxbadda;    /**< rx frames tossed for invalid da */
2676     uint32    rxfilter;    /**< rx frames filtered out */
2677 
2678     /* receive chip error counters */
2679     uint32    rxoflo;        /**< rx fifo overflow errors */
2680     uint32    rxuflo[NFIFO];    /**< rx dma descriptor underflow errors */
2681 
2682     uint32    d11cnt_txrts_off;    /**< d11cnt txrts value when reset d11cnt */
2683     uint32    d11cnt_rxcrc_off;    /**< d11cnt rxcrc value when reset d11cnt */
2684     uint32    d11cnt_txnocts_off;    /**< d11cnt txnocts value when reset d11cnt */
2685 
2686     /* misc counters */
2687     uint32    dmade;        /**< tx/rx dma descriptor errors */
2688     uint32    dmada;        /**< tx/rx dma data errors */
2689     uint32    dmape;        /**< tx/rx dma descriptor protocol errors */
2690     uint32    reset;        /**< reset count */
2691     uint32    tbtt;        /**< cnts the TBTT int's */
2692     uint32    txdmawar;
2693     uint32    pkt_callback_reg_fail;    /**< callbacks register failure */
2694 
2695     /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2696     uint32    txfrag;        /**< dot11TransmittedFragmentCount */
2697     uint32    txmulti;    /**< dot11MulticastTransmittedFrameCount */
2698     uint32    txfail;        /**< dot11FailedCount */
2699     uint32    txretry;    /**< dot11RetryCount */
2700     uint32    txretrie;    /**< dot11MultipleRetryCount */
2701     uint32    rxdup;        /**< dot11FrameduplicateCount */
2702     uint32    txrts;        /**< dot11RTSSuccessCount */
2703     uint32    txnocts;    /**< dot11RTSFailureCount */
2704     uint32    txnoack;    /**< dot11ACKFailureCount */
2705     uint32    rxfrag;        /**< dot11ReceivedFragmentCount */
2706     uint32    rxmulti;    /**< dot11MulticastReceivedFrameCount */
2707     uint32    rxcrc;        /**< dot11FCSErrorCount */
2708     uint32    txfrmsnt;    /**< dot11TransmittedFrameCount (bogus MIB?) */
2709     uint32    rxundec;    /**< dot11WEPUndecryptableCount */
2710 
2711     /* WPA2 counters (see rxundec for DecryptFailureCount) */
2712     uint32    tkipmicfaill;    /**< TKIPLocalMICFailures */
2713     uint32    tkipcntrmsr;    /**< TKIPCounterMeasuresInvoked */
2714     uint32    tkipreplay;    /**< TKIPReplays */
2715     uint32    ccmpfmterr;    /**< CCMPFormatErrors */
2716     uint32    ccmpreplay;    /**< CCMPReplays */
2717     uint32    ccmpundec;    /**< CCMPDecryptErrors */
2718     uint32    fourwayfail;    /**< FourWayHandshakeFailures */
2719     uint32    wepundec;    /**< dot11WEPUndecryptableCount */
2720     uint32    wepicverr;    /**< dot11WEPICVErrorCount */
2721     uint32    decsuccess;    /**< DecryptSuccessCount */
2722     uint32    tkipicverr;    /**< TKIPICVErrorCount */
2723     uint32    wepexcluded;    /**< dot11WEPExcludedCount */
2724 
2725     uint32    txchanrej;    /**< Tx frames suppressed due to channel rejection */
2726     uint32    psmwds;        /**< Count PSM watchdogs */
2727     uint32    phywatchdog;    /**< Count Phy watchdogs (triggered by ucode) */
2728 
2729     /* MBSS counters, AP only */
2730     uint32    prq_entries_handled;    /**< PRQ entries read in */
2731     uint32    prq_undirected_entries;    /**<    which were bcast bss & ssid */
2732     uint32    prq_bad_entries;    /**<    which could not be translated to info */
2733     uint32    atim_suppress_count;    /**< TX suppressions on ATIM fifo */
2734     uint32    bcn_template_not_ready;    /**< Template marked in use on send bcn ... */
2735     uint32    bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
2736     uint32    late_tbtt_dpc;    /**< TBTT DPC did not happen in time */
2737 
2738     /* per-rate receive stat counters */
2739     uint32  rx1mbps;    /**< packets rx at 1Mbps */
2740     uint32  rx2mbps;    /**< packets rx at 2Mbps */
2741     uint32  rx5mbps5;    /**< packets rx at 5.5Mbps */
2742     uint32  rx6mbps;    /**< packets rx at 6Mbps */
2743     uint32  rx9mbps;    /**< packets rx at 9Mbps */
2744     uint32  rx11mbps;    /**< packets rx at 11Mbps */
2745     uint32  rx12mbps;    /**< packets rx at 12Mbps */
2746     uint32  rx18mbps;    /**< packets rx at 18Mbps */
2747     uint32  rx24mbps;    /**< packets rx at 24Mbps */
2748     uint32  rx36mbps;    /**< packets rx at 36Mbps */
2749     uint32  rx48mbps;    /**< packets rx at 48Mbps */
2750     uint32  rx54mbps;    /**< packets rx at 54Mbps */
2751     uint32  rx108mbps;    /**< packets rx at 108mbps */
2752     uint32  rx162mbps;    /**< packets rx at 162mbps */
2753     uint32  rx216mbps;    /**< packets rx at 216 mbps */
2754     uint32  rx270mbps;    /**< packets rx at 270 mbps */
2755     uint32  rx324mbps;    /**< packets rx at 324 mbps */
2756     uint32  rx378mbps;    /**< packets rx at 378 mbps */
2757     uint32  rx432mbps;    /**< packets rx at 432 mbps */
2758     uint32  rx486mbps;    /**< packets rx at 486 mbps */
2759     uint32  rx540mbps;    /**< packets rx at 540 mbps */
2760 
2761     uint32    rfdisable;    /**< count of radio disables */
2762 
2763     uint32    txexptime;    /**< Tx frames suppressed due to timer expiration */
2764 
2765     uint32    txmpdu_sgi;    /**< count for sgi transmit */
2766     uint32    rxmpdu_sgi;    /**< count for sgi received */
2767     uint32    txmpdu_stbc;    /**< count for stbc transmit */
2768     uint32    rxmpdu_stbc;    /**< count for stbc received */
2769 
2770     uint32    rxundec_mcst;    /**< dot11WEPUndecryptableCount */
2771 
2772     /* WPA2 counters (see rxundec for DecryptFailureCount) */
2773     uint32    tkipmicfaill_mcst;    /**< TKIPLocalMICFailures */
2774     uint32    tkipcntrmsr_mcst;    /**< TKIPCounterMeasuresInvoked */
2775     uint32    tkipreplay_mcst;    /**< TKIPReplays */
2776     uint32    ccmpfmterr_mcst;    /**< CCMPFormatErrors */
2777     uint32    ccmpreplay_mcst;    /**< CCMPReplays */
2778     uint32    ccmpundec_mcst;    /**< CCMPDecryptErrors */
2779     uint32    fourwayfail_mcst;    /**< FourWayHandshakeFailures */
2780     uint32    wepundec_mcst;    /**< dot11WEPUndecryptableCount */
2781     uint32    wepicverr_mcst;    /**< dot11WEPICVErrorCount */
2782     uint32    decsuccess_mcst;    /**< DecryptSuccessCount */
2783     uint32    tkipicverr_mcst;    /**< TKIPICVErrorCount */
2784     uint32    wepexcluded_mcst;    /**< dot11WEPExcludedCount */
2785 
2786     uint32    dma_hang;    /**< count for dma hang */
2787     uint32    reinit;        /**< count for reinit */
2788 
2789     uint32  pstatxucast;    /**< count of ucast frames xmitted on all psta assoc */
2790     uint32  pstatxnoassoc;    /**< count of txnoassoc frames xmitted on all psta assoc */
2791     uint32  pstarxucast;    /**< count of ucast frames received on all psta assoc */
2792     uint32  pstarxbcmc;    /**< count of bcmc frames received on all psta */
2793     uint32  pstatxbcmc;    /**< count of bcmc frames transmitted on all psta */
2794 
2795     uint32  cso_passthrough; /**< hw cso required but passthrough */
2796     uint32    cso_normal;    /**< hw cso hdr for normal process */
2797     uint32    chained;    /**< number of frames chained */
2798     uint32    chainedsz1;    /**< number of chain size 1 frames */
2799     uint32    unchained;    /**< number of frames not chained */
2800     uint32    maxchainsz;    /**< max chain size so far */
2801     uint32    currchainsz;    /**< current chain size */
2802     uint32    pciereset;    /**< Secondary Bus Reset issued by driver */
2803     uint32    cfgrestore;    /**< configspace restore by driver */
2804     uint32    reinitreason[NREINITREASONCOUNT]; /**< reinitreason counters; 0: Unknown reason */
2805     uint32    rxrtry;
2806     uint32  rxmpdu_mu;      /**< Number of MU MPDUs received */
2807 
2808     /* detailed control/management frames */
2809     uint32    txbar;        /**< Number of TX BAR */
2810     uint32    rxbar;        /**< Number of RX BAR */
2811     uint32    txpspoll;    /**< Number of TX PS-poll */
2812     uint32    rxpspoll;    /**< Number of RX PS-poll */
2813     uint32    txnull;        /**< Number of TX NULL_DATA */
2814     uint32    rxnull;        /**< Number of RX NULL_DATA */
2815     uint32    txqosnull;    /**< Number of TX NULL_QoSDATA */
2816     uint32    rxqosnull;    /**< Number of RX NULL_QoSDATA */
2817     uint32    txassocreq;    /**< Number of TX ASSOC request */
2818     uint32    rxassocreq;    /**< Number of RX ASSOC request */
2819     uint32    txreassocreq;    /**< Number of TX REASSOC request */
2820     uint32    rxreassocreq;    /**< Number of RX REASSOC request */
2821     uint32    txdisassoc;    /**< Number of TX DISASSOC */
2822     uint32    rxdisassoc;    /**< Number of RX DISASSOC */
2823     uint32    txassocrsp;    /**< Number of TX ASSOC response */
2824     uint32    rxassocrsp;    /**< Number of RX ASSOC response */
2825     uint32    txreassocrsp;    /**< Number of TX REASSOC response */
2826     uint32    rxreassocrsp;    /**< Number of RX REASSOC response */
2827     uint32    txauth;        /**< Number of TX AUTH */
2828     uint32    rxauth;        /**< Number of RX AUTH */
2829     uint32    txdeauth;    /**< Number of TX DEAUTH */
2830     uint32    rxdeauth;    /**< Number of RX DEAUTH */
2831     uint32    txprobereq;    /**< Number of TX probe request */
2832     uint32    rxprobereq;    /**< Number of RX probe request */
2833     uint32    txprobersp;    /**< Number of TX probe response */
2834     uint32    rxprobersp;    /**< Number of RX probe response */
2835     uint32    txaction;    /**< Number of TX action frame */
2836     uint32    rxaction;    /**< Number of RX action frame */
2837     uint32  ampdu_wds;    /**< Number of AMPDU watchdogs */
2838     uint32  txlost;        /**< Number of lost packets reported in txs */
2839     uint32    txdatamcast;    /**< Number of TX multicast data packets */
2840     uint32    txdatabcast;    /**< Number of TX broadcast data packets */
2841     uint32    psmxwds;    /**< Number of PSMx watchdogs */
2842     uint32  rxback;
2843     uint32  txback;
2844     uint32  p2p_tbtt;    /**< Number of P2P TBTT Events */
2845     uint32  p2p_tbtt_miss;    /**< Number of P2P TBTT Events Miss */
2846     uint32    txqueue_start;
2847     uint32    txqueue_end;
2848     uint32  txbcast;        /* Broadcast TransmittedFrameCount */
2849     uint32  txdropped;      /* tx dropped pkts */
2850     uint32  rxbcast;        /* BroadcastReceivedFrameCount */
2851     uint32  rxdropped;      /* rx dropped pkts (derived: sum of others) */
2852 } wl_cnt_wlc_t;
2853 
2854 /* Reinit reasons - do not put anything else other than reinit reasons here */
2855 typedef struct {
2856     uint32 rsn[WL_REINIT_RC_LAST];
2857 } reinit_rsns_t;
2858 
2859 /* MACXSTAT counters for ucodex (corerev >= 64) */
2860 typedef struct {
2861     uint32 macxsusp;
2862     uint32 m2vmsg;
2863     uint32 v2mmsg;
2864     uint32 mboxout;
2865     uint32 musnd;
2866     uint32 sfb2v;
2867 } wl_cnt_ge64mcxst_v1_t;
2868 
2869 /** MACSTAT counters for ucode (corerev >= 40) */
2870 typedef struct {
2871     /* MAC counters: 32-bit version of d11.h's macstat_t */
2872     uint32    txallfrm;    /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
2873                  * Control Management (includes retransmissions)
2874                  */
2875     uint32    txrtsfrm;    /**< number of RTS sent out by the MAC */
2876     uint32    txctsfrm;    /**< number of CTS sent out by the MAC */
2877     uint32    txackfrm;    /**< number of ACK frames sent out */
2878     uint32    txdnlfrm;    /**< number of Null-Data transmission generated from template  */
2879     uint32    txbcnfrm;    /**< beacons transmitted */
2880     uint32    txfunfl[6];    /**< per-fifo tx underflows */
2881     uint32    txampdu;    /**< number of AMPDUs transmitted */
2882     uint32    txmpdu;        /**< number of MPDUs transmitted */
2883     uint32    txtplunfl;    /**< Template underflows (mac was too slow to transmit ACK/CTS
2884                  * or BCN)
2885                  */
2886     uint32    txphyerror;    /**< Transmit phy error, type of error is reported in tx-status for
2887                  * driver enqueued frames
2888                  */
2889     uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
2890     uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
2891     uint32    rxfrmtoolong;    /**< Received frame longer than legal limit (2346 bytes) */
2892     uint32    rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
2893     uint32    rxanyerr;    /**< Any RX error that is not counted by other counters. */
2894     uint32    rxbadfcs;    /**< number of frames for which the CRC check failed in the MAC */
2895     uint32    rxbadplcp;    /**< parity check of the PLCP header failed */
2896     uint32    rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
2897     uint32    rxstrt;        /**< Number of received frames with a good PLCP
2898                  * (i.e. passing parity check)
2899                  */
2900     uint32    rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
2901     uint32    rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
2902     uint32    rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
2903     uint32    rxrtsucast;    /**< number of unicast RTS addressed to the MAC (good FCS) */
2904     uint32    rxctsucast;    /**< number of unicast CTS addressed to the MAC (good FCS) */
2905     uint32    rxackucast;    /**< number of ucast ACKS received (good FCS) */
2906     uint32    rxdtocast; /**< number of received DATA frames (good FCS and not matching RA) */
2907     uint32    rxmgocast; /**< number of received MGMT frames (good FCS and not matching RA) */
2908     uint32    rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
2909     uint32    rxrtsocast;    /**< number of received RTS not addressed to the MAC */
2910     uint32    rxctsocast;    /**< number of received CTS not addressed to the MAC */
2911     uint32    rxdtmcast;    /**< number of RX Data multicast frames received by the MAC */
2912     uint32    rxmgmcast;    /**< number of RX Management multicast frames received by the MAC */
2913     uint32    rxctlmcast;    /**< number of RX Control multicast frames received by the MAC
2914                  * (unlikely to see these)
2915                  */
2916     uint32    rxbeaconmbss;    /**< beacons received from member of BSS */
2917     uint32    rxdtucastobss; /**< number of unicast frames addressed to the MAC from
2918                   * other BSS (WDS FRAME)
2919                   */
2920     uint32    rxbeaconobss;    /**< beacons received from other BSS */
2921     uint32    rxrsptmout;    /**< number of response timeouts for transmitted frames
2922                  * expecting a response
2923                  */
2924     uint32    bcntxcancl;    /**< transmit beacons canceled due to receipt of beacon (IBSS) */
2925     uint32    rxnodelim;    /**< number of no valid delimiter detected by ampdu parser */
2926     uint32    rxf0ovfl;    /**< number of receive fifo 0 overflows */
2927     uint32    rxf1ovfl;    /**< number of receive fifo 1 overflows */
2928     uint32    rxhlovfl;    /**< number of length / header fifo overflows */
2929     uint32    missbcn_dbg;    /**< number of beacon missed to receive */
2930     uint32    pmqovfl;    /**< number of PMQ overflows */
2931     uint32    rxcgprqfrm;    /**< number of received Probe requests that made it into
2932                  * the PRQ fifo
2933                  */
2934     uint32    rxcgprsqovfl;    /**< Rx Probe Request Que overflow in the AP */
2935     uint32    txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
2936                  * not get ACK
2937                  */
2938     uint32    txcgprssuc;    /**< Tx Probe Response Success (ACK was received) */
2939     uint32    prs_timeout;    /**< number of probe requests that were dropped from the PRQ
2940                  * fifo because a probe response could not be sent out within
2941                  * the time limit defined in M_PRS_MAXTIME
2942                  */
2943     uint32    txrtsfail;    /**< number of rts transmission failure that reach retry limit */
2944     uint32    txucast;    /**< number of unicast tx expecting response other than cts/cwcts */
2945     uint32  txinrtstxop;    /**< number of data frame transmissions during rts txop */
2946     uint32    rxback;        /**< blockack rxcnt */
2947     uint32    txback;        /**< blockack txcnt */
2948     uint32    bphy_rxcrsglitch;    /**< PHY count of bphy glitches */
2949     uint32    rxdrop20s;    /**< drop secondary cnt */
2950     uint32    rxtoolate;    /**< receive too late */
2951     uint32  bphy_badplcp;    /**< number of bad PLCP reception on BPHY rate */
2952 } wl_cnt_ge40mcst_v1_t;
2953 
2954 /** MACSTAT counters for ucode (corerev < 40) */
2955 typedef struct {
2956     /* MAC counters: 32-bit version of d11.h's macstat_t */
2957     uint32    txallfrm;    /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
2958                  * Control Management (includes retransmissions)
2959                  */
2960     uint32    txrtsfrm;    /**< number of RTS sent out by the MAC */
2961     uint32    txctsfrm;    /**< number of CTS sent out by the MAC */
2962     uint32    txackfrm;    /**< number of ACK frames sent out */
2963     uint32    txdnlfrm;    /**< number of Null-Data transmission generated from template  */
2964     uint32    txbcnfrm;    /**< beacons transmitted */
2965     uint32    txfunfl[6];    /**< per-fifo tx underflows */
2966     uint32    txampdu;    /**< number of AMPDUs transmitted */
2967     uint32    txmpdu;        /**< number of MPDUs transmitted */
2968     uint32    txtplunfl;    /**< Template underflows (mac was too slow to transmit ACK/CTS
2969                  * or BCN)
2970                  */
2971     uint32    txphyerror;    /**< Transmit phy error, type of error is reported in tx-status for
2972                  * driver enqueued frames
2973                  */
2974     uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
2975     uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
2976     uint32    rxfrmtoolong;    /**< Received frame longer than legal limit (2346 bytes) */
2977     uint32    rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
2978     uint32    rxanyerr;    /**< Any RX error that is not counted by other counters. */
2979     uint32    rxbadfcs;    /**< number of frames for which the CRC check failed in the MAC */
2980     uint32    rxbadplcp;    /**< parity check of the PLCP header failed */
2981     uint32    rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
2982     uint32    rxstrt;        /**< Number of received frames with a good PLCP
2983                  * (i.e. passing parity check)
2984                  */
2985     uint32    rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
2986     uint32    rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
2987     uint32    rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
2988     uint32    rxrtsucast;    /**< number of unicast RTS addressed to the MAC (good FCS) */
2989     uint32    rxctsucast;    /**< number of unicast CTS addressed to the MAC (good FCS) */
2990     uint32    rxackucast;    /**< number of ucast ACKS received (good FCS) */
2991     uint32    rxdtocast;  /**< number of received DATA frames (good FCS and not matching RA) */
2992     uint32    rxmgocast;  /**< number of received MGMT frames (good FCS and not matching RA) */
2993     uint32    rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
2994     uint32    rxrtsocast;    /**< number of received RTS not addressed to the MAC */
2995     uint32    rxctsocast;    /**< number of received CTS not addressed to the MAC */
2996     uint32    rxdtmcast;    /**< number of RX Data multicast frames received by the MAC */
2997     uint32    rxmgmcast;    /**< number of RX Management multicast frames received by the MAC */
2998     uint32    rxctlmcast;    /**< number of RX Control multicast frames received by the MAC
2999                  * (unlikely to see these)
3000                  */
3001     uint32    rxbeaconmbss;    /**< beacons received from member of BSS */
3002     uint32    rxdtucastobss; /**< number of unicast frames addressed to the MAC from
3003                   * other BSS (WDS FRAME)
3004                   */
3005     uint32    rxbeaconobss;    /**< beacons received from other BSS */
3006     uint32    rxrsptmout;    /**< number of response timeouts for transmitted frames
3007                  * expecting a response
3008                  */
3009     uint32    bcntxcancl;    /**< transmit beacons canceled due to receipt of beacon (IBSS) */
3010     uint32    rxnodelim;    /**< number of no valid delimiter detected by ampdu parser */
3011     uint32    rxf0ovfl;    /**< number of receive fifo 0 overflows */
3012     uint32    dbgoff46;
3013     uint32    dbgoff47;
3014     uint32    dbgoff48;    /**< Used for counting txstatus queue overflow (corerev <= 4)  */
3015     uint32    pmqovfl;    /**< number of PMQ overflows */
3016     uint32    rxcgprqfrm;    /**< number of received Probe requests that made it into
3017                  * the PRQ fifo
3018                  */
3019     uint32    rxcgprsqovfl;    /**< Rx Probe Request Que overflow in the AP */
3020     uint32    txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
3021                  * not get ACK
3022                  */
3023     uint32    txcgprssuc;    /**< Tx Probe Response Success (ACK was received) */
3024     uint32    prs_timeout;    /**< number of probe requests that were dropped from the PRQ
3025                  * fifo because a probe response could not be sent out within
3026                  * the time limit defined in M_PRS_MAXTIME
3027                  */
3028     uint32    txrtsfail;    /**< number of rts transmission failure that reach retry limit */
3029     uint32    txucast;    /**< number of unicast tx expecting response other than cts/cwcts */
3030     uint32  txinrtstxop;    /**< number of data frame transmissions during rts txop */
3031     uint32    rxback;        /**< blockack rxcnt */
3032     uint32    txback;        /**< blockack txcnt */
3033     uint32    bphy_rxcrsglitch;    /**< PHY count of bphy glitches */
3034     uint32    phywatch;
3035     uint32    rxtoolate;    /**< receive too late */
3036     uint32  bphy_badplcp;    /**< number of bad PLCP reception on BPHY rate */
3037 } wl_cnt_lt40mcst_v1_t;
3038 
3039 /** MACSTAT counters for "wl counter" version <= 10 */
3040 typedef struct {
3041     /* MAC counters: 32-bit version of d11.h's macstat_t */
3042     uint32    txallfrm;    /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
3043                  * Control Management (includes retransmissions)
3044                  */
3045     uint32    txrtsfrm;    /**< number of RTS sent out by the MAC */
3046     uint32    txctsfrm;    /**< number of CTS sent out by the MAC */
3047     uint32    txackfrm;    /**< number of ACK frames sent out */
3048     uint32    txdnlfrm;    /**< number of Null-Data transmission generated from template  */
3049     uint32    txbcnfrm;    /**< beacons transmitted */
3050     uint32    txfunfl[6];    /**< per-fifo tx underflows */
3051     uint32    txfbw;        /**< transmit at fallback bw (dynamic bw) */
3052     uint32    PAD0;        /**< number of MPDUs transmitted */
3053     uint32    txtplunfl;    /**< Template underflows (mac was too slow to transmit ACK/CTS
3054                  * or BCN)
3055                  */
3056     uint32    txphyerror;    /**< Transmit phy error, type of error is reported in tx-status for
3057                  * driver enqueued frames
3058                  */
3059     uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
3060     uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
3061     uint32    rxfrmtoolong;    /**< Received frame longer than legal limit (2346 bytes) */
3062     uint32    rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
3063     uint32    rxinvmachdr;    /**< Either the protocol version != 0 or frame type not
3064                  * data/control/management
3065                  */
3066     uint32    rxbadfcs;    /**< number of frames for which the CRC check failed in the MAC */
3067     uint32    rxbadplcp;    /**< parity check of the PLCP header failed */
3068     uint32    rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
3069     uint32    rxstrt;        /**< Number of received frames with a good PLCP
3070                  * (i.e. passing parity check)
3071                  */
3072     uint32    rxdfrmucastmbss; /* number of received DATA frames with good FCS and matching RA */
3073     uint32    rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
3074     uint32    rxcfrmucast; /**< number of received CNTRL frames with good FCS and matching RA */
3075     uint32    rxrtsucast;  /**< number of unicast RTS addressed to the MAC (good FCS) */
3076     uint32    rxctsucast;  /**< number of unicast CTS addressed to the MAC (good FCS) */
3077     uint32    rxackucast;    /**< number of ucast ACKS received (good FCS) */
3078     uint32    rxdfrmocast; /**< number of received DATA frames (good FCS and not matching RA) */
3079     uint32    rxmfrmocast; /**< number of received MGMT frames (good FCS and not matching RA) */
3080     uint32    rxcfrmocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
3081     uint32    rxrtsocast;    /**< number of received RTS not addressed to the MAC */
3082     uint32    rxctsocast;    /**< number of received CTS not addressed to the MAC */
3083     uint32    rxdfrmmcast;    /**< number of RX Data multicast frames received by the MAC */
3084     uint32    rxmfrmmcast;    /**< number of RX Management multicast frames received by the MAC */
3085     uint32    rxcfrmmcast;    /**< number of RX Control multicast frames received by the MAC
3086                  * (unlikely to see these)
3087                  */
3088     uint32    rxbeaconmbss;    /**< beacons received from member of BSS */
3089     uint32    rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
3090                   * other BSS (WDS FRAME)
3091                   */
3092     uint32    rxbeaconobss;    /**< beacons received from other BSS */
3093     uint32    rxrsptmout;    /**< number of response timeouts for transmitted frames
3094                  * expecting a response
3095                  */
3096     uint32    bcntxcancl;    /**< transmit beacons canceled due to receipt of beacon (IBSS) */
3097     uint32    PAD1;
3098     uint32    rxf0ovfl;    /**< number of receive fifo 0 overflows */
3099     uint32    rxf1ovfl;    /**< Number of receive fifo 1 overflows (obsolete) */
3100     uint32    rxf2ovfl;    /**< Number of receive fifo 2 overflows (obsolete) */
3101     uint32    txsfovfl;    /**< Number of transmit status fifo overflows (obsolete) */
3102     uint32    pmqovfl;    /**< number of PMQ overflows */
3103     uint32    rxcgprqfrm;    /**< number of received Probe requests that made it into
3104                  * the PRQ fifo
3105                  */
3106     uint32    rxcgprsqovfl;    /**< Rx Probe Request Que overflow in the AP */
3107     uint32    txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
3108                  * not get ACK
3109                  */
3110     uint32    txcgprssuc;    /**< Tx Probe Response Success (ACK was received) */
3111     uint32    prs_timeout;    /**< number of probe requests that were dropped from the PRQ
3112                  * fifo because a probe response could not be sent out within
3113                  * the time limit defined in M_PRS_MAXTIME
3114                  */
3115     uint32    rxnack;        /**< obsolete */
3116     uint32    frmscons;    /**< obsolete */
3117     uint32  txnack;        /**< obsolete */
3118     uint32    rxback;        /**< blockack rxcnt */
3119     uint32    txback;        /**< blockack txcnt */
3120     uint32    bphy_rxcrsglitch;    /**< PHY count of bphy glitches */
3121     uint32    rxdrop20s;    /**< drop secondary cnt */
3122     uint32    rxtoolate;    /**< receive too late */
3123     uint32  bphy_badplcp;    /**< number of bad PLCP reception on BPHY rate */
3124 } wl_cnt_v_le10_mcst_t;
3125 
3126 #define MAX_RX_FIFO 3
3127 #define WL_RXFIFO_CNT_VERSION  1   /* current version of wl_rxfifo_cnt_t */
3128 typedef struct {
3129     /* Counters for frames received from rx fifos */
3130     uint16    version;
3131     uint16    length;        /* length of entire structure */
3132     uint32    rxf_data[MAX_RX_FIFO];        /* data frames from rx fifo */
3133     uint32    rxf_mgmtctl[MAX_RX_FIFO];    /* mgmt/ctl frames from rx fifo */
3134 } wl_rxfifo_cnt_t;
3135 
3136 typedef struct {
3137     uint16    version;    /**< see definition of WL_CNT_T_VERSION */
3138     uint16    length;        /**< length of entire structure */
3139 
3140     /* transmit stat counters */
3141     uint32    txframe;    /**< tx data frames */
3142     uint32    txbyte;        /**< tx data bytes */
3143     uint32    txretrans;    /**< tx mac retransmits */
3144     uint32    txerror;    /**< tx data errors (derived: sum of others) */
3145     uint32    txctl;        /**< tx management frames */
3146     uint32    txprshort;    /**< tx short preamble frames */
3147     uint32    txserr;        /**< tx status errors */
3148     uint32    txnobuf;    /**< tx out of buffers errors */
3149     uint32    txnoassoc;    /**< tx discard because we're not associated */
3150     uint32    txrunt;        /**< tx runt frames */
3151     uint32    txchit;        /**< tx header cache hit (fastpath) */
3152     uint32    txcmiss;    /**< tx header cache miss (slowpath) */
3153 
3154     /* transmit chip error counters */
3155     uint32    txuflo;        /**< tx fifo underflows */
3156     uint32    txphyerr;    /**< tx phy errors (indicated in tx status) */
3157     uint32    txphycrs;
3158 
3159     /* receive stat counters */
3160     uint32    rxframe;    /**< rx data frames */
3161     uint32    rxbyte;        /**< rx data bytes */
3162     uint32    rxerror;    /**< rx data errors (derived: sum of others) */
3163     uint32    rxctl;        /**< rx management frames */
3164     uint32    rxnobuf;    /**< rx out of buffers errors */
3165     uint32    rxnondata;    /**< rx non data frames in the data channel errors */
3166     uint32    rxbadds;    /**< rx bad DS errors */
3167     uint32    rxbadcm;    /**< rx bad control or management frames */
3168     uint32    rxfragerr;    /**< rx fragmentation errors */
3169     uint32    rxrunt;        /**< rx runt frames */
3170     uint32    rxgiant;    /**< rx giant frames */
3171     uint32    rxnoscb;    /**< rx no scb error */
3172     uint32    rxbadproto;    /**< rx invalid frames */
3173     uint32    rxbadsrcmac;    /**< rx frames with Invalid Src Mac */
3174     uint32    rxbadda;    /**< rx frames tossed for invalid da */
3175     uint32    rxfilter;    /**< rx frames filtered out */
3176 
3177     /* receive chip error counters */
3178     uint32    rxoflo;        /**< rx fifo overflow errors */
3179     uint32    rxuflo[NFIFO];    /**< rx dma descriptor underflow errors */
3180 
3181     uint32    d11cnt_txrts_off;    /**< d11cnt txrts value when reset d11cnt */
3182     uint32    d11cnt_rxcrc_off;    /**< d11cnt rxcrc value when reset d11cnt */
3183     uint32    d11cnt_txnocts_off;    /**< d11cnt txnocts value when reset d11cnt */
3184 
3185     /* misc counters */
3186     uint32    dmade;        /**< tx/rx dma descriptor errors */
3187     uint32    dmada;        /**< tx/rx dma data errors */
3188     uint32    dmape;        /**< tx/rx dma descriptor protocol errors */
3189     uint32    reset;        /**< reset count */
3190     uint32    tbtt;        /**< cnts the TBTT int's */
3191     uint32    txdmawar;
3192     uint32    pkt_callback_reg_fail;    /**< callbacks register failure */
3193 
3194     /* MAC counters: 32-bit version of d11.h's macstat_t */
3195     uint32    txallfrm;    /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
3196                  * Control Management (includes retransmissions)
3197                  */
3198     uint32    txrtsfrm;    /**< number of RTS sent out by the MAC */
3199     uint32    txctsfrm;    /**< number of CTS sent out by the MAC */
3200     uint32    txackfrm;    /**< number of ACK frames sent out */
3201     uint32    txdnlfrm;    /**< Not used */
3202     uint32    txbcnfrm;    /**< beacons transmitted */
3203     uint32    txfunfl[6];    /**< per-fifo tx underflows */
3204     uint32    rxtoolate;    /**< receive too late */
3205     uint32  txfbw;        /**< transmit at fallback bw (dynamic bw) */
3206     uint32    txtplunfl;    /**< Template underflows (mac was too slow to transmit ACK/CTS
3207                  * or BCN)
3208                  */
3209     uint32    txphyerror;    /**< Transmit phy error, type of error is reported in tx-status for
3210                  * driver enqueued frames
3211                  */
3212     uint32    rxfrmtoolong;    /**< Received frame longer than legal limit (2346 bytes) */
3213     uint32    rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
3214     uint32    rxinvmachdr;    /**< Either the protocol version != 0 or frame type not
3215                  * data/control/management
3216                  */
3217     uint32    rxbadfcs;    /**< number of frames for which the CRC check failed in the MAC */
3218     uint32    rxbadplcp;    /**< parity check of the PLCP header failed */
3219     uint32    rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
3220     uint32    rxstrt;        /**< Number of received frames with a good PLCP
3221                  * (i.e. passing parity check)
3222                  */
3223     uint32    rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
3224     uint32    rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
3225     uint32    rxcfrmucast; /**< number of received CNTRL frames with good FCS and matching RA */
3226     uint32    rxrtsucast;    /**< number of unicast RTS addressed to the MAC (good FCS) */
3227     uint32    rxctsucast;    /**< number of unicast CTS addressed to the MAC (good FCS) */
3228     uint32    rxackucast;    /**< number of ucast ACKS received (good FCS) */
3229     uint32    rxdfrmocast; /**< number of received DATA frames (good FCS and not matching RA) */
3230     uint32    rxmfrmocast; /**< number of received MGMT frames (good FCS and not matching RA) */
3231     uint32    rxcfrmocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
3232     uint32    rxrtsocast;    /**< number of received RTS not addressed to the MAC */
3233     uint32    rxctsocast;    /**< number of received CTS not addressed to the MAC */
3234     uint32    rxdfrmmcast;    /**< number of RX Data multicast frames received by the MAC */
3235     uint32    rxmfrmmcast;    /**< number of RX Management multicast frames received by the MAC */
3236     uint32    rxcfrmmcast;    /**< number of RX Control multicast frames received by the MAC
3237                  * (unlikely to see these)
3238                  */
3239     uint32    rxbeaconmbss;    /**< beacons received from member of BSS */
3240     uint32    rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
3241                   * other BSS (WDS FRAME)
3242                   */
3243     uint32    rxbeaconobss;    /**< beacons received from other BSS */
3244     uint32    rxrsptmout;    /**< Number of response timeouts for transmitted frames
3245                  * expecting a response
3246                  */
3247     uint32    bcntxcancl;    /**< transmit beacons canceled due to receipt of beacon (IBSS) */
3248     uint32    rxf0ovfl;    /**< Number of receive fifo 0 overflows */
3249     uint32    rxf1ovfl;    /**< Number of receive fifo 1 overflows (obsolete) */
3250     uint32    rxf2ovfl;    /**< Number of receive fifo 2 overflows (obsolete) */
3251     uint32    txsfovfl;    /**< Number of transmit status fifo overflows (obsolete) */
3252     uint32    pmqovfl;    /**< Number of PMQ overflows */
3253     uint32    rxcgprqfrm;    /**< Number of received Probe requests that made it into
3254                  * the PRQ fifo
3255                  */
3256     uint32    rxcgprsqovfl;    /**< Rx Probe Request Que overflow in the AP */
3257     uint32    txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
3258                  * not get ACK
3259                  */
3260     uint32    txcgprssuc;    /**< Tx Probe Response Success (ACK was received) */
3261     uint32    prs_timeout;    /**< Number of probe requests that were dropped from the PRQ
3262                  * fifo because a probe response could not be sent out within
3263                  * the time limit defined in M_PRS_MAXTIME
3264                  */
3265     uint32    rxnack;        /**< obsolete */
3266     uint32    frmscons;    /**< obsolete */
3267     uint32  txnack;        /**< obsolete */
3268     uint32    rxback;        /**< blockack rxcnt */
3269     uint32    txback;        /**< blockack txcnt */
3270 
3271     /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
3272     uint32    txfrag;        /**< dot11TransmittedFragmentCount */
3273     uint32    txmulti;    /**< dot11MulticastTransmittedFrameCount */
3274     uint32    txfail;        /**< dot11FailedCount */
3275     uint32    txretry;    /**< dot11RetryCount */
3276     uint32    txretrie;    /**< dot11MultipleRetryCount */
3277     uint32    rxdup;        /**< dot11FrameduplicateCount */
3278     uint32    txrts;        /**< dot11RTSSuccessCount */
3279     uint32    txnocts;    /**< dot11RTSFailureCount */
3280     uint32    txnoack;    /**< dot11ACKFailureCount */
3281     uint32    rxfrag;        /**< dot11ReceivedFragmentCount */
3282     uint32    rxmulti;    /**< dot11MulticastReceivedFrameCount */
3283     uint32    rxcrc;        /**< dot11FCSErrorCount */
3284     uint32    txfrmsnt;    /**< dot11TransmittedFrameCount (bogus MIB?) */
3285     uint32    rxundec;    /**< dot11WEPUndecryptableCount */
3286 
3287     /* WPA2 counters (see rxundec for DecryptFailureCount) */
3288     uint32    tkipmicfaill;    /**< TKIPLocalMICFailures */
3289     uint32    tkipcntrmsr;    /**< TKIPCounterMeasuresInvoked */
3290     uint32    tkipreplay;    /**< TKIPReplays */
3291     uint32    ccmpfmterr;    /**< CCMPFormatErrors */
3292     uint32    ccmpreplay;    /**< CCMPReplays */
3293     uint32    ccmpundec;    /**< CCMPDecryptErrors */
3294     uint32    fourwayfail;    /**< FourWayHandshakeFailures */
3295     uint32    wepundec;    /**< dot11WEPUndecryptableCount */
3296     uint32    wepicverr;    /**< dot11WEPICVErrorCount */
3297     uint32    decsuccess;    /**< DecryptSuccessCount */
3298     uint32    tkipicverr;    /**< TKIPICVErrorCount */
3299     uint32    wepexcluded;    /**< dot11WEPExcludedCount */
3300 
3301     uint32    txchanrej;    /**< Tx frames suppressed due to channel rejection */
3302     uint32    psmwds;        /**< Count PSM watchdogs */
3303     uint32    phywatchdog;    /**< Count Phy watchdogs (triggered by ucode) */
3304 
3305     /* MBSS counters, AP only */
3306     uint32    prq_entries_handled;    /**< PRQ entries read in */
3307     uint32    prq_undirected_entries;    /**<    which were bcast bss & ssid */
3308     uint32    prq_bad_entries;    /**<    which could not be translated to info */
3309     uint32    atim_suppress_count;    /**< TX suppressions on ATIM fifo */
3310     uint32    bcn_template_not_ready;    /**< Template marked in use on send bcn ... */
3311     uint32    bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
3312     uint32    late_tbtt_dpc;    /**< TBTT DPC did not happen in time */
3313 
3314     /* per-rate receive stat counters */
3315     uint32  rx1mbps;    /**< packets rx at 1Mbps */
3316     uint32  rx2mbps;    /**< packets rx at 2Mbps */
3317     uint32  rx5mbps5;    /**< packets rx at 5.5Mbps */
3318     uint32  rx6mbps;    /**< packets rx at 6Mbps */
3319     uint32  rx9mbps;    /**< packets rx at 9Mbps */
3320     uint32  rx11mbps;    /**< packets rx at 11Mbps */
3321     uint32  rx12mbps;    /**< packets rx at 12Mbps */
3322     uint32  rx18mbps;    /**< packets rx at 18Mbps */
3323     uint32  rx24mbps;    /**< packets rx at 24Mbps */
3324     uint32  rx36mbps;    /**< packets rx at 36Mbps */
3325     uint32  rx48mbps;    /**< packets rx at 48Mbps */
3326     uint32  rx54mbps;    /**< packets rx at 54Mbps */
3327     uint32  rx108mbps;    /**< packets rx at 108mbps */
3328     uint32  rx162mbps;    /**< packets rx at 162mbps */
3329     uint32  rx216mbps;    /**< packets rx at 216 mbps */
3330     uint32  rx270mbps;    /**< packets rx at 270 mbps */
3331     uint32  rx324mbps;    /**< packets rx at 324 mbps */
3332     uint32  rx378mbps;    /**< packets rx at 378 mbps */
3333     uint32  rx432mbps;    /**< packets rx at 432 mbps */
3334     uint32  rx486mbps;    /**< packets rx at 486 mbps */
3335     uint32  rx540mbps;    /**< packets rx at 540 mbps */
3336 
3337     /* pkteng rx frame stats */
3338     uint32    pktengrxducast; /**< unicast frames rxed by the pkteng code */
3339     uint32    pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
3340 
3341     uint32    rfdisable;    /**< count of radio disables */
3342     uint32    bphy_rxcrsglitch;    /**< PHY count of bphy glitches */
3343     uint32  bphy_badplcp;
3344 
3345     uint32    txexptime;    /**< Tx frames suppressed due to timer expiration */
3346 
3347     uint32    txmpdu_sgi;    /**< count for sgi transmit */
3348     uint32    rxmpdu_sgi;    /**< count for sgi received */
3349     uint32    txmpdu_stbc;    /**< count for stbc transmit */
3350     uint32    rxmpdu_stbc;    /**< count for stbc received */
3351 
3352     uint32    rxundec_mcst;    /**< dot11WEPUndecryptableCount */
3353 
3354     /* WPA2 counters (see rxundec for DecryptFailureCount) */
3355     uint32    tkipmicfaill_mcst;    /**< TKIPLocalMICFailures */
3356     uint32    tkipcntrmsr_mcst;    /**< TKIPCounterMeasuresInvoked */
3357     uint32    tkipreplay_mcst;    /**< TKIPReplays */
3358     uint32    ccmpfmterr_mcst;    /**< CCMPFormatErrors */
3359     uint32    ccmpreplay_mcst;    /**< CCMPReplays */
3360     uint32    ccmpundec_mcst;    /**< CCMPDecryptErrors */
3361     uint32    fourwayfail_mcst;    /**< FourWayHandshakeFailures */
3362     uint32    wepundec_mcst;    /**< dot11WEPUndecryptableCount */
3363     uint32    wepicverr_mcst;    /**< dot11WEPICVErrorCount */
3364     uint32    decsuccess_mcst;    /**< DecryptSuccessCount */
3365     uint32    tkipicverr_mcst;    /**< TKIPICVErrorCount */
3366     uint32    wepexcluded_mcst;    /**< dot11WEPExcludedCount */
3367 
3368     uint32    dma_hang;    /**< count for dma hang */
3369     uint32    reinit;        /**< count for reinit */
3370 
3371     uint32  pstatxucast;    /**< count of ucast frames xmitted on all psta assoc */
3372     uint32  pstatxnoassoc;    /**< count of txnoassoc frames xmitted on all psta assoc */
3373     uint32  pstarxucast;    /**< count of ucast frames received on all psta assoc */
3374     uint32  pstarxbcmc;    /**< count of bcmc frames received on all psta */
3375     uint32  pstatxbcmc;    /**< count of bcmc frames transmitted on all psta */
3376 
3377     uint32  cso_passthrough; /**< hw cso required but passthrough */
3378     uint32    cso_normal;    /**< hw cso hdr for normal process */
3379     uint32    chained;    /**< number of frames chained */
3380     uint32    chainedsz1;    /**< number of chain size 1 frames */
3381     uint32    unchained;    /**< number of frames not chained */
3382     uint32    maxchainsz;    /**< max chain size so far */
3383     uint32    currchainsz;    /**< current chain size */
3384     uint32    rxdrop20s;    /**< drop secondary cnt */
3385     uint32    pciereset;    /**< Secondary Bus Reset issued by driver */
3386     uint32    cfgrestore;    /**< configspace restore by driver */
3387     uint32    reinitreason[NREINITREASONCOUNT]; /**< reinitreason counters; 0: Unknown reason */
3388     uint32  rxrtry;        /**< num of received packets with retry bit on */
3389     uint32    txmpdu;        /**< macstat cnt only valid in ver 11. number of MPDUs txed.  */
3390     uint32    rxnodelim;    /**< macstat cnt only valid in ver 11.
3391                  * number of occasions that no valid delimiter is detected
3392                  * by ampdu parser.
3393                  */
3394     uint32  rxmpdu_mu;      /**< Number of MU MPDUs received */
3395 
3396     /* detailed control/management frames */
3397     uint32    txbar;        /**< Number of TX BAR */
3398     uint32    rxbar;        /**< Number of RX BAR */
3399     uint32    txpspoll;    /**< Number of TX PS-poll */
3400     uint32    rxpspoll;    /**< Number of RX PS-poll */
3401     uint32    txnull;        /**< Number of TX NULL_DATA */
3402     uint32    rxnull;        /**< Number of RX NULL_DATA */
3403     uint32    txqosnull;    /**< Number of TX NULL_QoSDATA */
3404     uint32    rxqosnull;    /**< Number of RX NULL_QoSDATA */
3405     uint32    txassocreq;    /**< Number of TX ASSOC request */
3406     uint32    rxassocreq;    /**< Number of RX ASSOC request */
3407     uint32    txreassocreq;    /**< Number of TX REASSOC request */
3408     uint32    rxreassocreq;    /**< Number of RX REASSOC request */
3409     uint32    txdisassoc;    /**< Number of TX DISASSOC */
3410     uint32    rxdisassoc;    /**< Number of RX DISASSOC */
3411     uint32    txassocrsp;    /**< Number of TX ASSOC response */
3412     uint32    rxassocrsp;    /**< Number of RX ASSOC response */
3413     uint32    txreassocrsp;    /**< Number of TX REASSOC response */
3414     uint32    rxreassocrsp;    /**< Number of RX REASSOC response */
3415     uint32    txauth;        /**< Number of TX AUTH */
3416     uint32    rxauth;        /**< Number of RX AUTH */
3417     uint32    txdeauth;    /**< Number of TX DEAUTH */
3418     uint32    rxdeauth;    /**< Number of RX DEAUTH */
3419     uint32    txprobereq;    /**< Number of TX probe request */
3420     uint32    rxprobereq;    /**< Number of RX probe request */
3421     uint32    txprobersp;    /**< Number of TX probe response */
3422     uint32    rxprobersp;    /**< Number of RX probe response */
3423     uint32    txaction;    /**< Number of TX action frame */
3424     uint32    rxaction;    /**< Number of RX action frame */
3425     uint32  ampdu_wds;      /**< Number of AMPDU watchdogs */
3426     uint32  txlost;         /**< Number of lost packets reported in txs */
3427     uint32  txdatamcast;    /**< Number of TX multicast data packets */
3428     uint32  txdatabcast;    /**< Number of TX broadcast data packets */
3429     uint32  txbcast;        /* Broadcast TransmittedFrameCount */
3430     uint32  txdropped;      /* tx dropped pkts */
3431     uint32  rxbcast;        /* BroadcastReceivedFrameCount */
3432     uint32  rxdropped;      /* rx dropped pkts (derived: sum of others) */
3433 } wl_cnt_ver_11_t;
3434 
3435 typedef struct {
3436     uint16  version;    /**< see definition of WL_CNT_T_VERSION */
3437     uint16  length;     /**< length of entire structure */
3438 
3439     /* transmit stat counters */
3440     uint32  txframe;    /**< tx data frames */
3441     uint32  txbyte;     /**< tx data bytes */
3442     uint32  txretrans;  /**< tx mac retransmits */
3443     uint32  txerror;    /**< tx data errors (derived: sum of others) */
3444     uint32  txctl;      /**< tx management frames */
3445     uint32  txprshort;  /**< tx short preamble frames */
3446     uint32  txserr;     /**< tx status errors */
3447     uint32  txnobuf;    /**< tx out of buffers errors */
3448     uint32  txnoassoc;  /**< tx discard because we're not associated */
3449     uint32  txrunt;     /**< tx runt frames */
3450     uint32  txchit;     /**< tx header cache hit (fastpath) */
3451     uint32  txcmiss;    /**< tx header cache miss (slowpath) */
3452 
3453     /* transmit chip error counters */
3454     uint32  txuflo;     /**< tx fifo underflows */
3455     uint32  txphyerr;   /**< tx phy errors (indicated in tx status) */
3456     uint32  txphycrs;
3457 
3458     /* receive stat counters */
3459     uint32  rxframe;    /**< rx data frames */
3460     uint32  rxbyte;     /**< rx data bytes */
3461     uint32  rxerror;    /**< rx data errors (derived: sum of others) */
3462     uint32  rxctl;      /**< rx management frames */
3463     uint32  rxnobuf;    /**< rx out of buffers errors */
3464     uint32  rxnondata;  /**< rx non data frames in the data channel errors */
3465     uint32  rxbadds;    /**< rx bad DS errors */
3466     uint32  rxbadcm;    /**< rx bad control or management frames */
3467     uint32  rxfragerr;  /**< rx fragmentation errors */
3468     uint32  rxrunt;     /**< rx runt frames */
3469     uint32  rxgiant;    /**< rx giant frames */
3470     uint32  rxnoscb;    /**< rx no scb error */
3471     uint32  rxbadproto; /**< rx invalid frames */
3472     uint32  rxbadsrcmac;    /**< rx frames with Invalid Src Mac */
3473     uint32  rxbadda;    /**< rx frames tossed for invalid da */
3474     uint32  rxfilter;   /**< rx frames filtered out */
3475 
3476     /* receive chip error counters */
3477     uint32  rxoflo;     /**< rx fifo overflow errors */
3478     uint32  rxuflo[NFIFO];  /**< rx dma descriptor underflow errors */
3479 
3480     uint32  d11cnt_txrts_off;   /**< d11cnt txrts value when reset d11cnt */
3481     uint32  d11cnt_rxcrc_off;   /**< d11cnt rxcrc value when reset d11cnt */
3482     uint32  d11cnt_txnocts_off; /**< d11cnt txnocts value when reset d11cnt */
3483 
3484     /* misc counters */
3485     uint32  dmade;      /**< tx/rx dma descriptor errors */
3486     uint32  dmada;      /**< tx/rx dma data errors */
3487     uint32  dmape;      /**< tx/rx dma descriptor protocol errors */
3488     uint32  reset;      /**< reset count */
3489     uint32  tbtt;       /**< cnts the TBTT int's */
3490     uint32  txdmawar;
3491     uint32  pkt_callback_reg_fail;  /**< callbacks register failure */
3492 
3493     /* MAC counters: 32-bit version of d11.h's macstat_t */
3494     uint32  txallfrm;   /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
3495                  * Control Management (includes retransmissions)
3496                  */
3497     uint32  txrtsfrm;   /**< number of RTS sent out by the MAC */
3498     uint32  txctsfrm;   /**< number of CTS sent out by the MAC */
3499     uint32  txackfrm;   /**< number of ACK frames sent out */
3500     uint32  txdnlfrm;   /**< Not used */
3501     uint32  txbcnfrm;   /**< beacons transmitted */
3502     uint32  txfunfl[6]; /**< per-fifo tx underflows */
3503     uint32    rxtoolate;    /**< receive too late */
3504     uint32  txfbw;        /**< transmit at fallback bw (dynamic bw) */
3505     uint32  txtplunfl;  /**< Template underflows (mac was too slow to transmit ACK/CTS
3506                  * or BCN)
3507                  */
3508     uint32  txphyerror; /**< Transmit phy error, type of error is reported in tx-status for
3509                  * driver enqueued frames
3510                  */
3511     uint32  rxfrmtoolong;   /**< Received frame longer than legal limit (2346 bytes) */
3512     uint32  rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
3513     uint32  rxinvmachdr;    /**< Either the protocol version != 0 or frame type not
3514                  * data/control/management
3515                */
3516     uint32  rxbadfcs;   /**< number of frames for which the CRC check failed in the MAC */
3517     uint32  rxbadplcp;  /**< parity check of the PLCP header failed */
3518     uint32  rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
3519     uint32  rxstrt;     /**< Number of received frames with a good PLCP
3520                  * (i.e. passing parity check)
3521                  */
3522     uint32  rxdfrmucastmbss; /**< # of received DATA frames with good FCS and matching RA */
3523     uint32  rxmfrmucastmbss; /**< # of received mgmt frames with good FCS and matching RA */
3524     uint32  rxcfrmucast;     /**< # of received CNTRL frames with good FCS and matching RA */
3525     uint32  rxrtsucast; /**< number of unicast RTS addressed to the MAC (good FCS) */
3526     uint32  rxctsucast; /**< number of unicast CTS addressed to the MAC (good FCS) */
3527     uint32  rxackucast; /**< number of ucast ACKS received (good FCS) */
3528     uint32  rxdfrmocast;    /**< # of received DATA frames (good FCS and not matching RA) */
3529     uint32  rxmfrmocast;    /**< # of received MGMT frames (good FCS and not matching RA) */
3530     uint32  rxcfrmocast;    /**< # of received CNTRL frame (good FCS and not matching RA) */
3531     uint32  rxrtsocast; /**< number of received RTS not addressed to the MAC */
3532     uint32  rxctsocast; /**< number of received CTS not addressed to the MAC */
3533     uint32  rxdfrmmcast;    /**< number of RX Data multicast frames received by the MAC */
3534     uint32  rxmfrmmcast;    /**< number of RX Management multicast frames received by the MAC */
3535     uint32  rxcfrmmcast;    /**< number of RX Control multicast frames received by the MAC
3536                  * (unlikely to see these)
3537                  */
3538     uint32  rxbeaconmbss;   /**< beacons received from member of BSS */
3539     uint32  rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
3540                   * other BSS (WDS FRAME)
3541                   */
3542     uint32  rxbeaconobss;   /**< beacons received from other BSS */
3543     uint32  rxrsptmout; /**< Number of response timeouts for transmitted frames
3544                  * expecting a response
3545                  */
3546     uint32  bcntxcancl; /**< transmit beacons canceled due to receipt of beacon (IBSS) */
3547     uint32  rxf0ovfl;   /**< Number of receive fifo 0 overflows */
3548     uint32  rxf1ovfl;   /**< Number of receive fifo 1 overflows (obsolete) */
3549     uint32  rxf2ovfl;   /**< Number of receive fifo 2 overflows (obsolete) */
3550     uint32  txsfovfl;   /**< Number of transmit status fifo overflows (obsolete) */
3551     uint32  pmqovfl;    /**< Number of PMQ overflows */
3552     uint32  rxcgprqfrm; /**< Number of received Probe requests that made it into
3553                  * the PRQ fifo
3554                  */
3555     uint32  rxcgprsqovfl;   /**< Rx Probe Request Que overflow in the AP */
3556     uint32  txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
3557                  * not get ACK
3558                  */
3559     uint32  txcgprssuc; /**< Tx Probe Response Success (ACK was received) */
3560     uint32  prs_timeout;    /**< Number of probe requests that were dropped from the PRQ
3561                  * fifo because a probe response could not be sent out within
3562                  * the time limit defined in M_PRS_MAXTIME
3563                  */
3564     uint32  rxnack;
3565     uint32  frmscons;
3566     uint32  txnack;        /**< obsolete */
3567     uint32    rxback;        /**< blockack rxcnt */
3568     uint32    txback;        /**< blockack txcnt */
3569 
3570     /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
3571     uint32  txfrag;     /**< dot11TransmittedFragmentCount */
3572     uint32  txmulti;    /**< dot11MulticastTransmittedFrameCount */
3573     uint32  txfail;     /**< dot11FailedCount */
3574     uint32  txretry;    /**< dot11RetryCount */
3575     uint32  txretrie;   /**< dot11MultipleRetryCount */
3576     uint32  rxdup;      /**< dot11FrameduplicateCount */
3577     uint32  txrts;      /**< dot11RTSSuccessCount */
3578     uint32  txnocts;    /**< dot11RTSFailureCount */
3579     uint32  txnoack;    /**< dot11ACKFailureCount */
3580     uint32  rxfrag;     /**< dot11ReceivedFragmentCount */
3581     uint32  rxmulti;    /**< dot11MulticastReceivedFrameCount */
3582     uint32  rxcrc;      /**< dot11FCSErrorCount */
3583     uint32  txfrmsnt;   /**< dot11TransmittedFrameCount (bogus MIB?) */
3584     uint32  rxundec;    /**< dot11WEPUndecryptableCount */
3585 
3586     /* WPA2 counters (see rxundec for DecryptFailureCount) */
3587     uint32  tkipmicfaill;   /**< TKIPLocalMICFailures */
3588     uint32  tkipcntrmsr;    /**< TKIPCounterMeasuresInvoked */
3589     uint32  tkipreplay; /**< TKIPReplays */
3590     uint32  ccmpfmterr; /**< CCMPFormatErrors */
3591     uint32  ccmpreplay; /**< CCMPReplays */
3592     uint32  ccmpundec;  /**< CCMPDecryptErrors */
3593     uint32  fourwayfail;    /**< FourWayHandshakeFailures */
3594     uint32  wepundec;   /**< dot11WEPUndecryptableCount */
3595     uint32  wepicverr;  /**< dot11WEPICVErrorCount */
3596     uint32  decsuccess; /**< DecryptSuccessCount */
3597     uint32  tkipicverr; /**< TKIPICVErrorCount */
3598     uint32  wepexcluded;    /**< dot11WEPExcludedCount */
3599 
3600     uint32  rxundec_mcst;   /**< dot11WEPUndecryptableCount */
3601 
3602     /* WPA2 counters (see rxundec for DecryptFailureCount) */
3603     uint32  tkipmicfaill_mcst;  /**< TKIPLocalMICFailures */
3604     uint32  tkipcntrmsr_mcst;   /**< TKIPCounterMeasuresInvoked */
3605     uint32  tkipreplay_mcst;    /**< TKIPReplays */
3606     uint32  ccmpfmterr_mcst;    /**< CCMPFormatErrors */
3607     uint32  ccmpreplay_mcst;    /**< CCMPReplays */
3608     uint32  ccmpundec_mcst; /**< CCMPDecryptErrors */
3609     uint32  fourwayfail_mcst;   /**< FourWayHandshakeFailures */
3610     uint32  wepundec_mcst;  /**< dot11WEPUndecryptableCount */
3611     uint32  wepicverr_mcst; /**< dot11WEPICVErrorCount */
3612     uint32  decsuccess_mcst;    /**< DecryptSuccessCount */
3613     uint32  tkipicverr_mcst;    /**< TKIPICVErrorCount */
3614     uint32  wepexcluded_mcst;   /**< dot11WEPExcludedCount */
3615 
3616     uint32  txchanrej;  /**< Tx frames suppressed due to channel rejection */
3617     uint32  txexptime;  /**< Tx frames suppressed due to timer expiration */
3618     uint32  psmwds;     /**< Count PSM watchdogs */
3619     uint32  phywatchdog;    /**< Count Phy watchdogs (triggered by ucode) */
3620 
3621     /* MBSS counters, AP only */
3622     uint32  prq_entries_handled;    /**< PRQ entries read in */
3623     uint32  prq_undirected_entries; /**<    which were bcast bss & ssid */
3624     uint32  prq_bad_entries;    /**<    which could not be translated to info */
3625     uint32  atim_suppress_count;    /**< TX suppressions on ATIM fifo */
3626     uint32  bcn_template_not_ready; /**< Template marked in use on send bcn ... */
3627     uint32  bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
3628     uint32  late_tbtt_dpc;  /**< TBTT DPC did not happen in time */
3629 
3630     /* per-rate receive stat counters */
3631     uint32  rx1mbps;    /**< packets rx at 1Mbps */
3632     uint32  rx2mbps;    /**< packets rx at 2Mbps */
3633     uint32  rx5mbps5;   /**< packets rx at 5.5Mbps */
3634     uint32  rx6mbps;    /**< packets rx at 6Mbps */
3635     uint32  rx9mbps;    /**< packets rx at 9Mbps */
3636     uint32  rx11mbps;   /**< packets rx at 11Mbps */
3637     uint32  rx12mbps;   /**< packets rx at 12Mbps */
3638     uint32  rx18mbps;   /**< packets rx at 18Mbps */
3639     uint32  rx24mbps;   /**< packets rx at 24Mbps */
3640     uint32  rx36mbps;   /**< packets rx at 36Mbps */
3641     uint32  rx48mbps;   /**< packets rx at 48Mbps */
3642     uint32  rx54mbps;   /**< packets rx at 54Mbps */
3643     uint32  rx108mbps;  /**< packets rx at 108mbps */
3644     uint32  rx162mbps;  /**< packets rx at 162mbps */
3645     uint32  rx216mbps;  /**< packets rx at 216 mbps */
3646     uint32  rx270mbps;  /**< packets rx at 270 mbps */
3647     uint32  rx324mbps;  /**< packets rx at 324 mbps */
3648     uint32  rx378mbps;  /**< packets rx at 378 mbps */
3649     uint32  rx432mbps;  /**< packets rx at 432 mbps */
3650     uint32  rx486mbps;  /**< packets rx at 486 mbps */
3651     uint32  rx540mbps;  /**< packets rx at 540 mbps */
3652 
3653     /* pkteng rx frame stats */
3654     uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
3655     uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
3656 
3657     uint32  rfdisable;  /**< count of radio disables */
3658     uint32  bphy_rxcrsglitch;   /**< PHY count of bphy glitches */
3659     uint32  bphy_badplcp;
3660 
3661     uint32  txmpdu_sgi; /**< count for sgi transmit */
3662     uint32  rxmpdu_sgi; /**< count for sgi received */
3663     uint32  txmpdu_stbc;    /**< count for stbc transmit */
3664     uint32  rxmpdu_stbc;    /**< count for stbc received */
3665 
3666     uint32    rxdrop20s;    /**< drop secondary cnt */
3667 } wl_cnt_ver_6_t;
3668 
3669 #define    WL_DELTA_STATS_T_VERSION    2    /**< current version of wl_delta_stats_t struct */
3670 
3671 typedef struct {
3672     uint16 version;     /**< see definition of WL_DELTA_STATS_T_VERSION */
3673     uint16 length;      /**< length of entire structure */
3674 
3675     /* transmit stat counters */
3676     uint32 txframe;     /**< tx data frames */
3677     uint32 txbyte;      /**< tx data bytes */
3678     uint32 txretrans;   /**< tx mac retransmits */
3679     uint32 txfail;      /**< tx failures */
3680 
3681     /* receive stat counters */
3682     uint32 rxframe;     /**< rx data frames */
3683     uint32 rxbyte;      /**< rx data bytes */
3684 
3685     /* per-rate receive stat counters */
3686     uint32  rx1mbps;    /**< packets rx at 1Mbps */
3687     uint32  rx2mbps;    /**< packets rx at 2Mbps */
3688     uint32  rx5mbps5;    /**< packets rx at 5.5Mbps */
3689     uint32  rx6mbps;    /**< packets rx at 6Mbps */
3690     uint32  rx9mbps;    /**< packets rx at 9Mbps */
3691     uint32  rx11mbps;    /**< packets rx at 11Mbps */
3692     uint32  rx12mbps;    /**< packets rx at 12Mbps */
3693     uint32  rx18mbps;    /**< packets rx at 18Mbps */
3694     uint32  rx24mbps;    /**< packets rx at 24Mbps */
3695     uint32  rx36mbps;    /**< packets rx at 36Mbps */
3696     uint32  rx48mbps;    /**< packets rx at 48Mbps */
3697     uint32  rx54mbps;    /**< packets rx at 54Mbps */
3698     uint32  rx108mbps;    /**< packets rx at 108mbps */
3699     uint32  rx162mbps;    /**< packets rx at 162mbps */
3700     uint32  rx216mbps;    /**< packets rx at 216 mbps */
3701     uint32  rx270mbps;    /**< packets rx at 270 mbps */
3702     uint32  rx324mbps;    /**< packets rx at 324 mbps */
3703     uint32  rx378mbps;    /**< packets rx at 378 mbps */
3704     uint32  rx432mbps;    /**< packets rx at 432 mbps */
3705     uint32  rx486mbps;    /**< packets rx at 486 mbps */
3706     uint32  rx540mbps;    /**< packets rx at 540 mbps */
3707 
3708     /* phy stats */
3709     uint32 rxbadplcp;
3710     uint32 rxcrsglitch;
3711     uint32 bphy_rxcrsglitch;
3712     uint32 bphy_badplcp;
3713 } wl_delta_stats_t;
3714 
3715 /* Partial statistics counter report */
3716 #define WL_CNT_CTL_MGT_FRAMES    0
3717 
3718 typedef struct {
3719     uint16    type;
3720     uint16    len;
3721 
3722     /* detailed control/management frames */
3723     uint32    txnull;
3724     uint32    rxnull;
3725     uint32    txqosnull;
3726     uint32    rxqosnull;
3727     uint32    txassocreq;
3728     uint32    rxassocreq;
3729     uint32    txreassocreq;
3730     uint32    rxreassocreq;
3731     uint32    txdisassoc;
3732     uint32    rxdisassoc;
3733     uint32    txassocrsp;
3734     uint32    rxassocrsp;
3735     uint32    txreassocrsp;
3736     uint32    rxreassocrsp;
3737     uint32    txauth;
3738     uint32    rxauth;
3739     uint32    txdeauth;
3740     uint32    rxdeauth;
3741     uint32    txprobereq;
3742     uint32    rxprobereq;
3743     uint32    txprobersp;
3744     uint32    rxprobersp;
3745     uint32    txaction;
3746     uint32    rxaction;
3747     uint32    txrts;
3748     uint32    rxrts;
3749     uint32    txcts;
3750     uint32    rxcts;
3751     uint32    txack;
3752     uint32    rxack;
3753     uint32    txbar;
3754     uint32    rxbar;
3755     uint32    txback;
3756     uint32    rxback;
3757     uint32    txpspoll;
3758     uint32    rxpspoll;
3759 } wl_ctl_mgt_cnt_t;
3760 
3761 typedef struct {
3762     uint32 packets;
3763     uint32 bytes;
3764 } wl_traffic_stats_t;
3765 
3766 typedef struct {
3767     uint16    version;    /**< see definition of WL_WME_CNT_VERSION */
3768     uint16    length;        /**< length of entire structure */
3769 
3770     wl_traffic_stats_t tx[AC_COUNT];    /**< Packets transmitted */
3771     wl_traffic_stats_t tx_failed[AC_COUNT];    /**< Packets dropped or failed to transmit */
3772     wl_traffic_stats_t rx[AC_COUNT];    /**< Packets received */
3773     wl_traffic_stats_t rx_failed[AC_COUNT];    /**< Packets failed to receive */
3774 
3775     wl_traffic_stats_t forward[AC_COUNT];    /**< Packets forwarded by AP */
3776 
3777     wl_traffic_stats_t tx_expired[AC_COUNT]; /**< packets dropped due to lifetime expiry */
3778 } wl_wme_cnt_t;
3779 
3780 struct wl_msglevel2 {
3781     uint32 low;
3782     uint32 high;
3783 };
3784 
3785 #define WL_ICMP_IPV6_CFG_VERSION         1
3786 #define WL_ICMP_IPV6_CLEAR_ALL           (1 << 0)
3787 
3788 typedef struct wl_icmp_ipv6_cfg {
3789     uint16 version;
3790     uint16 length;
3791     uint16 fixed_length;
3792     uint16 flags;
3793     uint32 num_ipv6;
3794     /* num_ipv6 to follow */
3795     struct ipv6_addr host_ipv6[];
3796 } wl_icmp_ipv6_cfg_t;
3797 
3798 #define WL_ICMP_CFG_IPV6_FIXED_LEN      OFFSETOF(wl_icmp_ipv6_cfg_t, host_ipv6)
3799 #define WL_ICMP_CFG_IPV6_LEN(count)    (WL_ICMP_CFG_IPV6_FIXED_LEN + \
3800                     ((count) * sizeof(struct ipv6_addr)))
3801 
3802 typedef struct wl_mkeep_alive_pkt {
3803     uint16    version; /* Version for mkeep_alive */
3804     uint16    length; /* length of fixed parameters in the structure */
3805     uint32    period_msec; /* high bit on means immediate send */
3806     uint16    len_bytes;
3807     uint8    keep_alive_id; /* 0 - 3 for N = 4 */
3808     uint8    data[1];
3809 } wl_mkeep_alive_pkt_t;
3810 
3811 #define WL_MKEEP_ALIVE_VERSION        1
3812 #define WL_MKEEP_ALIVE_FIXED_LEN    OFFSETOF(wl_mkeep_alive_pkt_t, data)
3813 #define WL_MKEEP_ALIVE_PRECISION    500
3814 #define WL_MKEEP_ALIVE_PERIOD_MASK  0x7FFFFFFF
3815 #define WL_MKEEP_ALIVE_IMMEDIATE    0x80000000
3816 
3817 /** TCP Keep-Alive conn struct */
3818 typedef struct wl_mtcpkeep_alive_conn_pkt {
3819     struct ether_addr saddr;        /**< src mac address */
3820     struct ether_addr daddr;        /**< dst mac address */
3821     struct ipv4_addr sipaddr;        /**< source IP addr */
3822     struct ipv4_addr dipaddr;        /**< dest IP addr */
3823     uint16 sport;                /**< src port */
3824     uint16 dport;                /**< dest port */
3825     uint32 seq;                /**< seq number */
3826     uint32 ack;                /**< ACK number */
3827     uint16 tcpwin;                /**< TCP window */
3828     uint16 PAD;
3829 } wl_mtcpkeep_alive_conn_pkt_t;
3830 
3831 /** TCP Keep-Alive interval struct */
3832 typedef struct wl_mtcpkeep_alive_timers_pkt {
3833     uint16 interval;        /**< interval timer */
3834     uint16 retry_interval;        /**< retry_interval timer */
3835     uint16 retry_count;        /**< retry_count */
3836 } wl_mtcpkeep_alive_timers_pkt_t;
3837 
3838 typedef struct wake_info {
3839     uint32 wake_reason;
3840     uint32 wake_info_len;        /**< size of packet */
3841     uint8  packet[];
3842 } wake_info_t;
3843 
3844 typedef struct wake_pkt {
3845     uint32 wake_pkt_len;        /**< size of packet */
3846     uint8  packet[];
3847 } wake_pkt_t;
3848 
3849 
3850 #define WL_MTCPKEEP_ALIVE_VERSION        1
3851 
3852 /* #ifdef WLBA */
3853 
3854 #define WLC_BA_CNT_VERSION  1   /**< current version of wlc_ba_cnt_t */
3855 
3856 /** block ack related stats */
3857 typedef struct wlc_ba_cnt {
3858     uint16  version;    /**< WLC_BA_CNT_VERSION */
3859     uint16  length;     /**< length of entire structure */
3860 
3861     /* transmit stat counters */
3862     uint32 txpdu;       /**< pdus sent */
3863     uint32 txsdu;       /**< sdus sent */
3864     uint32 txfc;        /**< tx side flow controlled packets */
3865     uint32 txfci;       /**< tx side flow control initiated */
3866     uint32 txretrans;   /**< retransmitted pdus */
3867     uint32 txbatimer;   /**< ba resend due to timer */
3868     uint32 txdrop;      /**< dropped packets */
3869     uint32 txaddbareq;  /**< addba req sent */
3870     uint32 txaddbaresp; /**< addba resp sent */
3871     uint32 txdelba;     /**< delba sent */
3872     uint32 txba;        /**< ba sent */
3873     uint32 txbar;       /**< bar sent */
3874     uint32 txpad[4];    /**< future */
3875 
3876     /* receive side counters */
3877     uint32 rxpdu;       /**< pdus recd */
3878     uint32 rxqed;       /**< pdus buffered before sending up */
3879     uint32 rxdup;       /**< duplicate pdus */
3880     uint32 rxnobuf;     /**< pdus discarded due to no buf */
3881     uint32 rxaddbareq;  /**< addba req recd */
3882     uint32 rxaddbaresp; /**< addba resp recd */
3883     uint32 rxdelba;     /**< delba recd */
3884     uint32 rxba;        /**< ba recd */
3885     uint32 rxbar;       /**< bar recd */
3886     uint32 rxinvba;     /**< invalid ba recd */
3887     uint32 rxbaholes;   /**< ba recd with holes */
3888     uint32 rxunexp;     /**< unexpected packets */
3889     uint32 rxpad[4];    /**< future */
3890 } wlc_ba_cnt_t;
3891 /* #endif  WLBA */
3892 
3893 /** structure for per-tid ampdu control */
3894 struct ampdu_tid_control {
3895     uint8 tid;            /* tid */
3896     uint8 enable;            /* enable/disable */
3897 };
3898 
3899 /** struct for ampdu tx/rx aggregation control */
3900 struct ampdu_aggr {
3901     int8 aggr_override;    /**< aggr overrided by dongle. Not to be set by host. */
3902     uint16 conf_TID_bmap;    /**< bitmap of TIDs to configure */
3903     uint16 enab_TID_bmap;    /**< enable/disable per TID */
3904 };
3905 
3906 /** structure for identifying ea/tid for sending addba/delba */
3907 struct ampdu_ea_tid {
3908     struct ether_addr ea;        /**< Station address */
3909     uint8 tid;            /**< tid */
3910     uint8 initiator;    /**< 0 is recipient, 1 is originator */
3911 };
3912 
3913 /** structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
3914 struct ampdu_retry_tid {
3915     uint8 tid;    /**< tid */
3916     uint8 retry;    /**< retry value */
3917 };
3918 
3919 #define BDD_FNAME_LEN       32  /**< Max length of friendly name */
3920 typedef struct bdd_fname {
3921     uint8 len;          /**< length of friendly name */
3922     uchar name[BDD_FNAME_LEN];  /**< friendly name */
3923 } bdd_fname_t;
3924 
3925 /* structure for addts arguments */
3926 /** For ioctls that take a list of TSPEC */
3927 struct tslist {
3928     int32 count;            /**< number of tspecs */
3929     struct tsinfo_arg tsinfo[];    /**< variable length array of tsinfo */
3930 };
3931 
3932 /* WLTDLS */
3933 /**structure for tdls iovars */
3934 typedef struct tdls_iovar {
3935     struct ether_addr ea;        /**< Station address */
3936     uint8 mode;            /**< mode: depends on iovar */
3937     uint8 PAD;
3938     chanspec_t chanspec;
3939     uint16 PAD;
3940     uint32 pad;            /**< future */
3941 } tdls_iovar_t;
3942 
3943 #define TDLS_WFD_IE_SIZE        512
3944 /**structure for tdls wfd ie */
3945 typedef struct tdls_wfd_ie_iovar {
3946     struct ether_addr ea;        /**< Station address */
3947     uint8 mode;
3948     uint8 PAD;
3949     uint16 length;
3950     uint8 data[TDLS_WFD_IE_SIZE];
3951 } tdls_wfd_ie_iovar_t;
3952 /* #endif WLTDLS */
3953 
3954 /** structure for addts/delts arguments */
3955 typedef struct tspec_arg {
3956     uint16 version;            /**< see definition of TSPEC_ARG_VERSION */
3957     uint16 length;            /**< length of entire structure */
3958     uint32 flag;            /**< bit field */
3959     /* TSPEC Arguments */
3960     struct tsinfo_arg tsinfo;    /**< TS Info bit field */
3961     uint8  PAD;
3962     uint16 nom_msdu_size;        /**< (Nominal or fixed) MSDU Size (bytes) */
3963     uint16 max_msdu_size;        /**< Maximum MSDU Size (bytes) */
3964     uint32 min_srv_interval;        /**< Minimum Service Interval (us) */
3965     uint32 max_srv_interval;        /**< Maximum Service Interval (us) */
3966     uint32 inactivity_interval;    /**< Inactivity Interval (us) */
3967     uint32 suspension_interval;    /**< Suspension Interval (us) */
3968     uint32 srv_start_time;        /**< Service Start Time (us) */
3969     uint32 min_data_rate;        /**< Minimum Data Rate (bps) */
3970     uint32 mean_data_rate;        /**< Mean Data Rate (bps) */
3971     uint32 peak_data_rate;        /**< Peak Data Rate (bps) */
3972     uint32 max_burst_size;        /**< Maximum Burst Size (bytes) */
3973     uint32 delay_bound;        /**< Delay Bound (us) */
3974     uint32 min_phy_rate;        /**< Minimum PHY Rate (bps) */
3975     uint16 surplus_bw;        /**< Surplus Bandwidth Allowance (range 1.0 to 8.0) */
3976     uint16 medium_time;        /**< Medium Time (32 us/s periods) */
3977     uint8 dialog_token;        /**< dialog token */
3978     uint8  PAD[3];
3979 } tspec_arg_t;
3980 
3981 /** tspec arg for desired station */
3982 typedef    struct tspec_per_sta_arg {
3983     struct ether_addr ea;
3984     uint8  PAD[2];
3985     struct tspec_arg ts;
3986 } tspec_per_sta_arg_t;
3987 
3988 /** structure for max bandwidth for each access category */
3989 typedef    struct wme_max_bandwidth {
3990     uint32    ac[AC_COUNT];    /**< max bandwidth for each access category */
3991 } wme_max_bandwidth_t;
3992 
3993 #define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
3994 
3995 /* current version of wl_tspec_arg_t struct */
3996 #define    TSPEC_ARG_VERSION        2    /**< current version of wl_tspec_arg_t struct */
3997 #define TSPEC_ARG_LENGTH        55    /**< argument length from tsinfo to medium_time */
3998 #define TSPEC_DEFAULT_DIALOG_TOKEN    42    /**< default dialog token */
3999 #define TSPEC_DEFAULT_SBW_FACTOR    0x3000    /**< default surplus bw */
4000 
4001 
4002 #define WL_WOWL_KEEPALIVE_MAX_PACKET_SIZE  80
4003 #define WLC_WOWL_MAX_KEEPALIVE    2
4004 
4005 /** Packet lifetime configuration per ac */
4006 typedef struct wl_lifetime {
4007     uint32 ac;            /**< access class */
4008     uint32 lifetime;    /**< Packet lifetime value in ms */
4009 } wl_lifetime_t;
4010 
4011 /** Management time configuration */
4012 typedef struct wl_lifetime_mg {
4013     uint32 mgmt_bitmap;    /**< Mgmt subtype */
4014     uint32 lifetime;    /**< Packet lifetime value in us */
4015 } wl_lifetime_mg_t;
4016 
4017 /* MAC Sample Capture related */
4018 #define    WL_MACCAPTR_DEFSTART_PTR    0xA00
4019 #define    WL_MACCAPTR_DEFSTOP_PTR        0xA3F
4020 #define    WL_MACCAPTR_DEFSZ        0x3F
4021 
4022 #define WL_MACCAPTR_DEF_MASK        0xFFFFFFFF
4023 
4024 typedef enum {
4025     WL_MACCAPT_TRIG        = 0,
4026     WL_MACCAPT_STORE    = 1,
4027     WL_MACCAPT_TRANS    = 2,
4028     WL_MACCAPT_MATCH    = 3
4029 } maccaptr_optn;
4030 
4031 typedef enum {
4032     WL_MACCAPT_STRT    = 1,
4033     WL_MACCAPT_STOP    = 2,
4034     WL_MACCAPT_RST    = 3
4035 } maccaptr_cmd_t;
4036 
4037 /* MAC Sample Capture Set-up Paramters */
4038 typedef struct wl_maccapture_params {
4039     uint8    gpio_sel;
4040     uint8    la_mode;    /* TRUE: GPIO Out Enabled */
4041     uint8     PAD[2];
4042     uint32    start_ptr;    /* Start address to store */
4043     uint32    stop_ptr;    /* Stop address to store */
4044     uint8    optn_bmp;    /* Options */
4045     uint8     PAD[3];
4046     uint32    tr_mask;    /* Trigger Mask */
4047     uint32    tr_val;        /* Trigger Value */
4048     uint32    s_mask;        /* Store Mode Mask */
4049     uint32    x_mask;        /* Trans. Mode Mask */
4050     uint32    m_mask;        /* Match Mode Mask */
4051     uint32    m_val;        /* Match Value */
4052     maccaptr_cmd_t cmd;    /* Start / Stop */
4053 } wl_maccapture_params_t;
4054 
4055 /** Channel Switch Announcement param */
4056 typedef struct wl_chan_switch {
4057     uint8 mode;        /**< value 0 or 1 */
4058     uint8 count;        /**< count # of beacons before switching */
4059     chanspec_t chspec;    /**< chanspec */
4060     uint8 reg;        /**< regulatory class */
4061     uint8 frame_type;        /**< csa frame type, unicast or broadcast */
4062 } wl_chan_switch_t;
4063 
4064 enum {
4065     PFN_LIST_ORDER,
4066     PFN_RSSI
4067 };
4068 
4069 enum {
4070     DISABLE,
4071     ENABLE
4072 };
4073 
4074 enum {
4075     OFF_ADAPT,
4076     SMART_ADAPT,
4077     STRICT_ADAPT,
4078     SLOW_ADAPT
4079 };
4080 
4081 #define SORT_CRITERIA_BIT        0
4082 #define AUTO_NET_SWITCH_BIT        1
4083 #define ENABLE_BKGRD_SCAN_BIT        2
4084 #define IMMEDIATE_SCAN_BIT        3
4085 #define    AUTO_CONNECT_BIT        4
4086 #define    ENABLE_BD_SCAN_BIT        5
4087 #define ENABLE_ADAPTSCAN_BIT        6
4088 #define IMMEDIATE_EVENT_BIT        8
4089 #define SUPPRESS_SSID_BIT        9
4090 #define ENABLE_NET_OFFLOAD_BIT        10
4091 /** report found/lost events for SSID and BSSID networks seperately */
4092 #define REPORT_SEPERATELY_BIT        11
4093 
4094 #define SORT_CRITERIA_MASK    0x0001
4095 #define AUTO_NET_SWITCH_MASK    0x0002
4096 #define ENABLE_BKGRD_SCAN_MASK    0x0004
4097 #define IMMEDIATE_SCAN_MASK    0x0008
4098 #define AUTO_CONNECT_MASK    0x0010
4099 
4100 #define ENABLE_BD_SCAN_MASK    0x0020
4101 #define ENABLE_ADAPTSCAN_MASK    0x00c0
4102 #define IMMEDIATE_EVENT_MASK    0x0100
4103 #define SUPPRESS_SSID_MASK    0x0200
4104 #define ENABLE_NET_OFFLOAD_MASK    0x0400
4105 /** report found/lost events for SSID and BSSID networks seperately */
4106 #define REPORT_SEPERATELY_MASK    0x0800
4107 
4108 #define PFN_VERSION            2
4109 
4110 #define PFN_COMPLETE            1
4111 #define PFN_INCOMPLETE            0
4112 
4113 #define DEFAULT_BESTN            2
4114 #define DEFAULT_MSCAN            0
4115 #define DEFAULT_REPEAT            10
4116 #define DEFAULT_EXP            2
4117 
4118 #define PFN_PARTIAL_SCAN_BIT        0
4119 #define PFN_PARTIAL_SCAN_MASK        1
4120 
4121 #define PFN_SWC_RSSI_WINDOW_MAX   8
4122 #define PFN_SWC_MAX_NUM_APS       16
4123 #define PFN_HOTLIST_MAX_NUM_APS   64
4124 
4125 #define MAX_EPNO_HIDDEN_SSID    8
4126 #define MAX_WHITELIST_SSID      2
4127 
4128 /* Version 1 and 2 for various scan results structures defined below */
4129 #define PFN_SCANRESULTS_VERSION_V1    1
4130 #define PFN_SCANRESULTS_VERSION_V2    2
4131 
4132 /** PFN network info structure */
4133 typedef struct wl_pfn_subnet_info_v1 {
4134     struct ether_addr BSSID;
4135     uint8    channel; /**< channel number only */
4136     uint8    SSID_len;
4137     uint8    SSID[32];
4138 } wl_pfn_subnet_info_v1_t;
4139 
4140 typedef struct wl_pfn_subnet_info_v2 {
4141     struct ether_addr BSSID;
4142     uint8   channel; /**< channel number only */
4143     uint8   SSID_len;
4144     union {
4145         uint8   SSID[32];
4146         uint16 index;
4147     } u;
4148 } wl_pfn_subnet_info_v2_t;
4149 
4150 typedef struct wl_pfn_net_info_v1 {
4151     wl_pfn_subnet_info_v1_t pfnsubnet;
4152     int16    RSSI; /**< receive signal strength (in dBm) */
4153     uint16    timestamp; /**< age in seconds */
4154 } wl_pfn_net_info_v1_t;
4155 
4156 typedef struct wl_pfn_net_info_v2 {
4157     wl_pfn_subnet_info_v2_t pfnsubnet;
4158     int16   RSSI; /**< receive signal strength (in dBm) */
4159     uint16  timestamp; /**< age in seconds */
4160 } wl_pfn_net_info_v2_t;
4161 
4162 /* Version 1 and 2 for various lbest scan results structures below */
4163 #define PFN_LBEST_SCAN_RESULT_VERSION_V1 1
4164 #define PFN_LBEST_SCAN_RESULT_VERSION_V2 2
4165 
4166 #define MAX_CHBKT_PER_RESULT        4
4167 
4168 typedef struct wl_pfn_lnet_info_v1 {
4169     wl_pfn_subnet_info_v1_t pfnsubnet; /**< BSSID + channel + SSID len + SSID */
4170     uint16    flags; /**< partial scan, etc */
4171     int16    RSSI; /**< receive signal strength (in dBm) */
4172     uint32    timestamp; /**< age in miliseconds */
4173     uint16    rtt0; /**< estimated distance to this AP in centimeters */
4174     uint16    rtt1; /**< standard deviation of the distance to this AP in centimeters */
4175 } wl_pfn_lnet_info_v1_t;
4176 
4177 typedef struct wl_pfn_lnet_info_v2 {
4178     wl_pfn_subnet_info_v2_t pfnsubnet; /**< BSSID + channel + SSID len + SSID */
4179     uint16  flags; /**< partial scan, etc */
4180     int16   RSSI; /**< receive signal strength (in dBm) */
4181     uint32  timestamp; /**< age in miliseconds */
4182     uint16  rtt0; /**< estimated distance to this AP in centimeters */
4183     uint16  rtt1; /**< standard deviation of the distance to this AP in centimeters */
4184 } wl_pfn_lnet_info_v2_t;
4185 
4186 typedef struct wl_pfn_lscanresults_v1 {
4187     uint32 version;
4188     uint32 status;
4189     uint32 count;
4190     wl_pfn_lnet_info_v1_t netinfo[1];
4191 } wl_pfn_lscanresults_v1_t;
4192 
4193 typedef struct wl_pfn_lscanresults_v2 {
4194     uint32 version;
4195     uint16 status;
4196     uint16 count;
4197     uint32 scan_ch_buckets[MAX_CHBKT_PER_RESULT];
4198     wl_pfn_lnet_info_v2_t netinfo[1];
4199 } wl_pfn_lscanresults_v2_t;
4200 
4201 /**this is used to report on 1-* pfn scan results */
4202 typedef struct wl_pfn_scanresults_v1 {
4203     uint32 version;
4204     uint32 status;
4205     uint32 count;
4206     wl_pfn_net_info_v1_t netinfo[1];
4207 } wl_pfn_scanresults_v1_t;
4208 
4209 typedef struct wl_pfn_scanresults_v2 {
4210     uint32 version;
4211     uint32 status;
4212     uint32 count;
4213     uint32 scan_ch_bucket;
4214     wl_pfn_net_info_v2_t netinfo[1];
4215 } wl_pfn_scanresults_v2_t;
4216 
4217 typedef struct wl_pfn_significant_net {
4218     uint16 flags;
4219     uint16 channel;
4220     struct ether_addr BSSID;
4221     int8 rssi[PFN_SWC_RSSI_WINDOW_MAX];
4222 } wl_pfn_significant_net_t;
4223 
4224 #define PFN_SWC_SCANRESULT_VERSION     1
4225 
4226 typedef struct wl_pfn_swc_results {
4227     uint32 version;
4228     uint32 pkt_count;   /**< No. of results in current frame */
4229     uint32 total_count; /**< Total expected results */
4230     wl_pfn_significant_net_t list[];
4231 } wl_pfn_swc_results_t;
4232 typedef struct wl_pfn_net_info_bssid {
4233     struct ether_addr BSSID;
4234     uint8 channel;    /**< channel number only */
4235     int8  RSSI;    /**< receive signal strength (in dBm) */
4236     uint16 flags;    /**< (e.g. partial scan, off channel) */
4237     uint16 timestamp; /**< age in seconds */
4238 } wl_pfn_net_info_bssid_t;
4239 
4240 typedef struct wl_pfn_scanhist_bssid {
4241     uint32 version;
4242     uint32 status;
4243     uint32 count;
4244     wl_pfn_net_info_bssid_t netinfo[1];
4245 } wl_pfn_scanhist_bssid_t;
4246 
4247 /* Version 1 and 2 for various single scan result */
4248 #define PFN_SCANRESULT_VERSION_V1    1
4249 #define PFN_SCANRESULT_VERSION_V2    2
4250 
4251 /* used to report exactly one scan result */
4252 /* plus reports detailed scan info in bss_info */
4253 typedef struct wl_pfn_scanresult_v1 {
4254     uint32 version;
4255     uint32 status;
4256     uint32 count;
4257     wl_pfn_net_info_v1_t netinfo;
4258     wl_bss_info_t bss_info;
4259 } wl_pfn_scanresult_v1_t;
4260 
4261 typedef struct wl_pfn_scanresult_v2 {
4262     uint32 version;
4263     uint32 status;
4264     uint32 count;
4265     wl_pfn_net_info_v2_t netinfo;
4266     wl_bss_info_t bss_info;
4267 } wl_pfn_scanresult_v2_t;
4268 
4269 /**PFN data structure */
4270 typedef struct wl_pfn_param {
4271     int32 version;            /**< PNO parameters version */
4272     int32 scan_freq;        /**< Scan frequency */
4273     int32 lost_network_timeout;    /**< Timeout in sec. to declare
4274                                 * discovered network as lost
4275                                 */
4276     int16 flags;            /**< Bit field to control features
4277                             * of PFN such as sort criteria auto
4278                             * enable switch and background scan
4279                             */
4280     int16 rssi_margin;        /**< Margin to avoid jitter for choosing a
4281                             * PFN based on RSSI sort criteria
4282                             */
4283     uint8 bestn; /**< number of best networks in each scan */
4284     uint8 mscan; /**< number of scans recorded */
4285     uint8 repeat; /**< Minimum number of scan intervals
4286                      *before scan frequency changes in adaptive scan
4287                      */
4288     uint8 exp; /**< Exponent of 2 for maximum scan interval */
4289     int32 slow_freq; /**< slow scan period */
4290 } wl_pfn_param_t;
4291 
4292 typedef struct wl_pfn_bssid {
4293     struct ether_addr  macaddr;
4294     /* Bit4: suppress_lost, Bit3: suppress_found */
4295     uint16             flags;
4296 } wl_pfn_bssid_t;
4297 typedef struct wl_pfn_significant_bssid {
4298     struct ether_addr    macaddr;
4299     int8    rssi_low_threshold;
4300     int8    rssi_high_threshold;
4301 } wl_pfn_significant_bssid_t;
4302 #define WL_PFN_SUPPRESSFOUND_MASK    0x08
4303 #define WL_PFN_SUPPRESSLOST_MASK    0x10
4304 #define WL_PFN_SSID_IMPRECISE_MATCH    0x80
4305 #define WL_PFN_SSID_SAME_NETWORK    0x10000
4306 #define WL_PFN_SUPPRESS_AGING_MASK    0x20000
4307 #define WL_PFN_FLUSH_ALL_SSIDS        0x40000
4308 
4309 #define WL_PFN_IOVAR_FLAG_MASK        0xFFFF00FF
4310 #define WL_PFN_RSSI_MASK        0xff00
4311 #define WL_PFN_RSSI_SHIFT        8
4312 
4313 typedef struct wl_pfn_cfg {
4314     uint32    reporttype;
4315     int32    channel_num;
4316     uint16    channel_list[WL_NUMCHANNELS];
4317     uint32    flags;
4318 } wl_pfn_cfg_t;
4319 
4320 #define WL_PFN_SSID_CFG_VERSION        1
4321 #define WL_PFN_SSID_CFG_CLEAR        0x1
4322 
4323 typedef struct wl_pfn_ssid_params {
4324     int8 min5G_rssi;           /* minimum 5GHz RSSI for a BSSID to be considered      */
4325     int8 min2G_rssi;           /* minimum 2.4GHz RSSI for a BSSID to be considered   */
4326     int16 init_score_max;     /* The maximum score that a network can have before bonuses  */
4327 
4328     int16 cur_bssid_bonus;    /* Add to current bssid                                      */
4329     int16 same_ssid_bonus;    /* score bonus for all networks with the same network flag   */
4330     int16 secure_bonus;       /* score bonus for networks that are not open          */
4331     int16 band_5g_bonus;
4332 } wl_pfn_ssid_params_t;
4333 
4334 typedef struct wl_ssid_ext_params {
4335     int8 min5G_rssi;    /* minimum 5GHz RSSI for a BSSID to be considered      */
4336     int8 min2G_rssi;    /* minimum 2.4GHz RSSI for a BSSID to be considered   */
4337     int16 init_score_max;    /* The maximum score that a network can have before bonuses  */
4338     int16 cur_bssid_bonus;    /* Add to current bssid                                      */
4339     int16 same_ssid_bonus;    /* score bonus for all networks with the same network flag   */
4340     int16 secure_bonus;    /* score bonus for networks that are not open                */
4341     int16 band_5g_bonus;
4342 } wl_ssid_ext_params_t;
4343 
4344 typedef struct wl_pfn_ssid_cfg {
4345     uint16 version;
4346     uint16 flags;
4347     wl_ssid_ext_params_t params;
4348 } wl_pfn_ssid_cfg_t;
4349 
4350 #define CH_BUCKET_REPORT_NONE                   0
4351 #define CH_BUCKET_REPORT_SCAN_COMPLETE_ONLY     1
4352 #define CH_BUCKET_REPORT_FULL_RESULT            2
4353 #define CH_BUCKET_REPORT_SCAN_COMPLETE    (CH_BUCKET_REPORT_SCAN_COMPLETE_ONLY | \
4354                                 CH_BUCKET_REPORT_FULL_RESULT)
4355 #define CH_BUCKET_REPORT_REGULAR            0
4356 #define CH_BUCKET_GSCAN                     4
4357 
4358 typedef struct wl_pfn_gscan_ch_bucket_cfg {
4359     uint8 bucket_end_index;
4360     uint8 bucket_freq_multiple;
4361     uint8 flag;
4362     uint8 reserved;
4363     uint16 repeat;
4364     uint16 max_freq_multiple;
4365 } wl_pfn_gscan_ch_bucket_cfg_t;
4366 
4367 typedef struct wl_pfn_capabilities {
4368     uint16 max_mscan;
4369     uint16 max_bestn;
4370     uint16 max_swc_bssid;
4371     uint16 max_hotlist_bssid;
4372 } wl_pfn_capabilities_t;
4373 
4374 #define GSCAN_SEND_ALL_RESULTS_MASK          (1 << 0)
4375 #define GSCAN_ALL_BUCKETS_IN_FIRST_SCAN_MASK (1 << 3)
4376 #define GSCAN_CFG_FLAGS_ONLY_MASK            (1 << 7)
4377 #define WL_GSCAN_CFG_VERSION                     1
4378 typedef struct wl_pfn_gscan_cfg {
4379     uint16 version;
4380     /**
4381      * BIT0 1 = send probes/beacons to HOST
4382      * BIT1 Reserved
4383      * BIT2 Reserved
4384      * Add any future flags here
4385      * BIT7 1 = no other useful cfg sent
4386      */
4387     uint8  flags;
4388     /** Buffer filled threshold in % to generate an event */
4389     uint8   buffer_threshold;
4390     /**
4391      * No. of BSSIDs with "change" to generate an evt
4392      * change - crosses rssi threshold/lost
4393      */
4394     uint8   swc_nbssid_threshold;
4395     /* Max=8 (for now) Size of rssi cache buffer */
4396     uint8  swc_rssi_window_size;
4397     uint8  count_of_channel_buckets;
4398     uint8  retry_threshold;
4399     uint16  lost_ap_window;
4400     wl_pfn_gscan_ch_bucket_cfg_t channel_bucket[1];
4401 } wl_pfn_gscan_cfg_t;
4402 
4403 #define WL_PFN_REPORT_ALLNET    0
4404 #define WL_PFN_REPORT_SSIDNET   1
4405 #define WL_PFN_REPORT_BSSIDNET  2
4406 
4407 #define WL_PFN_CFG_FLAGS_PROHIBITED    0x00000001    /* Accept and use prohibited channels */
4408 #define WL_PFN_CFG_FLAGS_RESERVED    0xfffffffe    /**< Remaining reserved for future use */
4409 
4410 typedef struct wl_pfn {
4411     wlc_ssid_t        ssid;            /**< ssid name and its length */
4412     int32            flags;            /**< bit2: hidden */
4413     int32            infra;            /**< BSS Vs IBSS */
4414     int32            auth;            /**< Open Vs Closed */
4415     int32            wpa_auth;        /**< WPA type */
4416     int32            wsec;            /**< wsec value */
4417 } wl_pfn_t;
4418 
4419 typedef struct wl_pfn_list {
4420     uint32        version;
4421     uint32        enabled;
4422     uint32        count;
4423     wl_pfn_t    pfn[1];
4424 } wl_pfn_list_t;
4425 
4426 #define PFN_SSID_EXT_VERSION   1
4427 
4428 typedef struct wl_pfn_ext {
4429     uint8 flags;
4430     int8 rssi_thresh; /* RSSI threshold, track only if RSSI > threshold */
4431     uint16 wpa_auth; /* Match the wpa auth type defined in wlioctl_defs.h */
4432     uint8 ssid[DOT11_MAX_SSID_LEN];
4433     uint8 ssid_len;
4434     uint8 pad;
4435 } wl_pfn_ext_t;
4436 typedef struct wl_pfn_ext_list {
4437     uint16 version;
4438     uint16 count;
4439     wl_pfn_ext_t pfn_ext[1];
4440 } wl_pfn_ext_list_t;
4441 
4442 #define WL_PFN_SSID_EXT_FOUND   0x1
4443 #define WL_PFN_SSID_EXT_LOST    0x2
4444 typedef struct wl_pfn_result_ssid {
4445     uint8 flags;
4446     int8 rssi;
4447     /* channel number */
4448     uint16 channel;
4449     /* Assume idx in order of cfg */
4450     uint32 index;
4451 } wl_pfn_result_ssid_crc32_t;
4452 
4453 typedef struct wl_pfn_ssid_ext_result {
4454     uint16 version;
4455     uint16 count;
4456     wl_pfn_result_ssid_crc32_t net[1];
4457 } wl_pfn_ssid_ext_result_t;
4458 
4459 #define PFN_EXT_AUTH_CODE_OPEN   1 /* open */
4460 #define PFN_EXT_AUTH_CODE_PSK   2 /* WPA_PSK or WPA2PSK */
4461 #define PFN_EXT_AUTH_CODE_EAPOL 4 /* any EAPOL  */
4462 
4463 #define WL_PFN_HIDDEN_BIT        2
4464 #define WL_PFN_HIDDEN_MASK        0x4
4465 
4466 #ifndef BESTN_MAX
4467 #define BESTN_MAX            10
4468 #endif
4469 
4470 #ifndef MSCAN_MAX
4471 #define MSCAN_MAX            90
4472 #endif
4473 
4474 /* Dynamic scan configuration for motion profiles */
4475 
4476 #define WL_PFN_MPF_VERSION 1
4477 
4478 /* Valid group IDs, may be expanded in the future */
4479 #define WL_PFN_MPF_GROUP_SSID 0
4480 #define WL_PFN_MPF_GROUP_BSSID 1
4481 #define WL_PFN_MPF_MAX_GROUPS 2
4482 
4483 /* Max number of MPF states supported in this time */
4484 #define WL_PFN_MPF_STATES_MAX 4
4485 
4486 /* Flags for the mpf-specific stuff */
4487 #define WL_PFN_MPF_ADAPT_ON_BIT        0
4488 #define WL_PFN_MPF_ADAPTSCAN_BIT    1
4489 
4490 #define WL_PFN_MPF_ADAPT_ON_MASK    0x0001
4491 #define WL_PFN_MPF_ADAPTSCAN_MASK     0x0006
4492 
4493 /* Per-state timing values */
4494 typedef struct wl_pfn_mpf_state_params {
4495     int32  scan_freq;    /* Scan frequency (secs) */
4496     int32  lost_network_timeout; /* Timeout to declare net lost (secs) */
4497     int16  flags;        /* Space for flags: ADAPT etc */
4498     uint8  exp;        /* Exponent of 2 for max interval for SMART/STRICT_ADAPT */
4499     uint8  repeat;        /* Number of scans before changing adaptation level */
4500     int32  slow_freq;    /* Slow scan period for SLOW_ADAPT */
4501 } wl_pfn_mpf_state_params_t;
4502 
4503 typedef struct wl_pfn_mpf_param {
4504     uint16 version;        /* Structure version */
4505     uint16 groupid;        /* Group ID: 0 (SSID), 1 (BSSID), other: reserved */
4506     wl_pfn_mpf_state_params_t state[WL_PFN_MPF_STATES_MAX];
4507 } wl_pfn_mpf_param_t;
4508 
4509 /* Structure for setting pfn_override iovar */
4510 typedef struct wl_pfn_override_param {
4511     uint16 version;         /* Structure version */
4512     uint16 start_offset;    /* Seconds from now to apply new params */
4513     uint16 duration;        /* Seconds to keep new params applied */
4514     uint16 reserved;
4515     wl_pfn_mpf_state_params_t override;
4516 } wl_pfn_override_param_t;
4517 #define WL_PFN_OVERRIDE_VERSION    1
4518 
4519 /*
4520  * Definitions for base MPF configuration
4521  */
4522 
4523 #define WL_MPF_VERSION 1
4524 #define WL_MPF_MAX_BITS 3
4525 #define WL_MPF_MAX_STATES (1 << WL_MPF_MAX_BITS)
4526 
4527 #define WL_MPF_STATE_NAME_MAX 12
4528 
4529 typedef struct wl_mpf_val {
4530     uint16 val;        /* Value of GPIO bits */
4531     uint16 state;        /* State identifier */
4532     char name[WL_MPF_STATE_NAME_MAX]; /* Optional name */
4533 } wl_mpf_val_t;
4534 
4535 typedef struct wl_mpf_map {
4536     uint16 version;
4537     uint16 type;
4538     uint16 mask;        /* Which GPIO bits to use */
4539     uint8  count;        /* Count of state/value mappings */
4540     uint8  PAD;
4541     wl_mpf_val_t vals[WL_MPF_MAX_STATES];
4542 } wl_mpf_map_t;
4543 
4544 #define WL_MPF_STATE_AUTO (0xFFFF) /* (uint16)-1) */
4545 
4546 typedef struct wl_mpf_state {
4547     uint16 version;
4548     uint16 type;
4549     uint16 state;        /* Get/Set */
4550     uint8 force;        /* 0 - auto (HW) state, 1 - forced state */
4551     char name[WL_MPF_STATE_NAME_MAX]; /* Get/Set: Optional/actual name */
4552     uint8  PAD;
4553 } wl_mpf_state_t;
4554 /*
4555  * WLFCTS definition
4556  */
4557 typedef struct wl_txstatus_additional_info {
4558     uint32 rspec;
4559     uint32 enq_ts;
4560     uint32 last_ts;
4561     uint32 entry_ts;
4562     uint16 seq;
4563     uint8  rts_cnt;
4564     uint8  tx_cnt;
4565 } wl_txstatus_additional_info_t;
4566 
4567 /** Service discovery */
4568 typedef struct {
4569     uint8    transaction_id;    /**< Transaction id */
4570     uint8    protocol;    /**< Service protocol type */
4571     uint16    query_len;    /**< Length of query */
4572     uint16    response_len;    /**< Length of response */
4573     uint8    qrbuf[];
4574 } wl_p2po_qr_t;
4575 
4576 typedef struct {
4577     uint16            period;            /**< extended listen period */
4578     uint16            interval;        /**< extended listen interval */
4579     uint16                  count;                  /* count to repeat */
4580     uint16                  pad;                    /* pad for 32bit align */
4581 } wl_p2po_listen_t;
4582 
4583 /** GAS state machine tunable parameters.  Structure field values of 0 means use the default. */
4584 typedef struct wl_gas_config {
4585     uint16 max_retransmit;        /**< Max # of firmware/driver retransmits on no Ack
4586                      * from peer (on top of the ucode retries).
4587                      */
4588     uint16 response_timeout;    /**< Max time to wait for a GAS-level response
4589                      * after sending a packet.
4590                      */
4591     uint16 max_comeback_delay;    /**< Max GAS response comeback delay.
4592                      * Exceeding this fails the GAS exchange.
4593                      */
4594     uint16 max_retries;        /**< Max # of GAS state machine retries on failure
4595                      * of a GAS frame exchange.
4596                      */
4597 } wl_gas_config_t;
4598 
4599 /** P2P Find Offload parameters */
4600 typedef struct wl_p2po_find_config {
4601     uint16 version;            /**< Version of this struct */
4602     uint16 length;            /**< sizeof(wl_p2po_find_config_t) */
4603     int32 search_home_time;        /**< P2P search state home time when concurrent
4604                      * connection exists.  -1 for default.
4605                      */
4606     uint8 num_social_channels;
4607             /**< Number of social channels up to WL_P2P_SOCIAL_CHANNELS_MAX.
4608              * 0 means use default social channels.
4609              */
4610     uint8 flags;
4611     uint16 social_channels[1];    /**< Variable length array of social channels */
4612 } wl_p2po_find_config_t;
4613 #define WL_P2PO_FIND_CONFIG_VERSION 2    /**< value for version field */
4614 
4615 /** wl_p2po_find_config_t flags */
4616 #define P2PO_FIND_FLAG_SCAN_ALL_APS 0x01    /**< Whether to scan for all APs in the p2po_find
4617                          * periodic scans of all channels.
4618                          * 0 means scan for only P2P devices.
4619                          * 1 means scan for P2P devices plus non-P2P APs.
4620                          */
4621 
4622 
4623 /** For adding a WFDS service to seek */
4624 typedef struct {
4625     uint32 seek_hdl;        /**< unique id chosen by host */
4626     uint8 addr[6];            /**< Seek service from a specific device with this
4627                      * MAC address, all 1's for any device.
4628                      */
4629     uint8 service_hash[P2P_WFDS_HASH_LEN];
4630     uint8 service_name_len;
4631     uint8 service_name[MAX_WFDS_SEEK_SVC_NAME_LEN];
4632                     /**< Service name to seek, not null terminated */
4633     uint8 service_info_req_len;
4634     uint8 service_info_req[1];    /**< Service info request, not null terminated.
4635                      * Variable length specified by service_info_req_len.
4636                      * Maximum length is MAX_WFDS_SEEK_SVC_INFO_LEN.
4637                      */
4638 } wl_p2po_wfds_seek_add_t;
4639 
4640 /** For deleting a WFDS service to seek */
4641 typedef struct {
4642     uint32 seek_hdl;        /**< delete service specified by id */
4643 } wl_p2po_wfds_seek_del_t;
4644 
4645 
4646 /** For adding a WFDS service to advertise */
4647 #include <packed_section_start.h>
4648 typedef BWL_PRE_PACKED_STRUCT struct {
4649     uint32 advertise_hdl;        /**< unique id chosen by host */
4650     uint8 service_hash[P2P_WFDS_HASH_LEN];
4651     uint32 advertisement_id;
4652     uint16 service_config_method;
4653     uint8 service_name_len;
4654     uint8 service_name[MAX_WFDS_SVC_NAME_LEN];
4655                     /**< Service name , not null terminated */
4656     uint8 service_status;
4657     uint16 service_info_len;
4658     uint8 service_info[1];        /**< Service info, not null terminated.
4659                      * Variable length specified by service_info_len.
4660                      * Maximum length is MAX_WFDS_ADV_SVC_INFO_LEN.
4661                      */
4662 } BWL_POST_PACKED_STRUCT wl_p2po_wfds_advertise_add_t;
4663 #include <packed_section_end.h>
4664 
4665 /** For deleting a WFDS service to advertise */
4666 typedef struct {
4667     uint32 advertise_hdl;    /**< delete service specified by hdl */
4668 } wl_p2po_wfds_advertise_del_t;
4669 
4670 /** P2P Offload discovery mode for the p2po_state iovar */
4671 typedef enum {
4672     WL_P2PO_DISC_STOP,
4673     WL_P2PO_DISC_LISTEN,
4674     WL_P2PO_DISC_DISCOVERY
4675 } disc_mode_t;
4676 
4677 /* ANQP offload */
4678 
4679 #define ANQPO_MAX_QUERY_SIZE        256
4680 typedef struct {
4681     uint16 max_retransmit;        /**< ~0 use default, max retransmit on no ACK from peer */
4682     uint16 response_timeout; /**< ~0 use default, msec to wait for resp after tx packet */
4683     uint16 max_comeback_delay;    /**< ~0 use default, max comeback delay in resp else fail */
4684     uint16 max_retries;        /**< ~0 use default, max retries on failure */
4685     uint16 query_len;        /**< length of ANQP query */
4686     uint8 query_data[1];        /**< ANQP encoded query (max ANQPO_MAX_QUERY_SIZE) */
4687 } wl_anqpo_set_t;
4688 
4689 typedef struct {
4690     uint16 channel;            /**< channel of the peer */
4691     struct ether_addr addr;        /**< addr of the peer */
4692 } wl_anqpo_peer_t;
4693 
4694 #define ANQPO_MAX_PEER_LIST            64
4695 typedef struct {
4696     uint16 count;                /**< number of peers in list */
4697     wl_anqpo_peer_t peer[1];    /**< max ANQPO_MAX_PEER_LIST */
4698 } wl_anqpo_peer_list_t;
4699 
4700 #define ANQPO_MAX_IGNORE_SSID        64
4701 typedef struct {
4702     uint8 is_clear;                /**< set to clear list (not used on GET) */
4703     uint8 PAD;
4704     uint16 count;                /**< number of SSID in list */
4705     wlc_ssid_t ssid[1];            /**< max ANQPO_MAX_IGNORE_SSID */
4706 } wl_anqpo_ignore_ssid_list_t;
4707 
4708 #define ANQPO_MAX_IGNORE_BSSID        64
4709 typedef struct {
4710     uint8 is_clear;                /**< set to clear list (not used on GET) */
4711     uint8 PAD;
4712     uint16 count;                /**< number of addr in list */
4713     struct ether_addr bssid[];    /**< max ANQPO_MAX_IGNORE_BSSID */
4714 } wl_anqpo_ignore_bssid_list_t;
4715 
4716 
4717 struct toe_ol_stats_t {
4718     /** Num of tx packets that don't need to be checksummed */
4719     uint32 tx_summed;
4720 
4721     /* Num of tx packets where checksum is filled by offload engine */
4722     uint32 tx_iph_fill;
4723     uint32 tx_tcp_fill;
4724     uint32 tx_udp_fill;
4725     uint32 tx_icmp_fill;
4726 
4727     /*  Num of rx packets where toe finds out if checksum is good or bad */
4728     uint32 rx_iph_good;
4729     uint32 rx_iph_bad;
4730     uint32 rx_tcp_good;
4731     uint32 rx_tcp_bad;
4732     uint32 rx_udp_good;
4733     uint32 rx_udp_bad;
4734     uint32 rx_icmp_good;
4735     uint32 rx_icmp_bad;
4736 
4737     /* Num of tx packets in which csum error is injected */
4738     uint32 tx_tcp_errinj;
4739     uint32 tx_udp_errinj;
4740     uint32 tx_icmp_errinj;
4741 
4742     /* Num of rx packets in which csum error is injected */
4743     uint32 rx_tcp_errinj;
4744     uint32 rx_udp_errinj;
4745     uint32 rx_icmp_errinj;
4746 };
4747 
4748 /** Arp offload statistic counts */
4749 struct arp_ol_stats_t {
4750     uint32  host_ip_entries; /**< Host IP table addresses (more than one if multihomed) */
4751     uint32  host_ip_overflow;    /**< Host IP table additions skipped due to overflow */
4752 
4753     uint32  arp_table_entries;    /**< ARP table entries */
4754     uint32  arp_table_overflow;    /**< ARP table additions skipped due to overflow */
4755 
4756     uint32  host_request;        /**< ARP requests from host */
4757     uint32  host_reply;        /**< ARP replies from host */
4758     uint32  host_service;        /**< ARP requests from host serviced by ARP Agent */
4759 
4760     uint32  peer_request;        /**< ARP requests received from network */
4761     uint32  peer_request_drop;    /**< ARP requests from network that were dropped */
4762     uint32  peer_reply;        /**< ARP replies received from network */
4763     uint32  peer_reply_drop;    /**< ARP replies from network that were dropped */
4764     uint32  peer_service;        /**< ARP request from host serviced by ARP Agent */
4765 };
4766 
4767 /** NS offload statistic counts */
4768 struct nd_ol_stats_t {
4769     uint32  host_ip_entries;    /**< Host IP table addresses (more than one if multihomed) */
4770     uint32  host_ip_overflow;   /**< Host IP table additions skipped due to overflow */
4771     uint32  peer_request;       /**< NS requests received from network */
4772     uint32  peer_request_drop;  /**< NS requests from network that were dropped */
4773     uint32  peer_reply_drop;    /**< NA replies from network that were dropped */
4774     uint32  peer_service;       /**< NS request from host serviced by firmware */
4775 };
4776 
4777 /*
4778  * Neighbor Discovery Offloading
4779  */
4780 enum {
4781     WL_ND_IPV6_ADDR_TYPE_UNICAST = 0,
4782     WL_ND_IPV6_ADDR_TYPE_ANYCAST
4783 };
4784 
4785 typedef struct wl_nd_host_ip_addr {
4786     struct ipv6_addr ip_addr;    /* host ip address */
4787     uint8 type;            /* type of address */
4788     uint8 pad[3];
4789 } wl_nd_host_ip_addr_t;
4790 
4791 typedef struct wl_nd_host_ip_list {
4792     uint32 count;
4793     wl_nd_host_ip_addr_t host_ip[1];
4794 } wl_nd_host_ip_list_t;
4795 
4796 #define WL_ND_HOSTIP_IOV_VER    1
4797 
4798 enum {
4799     WL_ND_HOSTIP_OP_VER = 0,    /* get version */
4800     WL_ND_HOSTIP_OP_ADD,        /* add address */
4801     WL_ND_HOSTIP_OP_DEL,        /* delete specified address */
4802     WL_ND_HOSTIP_OP_DEL_UC,        /* delete all unicast address */
4803     WL_ND_HOSTIP_OP_DEL_AC,        /* delete all anycast address */
4804     WL_ND_HOSTIP_OP_DEL_ALL,    /* delete all addresses */
4805     WL_ND_HOSTIP_OP_LIST,        /* get list of host ip address */
4806     WL_ND_HOSTIP_OP_MAX
4807 };
4808 
4809 typedef struct wl_nd_hostip {
4810     uint16 version;                /* version of iovar buf */
4811     uint16 op_type;                /* operation type */
4812     uint32 length;                /* length of entire structure */
4813     union {
4814         wl_nd_host_ip_addr_t host_ip;    /* set param for add */
4815         uint16 version;            /* get return for ver */
4816     } u;
4817 } wl_nd_hostip_t;
4818 
4819 #define WL_ND_HOSTIP_FIXED_LEN        OFFSETOF(wl_nd_hostip_t, u)
4820 #define WL_ND_HOSTIP_WITH_ADDR_LEN    (WL_ND_HOSTIP_FIXED_LEN + sizeof(wl_nd_host_ip_addr_t))
4821 
4822 /*
4823  * Keep-alive packet offloading.
4824  */
4825 
4826 /**
4827  * NAT keep-alive packets format: specifies the re-transmission period, the packet
4828  * length, and packet contents.
4829  */
4830 typedef struct wl_keep_alive_pkt {
4831     uint32    period_msec;    /** Retransmission period (0 to disable packet re-transmits) */
4832     uint16    len_bytes;    /* Size of packet to transmit (0 to disable packet re-transmits) */
4833     uint8    data[1];    /** Variable length packet to transmit.  Contents should include
4834                  * entire ethernet packet (enet header, IP header, UDP header,
4835                  * and UDP payload) in network byte order.
4836                  */
4837 } wl_keep_alive_pkt_t;
4838 
4839 #define WL_KEEP_ALIVE_FIXED_LEN        OFFSETOF(wl_keep_alive_pkt_t, data)
4840 
4841 #define MAX_RSSI_COUNT            8
4842 typedef struct rssi_struct {
4843     int8    val[MAX_RSSI_COUNT];    /**< rssi values in AFs */
4844     int16    sum;            /**< total rssi sum */
4845     uint8    cnt;            /**< number rssi samples */
4846     uint8    idx;            /**< next rssi location */
4847 } rssi_struct_t;
4848 
4849 
4850 /*
4851  * ptk_start: iovar to start 4-way handshake for secured ranging
4852 */
4853 
4854 /* ptk negotiation security type - determines negotiation parameters */
4855 typedef enum {
4856     WL_PTK_START_SEC_TYPE_PMK = 1
4857 } wl_ptk_start_sec_type_t;
4858 
4859 /* ptk negotiation role */
4860 typedef enum {
4861     ROLE_NONE    = 0x0,
4862     ROLE_AUTH    = 0x1,
4863     ROLE_SUP    = 0x2,
4864     ROLE_STATIC    = 0x3,
4865     ROLE_INVALID    = 0xff,
4866     WL_PTK_START_ROLE_NONE = ROLE_NONE,
4867     WL_PTK_START_ROLE_AUTH = ROLE_AUTH,
4868     WL_PTK_START_ROLE_SUP = ROLE_SUP,
4869     WL_PTK_START_ROLE_STATIC = ROLE_STATIC,
4870     WL_PTK_START_ROLE_INVALID = ROLE_INVALID
4871 } wl_ptk_start_role_t;
4872 
4873 typedef struct wl_ptk_start_tlv {
4874     uint16 id;
4875     uint16 len;
4876     uint8 data[1];
4877 } wl_ptk_start_tlv_t;
4878 
4879 typedef enum {
4880     WL_PTK_START_TLV_PMK    = 1    /* uint8[] */
4881 } wl_ptk_start_tlv_type;
4882 
4883 typedef enum {
4884     WL_PTK_START_FLAG_NO_DATA_PROT    = 1,    /* data frame protection disabled */
4885     WL_PTK_START_FLAG_GEN_FTM_TPK    = 2    /* Generate FTM Toast/Seq Protection Key */
4886 } wl_ptk_start_flags_t;
4887 
4888 typedef struct wl_ptk_start_iov {
4889     uint16 version;
4890     uint16 len;                /* length of entire iov from version */
4891     wl_ptk_start_flags_t flags;
4892     wl_ptk_start_sec_type_t sec_type;
4893     wl_ptk_start_role_t role;
4894     struct ether_addr peer_addr;
4895     uint16 pad;                /* reserved/32 bit alignment */
4896     wl_ptk_start_tlv_t tlvs[1];
4897 } wl_ptk_start_iov_t;
4898 
4899 /*
4900  * Dongle pattern matching filter.
4901  */
4902 
4903 #define MAX_WAKE_PACKET_CACHE_BYTES 128 /**< Maximum cached wake packet */
4904 
4905 #define MAX_WAKE_PACKET_BYTES        (DOT11_A3_HDR_LEN +                \
4906                      DOT11_QOS_LEN +                \
4907                      sizeof(struct dot11_llc_snap_header) + \
4908                      ETHER_MAX_DATA)
4909 
4910 typedef struct pm_wake_packet {
4911     uint32    status;        /**< Is the wake reason a packet (if all the other field's valid) */
4912     uint32    pattern_id;    /**< Pattern ID that matched */
4913     uint32    original_packet_size;
4914     uint32    saved_packet_size;
4915     uint8    packet[MAX_WAKE_PACKET_CACHE_BYTES];
4916 } pm_wake_packet_t;
4917 
4918 /* Packet filter types. Currently, only pattern matching is supported. */
4919 typedef enum wl_pkt_filter_type {
4920     WL_PKT_FILTER_TYPE_PATTERN_MATCH=0,       /**< Pattern matching filter */
4921     WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH=1, /**< Magic packet match */
4922     WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH=2,  /**< A pattern list (match all to match filter) */
4923     WL_PKT_FILTER_TYPE_ENCRYPTED_PATTERN_MATCH=3, /**< SECURE WOWL magic / net pattern match */
4924     WL_PKT_FILTER_TYPE_APF_MATCH=4, /* Android packet filter match */
4925     WL_PKT_FILTER_TYPE_PATTERN_MATCH_TIMEOUT=5, /* Pattern matching filter with timeout event */
4926     WL_PKT_FILTER_TYPE_IMMEDIATE_PATTERN_MATCH=6, /* Immediately pattern matching filter */
4927     WL_PKT_FILTYER_TYPE_MAX = 7,    /* Pkt filter type MAX */
4928 } wl_pkt_filter_type_t;
4929 
4930 #define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
4931 
4932 /* String mapping for types that may be used by applications or debug */
4933 #define WL_PKT_FILTER_TYPE_NAMES \
4934     { "PATTERN", WL_PKT_FILTER_TYPE_PATTERN_MATCH },    \
4935     { "MAGIC",   WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH },    \
4936     { "PATLIST", WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH },    \
4937     { "SECURE WOWL", WL_PKT_FILTER_TYPE_ENCRYPTED_PATTERN_MATCH },    \
4938     { "APF", WL_PKT_FILTER_TYPE_APF_MATCH }, \
4939     { "PATTERN TIMEOUT", WL_PKT_FILTER_TYPE_PATTERN_MATCH_TIMEOUT }, \
4940     { "IMMEDIATE", WL_PKT_FILTER_TYPE_IMMEDIATE_PATTERN_MATCH }
4941 
4942 /** Secured WOWL packet was encrypted, need decrypted before check filter match */
4943 typedef struct wl_pkt_decrypter {
4944     uint8* (*dec_cb)(void* dec_ctx, const void *sdu, int sending);
4945     void*  dec_ctx;
4946 } wl_pkt_decrypter_t;
4947 
4948 /**
4949  * Pattern matching filter. Specifies an offset within received packets to
4950  * start matching, the pattern to match, the size of the pattern, and a bitmask
4951  * that indicates which bits within the pattern should be matched.
4952  */
4953 typedef struct wl_pkt_filter_pattern {
4954     uint32    offset;        /**< Offset within received packet to start pattern matching.
4955                  * Offset '0' is the first byte of the ethernet header.
4956                  */
4957     uint32    size_bytes;    /**< Size of the pattern.  Bitmask must be the same size. */
4958     uint8   mask_and_pattern[]; /**< Variable length mask and pattern data.  mask starts
4959                       * at offset 0.  Pattern immediately follows mask. for
4960                       * secured pattern, put the descrypter pointer to the
4961                       * beginning, mask and pattern postponed correspondingly
4962                       */
4963 } wl_pkt_filter_pattern_t;
4964 
4965 /** A pattern list is a numerically specified list of modified pattern structures. */
4966 typedef struct wl_pkt_filter_pattern_listel {
4967     uint16 rel_offs;    /**< Offset to begin match (relative to 'base' below) */
4968     uint16 base_offs;    /**< Base for offset (defined below) */
4969     uint16 size_bytes;    /**< Size of mask/pattern */
4970     uint16 match_flags;    /**< Addition flags controlling the match */
4971     uint8  mask_and_data[1]; /**< Variable length mask followed by data, each size_bytes */
4972 } wl_pkt_filter_pattern_listel_t;
4973 
4974 typedef struct wl_pkt_filter_pattern_list {
4975     uint8 list_cnt;        /**< Number of elements in the list */
4976     uint8 PAD1[1];        /**< Reserved (possible version: reserved) */
4977     uint16 totsize;        /**< Total size of this pattern list (includes this struct) */
4978     wl_pkt_filter_pattern_listel_t patterns[]; /**< Variable number of list elements */
4979 } wl_pkt_filter_pattern_list_t;
4980 
4981 typedef struct wl_apf_program {
4982     uint16 version;
4983     uint16 instr_len;    /* number of instruction blocks */
4984     uint32 inst_ts;        /* program installation timestamp */
4985     uint8 instrs[];    /* variable length instructions */
4986 } wl_apf_program_t;
4987 
4988 typedef struct wl_pkt_filter_pattern_timeout {
4989     uint32    offset;    /* Offset within received packet to start pattern matching.
4990                      * Offset '0' is the first byte of the ethernet header.
4991                      */
4992     uint32    size_bytes;    /* Size of the pattern. Bitmask must be the same size. */
4993     uint32    timeout;    /* Timeout(seconds) */
4994     uint8    mask_and_pattern[1]; /* Variable length mask and pattern data.
4995                                  * mask starts at offset 0. Pattern
4996                                  * immediately follows mask.
4997                                 */
4998 } wl_pkt_filter_pattern_timeout_t;
4999 
5000 /** IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
5001 typedef struct wl_pkt_filter {
5002     uint32    id;        /**< Unique filter id, specified by app. */
5003     uint32    type;        /**< Filter type (WL_PKT_FILTER_TYPE_xxx). */
5004     uint32    negate_match;    /**< Negate the result of filter matches */
5005     union {            /* Filter definitions */
5006         wl_pkt_filter_pattern_t pattern;    /**< Pattern matching filter */
5007         wl_pkt_filter_pattern_list_t patlist; /**< List of patterns to match */
5008         wl_apf_program_t apf_program; /* apf program */
5009         wl_pkt_filter_pattern_timeout_t pattern_timeout; /* Pattern timeout event filter */
5010     } u;
5011 } wl_pkt_filter_t;
5012 
5013 /** IOVAR "tcp_keep_set" parameter. Used to install tcp keep_alive stuff. */
5014 typedef struct wl_tcp_keep_set {
5015     uint32    val1;
5016     uint32    val2;
5017 } wl_tcp_keep_set_t;
5018 
5019 #define WL_PKT_FILTER_FIXED_LEN          OFFSETOF(wl_pkt_filter_t, u)
5020 #define WL_PKT_FILTER_PATTERN_FIXED_LEN      OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
5021 #define WL_PKT_FILTER_PATTERN_LIST_FIXED_LEN OFFSETOF(wl_pkt_filter_pattern_list_t, patterns)
5022 #define WL_PKT_FILTER_PATTERN_LISTEL_FIXED_LEN    \
5023             OFFSETOF(wl_pkt_filter_pattern_listel_t, mask_and_data)
5024 #define WL_PKT_FILTER_PATTERN_TIMEOUT_FIXED_LEN    \
5025             OFFSETOF(wl_pkt_filter_pattern_timeout_t, mask_and_pattern)
5026 
5027 #define WL_APF_INTERNAL_VERSION    1
5028 #define WL_APF_PROGRAM_MAX_SIZE (2 * 1024)
5029 #define WL_APF_PROGRAM_FIXED_LEN    OFFSETOF(wl_apf_program_t, instrs)
5030 #define WL_APF_PROGRAM_LEN(apf_program)    \
5031     ((apf_program)->instr_len * sizeof((apf_program)->instrs[0]))
5032 #define WL_APF_PROGRAM_TOTAL_LEN(apf_program)    \
5033     (WL_APF_PROGRAM_FIXED_LEN + WL_APF_PROGRAM_LEN(apf_program))
5034 
5035 /** IOVAR "pkt_filter_enable" parameter. */
5036 typedef struct wl_pkt_filter_enable {
5037     uint32    id;        /**< Unique filter id */
5038     uint32    enable;        /**< Enable/disable bool */
5039 } wl_pkt_filter_enable_t;
5040 
5041 /** IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
5042 typedef struct wl_pkt_filter_list {
5043     uint32    num;        /**< Number of installed packet filters */
5044     wl_pkt_filter_t    filter[1];    /**< Variable array of packet filters. */
5045 } wl_pkt_filter_list_t;
5046 
5047 #define WL_PKT_FILTER_LIST_FIXED_LEN      OFFSETOF(wl_pkt_filter_list_t, filter)
5048 
5049 /** IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
5050 typedef struct wl_pkt_filter_stats {
5051     uint32    num_pkts_matched;    /**< # filter matches for specified filter id */
5052     uint32    num_pkts_forwarded;    /**< # packets fwded from dongle to host for all filters */
5053     uint32    num_pkts_discarded;    /**< # packets discarded by dongle for all filters */
5054 } wl_pkt_filter_stats_t;
5055 
5056 /** IOVAR "pkt_filter_ports" parameter.  Configure TCP/UDP port filters. */
5057 typedef struct wl_pkt_filter_ports {
5058     uint8 version;        /**< Be proper */
5059     uint8 reserved;        /**< Be really proper */
5060     uint16 count;        /**< Number of ports following */
5061     /* End of fixed data */
5062     uint16 ports[1];    /**< Placeholder for ports[<count>] */
5063 } wl_pkt_filter_ports_t;
5064 
5065 #define WL_PKT_FILTER_PORTS_FIXED_LEN    OFFSETOF(wl_pkt_filter_ports_t, ports)
5066 
5067 #define WL_PKT_FILTER_PORTS_VERSION    0
5068 #define WL_PKT_FILTER_PORTS_MAX        128
5069 
5070 #define RSN_REPLAY_LEN 8
5071 typedef struct _gtkrefresh {
5072     uint8    KCK[RSN_KCK_LENGTH];
5073     uint8    KEK[RSN_KEK_LENGTH];
5074     uint8    ReplayCounter[RSN_REPLAY_LEN];
5075 } gtk_keyinfo_t, *pgtk_keyinfo_t;
5076 
5077 /** Sequential Commands ioctl */
5078 typedef struct wl_seq_cmd_ioctl {
5079     uint32 cmd;        /**< common ioctl definition */
5080     uint32 len;        /**< length of user buffer */
5081 } wl_seq_cmd_ioctl_t;
5082 
5083 #define WL_SEQ_CMD_ALIGN_BYTES    4
5084 
5085 /**
5086  * These are the set of get IOCTLs that should be allowed when using
5087  * IOCTL sequence commands. These are issued implicitly by wl.exe each time
5088  * it is invoked. We never want to buffer these, or else wl.exe will stop working.
5089  */
5090 #define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
5091     (((cmd) == WLC_GET_MAGIC)        || \
5092      ((cmd) == WLC_GET_VERSION)        || \
5093      ((cmd) == WLC_GET_AP)            || \
5094      ((cmd) == WLC_GET_INSTANCE))
5095 
5096 typedef struct wl_pkteng {
5097     uint32 flags;
5098     uint32 delay;            /**< Inter-packet delay */
5099     uint32 nframes;            /**< Number of frames */
5100     uint32 length;            /**< Packet length */
5101     uint8  seqno;            /**< Enable/disable sequence no. */
5102     struct ether_addr dest;        /**< Destination address */
5103     struct ether_addr src;        /**< Source address */
5104     uint8  PAD[3];
5105 } wl_pkteng_t;
5106 
5107 #define WL_PKTENG_RU_FILL_VER_1        1
5108 // struct for ru packet engine
5109 typedef struct wl_pkteng_ru {
5110     uint16 version;        /* ver is 1 */
5111     uint16 length;        /* size of complete structure */
5112     uint8 bw;            /* bandwidth info */
5113     uint8 ru_alloc_val;        /* ru allocation index number */
5114     uint8 mcs_val;            /* mcs allocated value */
5115     uint8 nss_val;            /* num of spatial streams */
5116     uint32 num_bytes;        /* approx num of bytes to calculate other required params */
5117     uint8 cp_ltf_val ;        /* GI and LTF symbol size */
5118     uint8 he_ltf_symb ;        /* num of HE-LTF symbols */
5119     uint8 stbc;            /* STBC support */
5120     uint8 coding_val;        /* BCC/LDPC coding support */
5121     uint8 pe_category;    /* PE duration 0/8/16usecs  */
5122     uint8 dcm;            /* dual carrier modulation */
5123     uint8 mumimo_ltfmode; /* ltf mode */
5124     uint8 PAD[1];        /* pad bytes to make structure occupy 4 byte aligned */
5125 } wl_pkteng_ru_fill_t;
5126 
5127 typedef struct wl_pkteng_stats {
5128     uint32 lostfrmcnt;        /**< RX PER test: no of frames lost (skip seqno) */
5129     int32 rssi;            /**< RSSI */
5130     int32 snr;            /**< signal to noise ratio */
5131     uint16 rxpktcnt[NUM_80211_RATES+1];
5132     uint8 rssi_qdb;            /**< qdB portion of the computed rssi */
5133     uint8  PAD;
5134 } wl_pkteng_stats_t;
5135 
5136 typedef struct wl_txcal_params {
5137     wl_pkteng_t pkteng;
5138     uint8 gidx_start;
5139     int8 gidx_step;
5140     uint8 gidx_stop;
5141     uint8  PAD;
5142 } wl_txcal_params_t;
5143 
5144 
5145 typedef struct wl_sslpnphy_papd_debug_data {
5146     uint8 psat_pwr;
5147     uint8 psat_indx;
5148     uint8 final_idx;
5149     uint8 start_idx;
5150     int32 min_phase;
5151     int32 voltage;
5152     int8 temperature;
5153     uint8  PAD[3];
5154 } wl_sslpnphy_papd_debug_data_t;
5155 typedef struct wl_sslpnphy_debug_data {
5156     int16 papdcompRe [64];
5157     int16 papdcompIm [64];
5158 } wl_sslpnphy_debug_data_t;
5159 typedef struct wl_sslpnphy_spbdump_data {
5160     uint16 tbl_length;
5161     int16 spbreal[256];
5162     int16 spbimg[256];
5163 } wl_sslpnphy_spbdump_data_t;
5164 typedef struct wl_sslpnphy_percal_debug_data {
5165     uint32 cur_idx;
5166     uint32 tx_drift;
5167     uint8 prev_cal_idx;
5168     uint8  PAD[3];
5169     uint32 percal_ctr;
5170     int32 nxt_cal_idx;
5171     uint32 force_1idxcal;
5172     uint32 onedxacl_req;
5173     int32 last_cal_volt;
5174     int8 last_cal_temp;
5175     uint8  PAD[3];
5176     uint32 vbat_ripple;
5177     uint32 exit_route;
5178     int32 volt_winner;
5179 } wl_sslpnphy_percal_debug_data_t;
5180 
5181 typedef enum {
5182     wowl_pattern_type_bitmap = 0,
5183     wowl_pattern_type_arp,
5184     wowl_pattern_type_na
5185 } wowl_pattern_type_t;
5186 
5187 typedef struct wl_wowl_pattern {
5188     uint32            masksize;        /**< Size of the mask in #of bytes */
5189     uint32            offset;        /**< Pattern byte offset in packet */
5190     uint32            patternoffset;    /**< Offset of start of pattern in the structure */
5191     uint32            patternsize;    /**< Size of the pattern itself in #of bytes */
5192     uint32            id;            /**< id */
5193     uint32            reasonsize;        /**< Size of the wakeup reason code */
5194     wowl_pattern_type_t type;        /**< Type of pattern */
5195     /* Mask follows the structure above */
5196     /* Pattern follows the mask is at 'patternoffset' from the start */
5197 } wl_wowl_pattern_t;
5198 
5199 typedef struct wl_wowl_pattern_list {
5200     uint32            count;
5201     wl_wowl_pattern_t    pattern[1];
5202 } wl_wowl_pattern_list_t;
5203 
5204 typedef struct wl_wowl_wakeind {
5205     uint8    pci_wakeind;    /**< Whether PCI PMECSR PMEStatus bit was set */
5206     uint32    ucode_wakeind;    /**< What wakeup-event indication was set by ucode */
5207 } wl_wowl_wakeind_t;
5208 
5209 /** per AC rate control related data structure */
5210 typedef struct wl_txrate_class {
5211     uint8        init_rate;
5212     uint8        min_rate;
5213     uint8        max_rate;
5214 } wl_txrate_class_t;
5215 
5216 /** structure for Overlap BSS scan arguments */
5217 typedef struct wl_obss_scan_arg {
5218     int16    passive_dwell;
5219     int16    active_dwell;
5220     int16    bss_widthscan_interval;
5221     int16    passive_total;
5222     int16    active_total;
5223     int16    chanwidth_transition_delay;
5224     int16    activity_threshold;
5225 } wl_obss_scan_arg_t;
5226 
5227 #define WL_OBSS_SCAN_PARAM_LEN    sizeof(wl_obss_scan_arg_t)
5228 
5229 /** RSSI event notification configuration. */
5230 typedef struct wl_rssi_event {
5231     uint32 rate_limit_msec;        /**< # of events posted to application will be limited to
5232                      * one per specified period (0 to disable rate limit).
5233                      */
5234     uint8 num_rssi_levels;        /**< Number of entries in rssi_levels[] below */
5235     int8 rssi_levels[MAX_RSSI_LEVELS];    /**< Variable number of RSSI levels. An event
5236                          * will be posted each time the RSSI of received
5237                          * beacons/packets crosses a level.
5238                          */
5239     int8 pad[3];
5240 } wl_rssi_event_t;
5241 
5242 #define RSSI_MONITOR_VERSION    1
5243 #define RSSI_MONITOR_STOP       (1 << 0)
5244 typedef struct wl_rssi_monitor_cfg {
5245     uint8 version;
5246     uint8 flags;
5247     int8 max_rssi;
5248     int8 min_rssi;
5249 } wl_rssi_monitor_cfg_t;
5250 
5251 typedef struct wl_rssi_monitor_evt {
5252     uint8 version;
5253     int8 cur_rssi;
5254     uint16 pad;
5255 } wl_rssi_monitor_evt_t;
5256 
5257 /* CCA based channel quality event configuration */
5258 #define WL_CHAN_QUAL_CCA    0
5259 #define WL_CHAN_QUAL_NF        1
5260 #define WL_CHAN_QUAL_NF_LTE    2
5261 #define WL_CHAN_QUAL_TOTAL    3
5262 
5263 #define MAX_CHAN_QUAL_LEVELS    8
5264 
5265 typedef struct wl_chan_qual_metric {
5266     uint8 id;                /**< metric ID */
5267     uint8 num_levels;                   /**< Number of entries in rssi_levels[] below */
5268     uint16 flags;
5269     int16 htol[MAX_CHAN_QUAL_LEVELS];    /**< threshold level array: hi-to-lo */
5270     int16 ltoh[MAX_CHAN_QUAL_LEVELS];    /**< threshold level array: lo-to-hi */
5271 } wl_chan_qual_metric_t;
5272 
5273 typedef struct wl_chan_qual_event {
5274     uint32 rate_limit_msec;        /**< # of events posted to application will be limited to
5275                      * one per specified period (0 to disable rate limit).
5276                      */
5277     uint16 flags;
5278     uint16 num_metrics;
5279     wl_chan_qual_metric_t metric[WL_CHAN_QUAL_TOTAL];    /**< metric array */
5280 } wl_chan_qual_event_t;
5281 typedef struct wl_action_obss_coex_req {
5282     uint8 info;
5283     uint8 num;
5284     uint8 ch_list[1];
5285 } wl_action_obss_coex_req_t;
5286 
5287 
5288 /** IOVar parameter block for small MAC address array with type indicator */
5289 #define WL_IOV_MAC_PARAM_LEN  4
5290 
5291 #define WL_IOV_PKTQ_LOG_PRECS 16
5292 
5293 #include <packed_section_start.h>
5294 typedef BWL_PRE_PACKED_STRUCT struct {
5295     uint32 num_addrs;
5296     uint8   addr_type[WL_IOV_MAC_PARAM_LEN];
5297     struct ether_addr ea[WL_IOV_MAC_PARAM_LEN];
5298 } BWL_POST_PACKED_STRUCT wl_iov_mac_params_t;
5299 #include <packed_section_end.h>
5300 
5301 /** This is extra info that follows wl_iov_mac_params_t */
5302 typedef struct {
5303     uint32 addr_info[WL_IOV_MAC_PARAM_LEN];
5304 } wl_iov_mac_extra_params_t;
5305 
5306 /** Combined structure */
5307 typedef struct {
5308     wl_iov_mac_params_t params;
5309     wl_iov_mac_extra_params_t extra_params;
5310 } wl_iov_mac_full_params_t;
5311 
5312 /** Parameter block for PKTQ_LOG statistics */
5313 #define PKTQ_LOG_COUNTERS_V4 \
5314     /* packets requested to be stored */ \
5315     uint32 requested; \
5316     /* packets stored */ \
5317     uint32 stored; \
5318     /* packets saved, because a lowest priority queue has given away one packet */ \
5319     uint32 saved; \
5320     /* packets saved, because an older packet from the same queue has been dropped */ \
5321     uint32 selfsaved; \
5322     /* packets dropped, because pktq is full with higher precedence packets */ \
5323     uint32 full_dropped; \
5324      /* packets dropped because pktq per that precedence is full */ \
5325     uint32 dropped; \
5326     /* packets dropped, in order to save one from a queue of a highest priority */ \
5327     uint32 sacrificed; \
5328     /* packets droped because of hardware/transmission error */ \
5329     uint32 busy; \
5330     /* packets re-sent because they were not received */ \
5331     uint32 retry; \
5332     /* packets retried again (ps pretend) prior to moving power save mode */ \
5333     uint32 ps_retry; \
5334      /* suppressed packet count */ \
5335     uint32 suppress; \
5336     /* packets finally dropped after retry limit */ \
5337     uint32 retry_drop; \
5338     /* the high-water mark of the queue capacity for packets - goes to zero as queue fills */ \
5339     uint32 max_avail; \
5340     /* the high-water mark of the queue utilisation for packets - ('inverse' of max_avail) */ \
5341     uint32 max_used; \
5342      /* the maximum capacity of the queue */ \
5343     uint32 queue_capacity; \
5344     /* count of rts attempts that failed to receive cts */ \
5345     uint32 rtsfail; \
5346     /* count of packets sent (acked) successfully */ \
5347     uint32 acked; \
5348     /* running total of phy rate of packets sent successfully */ \
5349     uint32 txrate_succ; \
5350     /* running total of phy 'main' rate */ \
5351     uint32 txrate_main; \
5352     /* actual data transferred successfully */ \
5353     uint32 throughput; \
5354     /* time difference since last pktq_stats */ \
5355     uint32 time_delta;
5356 
5357 typedef struct {
5358     PKTQ_LOG_COUNTERS_V4
5359 } pktq_log_counters_v04_t;
5360 
5361 /** v5 is the same as V4 with extra parameter */
5362 typedef struct {
5363     PKTQ_LOG_COUNTERS_V4
5364     /** cumulative time to transmit */
5365     uint32 airtime;
5366 } pktq_log_counters_v05_t;
5367 
5368 typedef struct {
5369     uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
5370     pktq_log_counters_v04_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
5371     uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
5372     uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
5373     char                 headings[];
5374 } pktq_log_format_v04_t;
5375 
5376 typedef struct {
5377     uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
5378     pktq_log_counters_v05_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
5379     uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
5380     uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
5381     char                 headings[];
5382 } pktq_log_format_v05_t;
5383 
5384 
5385 typedef struct {
5386     uint32               version;
5387     wl_iov_mac_params_t  params;
5388     union {
5389         pktq_log_format_v04_t v04;
5390         pktq_log_format_v05_t v05;
5391     } pktq_log;
5392 } wl_iov_pktq_log_t;
5393 
5394 /* PKTQ_LOG_AUTO, PKTQ_LOG_DEF_PREC flags introduced in v05, they are ignored by v04 */
5395 #define PKTQ_LOG_AUTO     (1 << 31)
5396 #define PKTQ_LOG_DEF_PREC (1 << 30)
5397 
5398 typedef struct wl_pfn_macaddr_cfg_0 {
5399     uint8 version;
5400     uint8 reserved;
5401     struct ether_addr macaddr;
5402 } wl_pfn_macaddr_cfg_0_t;
5403 #define LEGACY1_WL_PFN_MACADDR_CFG_VER 0
5404 #define WL_PFN_MAC_OUI_ONLY_MASK      1
5405 #define WL_PFN_SET_MAC_UNASSOC_MASK   2
5406 #define WL_PFN_RESTRICT_LA_MAC_MASK   4
5407 #define WL_PFN_MACADDR_FLAG_MASK     0x7
5408 /** To configure pfn_macaddr */
5409 typedef struct wl_pfn_macaddr_cfg {
5410     uint8 version;
5411     uint8 flags;
5412     struct ether_addr macaddr;
5413 } wl_pfn_macaddr_cfg_t;
5414 #define WL_PFN_MACADDR_CFG_VER 1
5415 
5416 /*
5417  * SCB_BS_DATA iovar definitions start.
5418  */
5419 #define SCB_BS_DATA_STRUCT_VERSION    1
5420 
5421 /** The actual counters maintained for each station */
5422 typedef struct {
5423     /* The following counters are a subset of what pktq_stats provides per precedence. */
5424     uint32 retry;          /**< packets re-sent because they were not received */
5425     uint32 retry_drop;     /**< packets finally dropped after retry limit */
5426     uint32 rtsfail;        /**< count of rts attempts that failed to receive cts */
5427     uint32 acked;          /**< count of packets sent (acked) successfully */
5428     uint32 txrate_succ;    /**< running total of phy rate of packets sent successfully */
5429     uint32 txrate_main;    /**< running total of phy 'main' rate */
5430     uint32 throughput;     /**< actual data transferred successfully */
5431     uint32 time_delta;     /**< time difference since last pktq_stats */
5432     uint32 airtime;        /**< cumulative total medium access delay in useconds */
5433 } iov_bs_data_counters_t;
5434 
5435 /** The structure for individual station information. */
5436 #include <packed_section_start.h>
5437 typedef BWL_PRE_PACKED_STRUCT struct {
5438     struct ether_addr    station_address;    /**< The station MAC address */
5439     uint16            station_flags;        /**< Bit mask of flags, for future use. */
5440     iov_bs_data_counters_t    station_counters;    /**< The actual counter values */
5441 } BWL_POST_PACKED_STRUCT iov_bs_data_record_t;
5442 #include <packed_section_end.h>
5443 
5444 #include <packed_section_start.h>
5445 typedef BWL_PRE_PACKED_STRUCT struct {
5446     uint16    structure_version;    /**< Structure version number (for wl/wlu matching) */
5447     uint16    structure_count;    /**< Number of iov_bs_data_record_t records following */
5448     iov_bs_data_record_t    structure_record[1];    /**< 0 - structure_count records */
5449 } BWL_POST_PACKED_STRUCT iov_bs_data_struct_t;
5450 #include <packed_section_end.h>
5451 
5452 /* Bitmask of options that can be passed in to the iovar. */
5453 enum {
5454     SCB_BS_DATA_FLAG_NO_RESET = (1<<0)    /**< Do not clear the counters after reading */
5455 };
5456 /*
5457  * SCB_BS_DATA iovar definitions end.
5458  */
5459 
5460 typedef struct wlc_extlog_cfg {
5461     int32 max_number;
5462     uint16 module;    /**< bitmap */
5463     uint8 level;
5464     uint8 flag;
5465     uint16 version;
5466     uint16 PAD;
5467 } wlc_extlog_cfg_t;
5468 
5469 typedef struct log_record {
5470     uint32 time;
5471     uint16 module;
5472     uint16 id;
5473     uint8 level;
5474     uint8 sub_unit;
5475     uint8 seq_num;
5476     uint8 pad;
5477     int32 arg;
5478     char  str[MAX_ARGSTR_LEN];
5479     char  PAD[4-MAX_ARGSTR_LEN%4];
5480 } log_record_t;
5481 
5482 typedef struct wlc_extlog_req {
5483     uint32 from_last;
5484     uint32 num;
5485 } wlc_extlog_req_t;
5486 
5487 typedef struct wlc_extlog_results {
5488     uint16 version;
5489     uint16 record_len;
5490     uint32 num;
5491     log_record_t logs[1];
5492 } wlc_extlog_results_t;
5493 
5494 typedef struct log_idstr {
5495     uint16    id;
5496     uint16    flag;
5497     uint8    arg_type;
5498     const char    *fmt_str;
5499 } log_idstr_t;
5500 
5501 #define FMTSTRF_USER        1
5502 
5503 /* flat ID definitions
5504  * New definitions HAVE TO BE ADDED at the end of the table. Otherwise, it will
5505  * affect backward compatibility with pre-existing apps
5506  */
5507 typedef enum {
5508     FMTSTR_DRIVER_UP_ID = 0,
5509     FMTSTR_DRIVER_DOWN_ID = 1,
5510     FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
5511     FMTSTR_NO_PROGRESS_ID = 3,
5512     FMTSTR_RFDISABLE_ID = 4,
5513     FMTSTR_REG_PRINT_ID = 5,
5514     FMTSTR_EXPTIME_ID = 6,
5515     FMTSTR_JOIN_START_ID = 7,
5516     FMTSTR_JOIN_COMPLETE_ID = 8,
5517     FMTSTR_NO_NETWORKS_ID = 9,
5518     FMTSTR_SECURITY_MISMATCH_ID = 10,
5519     FMTSTR_RATE_MISMATCH_ID = 11,
5520     FMTSTR_AP_PRUNED_ID = 12,
5521     FMTSTR_KEY_INSERTED_ID = 13,
5522     FMTSTR_DEAUTH_ID = 14,
5523     FMTSTR_DISASSOC_ID = 15,
5524     FMTSTR_LINK_UP_ID = 16,
5525     FMTSTR_LINK_DOWN_ID = 17,
5526     FMTSTR_RADIO_HW_OFF_ID = 18,
5527     FMTSTR_RADIO_HW_ON_ID = 19,
5528     FMTSTR_EVENT_DESC_ID = 20,
5529     FMTSTR_PNP_SET_POWER_ID = 21,
5530     FMTSTR_RADIO_SW_OFF_ID = 22,
5531     FMTSTR_RADIO_SW_ON_ID = 23,
5532     FMTSTR_PWD_MISMATCH_ID = 24,
5533     FMTSTR_FATAL_ERROR_ID = 25,
5534     FMTSTR_AUTH_FAIL_ID = 26,
5535     FMTSTR_ASSOC_FAIL_ID = 27,
5536     FMTSTR_IBSS_FAIL_ID = 28,
5537     FMTSTR_EXTAP_FAIL_ID = 29,
5538     FMTSTR_MAX_ID
5539 } log_fmtstr_id_t;
5540 
5541 /** 11k Neighbor Report element (unversioned, deprecated) */
5542 typedef struct nbr_element {
5543     uint8 id;
5544     uint8 len;
5545     struct ether_addr bssid;
5546     uint32 bssid_info;
5547     uint8 reg;
5548     uint8 channel;
5549     uint8 phytype;
5550     uint8 pad;
5551 } nbr_element_t;
5552 
5553 #define WL_RRM_NBR_RPT_VER        1
5554 /** 11k Neighbor Report element */
5555 typedef struct nbr_rpt_elem {
5556     uint8 version;
5557     uint8 id;
5558     uint8 len;
5559     uint8 pad;
5560     struct ether_addr bssid;
5561     uint8 pad_1[2];
5562     uint32 bssid_info;
5563     uint8 reg;
5564     uint8 channel;
5565     uint8 phytype;
5566     uint8 pad_2;
5567     wlc_ssid_t ssid;
5568     chanspec_t chanspec;
5569     uint8 bss_trans_preference;
5570     uint8 flags;
5571 } nbr_rpt_elem_t;
5572 
5573 typedef enum event_msgs_ext_command {
5574     EVENTMSGS_NONE        =    0,
5575     EVENTMSGS_SET_BIT    =    1,
5576     EVENTMSGS_RESET_BIT    =    2,
5577     EVENTMSGS_SET_MASK    =    3
5578 } event_msgs_ext_command_t;
5579 
5580 #define EVENTMSGS_VER 1
5581 #define EVENTMSGS_EXT_STRUCT_SIZE    OFFSETOF(eventmsgs_ext_t, mask[0])
5582 
5583 /* len-    for SET it would be mask size from the application to the firmware */
5584 /*        for GET it would be actual firmware mask size */
5585 /* maxgetsize -    is only used for GET. indicate max mask size that the */
5586 /*                application can read from the firmware */
5587 typedef struct eventmsgs_ext
5588 {
5589     uint8    ver;
5590     uint8    command;
5591     uint8    len;
5592     uint8    maxgetsize;
5593     uint8    mask[1];
5594 } eventmsgs_ext_t;
5595 
5596 #include <packed_section_start.h>
5597 typedef BWL_PRE_PACKED_STRUCT struct pcie_bus_tput_params {
5598     /** no of host dma descriptors programmed by the firmware before a commit */
5599     uint16        max_dma_descriptors;
5600 
5601     uint16        host_buf_len; /**< length of host buffer */
5602     dmaaddr_t    host_buf_addr; /**< physical address for bus_throughput_buf */
5603 } BWL_POST_PACKED_STRUCT pcie_bus_tput_params_t;
5604 #include <packed_section_end.h>
5605 
5606 typedef struct pcie_bus_tput_stats {
5607     uint16        time_taken; /**< no of secs the test is run */
5608     uint16        nbytes_per_descriptor; /**< no of bytes of data dma ed per descriptor */
5609 
5610     /** no of desciptors for which dma is sucessfully completed within the test time */
5611     uint32        count;
5612 } pcie_bus_tput_stats_t;
5613 
5614 typedef struct keepalives_max_idle {
5615     uint16  keepalive_count;        /**< nmbr of keepalives per bss_max_idle period */
5616     uint8   mkeepalive_index;       /**< mkeepalive_index for keepalive frame to be used */
5617     uint8   PAD;            /**< to align next field */
5618     uint16  max_interval;           /**< seconds */
5619 } keepalives_max_idle_t;
5620 
5621 #define PM_IGNORE_BCMC_PROXY_ARP (1 << 0)
5622 #define PM_IGNORE_BCMC_ALL_DMS_ACCEPTED (1 << 1)
5623 
5624 /* ##### Power Stats section ##### */
5625 
5626 #define WL_PWRSTATS_VERSION    2
5627 
5628 /** Input structure for pwrstats IOVAR */
5629 typedef struct wl_pwrstats_query {
5630     uint16 length;        /**< Number of entries in type array. */
5631     uint16 type[1];        /**< Types (tags) to retrieve.
5632                  * Length 0 (no types) means get all.
5633                  */
5634 } wl_pwrstats_query_t;
5635 
5636 /** This structure is for version 2; version 1 will be deprecated in by FW */
5637 #include <packed_section_start.h>
5638 typedef BWL_PRE_PACKED_STRUCT struct wl_pwrstats {
5639     uint16 version;              /**< Version = 2 is TLV format */
5640     uint16 length;              /**< Length of entire structure */
5641     uint8 data[1];              /**< TLV data, a series of structures,
5642                        * each starting with type and length.
5643                        *
5644                        * Padded as necessary so each section
5645                        * starts on a 4-byte boundary.
5646                        *
5647                        * Both type and len are uint16, but the
5648                        * upper nibble of length is reserved so
5649                        * valid len values are 0-4095.
5650                        */
5651 } BWL_POST_PACKED_STRUCT wl_pwrstats_t;
5652 #include <packed_section_end.h>
5653 #define WL_PWR_STATS_HDRLEN    OFFSETOF(wl_pwrstats_t, data)
5654 
5655 /* Bits for wake reasons */
5656 #define WLC_PMD_WAKE_SET        0x1
5657 #define WLC_PMD_PM_AWAKE_BCN        0x2
5658 /* BIT:3 is no longer being used */
5659 #define WLC_PMD_SCAN_IN_PROGRESS    0x8
5660 #define WLC_PMD_RM_IN_PROGRESS        0x10
5661 #define WLC_PMD_AS_IN_PROGRESS        0x20
5662 #define WLC_PMD_PM_PEND            0x40
5663 #define WLC_PMD_PS_POLL            0x80
5664 #define WLC_PMD_CHK_UNALIGN_TBTT    0x100
5665 #define WLC_PMD_APSD_STA_UP        0x200
5666 #define WLC_PMD_TX_PEND_WAR        0x400   /* obsolete, can be reused */
5667 #define WLC_PMD_GPTIMER_STAY_AWAKE    0x800
5668 #define WLC_PMD_PM2_RADIO_SOFF_PEND    0x2000
5669 #define WLC_PMD_NON_PRIM_STA_UP        0x4000
5670 #define WLC_PMD_AP_UP            0x8000
5671 
5672 typedef struct wlc_pm_debug {
5673     uint32 timestamp;         /**< timestamp in millisecond */
5674     uint32 reason;             /**< reason(s) for staying awake */
5675 } wlc_pm_debug_t;
5676 
5677 /** WL_PWRSTATS_TYPE_PM_AWAKE1 structures (for 6.25 firmware) */
5678 #define WLC_STA_AWAKE_STATES_MAX_V1    30
5679 #define WLC_PMD_EVENT_MAX_V1        32
5680 /** Data sent as part of pwrstats IOVAR (and EXCESS_PM_WAKE event) */
5681 #include <packed_section_start.h>
5682 typedef BWL_PRE_PACKED_STRUCT struct pm_awake_data_v1 {
5683     uint32 curr_time;    /**< ms */
5684     uint32 hw_macc;        /**< HW maccontrol */
5685     uint32 sw_macc;        /**< SW maccontrol */
5686     uint32 pm_dur;        /**< Total sleep time in PM, msecs */
5687     uint32 mpc_dur;        /**< Total sleep time in MPC, msecs */
5688 
5689     /* int32 drifts = remote - local; +ve drift => local-clk slow */
5690     int32 last_drift;    /**< Most recent TSF drift from beacon */
5691     int32 min_drift;    /**< Min TSF drift from beacon in magnitude */
5692     int32 max_drift;    /**< Max TSF drift from beacon in magnitude */
5693 
5694     uint32 avg_drift;    /**< Avg TSF drift from beacon */
5695 
5696     /* Wake history tracking */
5697     uint8  pmwake_idx;                   /**< for stepping through pm_state */
5698     wlc_pm_debug_t pm_state[WLC_STA_AWAKE_STATES_MAX_V1]; /**< timestamped wake bits */
5699     uint32 pmd_event_wake_dur[WLC_PMD_EVENT_MAX_V1];   /**< cumulative usecs per wake reason */
5700     uint32 drift_cnt;    /**< Count of drift readings over which avg_drift was computed */
5701 } BWL_POST_PACKED_STRUCT pm_awake_data_v1_t;
5702 #include <packed_section_end.h>
5703 
5704 #include <packed_section_start.h>
5705 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pm_awake_stats_v1 {
5706     uint16 type;         /**< WL_PWRSTATS_TYPE_PM_AWAKE */
5707     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
5708 
5709     pm_awake_data_v1_t awake_data;
5710     uint32 frts_time;    /**< Cumulative ms spent in frts since driver load */
5711     uint32 frts_end_cnt;    /**< No of times frts ended since driver load */
5712 } BWL_POST_PACKED_STRUCT wl_pwr_pm_awake_stats_v1_t;
5713 #include <packed_section_end.h>
5714 
5715 /** WL_PWRSTATS_TYPE_PM_AWAKE2 structures. Data sent as part of pwrstats IOVAR */
5716 typedef struct pm_awake_data_v2 {
5717     uint32 curr_time;    /**< ms */
5718     uint32 hw_macc;        /**< HW maccontrol */
5719     uint32 sw_macc;        /**< SW maccontrol */
5720     uint32 pm_dur;        /**< Total sleep time in PM, msecs */
5721     uint32 mpc_dur;        /**< Total sleep time in MPC, msecs */
5722 
5723     /* int32 drifts = remote - local; +ve drift => local-clk slow */
5724     int32 last_drift;    /**< Most recent TSF drift from beacon */
5725     int32 min_drift;    /**< Min TSF drift from beacon in magnitude */
5726     int32 max_drift;    /**< Max TSF drift from beacon in magnitude */
5727 
5728     uint32 avg_drift;    /**< Avg TSF drift from beacon */
5729 
5730     /* Wake history tracking */
5731 
5732     /* pmstate array (type wlc_pm_debug_t) start offset */
5733     uint16 pm_state_offset;
5734     /** pmstate number of array entries */
5735     uint16 pm_state_len;
5736 
5737     /** array (type uint32) start offset */
5738     uint16 pmd_event_wake_dur_offset;
5739     /** pmd_event_wake_dur number of array entries */
5740     uint16 pmd_event_wake_dur_len;
5741 
5742     uint32 drift_cnt;    /**< Count of drift readings over which avg_drift was computed */
5743     uint8  pmwake_idx;    /**< for stepping through pm_state */
5744     uint8  flags;        /**< bit0: 1-sleep, 0- wake. bit1: 0-bit0 invlid, 1-bit0 valid */
5745     uint8  pad[2];
5746     uint32 frts_time;    /**< Cumulative ms spent in frts since driver load */
5747     uint32 frts_end_cnt;    /**< No of times frts ended since driver load */
5748 } pm_awake_data_v2_t;
5749 
5750 typedef struct wl_pwr_pm_awake_stats_v2 {
5751     uint16 type;         /**< WL_PWRSTATS_TYPE_PM_AWAKE */
5752     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
5753 
5754     pm_awake_data_v2_t awake_data;
5755 } wl_pwr_pm_awake_stats_v2_t;
5756 
5757 /* bit0: 1-sleep, 0- wake. bit1: 0-bit0 invlid, 1-bit0 valid */
5758 #define WL_PWR_PM_AWAKE_STATS_WAKE      0x02
5759 #define WL_PWR_PM_AWAKE_STATS_ASLEEP    0x03
5760 #define WL_PWR_PM_AWAKE_STATS_WAKE_MASK 0x03
5761 
5762 /* WL_PWRSTATS_TYPE_PM_AWAKE Version 2 structures taken from 4324/43342 */
5763 /* These structures are only to be used with 4324/43342 devices */
5764 
5765 #define WL_STA_AWAKE_STATES_MAX_V2    30
5766 #define WL_PMD_EVENT_MAX_V2        32
5767 #define MAX_P2P_BSS_DTIM_PRD        4
5768 
5769 #include <packed_section_start.h>
5770 typedef BWL_PRE_PACKED_STRUCT struct ucode_dbg_v2 {
5771     uint32 macctrl;
5772     uint16 m_p2p_hps;
5773     uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
5774     uint32 psmdebug[20];
5775     uint32 phydebug[20];
5776     uint32 psm_brc;
5777     uint32 ifsstat;
5778 } BWL_POST_PACKED_STRUCT ucode_dbg_v2_t;
5779 #include <packed_section_end.h>
5780 
5781 #include <packed_section_start.h>
5782 typedef BWL_PRE_PACKED_STRUCT struct pmalert_awake_data_v2 {
5783     uint32 curr_time;    /* ms */
5784     uint32 hw_macc;        /* HW maccontrol */
5785     uint32 sw_macc;        /* SW maccontrol */
5786     uint32 pm_dur;        /* Total sleep time in PM, msecs */
5787     uint32 mpc_dur;        /* Total sleep time in MPC, msecs */
5788 
5789     /* int32 drifts = remote - local; +ve drift => local-clk slow */
5790     int32 last_drift;    /* Most recent TSF drift from beacon */
5791     int32 min_drift;    /* Min TSF drift from beacon in magnitude */
5792     int32 max_drift;    /* Max TSF drift from beacon in magnitude */
5793 
5794     uint32 avg_drift;    /* Avg TSF drift from beacon */
5795 
5796     /* Wake history tracking */
5797     uint8  pmwake_idx;                   /* for stepping through pm_state */
5798     wlc_pm_debug_t pm_state[WL_STA_AWAKE_STATES_MAX_V2]; /* timestamped wake bits */
5799     uint32 pmd_event_wake_dur[WL_PMD_EVENT_MAX_V2];      /* cumulative usecs per wake reason */
5800     uint32 drift_cnt;    /* Count of drift readings over which avg_drift was computed */
5801     uint32    start_event_dur[WL_PMD_EVENT_MAX_V2]; /* start event-duration */
5802     ucode_dbg_v2_t ud;
5803     uint32 frts_time;    /* Cumulative ms spent in frts since driver load */
5804     uint32 frts_end_cnt;    /* No of times frts ended since driver load */
5805 } BWL_POST_PACKED_STRUCT pmalert_awake_data_v2_t;
5806 #include <packed_section_end.h>
5807 
5808 #include <packed_section_start.h>
5809 typedef BWL_PRE_PACKED_STRUCT struct pm_alert_data_v2 {
5810     uint32 version;
5811     uint32 length; /* Length of entire structure */
5812     uint32 reasons; /* reason(s) for pm_alert */
5813     /* Following fields are present only for reasons
5814      * PM_DUR_EXCEEDED, MPC_DUR_EXCEEDED & CONST_AWAKE_DUR_EXCEEDED
5815      */
5816     uint32 prev_stats_time;    /* msecs */
5817     uint32 prev_pm_dur;    /* msecs */
5818     uint32 prev_mpc_dur;    /* msecs */
5819     pmalert_awake_data_v2_t awake_data;
5820 } BWL_POST_PACKED_STRUCT pm_alert_data_v2_t;
5821 #include <packed_section_end.h>
5822 
5823 #include <packed_section_start.h>
5824 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pm_awake_status_v2 {
5825     uint16 type;         /* WL_PWRSTATS_TYPE_PM_AWAKE */
5826     uint16 len;         /* Up to 4K-1, top 4 bits are reserved */
5827 
5828     pmalert_awake_data_v2_t awake_data;
5829     uint32 frts_time;    /* Cumulative ms spent in frts since driver load */
5830     uint32 frts_end_cnt;    /* No of times frts ended since driver load */
5831 } BWL_POST_PACKED_STRUCT wl_pwr_pm_awake_status_v2_t;
5832 #include <packed_section_end.h>
5833 
5834 /* Below are latest definitions from PHO25178RC100_BRANCH_6_50 */
5835 /* wl_pwr_pm_awake_stats_v1_t is used for WL_PWRSTATS_TYPE_PM_AWAKE */
5836 /* (at least) the chip independent registers */
5837 typedef struct ucode_dbg_ext {
5838     uint32 x120;
5839     uint32 x124;
5840     uint32 x154;
5841     uint32 x158;
5842     uint32 x15c;
5843     uint32 x180;
5844     uint32 x184;
5845     uint32 x188;
5846     uint32 x18c;
5847     uint32 x1a0;
5848     uint32 x1a8;
5849     uint32 x1e0;
5850     uint32 scr_x14;
5851     uint32 scr_x2b;
5852     uint32 scr_x2c;
5853     uint32 scr_x2d;
5854     uint32 scr_x2e;
5855 
5856     uint16 x40a;
5857     uint16 x480;
5858     uint16 x490;
5859     uint16 x492;
5860     uint16 x4d8;
5861     uint16 x4b8;
5862     uint16 x4ba;
5863     uint16 x4bc;
5864     uint16 x4be;
5865     uint16 x500;
5866     uint16 x50e;
5867     uint16 x522;
5868     uint16 x546;
5869     uint16 x578;
5870     uint16 x602;
5871     uint16 x646;
5872     uint16 x648;
5873     uint16 x666;
5874     uint16 x670;
5875     uint16 x690;
5876     uint16 x692;
5877     uint16 x6a0;
5878     uint16 x6a2;
5879     uint16 x6a4;
5880     uint16 x6b2;
5881     uint16 x7c0;
5882 
5883     uint16 shm_x20;
5884     uint16 shm_x4a;
5885     uint16 shm_x5e;
5886     uint16 shm_x5f;
5887     uint16 shm_xaab;
5888     uint16 shm_x74a;
5889     uint16 shm_x74b;
5890     uint16 shm_x74c;
5891     uint16 shm_x74e;
5892     uint16 shm_x756;
5893     uint16 shm_x75b;
5894     uint16 shm_x7b9;
5895     uint16 shm_x7d4;
5896 
5897     uint16 shm_P2P_HPS;
5898     uint16 shm_P2P_intr[16];
5899     uint16 shm_P2P_perbss[48];
5900 } ucode_dbg_ext_t;
5901 
5902 #include <packed_section_start.h>
5903 typedef BWL_PRE_PACKED_STRUCT struct pm_alert_data_v1 {
5904     uint32 version;
5905     uint32 length; /**< Length of entire structure */
5906     uint32 reasons; /**< reason(s) for pm_alert */
5907     /* Following fields are present only for reasons
5908      * PM_DUR_EXCEEDED, MPC_DUR_EXCEEDED & CONST_AWAKE_DUR_EXCEEDED
5909      */
5910     uint32 prev_stats_time;    /**< msecs */
5911     uint32 prev_pm_dur;    /**< msecs */
5912     uint32 prev_mpc_dur;    /**< msecs */
5913     pm_awake_data_v1_t awake_data;
5914     uint32    start_event_dur[WLC_PMD_EVENT_MAX_V1]; /**< start event-duration */
5915     ucode_dbg_v2_t ud;
5916     uint32 frts_time;    /**< Cumulative ms spent in frts since driver load */
5917     uint32 frts_end_cnt;    /**< No of times frts ended since driver load */
5918     ucode_dbg_ext_t ud_ext;
5919     uint32 prev_frts_dur; /**< ms */
5920 } BWL_POST_PACKED_STRUCT pm_alert_data_v1_t;
5921 #include <packed_section_end.h>
5922 
5923 /* End of 43342/4324 v2 structure definitions */
5924 
5925 /* Original bus structure is for HSIC */
5926 
5927 typedef struct bus_metrics {
5928     uint32 suspend_ct;    /**< suspend count */
5929     uint32 resume_ct;    /**< resume count */
5930     uint32 disconnect_ct;    /**< disconnect count */
5931     uint32 reconnect_ct;    /**< reconnect count */
5932     uint32 active_dur;    /**< msecs in bus, usecs for user */
5933     uint32 suspend_dur;    /**< msecs in bus, usecs for user */
5934     uint32 disconnect_dur;    /**< msecs in bus, usecs for user */
5935 } bus_metrics_t;
5936 
5937 /** Bus interface info for USB/HSIC */
5938 #include <packed_section_start.h>
5939 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_usb_hsic_stats {
5940     uint16 type;         /**< WL_PWRSTATS_TYPE_USB_HSIC */
5941     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
5942 
5943     bus_metrics_t hsic;    /**< stats from hsic bus driver */
5944 } BWL_POST_PACKED_STRUCT wl_pwr_usb_hsic_stats_t;
5945 #include <packed_section_end.h>
5946 
5947 typedef struct pcie_bus_metrics {
5948     uint32 d3_suspend_ct;    /**< suspend count */
5949     uint32 d0_resume_ct;    /**< resume count */
5950     uint32 perst_assrt_ct;    /**< PERST# assert count */
5951     uint32 perst_deassrt_ct;    /**< PERST# de-assert count */
5952     uint32 active_dur;    /**< msecs */
5953     uint32 d3_suspend_dur;    /**< msecs */
5954     uint32 perst_dur;    /**< msecs */
5955     uint32 l0_cnt;        /**< L0 entry count */
5956     uint32 l0_usecs;    /**< L0 duration in usecs */
5957     uint32 l1_cnt;        /**< L1 entry count */
5958     uint32 l1_usecs;    /**< L1 duration in usecs */
5959     uint32 l1_1_cnt;    /**< L1_1ss entry count */
5960     uint32 l1_1_usecs;    /**< L1_1ss duration in usecs */
5961     uint32 l1_2_cnt;    /**< L1_2ss entry count */
5962     uint32 l1_2_usecs;    /**< L1_2ss duration in usecs */
5963     uint32 l2_cnt;        /**< L2 entry count */
5964     uint32 l2_usecs;    /**< L2 duration in usecs */
5965     uint32 timestamp;    /**< Timestamp on when stats are collected */
5966     uint32 num_h2d_doorbell;    /**< # of doorbell interrupts - h2d */
5967     uint32 num_d2h_doorbell;    /**< # of doorbell interrupts - d2h */
5968     uint32 num_submissions; /**< # of submissions */
5969     uint32 num_completions; /**< # of completions */
5970     uint32 num_rxcmplt;    /**< # of rx completions */
5971     uint32 num_rxcmplt_drbl;    /**< of drbl interrupts for rx complt. */
5972     uint32 num_txstatus;    /**< # of tx completions */
5973     uint32 num_txstatus_drbl;    /**< of drbl interrupts for tx complt. */
5974     uint32 deepsleep_count; /**< # of times chip went to deepsleep */
5975     uint32 deepsleep_dur;   /**< # of msecs chip was in deepsleep */
5976     uint32 ltr_active_ct;    /**< # of times chip went to LTR ACTIVE */
5977     uint32 ltr_active_dur;    /**< # of msecs chip was in LTR ACTIVE */
5978     uint32 ltr_sleep_ct;    /**< # of times chip went to LTR SLEEP */
5979     uint32 ltr_sleep_dur;    /**< # of msecs chip was in LTR SLEEP */
5980 } pcie_bus_metrics_t;
5981 
5982 /** Bus interface info for PCIE */
5983 typedef struct wl_pwr_pcie_stats {
5984     uint16 type;         /**< WL_PWRSTATS_TYPE_PCIE */
5985     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
5986     pcie_bus_metrics_t pcie;    /**< stats from pcie bus driver */
5987 } wl_pwr_pcie_stats_t;
5988 
5989 /** Scan information history per category */
5990 typedef struct scan_data {
5991     uint32 count;        /**< Number of scans performed */
5992     uint32 dur;        /**< Total time (in us) used */
5993 } scan_data_t;
5994 
5995 typedef struct wl_pwr_scan_stats {
5996     uint16 type;         /**< WL_PWRSTATS_TYPE_SCAN */
5997     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
5998 
5999     /* Scan history */
6000     scan_data_t user_scans;      /**< User-requested scans: (i/e/p)scan */
6001     scan_data_t assoc_scans;  /**< Scans initiated by association requests */
6002     scan_data_t roam_scans;      /**< Scans initiated by the roam engine */
6003     scan_data_t pno_scans[8]; /**< For future PNO bucketing (BSSID, SSID, etc) */
6004     scan_data_t other_scans;  /**< Scan engine usage not assigned to the above */
6005 } wl_pwr_scan_stats_t;
6006 
6007 typedef struct wl_pwr_connect_stats {
6008     uint16 type;         /**< WL_PWRSTATS_TYPE_SCAN */
6009     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
6010 
6011     /* Connection (Association + Key exchange) data */
6012     uint32 count;    /**< Number of connections performed */
6013     uint32 dur;        /**< Total time (in ms) used */
6014 } wl_pwr_connect_stats_t;
6015 
6016 typedef struct wl_pwr_phy_stats {
6017     uint16 type;        /**< WL_PWRSTATS_TYPE_PHY */
6018     uint16 len;        /**< Up to 4K-1, top 4 bits are reserved */
6019     uint32 tx_dur;        /**< TX Active duration in us */
6020     uint32 rx_dur;        /**< RX Active duration in us */
6021 } wl_pwr_phy_stats_t;
6022 
6023 
6024 typedef struct wl_mimo_meas_metrics_v1 {
6025     uint16 type;
6026     uint16 len;
6027     /* Total time(us) idle in MIMO RX chain configuration */
6028     uint32 total_idle_time_mimo;
6029     /* Total time(us) idle in SISO  RX chain configuration */
6030     uint32 total_idle_time_siso;
6031     /* Total receive time (us) in SISO RX chain configuration */
6032     uint32 total_rx_time_siso;
6033     /* Total receive time (us) in MIMO RX chain configuration */
6034     uint32 total_rx_time_mimo;
6035     /* Total 1-chain transmit time(us) */
6036     uint32 total_tx_time_1chain;
6037     /* Total 2-chain transmit time(us) */
6038     uint32 total_tx_time_2chain;
6039     /* Total 3-chain transmit time(us) */
6040     uint32 total_tx_time_3chain;
6041 } wl_mimo_meas_metrics_v1_t;
6042 
6043 typedef struct wl_mimo_meas_metrics {
6044     uint16 type;
6045     uint16 len;
6046     /* Total time(us) idle in MIMO RX chain configuration */
6047     uint32 total_idle_time_mimo;
6048     /* Total time(us) idle in SISO  RX chain configuration */
6049     uint32 total_idle_time_siso;
6050     /* Total receive time (us) in SISO RX chain configuration */
6051     uint32 total_rx_time_siso;
6052     /* Total receive time (us) in MIMO RX chain configuration */
6053     uint32 total_rx_time_mimo;
6054     /* Total 1-chain transmit time(us) */
6055     uint32 total_tx_time_1chain;
6056     /* Total 2-chain transmit time(us) */
6057     uint32 total_tx_time_2chain;
6058     /* Total 3-chain transmit time(us) */
6059     uint32 total_tx_time_3chain;
6060     /* End of original, OCL fields start here */
6061     /* Total time(us) idle in ocl mode */
6062     uint32 total_idle_time_ocl;
6063     /* Total receive time (us) in ocl mode */
6064     uint32 total_rx_time_ocl;
6065     /* End of OCL fields, internal adjustment fields here */
6066     /* Total SIFS idle time in MIMO mode */
6067     uint32 total_sifs_time_mimo;
6068     /* Total SIFS idle time in SISO mode */
6069     uint32 total_sifs_time_siso;
6070 } wl_mimo_meas_metrics_t;
6071 /* ##### End of Power Stats section ##### */
6072 
6073 /** IPV4 Arp offloads for ndis context */
6074 #include <packed_section_start.h>
6075 BWL_PRE_PACKED_STRUCT struct hostip_id {
6076     struct ipv4_addr ipa;
6077     uint8 id;
6078 } BWL_POST_PACKED_STRUCT;
6079 #include <packed_section_end.h>
6080 
6081 /* Return values */
6082 #define ND_REPLY_PEER        0x1    /**< Reply was sent to service NS request from peer */
6083 #define ND_REQ_SINK        0x2    /**< Input packet should be discarded */
6084 #define ND_FORCE_FORWARD    0X3    /**< For the dongle to forward req to HOST */
6085 
6086 /** Neighbor Solicitation Response Offload IOVAR param */
6087 #include <packed_section_start.h>
6088 typedef BWL_PRE_PACKED_STRUCT struct nd_param {
6089     struct ipv6_addr    host_ip[2];
6090     struct ipv6_addr    solicit_ip;
6091     struct ipv6_addr    remote_ip;
6092     uint8    host_mac[ETHER_ADDR_LEN];
6093     uint32    offload_id;
6094 } BWL_POST_PACKED_STRUCT nd_param_t;
6095 #include <packed_section_end.h>
6096 
6097 typedef struct wl_pfn_roam_thresh {
6098     uint32 pfn_alert_thresh; /**< time in ms */
6099     uint32 roam_alert_thresh; /**< time in ms */
6100 } wl_pfn_roam_thresh_t;
6101 
6102 
6103 /* Reasons for wl_pmalert_t */
6104 #define PM_DUR_EXCEEDED            (1<<0)
6105 #define MPC_DUR_EXCEEDED        (1<<1)
6106 #define ROAM_ALERT_THRESH_EXCEEDED    (1<<2)
6107 #define PFN_ALERT_THRESH_EXCEEDED    (1<<3)
6108 #define CONST_AWAKE_DUR_ALERT        (1<<4)
6109 #define CONST_AWAKE_DUR_RECOVERY    (1<<5)
6110 
6111 #define MIN_PM_ALERT_LEN 9
6112 
6113 /** Data sent in EXCESS_PM_WAKE event */
6114 #define WL_PM_ALERT_VERSION 3
6115 
6116 /** This structure is for version 3; version 2 will be deprecated in by FW */
6117 #include <packed_section_start.h>
6118 typedef BWL_PRE_PACKED_STRUCT struct wl_pmalert {
6119     uint16 version;        /**< Version = 3 is TLV format */
6120     uint16 length;        /**< Length of entire structure */
6121     uint32 reasons;        /**< reason(s) for pm_alert */
6122     uint8 data[1];        /**< TLV data, a series of structures,
6123                  * each starting with type and length.
6124                  *
6125                  * Padded as necessary so each section
6126                  * starts on a 4-byte boundary.
6127                  *
6128                  * Both type and len are uint16, but the
6129                  * upper nibble of length is reserved so
6130                  * valid len values are 0-4095.
6131                 */
6132 } BWL_POST_PACKED_STRUCT wl_pmalert_t;
6133 #include <packed_section_end.h>
6134 
6135 /* Type values for the data section */
6136 #define WL_PMALERT_FIXED    0    /**< struct wl_pmalert_fixed_t, fixed fields */
6137 #define WL_PMALERT_PMSTATE    1    /**< struct wl_pmalert_pmstate_t, variable */
6138 #define WL_PMALERT_EVENT_DUR    2    /**< struct wl_pmalert_event_dur_t, variable */
6139 #define WL_PMALERT_UCODE_DBG    3    /**< struct wl_pmalert_ucode_dbg_v1, variable */
6140 #define WL_PMALERT_PS_ALLOWED_HIST    4 /**< struct wl_pmalert_ps_allowed_history, variable */
6141 #define WL_PMALERT_EXT_UCODE_DBG    5 /**< struct wl_pmalert_ext_ucode_dbg_t, variable */
6142 #define WL_PMALERT_EPM_START_EVENT_DUR    6 /**< struct wl_pmalert_event_dur_t, variable */
6143 #define WL_PMALERT_UCODE_DBG_V2        7 /**< struct wl_pmalert_ucode_dbg_v2, variable */
6144 
6145 typedef struct wl_pmalert_fixed {
6146     uint16 type;        /**< WL_PMALERT_FIXED */
6147     uint16 len;        /**< Up to 4K-1, top 4 bits are reserved */
6148     uint32 prev_stats_time;    /**< msecs */
6149     uint32 curr_time;    /**< ms */
6150     uint32 prev_pm_dur;    /**< msecs */
6151     uint32 pm_dur;        /**< Total sleep time in PM, msecs */
6152     uint32 prev_mpc_dur;    /**< msecs */
6153     uint32 mpc_dur;        /**< Total sleep time in MPC, msecs */
6154     uint32 hw_macc;        /**< HW maccontrol */
6155     uint32 sw_macc;        /**< SW maccontrol */
6156 
6157     /* int32 drifts = remote - local; +ve drift -> local-clk slow */
6158     int32 last_drift;    /**< Most recent TSF drift from beacon */
6159     int32 min_drift;    /**< Min TSF drift from beacon in magnitude */
6160     int32 max_drift;    /**< Max TSF drift from beacon in magnitude */
6161 
6162     uint32 avg_drift;    /**< Avg TSF drift from beacon */
6163     uint32 drift_cnt;    /**< Count of drift readings over which avg_drift was computed */
6164     uint32 frts_time;    /**< Cumulative ms spent in data frts since driver load */
6165     uint32 frts_end_cnt;    /**< No of times frts ended since driver load */
6166     uint32 prev_frts_dur;    /**< Data frts duration at start of pm-period */
6167     uint32 cal_dur;        /**< Cumulative ms spent in calibration */
6168     uint32 prev_cal_dur;    /**< cal duration at start of pm-period */
6169 } wl_pmalert_fixed_t;
6170 
6171 typedef struct wl_pmalert_pmstate {
6172     uint16 type;         /**< WL_PMALERT_PMSTATE */
6173     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
6174 
6175     uint8 pmwake_idx;   /**< for stepping through pm_state */
6176     uint8 pad[3];
6177     /* Array of pmstate; len of array is based on tlv len */
6178     wlc_pm_debug_t pmstate[1];
6179 } wl_pmalert_pmstate_t;
6180 
6181 typedef struct wl_pmalert_event_dur {
6182     uint16 type;         /**< WL_PMALERT_EVENT_DUR */
6183     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
6184 
6185     /* Array of event_dur, len of array is based on tlv len */
6186     uint32 event_dur[1];
6187 } wl_pmalert_event_dur_t;
6188 
6189 #include <packed_section_start.h>
6190 BWL_PRE_PACKED_STRUCT struct wl_pmalert_ucode_dbg_v1 {
6191     uint16 type;         /* WL_PMALERT_UCODE_DBG */
6192     uint16 len;      /* Up to 4K-1, top 4 bits are reserved */
6193     uint32 macctrl;
6194     uint16 m_p2p_hps;
6195     uint32 psm_brc;
6196     uint32 ifsstat;
6197     uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
6198     uint32 psmdebug[20];
6199     uint32 phydebug[20];
6200     uint16 M_P2P_BSS[3][12];
6201     uint16 M_P2P_PRE_TBTT[3];
6202 
6203     /* Following is valid only for corerevs<40 */
6204     uint16 xmtfifordy;
6205 
6206     /* Following 3 are valid only for 11ac corerevs (>=40) */
6207     uint16 psm_maccommand;
6208     uint16 txe_status1;
6209     uint16 AQMFifoReady;
6210 } BWL_POST_PACKED_STRUCT;
6211 #include <packed_section_end.h>
6212 
6213 #include <packed_section_start.h>
6214 BWL_PRE_PACKED_STRUCT struct wl_pmalert_ucode_dbg_v2 {
6215     uint16 type;         /**< WL_PMALERT_UCODE_DBG_V2 */
6216     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
6217     uint32 macctrl;
6218     uint16 m_p2p_hps;
6219     uint32 psm_brc;
6220     uint32 ifsstat;
6221     uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
6222     uint32 psmdebug[20];
6223     uint32 phydebug[20];
6224     uint16 M_P2P_BSS[3][12];
6225     uint16 M_P2P_PRE_TBTT[3];
6226 
6227     /* Following is valid only for corerevs<40 */
6228     uint16 xmtfifordy;
6229 
6230     /* Following 3 are valid only for 11ac corerevs (>=40) */
6231     uint16 psm_maccommand;
6232     uint16 txe_status1;
6233     uint32 AQMFifoReady;
6234 } BWL_POST_PACKED_STRUCT;
6235 #include <packed_section_end.h>
6236 
6237 typedef struct wlc_ps_debug {
6238     uint32 timestamp;         /**< timestamp in millisecond */
6239     uint32 ps_mask;             /**< reason(s) for disallowing ps */
6240 } wlc_ps_debug_t;
6241 
6242 typedef struct wl_pmalert_ps_allowed_hist {
6243     uint16 type;         /**< WL_PMALERT_PS_ALLOWED_HIST */
6244     uint16 len;         /**< Up to 4K-1, top 4 bits are reserved */
6245     uint32 ps_allowed_start_idx;
6246     /* Array of ps_debug, len of array is based on tlv len */
6247     wlc_ps_debug_t ps_debug[1];
6248 } wl_pmalert_ps_allowed_hist_t;
6249 
6250 /* Structures and constants used for "vndr_ie" IOVar interface */
6251 #define VNDR_IE_CMD_LEN        4    /**< length of the set command string:
6252                      * "add", "del" (+ NUL)
6253                      */
6254 
6255 #define VNDR_IE_INFO_HDR_LEN    (sizeof(uint32))
6256 
6257 #include <packed_section_start.h>
6258 typedef BWL_PRE_PACKED_STRUCT struct {
6259     uint32 pktflag;            /**< bitmask indicating which packet(s) contain this IE */
6260     vndr_ie_t vndr_ie_data;        /**< vendor IE data */
6261 } BWL_POST_PACKED_STRUCT vndr_ie_info_t;
6262 #include <packed_section_end.h>
6263 
6264 #include <packed_section_start.h>
6265 typedef BWL_PRE_PACKED_STRUCT struct {
6266     int32 iecount;            /**< number of entries in the vndr_ie_list[] array */
6267     vndr_ie_info_t vndr_ie_list[1];    /**< variable size list of vndr_ie_info_t structs */
6268 } BWL_POST_PACKED_STRUCT vndr_ie_buf_t;
6269 #include <packed_section_end.h>
6270 
6271 #include <packed_section_start.h>
6272 typedef BWL_PRE_PACKED_STRUCT struct {
6273     char cmd[VNDR_IE_CMD_LEN];    /**< vndr_ie IOVar set command : "add", "del" + NUL */
6274     vndr_ie_buf_t vndr_ie_buffer;    /**< buffer containing Vendor IE list information */
6275 } BWL_POST_PACKED_STRUCT vndr_ie_setbuf_t;
6276 #include <packed_section_end.h>
6277 
6278 /** tag_ID/length/value_buffer tuple */
6279 #include <packed_section_start.h>
6280 typedef BWL_PRE_PACKED_STRUCT struct {
6281     uint8    id;
6282     uint8    len;
6283     uint8    data[1];
6284 } BWL_POST_PACKED_STRUCT tlv_t;
6285 #include <packed_section_end.h>
6286 
6287 #include <packed_section_start.h>
6288 typedef BWL_PRE_PACKED_STRUCT struct {
6289     uint32 pktflag;            /**< bitmask indicating which packet(s) contain this IE */
6290     tlv_t ie_data;        /**< IE data */
6291 } BWL_POST_PACKED_STRUCT ie_info_t;
6292 #include <packed_section_end.h>
6293 
6294 #include <packed_section_start.h>
6295 typedef BWL_PRE_PACKED_STRUCT struct {
6296     int32 iecount;            /**< number of entries in the ie_list[] array */
6297     ie_info_t ie_list[1];    /**< variable size list of ie_info_t structs */
6298 } BWL_POST_PACKED_STRUCT ie_buf_t;
6299 #include <packed_section_end.h>
6300 
6301 #include <packed_section_start.h>
6302 typedef BWL_PRE_PACKED_STRUCT struct {
6303     char cmd[VNDR_IE_CMD_LEN];    /**< ie IOVar set command : "add" + NUL */
6304     ie_buf_t ie_buffer;    /**< buffer containing IE list information */
6305 } BWL_POST_PACKED_STRUCT ie_setbuf_t;
6306 #include <packed_section_end.h>
6307 
6308 #include <packed_section_start.h>
6309 typedef BWL_PRE_PACKED_STRUCT struct {
6310     uint32 pktflag;        /**< bitmask indicating which packet(s) contain this IE */
6311     uint8 id;        /**< IE type */
6312 } BWL_POST_PACKED_STRUCT ie_getbuf_t;
6313 #include <packed_section_end.h>
6314 
6315 /* structures used to define format of wps ie data from probe requests */
6316 /* passed up to applications via iovar "prbreq_wpsie" */
6317 typedef struct sta_prbreq_wps_ie_hdr {
6318     struct ether_addr staAddr;
6319     uint16 ieLen;
6320 } sta_prbreq_wps_ie_hdr_t;
6321 
6322 #include <packed_section_start.h>
6323 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
6324     sta_prbreq_wps_ie_hdr_t hdr;
6325     uint8 ieData[1];
6326 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
6327 #include <packed_section_end.h>
6328 
6329 #include <packed_section_start.h>
6330 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
6331     uint32 totLen;
6332     uint8 ieDataList[1];
6333 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
6334 #include <packed_section_end.h>
6335 
6336 #include <packed_section_start.h>
6337 typedef BWL_PRE_PACKED_STRUCT struct {
6338     uint32 flags;
6339     chanspec_t chanspec;            /**< txpwr report for this channel */
6340     chanspec_t local_chanspec;        /**< channel on which we are associated */
6341     uint8 local_max;            /**< local max according to the AP */
6342     uint8 local_constraint;            /**< local constraint according to the AP */
6343     int8  antgain[2];            /**< Ant gain for each band - from SROM */
6344     uint8 rf_cores;                /**< count of RF Cores being reported */
6345     uint8 est_Pout[4];            /**< Latest tx power out estimate per RF chain */
6346     uint8 est_Pout_act[4]; /**< Latest tx power out estimate per RF chain w/o adjustment */
6347     uint8 est_Pout_cck;            /**< Latest CCK tx power out estimate */
6348     uint8 tx_power_max[4];            /**< Maximum target power among all rates */
6349     uint32 tx_power_max_rate_ind[4];  /**< Index of the rate with the max target power */
6350     int8 sar;                /**< SAR limit for display by wl executable */
6351     int8 channel_bandwidth;        /**< 20, 40 or 80 MHz bandwidth? */
6352     uint8 version;                /**< Version of the data format wlu <--> driver */
6353     uint8 display_core;            /**< Displayed curpower core */
6354     int8 target_offsets[4];        /**< Target power offsets for current rate per core */
6355     uint32 last_tx_ratespec;    /**< Ratespec for last transmition */
6356     uint32 user_target;        /**< user limit */
6357     uint32 ppr_len;        /**< length of each ppr serialization buffer */
6358     int8 SARLIMIT[MAX_STREAMS_SUPPORTED];
6359     uint8  pprdata[1];        /**< ppr serialization buffer */
6360 } BWL_POST_PACKED_STRUCT tx_pwr_rpt_t;
6361 #include <packed_section_end.h>
6362 
6363 #include <packed_section_start.h>
6364 typedef BWL_PRE_PACKED_STRUCT struct {
6365     struct ipv4_addr    ipv4_addr;
6366     struct ether_addr nexthop;
6367 } BWL_POST_PACKED_STRUCT ibss_route_entry_t;
6368 #include <packed_section_end.h>
6369 
6370 #include <packed_section_start.h>
6371 typedef BWL_PRE_PACKED_STRUCT struct {
6372     uint32 num_entry;
6373     ibss_route_entry_t route_entry[1];
6374 } BWL_POST_PACKED_STRUCT ibss_route_tbl_t;
6375 #include <packed_section_end.h>
6376 
6377 #define MAX_IBSS_ROUTE_TBL_ENTRY    64
6378 
6379 #define TXPWR_TARGET_VERSION  0
6380 #include <packed_section_start.h>
6381 typedef BWL_PRE_PACKED_STRUCT struct {
6382     int32 version;        /**< version number */
6383     chanspec_t chanspec;    /**< txpwr report for this channel */
6384     int8 txpwr[WL_STA_ANT_MAX]; /**< Max tx target power, in qdb */
6385     uint8 rf_cores;        /**< count of RF Cores being reported */
6386 } BWL_POST_PACKED_STRUCT txpwr_target_max_t;
6387 #include <packed_section_end.h>
6388 
6389 #define BSS_PEER_INFO_PARAM_CUR_VER    0
6390 /** Input structure for IOV_BSS_PEER_INFO */
6391 #include <packed_section_start.h>
6392 typedef BWL_PRE_PACKED_STRUCT    struct {
6393     uint16            version;
6394     struct    ether_addr ea;    /**< peer MAC address */
6395 } BWL_POST_PACKED_STRUCT bss_peer_info_param_t;
6396 #include <packed_section_end.h>
6397 
6398 #define BSS_PEER_INFO_CUR_VER        0
6399 
6400 #include <packed_section_start.h>
6401 typedef BWL_PRE_PACKED_STRUCT struct {
6402     uint16            version;
6403     struct ether_addr    ea;
6404     int32            rssi;
6405     uint32            tx_rate;    /**< current tx rate */
6406     uint32            rx_rate;    /**< current rx rate */
6407     wl_rateset_t        rateset;    /**< rateset in use */
6408     uint32            age;        /**< age in seconds */
6409 } BWL_POST_PACKED_STRUCT bss_peer_info_t;
6410 #include <packed_section_end.h>
6411 
6412 #define BSS_PEER_LIST_INFO_CUR_VER    0
6413 
6414 #include <packed_section_start.h>
6415 typedef BWL_PRE_PACKED_STRUCT struct {
6416     uint16            version;
6417     uint16            bss_peer_info_len;    /**< length of bss_peer_info_t */
6418     uint32            count;            /**< number of peer info */
6419     bss_peer_info_t        peer_info[1];        /**< peer info */
6420 } BWL_POST_PACKED_STRUCT bss_peer_list_info_t;
6421 #include <packed_section_end.h>
6422 
6423 #define BSS_PEER_LIST_INFO_FIXED_LEN OFFSETOF(bss_peer_list_info_t, peer_info)
6424 
6425 #define AIBSS_BCN_FORCE_CONFIG_VER_0    0
6426 
6427 /** structure used to configure AIBSS beacon force xmit */
6428 #include <packed_section_start.h>
6429 typedef BWL_PRE_PACKED_STRUCT struct {
6430     uint16  version;
6431     uint16    len;
6432     uint32 initial_min_bcn_dur;    /**< dur in ms to check a bcn in bcn_flood period */
6433     uint32 min_bcn_dur;    /**< dur in ms to check a bcn after bcn_flood period */
6434     uint32 bcn_flood_dur; /**< Initial bcn xmit period in ms */
6435 } BWL_POST_PACKED_STRUCT aibss_bcn_force_config_t;
6436 #include <packed_section_end.h>
6437 
6438 #define AIBSS_TXFAIL_CONFIG_VER_0    0
6439 #define AIBSS_TXFAIL_CONFIG_VER_1    1
6440 #define AIBSS_TXFAIL_CONFIG_CUR_VER        AIBSS_TXFAIL_CONFIG_VER_1
6441 
6442 /** structure used to configure aibss tx fail event */
6443 #include <packed_section_start.h>
6444 typedef BWL_PRE_PACKED_STRUCT struct {
6445     uint16  version;
6446     uint16  len;
6447     uint32 bcn_timeout;     /**< dur in seconds to receive 1 bcn */
6448     uint32 max_tx_retry;     /**< no of consecutive no acks to send txfail event */
6449     uint32 max_atim_failure; /**< no of consecutive atim failure */
6450 } BWL_POST_PACKED_STRUCT aibss_txfail_config_t;
6451 #include <packed_section_end.h>
6452 
6453 #include <packed_section_start.h>
6454 typedef BWL_PRE_PACKED_STRUCT struct wl_aibss_if {
6455     uint16 version;
6456     uint16 len;
6457     uint32 flags;
6458     struct ether_addr addr;
6459     chanspec_t chspec;
6460 } BWL_POST_PACKED_STRUCT wl_aibss_if_t;
6461 #include <packed_section_end.h>
6462 
6463 #include <packed_section_start.h>
6464 typedef BWL_PRE_PACKED_STRUCT struct wlc_ipfo_route_entry {
6465     struct ipv4_addr ip_addr;
6466     struct ether_addr nexthop;
6467 } BWL_POST_PACKED_STRUCT wlc_ipfo_route_entry_t;
6468 #include <packed_section_end.h>
6469 
6470 #include <packed_section_start.h>
6471 typedef BWL_PRE_PACKED_STRUCT struct wlc_ipfo_route_tbl {
6472     uint32 num_entry;
6473     wlc_ipfo_route_entry_t route_entry[1];
6474 } BWL_POST_PACKED_STRUCT wlc_ipfo_route_tbl_t;
6475 #include <packed_section_end.h>
6476 
6477 /* Version of wlc_btc_stats_t structure.
6478  * Increment whenever a change is made to wlc_btc_stats_t
6479  */
6480 #define BTCX_STATS_VER   2
6481 
6482 typedef struct wlc_btc_stats {
6483     uint16 version; /* version number of struct */
6484     uint16 valid; /* Size of this struct */
6485     uint32 stats_update_timestamp;    /* tStamp when data is updated. */
6486     uint32 btc_status; /* Hybrid/TDM indicator: Bit2:Hybrid, Bit1:TDM,Bit0:CoexEnabled */
6487     uint32 bt_req_type_map; /* BT Antenna Req types since last stats sample */
6488     uint32 bt_req_cnt; /* #BT antenna requests since last stats sampl */
6489     uint32 bt_gnt_cnt; /* #BT antenna grants since last stats sample */
6490     uint32 bt_gnt_dur; /* usec BT owns antenna since last stats sample */
6491     uint16 bt_abort_cnt; /* #Times WL was preempted due to BT since WL up */
6492     uint16 bt_rxf1ovfl_cnt; /* #Time PSNULL retry count exceeded since WL up */
6493     uint16 bt_latency_cnt; /* #Time ucode high latency detected since WL up */
6494     uint16 rsvd; /* pad to align struct to 32bit bndry     */
6495 } wlc_btc_stats_t;
6496 
6497 #define WL_IPFO_ROUTE_TBL_FIXED_LEN 4
6498 #define WL_MAX_IPFO_ROUTE_TBL_ENTRY    64
6499 
6500     /* Global ASSERT Logging */
6501 #define ASSERTLOG_CUR_VER    0x0100
6502 #define MAX_ASSRTSTR_LEN    64
6503 
6504     typedef struct assert_record {
6505         uint32 time;
6506         uint8 seq_num;
6507         int8 str[MAX_ASSRTSTR_LEN];
6508     } assert_record_t;
6509 
6510     typedef struct assertlog_results {
6511         uint16 version;
6512         uint16 record_len;
6513         uint32 num;
6514         assert_record_t logs[1];
6515     } assertlog_results_t;
6516 
6517 #define LOGRRC_FIX_LEN    8
6518 #define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
6519 #ifdef BCMWAPI_WAI
6520 /* BCMWAPI_WAI */
6521 #define IV_LEN 16
6522     struct wapi_sta_msg_t
6523     {
6524         uint16    msg_type;
6525         uint16    datalen;
6526         uint8    vap_mac[6];
6527         uint8    reserve_data1[2];
6528         uint8    sta_mac[6];
6529         uint8    reserve_data2[2];
6530         uint8    gsn[IV_LEN];
6531         uint8    wie[256];
6532     };
6533 #endif /* BCMWAPI_WAI */
6534     /* chanim acs record */
6535     typedef struct {
6536         uint8 valid;
6537         uint8 trigger;
6538         chanspec_t selected_chspc;
6539         int8 bgnoise;
6540         uint32 glitch_cnt;
6541         uint8 ccastats;
6542         uint8 chan_idle;
6543         uint32 timestamp;
6544     } chanim_acs_record_t;
6545 
6546     typedef struct {
6547         chanim_acs_record_t acs_record[CHANIM_ACS_RECORD];
6548         uint8 count;
6549         uint32 timestamp;
6550     } wl_acs_record_t;
6551 
6552 #define WL_CHANIM_STATS_V2 2
6553 #define CCASTATS_V2_MAX 9
6554 typedef struct chanim_stats_v2 {
6555     uint32 glitchcnt;               /**< normalized as per second count */
6556     uint32 badplcp;                 /**< normalized as per second count */
6557     uint8 ccastats[CCASTATS_V2_MAX];   /**< normalized as 0-255 */
6558     int8 bgnoise;                   /**< background noise level (in dBm) */
6559     chanspec_t chanspec;            /**< ctrl chanspec of the interface */
6560     uint32 timestamp;               /**< time stamp at which the stats are collected */
6561     uint32 bphy_glitchcnt;          /**< normalized as per second count */
6562     uint32 bphy_badplcp;            /**< normalized as per second count */
6563     uint8 chan_idle;                /**< normalized as 0~255 */
6564     uint8 PAD[3];
6565 } chanim_stats_v2_t;
6566 
6567 typedef struct chanim_stats {
6568     uint32 glitchcnt;               /**< normalized as per second count */
6569     uint32 badplcp;                 /**< normalized as per second count */
6570     uint8 ccastats[CCASTATS_MAX];   /**< normalized as 0-255 */
6571     int8 bgnoise;                   /**< background noise level (in dBm) */
6572     uint8 pad_1[11 - CCASTATS_MAX];
6573     chanspec_t chanspec;            /**< ctrl chanspec of the interface */
6574     uint8 pad_2[2];
6575     uint32 timestamp;               /**< time stamp at which the stats are collected */
6576     uint32 bphy_glitchcnt;          /**< normalized as per second count */
6577     uint32 bphy_badplcp;            /**< normalized as per second count */
6578     uint8 chan_idle;                /**< normalized as 0~255 */
6579     uint8 PAD[3];
6580 } chanim_stats_t;
6581 
6582 #define WL_CHANIM_STATS_VERSION 3
6583 typedef struct {
6584     uint32 buflen;
6585     uint32 version;
6586     uint32 count;
6587     chanim_stats_t stats[1];
6588 } wl_chanim_stats_t;
6589 
6590 #define WL_CHANIM_STATS_FIXED_LEN OFFSETOF(wl_chanim_stats_t, stats)
6591 
6592 /** Noise measurement metrics. */
6593 #define NOISE_MEASURE_KNOISE    0x1
6594 
6595 /** scb probe parameter */
6596 typedef struct {
6597     uint32 scb_timeout;
6598     uint32 scb_activity_time;
6599     uint32 scb_max_probe;
6600 } wl_scb_probe_t;
6601 
6602 /* structure/defines for selective mgmt frame (smf) stats support */
6603 
6604 #define SMFS_VERSION 1
6605 /** selected mgmt frame (smf) stats element */
6606 typedef struct wl_smfs_elem {
6607     uint32 count;
6608     uint16 code;  /**< SC or RC code */
6609     uint8 PAD[2];
6610 } wl_smfs_elem_t;
6611 
6612 typedef struct wl_smf_stats {
6613     uint32 version;
6614     uint16 length;    /**< reserved for future usage */
6615     uint8 type;
6616     uint8 codetype;
6617     uint32 ignored_cnt;
6618     uint32 malformed_cnt;
6619     uint32 count_total; /**< count included the interested group */
6620     wl_smfs_elem_t elem[1];
6621 } wl_smf_stats_t;
6622 
6623 #define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);
6624 
6625 enum {
6626     SMFS_CODETYPE_SC,
6627     SMFS_CODETYPE_RC
6628 };
6629 
6630 typedef enum smfs_type {
6631     SMFS_TYPE_AUTH,
6632     SMFS_TYPE_ASSOC,
6633     SMFS_TYPE_REASSOC,
6634     SMFS_TYPE_DISASSOC_TX,
6635     SMFS_TYPE_DISASSOC_RX,
6636     SMFS_TYPE_DEAUTH_TX,
6637     SMFS_TYPE_DEAUTH_RX,
6638     SMFS_TYPE_MAX
6639 } smfs_type_t;
6640 
6641 /* #ifdef PHYMON */
6642 
6643 #define PHYMON_VERSION 1
6644 
6645 typedef struct wl_phycal_core_state {
6646     /* Tx IQ/LO calibration coeffs */
6647     int16 tx_iqlocal_a;
6648     int16 tx_iqlocal_b;
6649     int8 tx_iqlocal_ci;
6650     int8 tx_iqlocal_cq;
6651     int8 tx_iqlocal_di;
6652     int8 tx_iqlocal_dq;
6653     int8 tx_iqlocal_ei;
6654     int8 tx_iqlocal_eq;
6655     int8 tx_iqlocal_fi;
6656     int8 tx_iqlocal_fq;
6657 
6658     /** Rx IQ calibration coeffs */
6659     int16 rx_iqcal_a;
6660     int16 rx_iqcal_b;
6661 
6662     uint8 tx_iqlocal_pwridx; /**< Tx Power Index for Tx IQ/LO calibration */
6663     uint8 PAD[3];
6664     uint32 papd_epsilon_table[64]; /**< PAPD epsilon table */
6665     int16 papd_epsilon_offset; /**< PAPD epsilon offset */
6666     uint8 curr_tx_pwrindex; /**< Tx power index */
6667     int8 idle_tssi; /**< Idle TSSI */
6668     int8 est_tx_pwr; /**< Estimated Tx Power (dB) */
6669     int8 est_rx_pwr; /**< Estimated Rx Power (dB) from RSSI */
6670     uint16 rx_gaininfo; /**< Rx gain applied on last Rx pkt */
6671     uint16 init_gaincode; /**< initgain required for ACI */
6672     int8 estirr_tx;
6673     int8 estirr_rx;
6674 } wl_phycal_core_state_t;
6675 
6676 typedef struct wl_phycal_state {
6677     int32 version;
6678     int8 num_phy_cores; /**< number of cores */
6679     int8 curr_temperature; /**< on-chip temperature sensor reading */
6680     chanspec_t chspec; /**< channspec for this state */
6681     uint8 aci_state; /**< ACI state: ON/OFF */
6682     uint8 PAD;
6683     uint16 crsminpower; /**< crsminpower required for ACI */
6684     uint16 crsminpowerl; /**< crsminpowerl required for ACI */
6685     uint16 crsminpoweru; /**< crsminpoweru required for ACI */
6686     wl_phycal_core_state_t phycal_core[1];
6687 } wl_phycal_state_t;
6688 
6689 #define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
6690 /* endif PHYMON */
6691 
6692 /** discovery state */
6693 typedef struct wl_p2p_disc_st {
6694     uint8 state;    /**< see state */
6695     uint8 PAD;
6696     chanspec_t chspec;    /**< valid in listen state */
6697     uint16 dwell;    /**< valid in listen state, in ms */
6698 } wl_p2p_disc_st_t;
6699 
6700 /** scan request */
6701 typedef struct wl_p2p_scan {
6702     uint8 type;        /**< 'S' for WLC_SCAN, 'E' for "escan" */
6703     uint8 reserved[3];
6704     /* scan or escan parms... */
6705 } wl_p2p_scan_t;
6706 
6707 /** i/f request */
6708 typedef struct wl_p2p_if {
6709     struct ether_addr addr;
6710     uint8 type;    /**< see i/f type */
6711     uint8 PAD;
6712     chanspec_t chspec;    /**< for p2p_ifadd GO */
6713 } wl_p2p_if_t;
6714 
6715 /** i/f query */
6716 typedef struct wl_p2p_ifq {
6717     uint32 bsscfgidx;
6718     char ifname[BCM_MSG_IFNAME_MAX];
6719 } wl_p2p_ifq_t;
6720 
6721 /** OppPS & CTWindow */
6722 typedef struct wl_p2p_ops {
6723     uint8 ops;    /**< 0: disable 1: enable */
6724     uint8 ctw;    /**< >= 10 */
6725 } wl_p2p_ops_t;
6726 
6727 /** absence and presence request */
6728 typedef struct wl_p2p_sched_desc {
6729     uint32 start;
6730     uint32 interval;
6731     uint32 duration;
6732     uint32 count;    /**< see count */
6733 } wl_p2p_sched_desc_t;
6734 
6735 typedef struct wl_p2p_sched {
6736     uint8 type;    /**< see schedule type */
6737     uint8 action;    /**< see schedule action */
6738     uint8 option;    /**< see schedule option */
6739     uint8 PAD;
6740     wl_p2p_sched_desc_t desc[1];
6741 } wl_p2p_sched_t;
6742 
6743 typedef struct wl_p2p_wfds_hash {
6744     uint32    advt_id;
6745     uint16    nw_cfg_method;
6746     uint8    wfds_hash[6];
6747     uint8    name_len;
6748     uint8    service_name[MAX_WFDS_SVC_NAME_LEN];
6749     uint8    PAD[3];
6750 } wl_p2p_wfds_hash_t;
6751 
6752 typedef struct wl_bcmdcs_data {
6753     uint32 reason;
6754     chanspec_t chspec;
6755     uint8    PAD[2];
6756 } wl_bcmdcs_data_t;
6757 /* ifdef EXT_STA */
6758 /**
6759  * Format of IHV data passed to OID_DOT11_NIC_SPECIFIC_EXTENSION.
6760  */
6761 typedef struct _IHV_NIC_SPECIFIC_EXTENSION {
6762     uint8            oui[4];     /**< vendor specific OUI value */
6763     uint32            event;      /**< event code */
6764     uint8            ihvData[1];    /**< ihv data */
6765 } IHV_NIC_SPECIFIC_EXTENSION, *PIHV_NIC_SPECIFIC_EXTENSION;
6766 #define IHV_NIC_SPECIFIC_EXTENTION_HEADER    OFFSETOF(IHV_NIC_SPECIFIC_EXTENSION, ihvData[0])
6767 /* EXT_STA */
6768 /** NAT configuration */
6769 typedef struct {
6770     uint32 ipaddr;        /**< interface ip address */
6771     uint32 ipaddr_mask;    /**< interface ip address mask */
6772     uint32 ipaddr_gateway;    /**< gateway ip address */
6773     uint8 mac_gateway[6];    /**< gateway mac address */
6774     uint8    PAD[2];
6775     uint32 ipaddr_dns;    /**< DNS server ip address, valid only for public if */
6776     uint8 mac_dns[6];    /**< DNS server mac address,  valid only for public if */
6777     uint8 GUID[38];        /**< interface GUID */
6778 } nat_if_info_t;
6779 
6780 typedef struct {
6781     uint32 op;        /**< operation code */
6782     uint8 pub_if;        /**< set for public if, clear for private if */
6783     uint8    PAD[3];
6784     nat_if_info_t if_info;    /**< interface info */
6785 } nat_cfg_t;
6786 
6787 typedef struct {
6788     int32 state;    /**< NAT state returned */
6789 } nat_state_t;
6790 
6791 typedef struct flush_txfifo {
6792     uint32 txfifobmp;
6793     uint32 hwtxfifoflush;
6794     struct ether_addr ea;
6795     uint8    PAD[2];
6796 } flush_txfifo_t;
6797 
6798 enum {
6799     SPATIAL_MODE_2G_IDX = 0,
6800     SPATIAL_MODE_5G_LOW_IDX,
6801     SPATIAL_MODE_5G_MID_IDX,
6802     SPATIAL_MODE_5G_HIGH_IDX,
6803     SPATIAL_MODE_5G_UPPER_IDX,
6804     SPATIAL_MODE_MAX_IDX
6805 };
6806 
6807 #define WLC_TXCORE_MAX        4    /**< max number of txcore supports */
6808 #define WLC_TXCORE_MAX_OLD    2    /**< backward compatibilty for TXCAL */
6809 #define WLC_SUBBAND_MAX        4    /**< max number of sub-band supports */
6810 typedef struct {
6811     uint8    band2g[WLC_TXCORE_MAX];
6812     uint8    band5g[WLC_SUBBAND_MAX][WLC_TXCORE_MAX];
6813 } sar_limit_t;
6814 
6815 #define MAX_NUM_TXCAL_MEAS 128
6816 #define MAX_NUM_PWR_STEP 40
6817 #define TXCAL_IOVAR_VERSION    0x1
6818 typedef struct wl_txcal_meas_percore {
6819     uint16 tssi[MAX_NUM_TXCAL_MEAS];
6820     int16 pwr[MAX_NUM_TXCAL_MEAS];
6821 } wl_txcal_meas_percore_t;
6822 
6823 typedef struct wl_txcal_meas_ncore {
6824     uint16 version;
6825     uint8 valid_cnt;
6826     uint8 num_core;
6827     wl_txcal_meas_percore_t txcal_percore[1];
6828 } wl_txcal_meas_ncore_t;
6829 
6830 typedef struct wl_txcal_power_tssi_percore {
6831     int16 tempsense;
6832     int16 pwr_start;
6833     uint8 pwr_start_idx;
6834     uint8 num_entries;
6835     uint16 pad;
6836     uint8 tssi[MAX_NUM_PWR_STEP];
6837 } wl_txcal_power_tssi_percore_t;
6838 
6839 typedef struct wl_txcal_power_tssi_ncore {
6840     uint16 version;
6841     uint8 set_core;
6842     uint8 channel;
6843     uint8 num_core;
6844     uint8 gen_tbl;
6845     uint16 pad;
6846     wl_txcal_power_tssi_percore_t tssi_percore[1];
6847 } wl_txcal_power_tssi_ncore_t;
6848 
6849 typedef struct wl_txcal_meas {
6850     uint16 tssi[WLC_TXCORE_MAX][MAX_NUM_TXCAL_MEAS];
6851     int16 pwr[WLC_TXCORE_MAX][MAX_NUM_TXCAL_MEAS];
6852     uint8 valid_cnt;
6853     uint8 PAD;
6854 } wl_txcal_meas_t;
6855 
6856 typedef struct wl_txcal_meas_old {
6857     uint16 tssi[WLC_TXCORE_MAX_OLD][MAX_NUM_TXCAL_MEAS];
6858     int16 pwr[WLC_TXCORE_MAX_OLD][MAX_NUM_TXCAL_MEAS];
6859     uint8 valid_cnt;
6860     uint8 PAD;
6861 } wl_txcal_meas_old_t;
6862 
6863 typedef struct wl_txcal_power_tssi {
6864     uint8 set_core;
6865     uint8 channel;
6866     int16 tempsense[WLC_TXCORE_MAX];
6867     int16 pwr_start[WLC_TXCORE_MAX];
6868     uint8 pwr_start_idx[WLC_TXCORE_MAX];
6869     uint8 num_entries[WLC_TXCORE_MAX];
6870     uint8 tssi[WLC_TXCORE_MAX][MAX_NUM_PWR_STEP];
6871     uint8 gen_tbl;
6872     uint8 PAD;
6873 } wl_txcal_power_tssi_t;
6874 
6875 typedef struct wl_txcal_power_tssi_old {
6876     uint8 set_core;
6877     uint8 channel;
6878     int16 tempsense[WLC_TXCORE_MAX_OLD];
6879     int16 pwr_start[WLC_TXCORE_MAX_OLD];
6880     uint8 pwr_start_idx[WLC_TXCORE_MAX_OLD];
6881     uint8 num_entries[WLC_TXCORE_MAX_OLD];
6882     uint8 tssi[WLC_TXCORE_MAX_OLD][MAX_NUM_PWR_STEP];
6883     uint8 gen_tbl;
6884     uint8 PAD;
6885 } wl_txcal_power_tssi_old_t;
6886 
6887 typedef struct wl_olpc_pwr {
6888     uint16 version;
6889     uint8 core;
6890     uint8 channel;
6891     int16 tempsense;
6892     uint8 olpc_idx;
6893     uint8 pad;
6894 } wl_olpc_pwr_t;
6895 
6896 /** IOVAR "mempool" parameter. Used to retrieve a list of memory pool statistics. */
6897 typedef struct wl_mempool_stats {
6898     int32 num;        /**< Number of memory pools */
6899     bcm_mp_stats_t s[1];    /**< Variable array of memory pool stats. */
6900 } wl_mempool_stats_t;
6901 
6902 typedef struct {
6903     uint32 ipaddr;
6904     uint32 ipaddr_netmask;
6905     uint32 ipaddr_gateway;
6906 } nwoe_ifconfig_t;
6907 
6908 /** Traffic management priority classes */
6909 typedef enum trf_mgmt_priority_class {
6910     trf_mgmt_priority_low           = 0,        /**< Maps to 802.1p BK */
6911     trf_mgmt_priority_medium        = 1,        /**< Maps to 802.1p BE */
6912     trf_mgmt_priority_high          = 2,        /**< Maps to 802.1p VI */
6913     trf_mgmt_priority_nochange    = 3,        /**< do not update the priority */
6914     trf_mgmt_priority_invalid       = (trf_mgmt_priority_nochange + 1)
6915 } trf_mgmt_priority_class_t;
6916 
6917 /** Traffic management configuration parameters */
6918 typedef struct trf_mgmt_config {
6919     uint32  trf_mgmt_enabled;                           /**< 0 - disabled, 1 - enabled */
6920     uint32  flags;                                      /**< See TRF_MGMT_FLAG_xxx defines */
6921     uint32  host_ip_addr;                              /**< My IP address to determine subnet */
6922     uint32  host_subnet_mask;                           /**< My subnet mask */
6923     uint32  downlink_bandwidth;                         /**< In units of kbps */
6924     uint32  uplink_bandwidth;                           /**< In units of kbps */
6925     uint32  min_tx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /**< Minimum guaranteed tx bandwidth */
6926     uint32  min_rx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /**< Minimum guaranteed rx bandwidth */
6927 } trf_mgmt_config_t;
6928 
6929 /** Traffic management filter */
6930 typedef struct trf_mgmt_filter {
6931     struct ether_addr           dst_ether_addr;         /**< His L2 address */
6932     uint8                        PAD[2];
6933     uint32                      dst_ip_addr;            /**< His IP address */
6934     uint16                      dst_port;               /**< His L4 port */
6935     uint16                      src_port;               /**< My L4 port */
6936     uint16                      prot;                   /**< L4 protocol (only TCP or UDP) */
6937     uint16                      flags;                  /**< TBD. For now, this must be zero. */
6938     trf_mgmt_priority_class_t   priority;               /**< Priority for filtered packets */
6939     uint32                      dscp;                   /**< DSCP */
6940 } trf_mgmt_filter_t;
6941 
6942 /** Traffic management filter list (variable length) */
6943 typedef struct trf_mgmt_filter_list     {
6944     uint32              num_filters;
6945     trf_mgmt_filter_t   filter[1];
6946 } trf_mgmt_filter_list_t;
6947 
6948 /** Traffic management global info used for all queues */
6949 typedef struct trf_mgmt_global_info {
6950     uint32  maximum_bytes_per_second;
6951     uint32  maximum_bytes_per_sampling_period;
6952     uint32  total_bytes_consumed_per_second;
6953     uint32  total_bytes_consumed_per_sampling_period;
6954     uint32  total_unused_bytes_per_sampling_period;
6955 } trf_mgmt_global_info_t;
6956 
6957 /** Traffic management shaping info per priority queue */
6958 typedef struct trf_mgmt_shaping_info {
6959     uint32  gauranteed_bandwidth_percentage;
6960     uint32  guaranteed_bytes_per_second;
6961     uint32  guaranteed_bytes_per_sampling_period;
6962     uint32  num_bytes_produced_per_second;
6963     uint32  num_bytes_consumed_per_second;
6964     uint32  num_queued_packets;                         /**< Number of packets in queue */
6965     uint32  num_queued_bytes;                           /**< Number of bytes in queue */
6966 } trf_mgmt_shaping_info_t;
6967 
6968 /** Traffic management shaping info array */
6969 typedef struct trf_mgmt_shaping_info_array {
6970     trf_mgmt_global_info_t   tx_global_shaping_info;
6971     trf_mgmt_shaping_info_t  tx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
6972     trf_mgmt_global_info_t   rx_global_shaping_info;
6973     trf_mgmt_shaping_info_t  rx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
6974 } trf_mgmt_shaping_info_array_t;
6975 
6976 
6977 /** Traffic management statistical counters */
6978 typedef struct trf_mgmt_stats {
6979     uint32  num_processed_packets;      /**< Number of packets processed */
6980     uint32  num_processed_bytes;        /**< Number of bytes processed */
6981     uint32  num_discarded_packets;      /**< Number of packets discarded from queue */
6982 } trf_mgmt_stats_t;
6983 
6984 /** Traffic management statistics array */
6985 typedef struct trf_mgmt_stats_array {
6986     trf_mgmt_stats_t  tx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
6987     trf_mgmt_stats_t  rx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
6988 } trf_mgmt_stats_array_t;
6989 
6990 /* Both powersel_params and lpc_params are used by IOVAR lpc_params.
6991  * The powersel_params is replaced by lpc_params in later WLC versions.
6992  */
6993 typedef struct powersel_params {
6994     /* LPC Params exposed via IOVAR */
6995     int32        tp_ratio_thresh;  /**< Throughput ratio threshold */
6996     uint8        rate_stab_thresh; /**< Thresh for rate stability based on nupd */
6997     uint8        pwr_stab_thresh; /**< Number of successes before power step down */
6998     uint8        pwr_sel_exp_time; /**< Time lapse for expiry of database */
6999     uint8        PAD;
7000 } powersel_params_t;
7001 
7002 #define WL_LPC_PARAMS_VER_2    2
7003 #define WL_LPC_PARAMS_CURRENT_VERSION WL_LPC_PARAMS_VER_2
7004 
7005 typedef struct lpc_params {
7006     uint16        version;
7007     uint16        length;
7008     /* LPC Params exposed via IOVAR */
7009     uint8        rate_stab_thresh; /**< Thresh for rate stability based on nupd */
7010     uint8        pwr_stab_thresh; /**< Number of successes before power step down */
7011     uint8        lpc_exp_time; /**< Time lapse for expiry of database */
7012     uint8        pwrup_slow_step; /**< Step size for slow step up */
7013     uint8        pwrup_fast_step; /**< Step size for fast step up */
7014     uint8        pwrdn_slow_step; /**< Step size for slow step down */
7015 } lpc_params_t;
7016 
7017 /* tx pkt delay statistics */
7018 #define    SCB_RETRY_SHORT_DEF    7    /**< Default Short retry Limit */
7019 #define WLPKTDLY_HIST_NBINS    16    /**< number of bins used in the Delay histogram */
7020 
7021 /** structure to store per-AC delay statistics */
7022 typedef struct scb_delay_stats {
7023     uint32 txmpdu_lost;    /**< number of MPDUs lost */
7024     uint32 txmpdu_cnt[SCB_RETRY_SHORT_DEF]; /**< retry times histogram */
7025     uint32 delay_sum[SCB_RETRY_SHORT_DEF]; /**< cumulative packet latency */
7026     uint32 delay_min;    /**< minimum packet latency observed */
7027     uint32 delay_max;    /**< maximum packet latency observed */
7028     uint32 delay_avg;    /**< packet latency average */
7029     uint32 delay_hist[WLPKTDLY_HIST_NBINS];    /**< delay histogram */
7030     uint32 delay_count;    /**< minimum number of time period units before
7031                 consequent packet delay events can be generated
7032                 */
7033     uint32 prev_txmpdu_cnt;    /**< Previous value of txmpdu_cnt[] during last iteration */
7034     uint32 prev_delay_sum;    /**< Previous value of delay_sum[] during last iteration */
7035 } scb_delay_stats_t;
7036 
7037 /** structure for txdelay event */
7038 typedef struct txdelay_event {
7039     uint8                status;
7040     uint8                PAD[3];
7041     int32                rssi;
7042     chanim_stats_t        chanim_stats;
7043     scb_delay_stats_t    delay_stats[AC_COUNT];
7044 } txdelay_event_t;
7045 
7046 /** structure for txdelay parameters */
7047 typedef struct txdelay_params {
7048     uint16    ratio;    /**< Avg Txdelay Delta */
7049     uint8    cnt;    /**< Sample cnt */
7050     uint8    period;    /**< Sample period */
7051     uint8    tune;    /**< Debug */
7052     uint8    PAD;
7053 } txdelay_params_t;
7054 #define MAX_TXDELAY_STATS_SCBS 6
7055 #define TXDELAY_STATS_VERSION 1
7056 
7057 enum {
7058     TXDELAY_STATS_PARTIAL_RESULT = 0,
7059     TXDELAY_STATS_FULL_RESULT = 1
7060 };
7061 
7062 typedef struct scb_total_delay_stats {
7063     struct  ether_addr ea;
7064     uint8   pad[2];
7065     scb_delay_stats_t dlystats[AC_COUNT];
7066 } scb_total_delay_stats_t;
7067 
7068 typedef struct txdelay_stats {
7069     uint32  version;
7070     uint32  full_result;    /* 0:Partial, 1:full */
7071     uint32  scb_cnt;        /* in:requested, out:returned */
7072     scb_total_delay_stats_t scb_delay_stats[1];
7073 } txdelay_stats_t;
7074 
7075 #define WL_TXDELAY_STATS_FIXED_SIZE \
7076     (sizeof(txdelay_stats_t)+(MAX_TXDELAY_STATS_SCBS-1)*sizeof(scb_total_delay_stats_t))
7077 enum {
7078     WNM_SERVICE_DMS = 1,
7079     WNM_SERVICE_FMS = 2,
7080     WNM_SERVICE_TFS = 3
7081 };
7082 
7083 /** Definitions for WNM/NPS TCLAS */
7084 typedef struct wl_tclas {
7085     uint8 user_priority;
7086     uint8 fc_len;
7087     dot11_tclas_fc_t fc;
7088 } wl_tclas_t;
7089 
7090 #define WL_TCLAS_FIXED_SIZE    OFFSETOF(wl_tclas_t, fc)
7091 
7092 typedef struct wl_tclas_list {
7093     uint32 num;
7094     wl_tclas_t tclas[];
7095 } wl_tclas_list_t;
7096 
7097 /** Definitions for WNM/NPS Traffic Filter Service */
7098 typedef struct wl_tfs_req {
7099     uint8 tfs_id;
7100     uint8 tfs_actcode;
7101     uint8 tfs_subelem_id;
7102     uint8 send;
7103 } wl_tfs_req_t;
7104 
7105 typedef struct wl_tfs_filter {
7106     uint8 status;            /**< Status returned by the AP */
7107     uint8 tclas_proc;        /**< TCLAS processing value (0:and, 1:or)  */
7108     uint8 tclas_cnt;        /**< count of all wl_tclas_t in tclas array */
7109     uint8 tclas[1];            /**< VLA of wl_tclas_t */
7110 } wl_tfs_filter_t;
7111 #define WL_TFS_FILTER_FIXED_SIZE    OFFSETOF(wl_tfs_filter_t, tclas)
7112 
7113 typedef struct wl_tfs_fset {
7114     struct ether_addr ea;        /**< Address of AP/STA involved with this filter set */
7115     uint8 tfs_id;            /**< TFS ID field chosen by STA host */
7116     uint8 status;            /**< Internal status TFS_STATUS_xxx */
7117     uint8 actcode;            /**< Action code DOT11_TFS_ACTCODE_xxx */
7118     uint8 token;            /**< Token used in last request frame */
7119     uint8 notify;            /**< Notify frame sent/received because of this set */
7120     uint8 filter_cnt;        /**< count of all wl_tfs_filter_t in filter array */
7121     uint8 filter[1];        /**< VLA of wl_tfs_filter_t */
7122 } wl_tfs_fset_t;
7123 #define WL_TFS_FSET_FIXED_SIZE        OFFSETOF(wl_tfs_fset_t, filter)
7124 
7125 enum {
7126     TFS_STATUS_DISABLED = 0,    /**< TFS filter set disabled by user */
7127     TFS_STATUS_DISABLING = 1,    /**< Empty request just sent to AP */
7128     TFS_STATUS_VALIDATED = 2,    /**< Filter set validated by AP (but maybe not enabled!) */
7129     TFS_STATUS_VALIDATING = 3,    /**< Filter set just sent to AP */
7130     TFS_STATUS_NOT_ASSOC = 4,    /**< STA not associated */
7131     TFS_STATUS_NOT_SUPPORT = 5,    /**< TFS not supported by AP */
7132     TFS_STATUS_DENIED = 6,        /**< Filter set refused by AP (=> all sets are disabled!) */
7133 };
7134 
7135 typedef struct wl_tfs_status {
7136     uint8 fset_cnt;            /**< count of all wl_tfs_fset_t in fset array */
7137     wl_tfs_fset_t fset[1];        /**< VLA of wl_tfs_fset_t */
7138 } wl_tfs_status_t;
7139 
7140 typedef struct wl_tfs_set {
7141     uint8 send;        /**< Immediatly register registered sets on AP side */
7142     uint8 tfs_id;        /**< ID of a specific set (existing or new), or nul for all */
7143     uint8 actcode;        /**< Action code for this filter set */
7144     uint8 tclas_proc;    /**< TCLAS processing operator for this filter set */
7145 } wl_tfs_set_t;
7146 
7147 typedef struct wl_tfs_term {
7148     uint8 del;            /**< Delete internal set once confirmation received */
7149     uint8 tfs_id;            /**< ID of a specific set (existing), or nul for all */
7150 } wl_tfs_term_t;
7151 
7152 
7153 #define DMS_DEP_PROXY_ARP (1 << 0)
7154 
7155 /* Definitions for WNM/NPS Directed Multicast Service */
7156 enum {
7157     DMS_STATUS_DISABLED = 0,    /**< DMS desc disabled by user */
7158     DMS_STATUS_ACCEPTED = 1,    /**< Request accepted by AP */
7159     DMS_STATUS_NOT_ASSOC = 2,    /**< STA not associated */
7160     DMS_STATUS_NOT_SUPPORT = 3,    /**< DMS not supported by AP */
7161     DMS_STATUS_DENIED = 4,        /**< Request denied by AP */
7162     DMS_STATUS_TERM = 5,        /**< Request terminated by AP */
7163     DMS_STATUS_REMOVING = 6,    /**< Remove request just sent */
7164     DMS_STATUS_ADDING = 7,        /**< Add request just sent */
7165     DMS_STATUS_ERROR = 8,        /**< Non compliant AP behvior */
7166     DMS_STATUS_IN_PROGRESS = 9,    /**< Request just sent */
7167     DMS_STATUS_REQ_MISMATCH = 10    /**< Conditions for sending DMS req not met */
7168 };
7169 
7170 typedef struct wl_dms_desc {
7171     uint8 user_id;
7172     uint8 status;
7173     uint8 token;
7174     uint8 dms_id;
7175     uint8 tclas_proc;
7176     uint8 mac_len;        /**< length of all ether_addr in data array, 0 if STA */
7177     uint8 tclas_len;    /**< length of all wl_tclas_t in data array */
7178     uint8 data[1];        /**< VLA of 'ether_addr' and 'wl_tclas_t' (in this order ) */
7179 } wl_dms_desc_t;
7180 
7181 #define WL_DMS_DESC_FIXED_SIZE    OFFSETOF(wl_dms_desc_t, data)
7182 
7183 typedef struct wl_dms_status {
7184     uint32 cnt;
7185     wl_dms_desc_t desc[1];
7186 } wl_dms_status_t;
7187 
7188 typedef struct wl_dms_set {
7189     uint8 send;
7190     uint8 user_id;
7191     uint8 tclas_proc;
7192 } wl_dms_set_t;
7193 
7194 typedef struct wl_dms_term {
7195     uint8 del;
7196     uint8 user_id;
7197 } wl_dms_term_t;
7198 
7199 typedef struct wl_service_term {
7200     uint8 service;
7201     union {
7202         wl_dms_term_t dms;
7203     } u;
7204 } wl_service_term_t;
7205 
7206 /** Definitions for WNM/NPS BSS Transistion */
7207 typedef struct wl_bsstrans_req {
7208     uint16 tbtt;            /**< time of BSS to end of life, in unit of TBTT */
7209     uint16 dur;            /**< time of BSS to keep off, in unit of minute */
7210     uint8 reqmode;            /**< request mode of BSS transition request */
7211     uint8 unicast;            /**< request by unicast or by broadcast */
7212 } wl_bsstrans_req_t;
7213 
7214 enum {
7215     BSSTRANS_RESP_AUTO = 0,        /**< Currently equivalent to ENABLE */
7216     BSSTRANS_RESP_DISABLE = 1,    /**< Never answer BSS Trans Req frames */
7217     BSSTRANS_RESP_ENABLE = 2,    /**< Always answer Req frames with preset data */
7218     BSSTRANS_RESP_WAIT = 3,        /**< Send ind, wait and/or send preset data (NOT IMPL) */
7219     BSSTRANS_RESP_IMMEDIATE = 4    /**< After an ind, set data and send resp (NOT IMPL) */
7220 };
7221 
7222 typedef struct wl_bsstrans_resp {
7223     uint8 policy;
7224     uint8 status;
7225     uint8 delay;
7226     struct ether_addr target;
7227 } wl_bsstrans_resp_t;
7228 
7229 /* "wnm_bsstrans_policy" argument programs behavior after BSSTRANS Req reception.
7230  * BSS-Transition feature is used by multiple programs such as NPS-PF, VE-PF,
7231  * Band-steering, Hotspot 2.0 and customer requirements. Each PF and its test plan
7232  * mandates different behavior on receiving BSS-transition request. To accomodate
7233  * such divergent behaviors these policies have been created.
7234  */
7235 typedef enum {
7236     WL_BSSTRANS_POLICY_ROAM_ALWAYS = 0,    /**< Roam (or disassociate) in all cases */
7237     WL_BSSTRANS_POLICY_ROAM_IF_MODE = 1,    /**< Roam only if requested by Request Mode field */
7238     WL_BSSTRANS_POLICY_ROAM_IF_PREF = 2,    /**< Roam only if Preferred BSS provided */
7239     WL_BSSTRANS_POLICY_WAIT = 3,        /**< Wait for deauth and send Accepted status */
7240     WL_BSSTRANS_POLICY_PRODUCT = 4,    /**< Policy for real product use cases (Olympic) */
7241     WL_BSSTRANS_POLICY_PRODUCT_WBTEXT = 5,    /**< Policy for real product use cases (SS) */
7242     WL_BSSTRANS_POLICY_MAX = 6
7243 } wnm_bsstrans_policy_type_t;
7244 
7245 /** Definitions for WNM/NPS TIM Broadcast */
7246 typedef struct wl_timbc_offset {
7247     int16 offset;        /**< offset in us */
7248     uint16 fix_intv;    /**< override interval sent from STA */
7249     uint16 rate_override;    /**< use rate override to send high rate TIM broadcast frame */
7250     uint8 tsf_present;    /**< show timestamp in TIM broadcast frame */
7251     uint8 PAD;
7252 } wl_timbc_offset_t;
7253 
7254 typedef struct wl_timbc_set {
7255     uint8 interval;        /**< Interval in DTIM wished or required. */
7256     uint8 flags;        /**< Bitfield described below */
7257     uint16 rate_min;    /**< Minimum rate required for High/Low TIM frames. Optionnal */
7258     uint16 rate_max;    /**< Maximum rate required for High/Low TIM frames. Optionnal */
7259 } wl_timbc_set_t;
7260 
7261 enum {
7262     WL_TIMBC_SET_TSF_REQUIRED = 1,    /**< Enable TIMBC only if TSF in TIM frames */
7263     WL_TIMBC_SET_NO_OVERRIDE = 2,    /**< ... if AP does not override interval */
7264     WL_TIMBC_SET_PROXY_ARP = 4,    /**< ... if AP support Proxy ARP */
7265     WL_TIMBC_SET_DMS_ACCEPTED = 8    /**< ... if all DMS desc have been accepted */
7266 };
7267 
7268 typedef struct wl_timbc_status {
7269     uint8 status_sta;        /**< Status from internal state machine (check below) */
7270     uint8 status_ap;        /**< From AP response frame (check 8.4.2.86 from 802.11) */
7271     uint8 interval;
7272     uint8 pad;
7273     int32 offset;
7274     uint16 rate_high;
7275     uint16 rate_low;
7276 } wl_timbc_status_t;
7277 
7278 enum {
7279     WL_TIMBC_STATUS_DISABLE = 0,        /**< TIMBC disabled by user */
7280     WL_TIMBC_STATUS_REQ_MISMATCH = 1,    /**< AP settings do no match user requirements */
7281     WL_TIMBC_STATUS_NOT_ASSOC = 2,        /**< STA not associated */
7282     WL_TIMBC_STATUS_NOT_SUPPORT = 3,    /**< TIMBC not supported by AP */
7283     WL_TIMBC_STATUS_DENIED = 4,        /**< Req to disable TIMBC sent to AP */
7284     WL_TIMBC_STATUS_ENABLE = 5        /**< TIMBC enabled */
7285 };
7286 
7287 /** Definitions for PM2 Dynamic Fast Return To Sleep */
7288 typedef struct wl_pm2_sleep_ret_ext {
7289     uint8  logic;            /**< DFRTS logic: see WL_DFRTS_LOGIC_* below */
7290     uint8  PAD;
7291     uint16 low_ms;            /**< Low FRTS timeout */
7292     uint16 high_ms;            /**< High FRTS timeout */
7293     uint16 rx_pkts_threshold;    /**< switching threshold: # rx pkts */
7294     uint16 tx_pkts_threshold;    /**< switching threshold: # tx pkts */
7295     uint16 txrx_pkts_threshold;    /**< switching threshold: # (tx+rx) pkts */
7296     uint32 rx_bytes_threshold;    /**< switching threshold: # rx bytes */
7297     uint32 tx_bytes_threshold;    /**< switching threshold: # tx bytes */
7298     uint32 txrx_bytes_threshold;    /**< switching threshold: # (tx+rx) bytes */
7299 } wl_pm2_sleep_ret_ext_t;
7300 
7301 #define WL_DFRTS_LOGIC_OFF    0    /**< Feature is disabled */
7302 #define WL_DFRTS_LOGIC_OR    1    /**< OR all non-zero threshold conditions */
7303 #define WL_DFRTS_LOGIC_AND    2    /**< AND all non-zero threshold conditions */
7304 
7305 /* Values for the passive_on_restricted_mode iovar.  When set to non-zero, this iovar
7306  * disables automatic conversions of a channel from passively scanned to
7307  * actively scanned.  These values only have an effect for country codes such
7308  * as XZ where some 5 GHz channels are defined to be passively scanned.
7309  */
7310 #define WL_PASSACTCONV_DISABLE_NONE    0    /**< Enable permanent and temporary conversions */
7311 #define WL_PASSACTCONV_DISABLE_ALL    1    /**< Disable permanent and temporary conversions */
7312 #define WL_PASSACTCONV_DISABLE_PERM    2    /**< Disable only permanent conversions */
7313 
7314 /* Definitions for Reliable Multicast */
7315 #define WL_RMC_CNT_VERSION       1
7316 #define WL_RMC_TR_VERSION       1
7317 #define WL_RMC_MAX_CLIENT       32
7318 #define WL_RMC_FLAG_INBLACKLIST       1
7319 #define WL_RMC_FLAG_ACTIVEACKER       2
7320 #define WL_RMC_FLAG_RELMCAST       4
7321 #define WL_RMC_MAX_TABLE_ENTRY     4
7322 
7323 #define WL_RMC_VER           1
7324 #define WL_RMC_INDEX_ACK_ALL       255
7325 #define WL_RMC_NUM_OF_MC_STREAMS   4
7326 #define WL_RMC_MAX_TRS_PER_GROUP   1
7327 #define WL_RMC_MAX_TRS_IN_ACKALL   1
7328 #define WL_RMC_ACK_MCAST0          0x02
7329 #define WL_RMC_ACK_MCAST_ALL       0x01
7330 #define WL_RMC_ACTF_TIME_MIN       300        /**< time in ms */
7331 #define WL_RMC_ACTF_TIME_MAX       20000    /**< time in ms */
7332 #define WL_RMC_MAX_NUM_TRS       32        /**< maximun transmitters allowed */
7333 #define WL_RMC_ARTMO_MIN           350        /**< time in ms */
7334 #define WL_RMC_ARTMO_MAX           40000    /**< time in ms */
7335 
7336 /* RMC events in action frames */
7337 enum rmc_opcodes {
7338     RELMCAST_ENTRY_OP_DISABLE = 0,   /**< Disable multi-cast group */
7339     RELMCAST_ENTRY_OP_DELETE  = 1,   /**< Delete multi-cast group */
7340     RELMCAST_ENTRY_OP_ENABLE  = 2,   /**< Enable multi-cast group */
7341     RELMCAST_ENTRY_OP_ACK_ALL = 3    /**< Enable ACK ALL bit in AMT */
7342 };
7343 
7344 /* RMC operational modes */
7345 enum rmc_modes {
7346     WL_RMC_MODE_RECEIVER    = 0,     /**< Receiver mode by default */
7347     WL_RMC_MODE_TRANSMITTER = 1,     /**< Transmitter mode using wl ackreq */
7348     WL_RMC_MODE_INITIATOR   = 2     /**< Initiator mode using wl ackreq */
7349 };
7350 
7351 /** Each RMC mcast client info */
7352 typedef struct wl_relmcast_client {
7353     uint8 flag;            /**< status of client such as AR, R, or blacklisted */
7354     uint8 PAD;
7355     int16 rssi;            /**< rssi value of RMC client */
7356     struct ether_addr addr;        /**< mac address of RMC client */
7357 } wl_relmcast_client_t;
7358 
7359 /** RMC Counters */
7360 typedef struct wl_rmc_cnts {
7361     uint16  version;        /**< see definition of WL_CNT_T_VERSION */
7362     uint16  length;            /**< length of entire structure */
7363     uint16    dupcnt;            /**< counter for duplicate rmc MPDU */
7364     uint16    ackreq_err;        /**< counter for wl ackreq error    */
7365     uint16    af_tx_err;        /**< error count for action frame transmit   */
7366     uint16    null_tx_err;        /**< error count for rmc null frame transmit */
7367     uint16    af_unicast_tx_err;    /**< error count for rmc unicast frame transmit */
7368     uint16    mc_no_amt_slot;        /**< No mcast AMT entry available */
7369     /* Unused. Keep for rom compatibility */
7370     uint16    mc_no_glb_slot;        /**< No mcast entry available in global table */
7371     uint16    mc_not_mirrored;    /**< mcast group is not mirrored */
7372     uint16    mc_existing_tr;        /**< mcast group is already taken by transmitter */
7373     uint16    mc_exist_in_amt;    /**< mcast group is already programmed in amt */
7374     /* Unused. Keep for rom compatibility */
7375     uint16    mc_not_exist_in_gbl;    /**< mcast group is not in global table */
7376     uint16    mc_not_exist_in_amt;    /**< mcast group is not in AMT table */
7377     uint16    mc_utilized;        /**< mcast addressed is already taken */
7378     uint16    mc_taken_other_tr;    /**< multi-cast addressed is already taken */
7379     uint32    rmc_rx_frames_mac;      /**< no of mc frames received from mac */
7380     uint32    rmc_tx_frames_mac;      /**< no of mc frames transmitted to mac */
7381     uint32    mc_null_ar_cnt;         /**< no. of times NULL AR is received */
7382     uint32    mc_ar_role_selected;    /**< no. of times took AR role */
7383     uint32    mc_ar_role_deleted;    /**< no. of times AR role cancelled */
7384     uint32    mc_noacktimer_expired;  /**< no. of times noack timer expired */
7385     uint16  mc_no_wl_clk;           /**< no wl clk detected when trying to access amt */
7386     uint16  mc_tr_cnt_exceeded;     /**< No of transmitters in the network exceeded */
7387 } wl_rmc_cnts_t;
7388 
7389 /** RMC Status */
7390 typedef struct wl_relmcast_st {
7391     uint8         ver;        /**< version of RMC */
7392     uint8         num;        /**< number of clients detected by transmitter */
7393     wl_relmcast_client_t clients[WL_RMC_MAX_CLIENT];
7394     uint16        err;        /**< error status (used in infra) */
7395     uint16        actf_time;    /**< action frame time period */
7396 } wl_relmcast_status_t;
7397 
7398 /** Entry for each STA/node */
7399 typedef struct wl_rmc_entry {
7400     /* operation on multi-cast entry such add,
7401      * delete, ack-all
7402      */
7403     int8    flag;
7404     struct ether_addr addr;        /**< multi-cast group mac address */
7405 } wl_rmc_entry_t;
7406 
7407 /** RMC table */
7408 typedef struct wl_rmc_entry_table {
7409     uint8   index;            /**< index to a particular mac entry in table */
7410     uint8   opcode;            /**< opcodes or operation on entry */
7411     wl_rmc_entry_t entry[WL_RMC_MAX_TABLE_ENTRY];
7412 } wl_rmc_entry_table_t;
7413 
7414 typedef struct wl_rmc_trans_elem {
7415     struct ether_addr tr_mac;    /**< transmitter mac */
7416     struct ether_addr ar_mac;    /**< ar mac */
7417     uint16 artmo;            /**< AR timeout */
7418     uint8 amt_idx;            /**< amt table entry */
7419     uint8 PAD;
7420     uint16 flag;            /**< entry will be acked, not acked, programmed, full etc */
7421 } wl_rmc_trans_elem_t;
7422 
7423 /** RMC transmitters */
7424 typedef struct wl_rmc_trans_in_network {
7425     uint8         ver;        /**< version of RMC */
7426     uint8         num_tr;        /**< number of transmitters in the network */
7427     wl_rmc_trans_elem_t trs[WL_RMC_MAX_NUM_TRS];
7428 } wl_rmc_trans_in_network_t;
7429 
7430 /** To update vendor specific ie for RMC */
7431 typedef struct wl_rmc_vsie {
7432     uint8    oui[DOT11_OUI_LEN];
7433     uint8    PAD;
7434     uint16    payload;    /**< IE Data Payload */
7435 } wl_rmc_vsie_t;
7436 
7437 
7438 /* structures  & defines for proximity detection  */
7439 enum proxd_method {
7440     PROXD_UNDEFINED_METHOD = 0,
7441     PROXD_RSSI_METHOD = 1,
7442     PROXD_TOF_METHOD = 2
7443 };
7444 
7445 /* structures for proximity detection device role */
7446 #define WL_PROXD_MODE_DISABLE    0
7447 #define WL_PROXD_MODE_NEUTRAL    1
7448 #define WL_PROXD_MODE_INITIATOR    2
7449 #define WL_PROXD_MODE_TARGET    3
7450 
7451 #define WL_PROXD_ACTION_STOP        0
7452 #define WL_PROXD_ACTION_START        1
7453 
7454 #define WL_PROXD_FLAG_TARGET_REPORT    0x1
7455 #define WL_PROXD_FLAG_REPORT_FAILURE    0x2
7456 #define WL_PROXD_FLAG_INITIATOR_REPORT    0x4
7457 #define WL_PROXD_FLAG_NOCHANSWT        0x8
7458 #define WL_PROXD_FLAG_NETRUAL        0x10
7459 #define WL_PROXD_FLAG_INITIATOR_RPTRTT    0x20
7460 #define WL_PROXD_FLAG_ONEWAY        0x40
7461 #define WL_PROXD_FLAG_SEQ_EN        0x80
7462 
7463 #define WL_PROXD_SETFLAG_K        0x1
7464 #define WL_PROXD_SETFLAG_N        0x2
7465 #define WL_PROXD_SETFLAG_S        0x4
7466 
7467 #define WL_PROXD_SETFLAG_K        0x1
7468 #define WL_PROXD_SETFLAG_N        0x2
7469 #define WL_PROXD_SETFLAG_S        0x4
7470 
7471 #define WL_PROXD_RANDOM_WAKEUP    0x8000
7472 #define WL_PROXD_MAXREPORT    8
7473 
7474 typedef struct wl_proxd_iovar {
7475     uint16    method;        /**< Proximity Detection method */
7476     uint16    mode;        /**< Mode (neutral, initiator, target) */
7477 } wl_proxd_iovar_t;
7478 
7479 /*
7480  * structures for proximity detection parameters
7481  * consists of two parts, common and method specific params
7482  * common params should be placed at the beginning
7483  */
7484 
7485 typedef struct wl_proxd_params_common    {
7486     chanspec_t    chanspec;    /**< channel spec */
7487     int16        tx_power;    /**< tx power of Proximity Detection(PD) frames (in dBm) */
7488     uint16        tx_rate;    /**< tx rate of PD rames  (in 500kbps units) */
7489     uint16        timeout;    /**< timeout value */
7490     uint16        interval;    /**< interval between neighbor finding attempts (in TU) */
7491     uint16        duration;    /**< duration of neighbor finding attempts (in ms) */
7492 } wl_proxd_params_common_t;
7493 
7494 typedef struct wl_proxd_params_rssi_method {
7495     chanspec_t    chanspec;    /**< chanspec for home channel */
7496     int16        tx_power;    /**< tx power of Proximity Detection frames (in dBm) */
7497     uint16        tx_rate;    /**< tx rate of PD frames, 500kbps units */
7498     uint16        timeout;    /**< state machine wait timeout of the frames (in ms) */
7499     uint16        interval;    /**< interval between neighbor finding attempts (in TU) */
7500     uint16        duration;    /**< duration of neighbor finding attempts (in ms) */
7501                     /* method specific ones go after this line */
7502     int16        rssi_thresh;    /**< RSSI threshold (in dBm) */
7503     uint16        maxconvergtmo;    /**< max wait converge timeout (in ms) */
7504 } wl_proxd_params_rssi_method_t;
7505 
7506 #define Q1_NS            25    /**< Q1 time units */
7507 
7508 #define TOF_BW_NUM        3    /**< number of bandwidth that the TOF can support */
7509 #define TOF_BW_SEQ_NUM        (TOF_BW_NUM+2)    /* number of total index */
7510 enum tof_bw_index {
7511     TOF_BW_20MHZ_INDEX = 0,
7512     TOF_BW_40MHZ_INDEX = 1,
7513     TOF_BW_80MHZ_INDEX = 2,
7514     TOF_BW_SEQTX_INDEX = 3,
7515     TOF_BW_SEQRX_INDEX = 4
7516 };
7517 
7518 #define BANDWIDTH_BASE    20    /**< base value of bandwidth */
7519 #define TOF_BW_20MHZ    (BANDWIDTH_BASE << TOF_BW_20MHZ_INDEX)
7520 #define TOF_BW_40MHZ    (BANDWIDTH_BASE << TOF_BW_40MHZ_INDEX)
7521 #define TOF_BW_80MHZ    (BANDWIDTH_BASE << TOF_BW_80MHZ_INDEX)
7522 #define TOF_BW_10MHZ    10
7523 
7524 #define NFFT_BASE        64    /**< base size of fft */
7525 #define TOF_NFFT_20MHZ  (NFFT_BASE << TOF_BW_20MHZ_INDEX)
7526 #define TOF_NFFT_40MHZ  (NFFT_BASE << TOF_BW_40MHZ_INDEX)
7527 #define TOF_NFFT_80MHZ  (NFFT_BASE << TOF_BW_80MHZ_INDEX)
7528 
7529 typedef struct wl_proxd_params_tof_method {
7530     chanspec_t    chanspec;    /**< chanspec for home channel */
7531     int16        tx_power;    /**< tx power of Proximity Detection(PD) frames (in dBm) */
7532     uint16        tx_rate;    /**< tx rate of PD rames  (in 500kbps units) */
7533     uint16        timeout;    /**< state machine wait timeout of the frames (in ms) */
7534     uint16        interval;    /**< interval between neighbor finding attempts (in TU) */
7535     uint16        duration;    /**< duration of neighbor finding attempts (in ms) */
7536     /* specific for the method go after this line */
7537     struct ether_addr tgt_mac;    /**< target mac addr for TOF method */
7538     uint16        ftm_cnt;    /**< number of the frames txed by initiator */
7539     uint16        retry_cnt;    /**< number of retransmit attampts for ftm frames */
7540     int16        vht_rate;    /**< ht or vht rate */
7541     /* add more params required for other methods can be added here  */
7542 } wl_proxd_params_tof_method_t;
7543 
7544 typedef struct wl_proxd_seq_config
7545 {
7546     int16 N_tx_log2;
7547     int16 N_rx_log2;
7548     int16 N_tx_scale;
7549     int16 N_rx_scale;
7550     int16 w_len;
7551     int16 w_offset;
7552 } wl_proxd_seq_config_t;
7553 
7554 #define WL_PROXD_TUNE_VERSION_1        1
7555 #include <packed_section_start.h>
7556 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_params_tof_tune {
7557     uint32        version;
7558     uint32        Ki;            /**< h/w delay K factor for initiator */
7559     uint32        Kt;            /**< h/w delay K factor for target */
7560     int16        vhtack;            /**< enable/disable VHT ACK */
7561     int16        N_log2[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
7562     int16        w_offset[TOF_BW_NUM];    /**< offset of threshold crossing window(per BW) */
7563     int16        w_len[TOF_BW_NUM];    /**< length of threshold crossing window(per BW) */
7564     int32        maxDT;            /**< max time difference of T4/T1 or T3/T2 */
7565     int32        minDT;            /**< min time difference of T4/T1 or T3/T2 */
7566     uint8        totalfrmcnt;    /**< total count of transfered measurement frames */
7567     uint16        rsv_media;        /**< reserve media value for TOF */
7568     uint32        flags;            /**< flags */
7569     uint8        core;            /**< core to use for tx */
7570     uint8        setflags;        /* set flags of K, N. S values  */
7571     int16        N_scale[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
7572     uint8        sw_adj;            /**< enable sw assisted timestamp adjustment */
7573     uint8        hw_adj;            /**< enable hw assisted timestamp adjustment */
7574     uint8        seq_en;            /**< enable ranging sequence */
7575     uint8        ftm_cnt[TOF_BW_SEQ_NUM]; /**< number of ftm frames based on bandwidth */
7576     int16        N_log2_2g;        /**< simple threshold crossing for 2g channel */
7577     int16        N_scale_2g;        /**< simple threshold crossing for 2g channel */
7578     wl_proxd_seq_config_t seq_5g20;
7579     wl_proxd_seq_config_t seq_2g20;        /* Thresh crossing params for 2G Sequence */
7580     uint16          bitflip_thresh;        /* bitflip threshold */
7581     uint16          snr_thresh;        /* SNR threshold */
7582     int8            recv_2g_thresh;        /* 2g recieve sensitivity threshold */
7583     uint32          acs_gdv_thresh;
7584     int8            acs_rssi_thresh;
7585     uint8           smooth_win_en;
7586     int32        acs_gdmm_thresh;
7587     int8        acs_delta_rssi_thresh;
7588     int32        emu_delay;
7589 } BWL_POST_PACKED_STRUCT wl_proxd_params_tof_tune_t;
7590 #include <packed_section_end.h>
7591 
7592 typedef struct wl_proxd_params_iovar {
7593     uint16    method;            /**< Proximity Detection method */
7594     union {
7595         /* common params for pdsvc */
7596         wl_proxd_params_common_t    cmn_params;    /**< common parameters */
7597         /*  method specific */
7598         wl_proxd_params_rssi_method_t    rssi_params;    /**< RSSI method parameters */
7599         wl_proxd_params_tof_method_t    tof_params;    /**< TOF method parameters */
7600         /* tune parameters */
7601         wl_proxd_params_tof_tune_t    tof_tune;    /**< TOF tune parameters */
7602         uint8    PAD[sizeof(wl_proxd_params_tof_tune_t)+1];
7603     } u;                /**< Method specific optional parameters */
7604 } wl_proxd_params_iovar_t;
7605 
7606 #define PROXD_COLLECT_GET_STATUS    0
7607 #define PROXD_COLLECT_SET_STATUS    1
7608 #define PROXD_COLLECT_QUERY_HEADER    2
7609 #define PROXD_COLLECT_QUERY_DATA    3
7610 #define PROXD_COLLECT_QUERY_DEBUG    4
7611 #define PROXD_COLLECT_REMOTE_REQUEST    5
7612 #define PROXD_COLLECT_DONE        6
7613 
7614 typedef enum {
7615     WL_PROXD_COLLECT_METHOD_TYPE_DISABLE        = 0x0,
7616     WL_PROXD_COLLECT_METHOD_TYPE_IOVAR        = 0x1,
7617     WL_PROXD_COLLECT_METHOD_TYPE_EVENT        = 0x2,
7618     WL_PROXD_COLLECT_METHOD_TYPE_EVENT_LOG        = 0x4
7619 } wl_proxd_collect_method_type_t;
7620 
7621 typedef uint16 wl_proxd_collect_method_t;    /* query status: method to send proxd collect */
7622 
7623 #include <packed_section_start.h>
7624 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_query {
7625     uint32        method;        /**< method */
7626     uint8        request;    /**< Query request. */
7627     uint8        status;        /**< bitmask 0 -- disable, 0x1 -- enable collection, */
7628                     /* 0x2 -- Use generic event, 0x4 -- use event log */
7629     uint16        index;        /**< The current frame index [0 to total_frames - 1]. */
7630     uint16        mode;        /**< Initiator or Target */
7631     uint8        busy;        /**< tof sm is busy */
7632     uint8        remote;        /**< Remote collect data */
7633 } BWL_POST_PACKED_STRUCT wl_proxd_collect_query_t;
7634 #include <packed_section_end.h>
7635 
7636 #include <packed_section_start.h>
7637 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_header {
7638     uint16        total_frames;            /**< The total frames for this collect. */
7639     uint16        nfft;                /**< nfft value */
7640     uint16        bandwidth;            /**< bandwidth */
7641     uint16        channel;            /**< channel number */
7642     uint32        chanspec;            /**< channel spec */
7643     uint32        fpfactor;            /**< avb timer value factor */
7644     uint16        fpfactor_shift;            /**< avb timer value shift bits */
7645     int32        distance;            /**< distance calculated by fw */
7646     uint32        meanrtt;            /**< mean of RTTs */
7647     uint32        modertt;            /**< mode of RTTs */
7648     uint32        medianrtt;            /**< median of RTTs */
7649     uint32        sdrtt;                /**< standard deviation of RTTs */
7650     uint32        clkdivisor;            /**< clock divisor */
7651     uint16        chipnum;            /**< chip type */
7652     uint8        chiprev;            /**< chip revision */
7653     uint8        phyver;                /**< phy version */
7654     struct ether_addr    localMacAddr;        /**< local mac address */
7655     struct ether_addr    remoteMacAddr;        /**< remote mac address */
7656     wl_proxd_params_tof_tune_t params;
7657 } BWL_POST_PACKED_STRUCT wl_proxd_collect_header_t;
7658 #include <packed_section_end.h>
7659 
7660 
7661 /* ifdef WL_NAN */
7662 /*  ********************** NAN wl interface struct types and defs ******************** */
7663 /*
7664  * Uses new common IOVAR batch processing mechanism
7665  */
7666 
7667 /*
7668  * NAN config control
7669  * Bits 0 - 23 can be set by host
7670  * Bits 24 - 31 - Internal use for firmware, host cannot set it
7671  */
7672 
7673 /*
7674  * Bit 0 : If set to 1, means event uses nan bsscfg,
7675  * otherwise uses infra bsscfg. Default is using infra bsscfg
7676  */
7677 #define WL_NAN_CTRL_ROUTE_EVENT_VIA_NAN_BSSCFG    0x1
7678 /* If set, discovery beacons are transmitted on 2G band */
7679 #define WL_NAN_CTRL_DISC_BEACON_TX_2G        0x2
7680 /* If set, sync beacons are transmitted on 2G band */
7681 #define WL_NAN_CTRL_SYNC_BEACON_TX_2G        0x4
7682 /* If set, discovery beacons are transmitted on 5G band */
7683 #define WL_NAN_CTRL_DISC_BEACON_TX_5G        0x8
7684 /* If set, sync beacons are transmitted on 5G band */
7685 #define WL_NAN_CTRL_SYNC_BEACON_TX_5G        0x10
7686 /* If set, auto datapath responses will be sent by FW */
7687 #define WL_NAN_CTRL_AUTO_DPRESP            0x20
7688 /* If set, auto datapath confirms will be sent by FW */
7689 #define WL_NAN_CTRL_AUTO_DPCONF            0x40
7690 
7691 /* Value when all host-configurable bits set */
7692 #define WL_NAN_CTRL_MAX_MASK            0xFFFFFF
7693 #define WL_NAN_CFG_CTRL_FW_BITS            8
7694 
7695 /* Bit 31:
7696  * If set - indicates that NAN initialization is successful
7697  * NOTE: This is a ready-only bit. All sets to this are masked off
7698  */
7699 #define WL_NAN_PROTO_INIT_DONE        0x80000000
7700 #define WL_NAN_GET_PROTO_INIT_STATUS(x) \
7701         (((x) >> 31) & 1)
7702 #define WL_NAN_CLEAR_PROTO_INIT_STATUS(x) \
7703         ((x) &= ~WL_NAN_PROTO_INIT_DONE)
7704 #define WL_NAN_SET_PROTO_INIT_STATUS(x) \
7705         ((x) |= (1 << 31))
7706 
7707 #define WL_NAN_IOCTL_VERSION            0x2
7708 /* < some sufficient ioc buff size for our module */
7709 #define WL_NAN_IOC_BUFSZ            256
7710 /* some sufficient ioc buff size for dump commands */
7711 #define WL_NAN_IOC_BUFSZ_EXT            1024
7712 #define WL_NAN_MAX_SIDS_IN_BEACONS        127 /* Max allowed SIDs */
7713 #define WL_NAN_MASTER_RANK_LEN            8
7714 #define WL_NAN_RANGE_LIMITED            0x0040 /* Publish/Subscribe flags */
7715 
7716 /** The service hash (service id) is exactly this many bytes. */
7717 #define WL_NAN_SVC_HASH_LEN            6
7718 #define WL_NAN_HASHES_PER_BLOOM            4 /** Number of hash functions per bloom filter */
7719 
7720 /* no. of max last disc results */
7721 #define WL_NAN_MAX_DISC_RESULTS            3
7722 
7723 /* Max len of Rx and Tx filters */
7724 #define WL_NAN_MAX_SVC_MATCH_FILTER_LEN    255
7725 
7726 /* Max service name len */
7727 #define WL_NAN_MAX_SVC_NAME_LEN    32
7728 
7729 /* Type of Data path connection */
7730 #define WL_NAN_DP_TYPE_UNICAST            0
7731 #define WL_NAN_DP_TYPE_MULTICAST        1
7732 
7733 /* MAX security params length PMK field */
7734 #define WL_NAN_NCS_SK_PMK_LEN 32
7735 
7736 /* Post disc attr ID type */
7737 typedef uint8 wl_nan_post_disc_attr_id_t;
7738 
7739 /*
7740  * Component IDs
7741  */
7742 typedef enum {
7743     WL_NAN_COMPID_CONFIG = 1,
7744     WL_NAN_COMPID_ELECTION = 2,
7745     WL_NAN_COMPID_SD = 3,
7746     WL_NAN_COMPID_TIMESYNC = 4,
7747     WL_NAN_COMPID_DATA_PATH = 5,
7748     WL_NAN_COMPID_DEBUG = 15 /* Keep this at the end */
7749 } wl_nan_comp_id_t;
7750 
7751 #define WL_NAN_COMP_SHIFT    8
7752 #define WL_NAN_COMP_MASK(_c)    (0x0F & ((uint8)(_c)))
7753 #define WL_NAN_COMP_ID(_c)    (WL_NAN_COMP_MASK(_c) << WL_NAN_COMP_SHIFT)
7754 
7755 /* NAN Events */
7756 
7757 /** Instance ID type (unique identifier) */
7758 typedef uint8 wl_nan_instance_id_t;
7759 
7760 /* Publish sent for a subscribe */
7761 /* WL_NAN_EVENT_REPLIED */
7762 
7763 typedef struct wl_nan_ev_replied {
7764     struct ether_addr    sub_mac; /* Subscriber MAC */
7765     wl_nan_instance_id_t    pub_id; /* Publisher Instance ID */
7766     uint8            sub_id; /* Subscriber ID */
7767     int8            sub_rssi; /* Subscriber RSSI */
7768     uint8            pad[3];
7769 } wl_nan_ev_replied_t;
7770 
7771 typedef struct wl_nan_event_replied {
7772     struct ether_addr    sub_mac; /* Subscriber MAC */
7773     wl_nan_instance_id_t    pub_id; /* Publisher Instance ID */
7774     uint8            sub_id; /* Subscriber ID */
7775     int8            sub_rssi; /* Subscriber RSSI */
7776     uint8        attr_num;
7777     uint16        attr_list_len;  /* sizeof attributes attached to payload */
7778     uint8        attr_list[0];   /* attributes payload */
7779 } wl_nan_event_replied_t;
7780 
7781 /* Subscribe or Publish instance Terminated */
7782 
7783 /* WL_NAN_EVENT_TERMINATED */
7784 
7785 #define    NAN_SD_TERM_REASON_TIMEOUT    1
7786 #define    NAN_SD_TERM_REASON_HOSTREQ    2
7787 #define    NAN_SD_TERM_REASON_FWTERM    3
7788 #define    NAN_SD_TERM_REASON_FAIL        4
7789 
7790 typedef struct wl_nan_ev_terminated {
7791     uint8 instance_id;    /* publish / subscribe instance id */
7792     uint8 reason;        /* 1=timeout, 2=Host/IOVAR, 3=FW Terminated 4=Failure */
7793     uint8 svctype;        /* 0 - Publish, 0x1 - Subscribe */
7794     uint8 pad;        /* Align */
7795 } wl_nan_ev_terminated_t;
7796 
7797 /* Follow up received against a pub / subscr */
7798 /* WL_NAN_EVENT_RECEIVE */
7799 
7800 typedef struct wl_nan_ev_receive {
7801     struct ether_addr remote_addr;    /* Peer NAN device MAC */
7802     uint8    local_id;        /* Local subscribe or publish ID */
7803     uint8    remote_id;        /* Remote subscribe or publish ID */
7804     int8    fup_rssi;
7805     uint8    attr_num;
7806     uint16    attr_list_len;  /* sizeof attributes attached to payload */
7807     uint8    attr_list[0];   /* attributes payload */
7808 } wl_nan_ev_receive_t;
7809 
7810 /*
7811  * TLVs - Below XTLV definitions will be deprecated
7812  * in due course (soon as all other branches update
7813  * to the comp ID based XTLVs listed below).
7814  */
7815 enum wl_nan_cmd_xtlv_id {
7816     WL_NAN_XTLV_MAC_ADDR = 0x120,
7817     WL_NAN_XTLV_MATCH_RX = 0x121,
7818     WL_NAN_XTLV_MATCH_TX = 0x122,
7819     WL_NAN_XTLV_SVC_INFO = 0x123,
7820     WL_NAN_XTLV_SVC_NAME = 0x124,
7821     WL_NAN_XTLV_SR_FILTER = 0x125,
7822     WL_NAN_XTLV_FOLLOWUP = 0x126,
7823     WL_NAN_XTLV_SVC_LIFE_COUNT = 0x127,
7824     WL_NAN_XTLV_AVAIL = 0x128,
7825     WL_NAN_XTLV_SDF_RX = 0x129,
7826     WL_NAN_XTLV_SDE_CONTROL = 0x12a,
7827     WL_NAN_XTLV_SDE_RANGE_LIMIT = 0x12b,
7828     WL_NAN_XTLV_NAN_AF = 0x12c,
7829     WL_NAN_XTLV_SD_TERMINATE = 0x12d,
7830     WL_NAN_XTLV_CLUSTER_ID = 0x12e,
7831     WL_NAN_XTLV_PEER_RSSI = 0x12f,
7832     WL_NAN_XTLV_BCN_RX = 0x130,
7833     WL_NAN_XTLV_REPLIED = 0x131, /* Publish sent for a subscribe */
7834     WL_NAN_XTLV_RECEIVED = 0x132, /* FUP Received */
7835     WL_NAN_XTLV_DISC_RESULTS = 0x133 /* Discovery results */
7836 };
7837 
7838 #define WL_NAN_CMD_GLOBAL        0x00
7839 #define WL_NAN_CMD_CFG_COMP_ID        0x01
7840 #define WL_NAN_CMD_ELECTION_COMP_ID    0x02
7841 #define WL_NAN_CMD_SD_COMP_ID        0x03
7842 #define WL_NAN_CMD_SYNC_COMP_ID        0x04
7843 #define WL_NAN_CMD_DATA_COMP_ID        0x05
7844 #define WL_NAN_CMD_DAM_COMP_ID        0x06
7845 #define WL_NAN_CMD_RANGE_COMP_ID    0x07
7846 #define WL_NAN_CMD_DBG_COMP_ID        0x0f
7847 
7848 #define WL_NAN_CMD_COMP_SHIFT        8
7849 #define NAN_CMD(x, y)  (((x) << WL_NAN_CMD_COMP_SHIFT) | (y))
7850 
7851 /*
7852  * Module based NAN TLV IDs
7853  */
7854 typedef enum wl_nan_tlv {
7855     WL_NAN_XTLV_CFG_MATCH_RX    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x01),
7856     WL_NAN_XTLV_CFG_MATCH_TX    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x02),
7857     WL_NAN_XTLV_CFG_SR_FILTER    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x03),
7858     WL_NAN_XTLV_CFG_SVC_NAME    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x04),
7859     WL_NAN_XTLV_CFG_NAN_STATUS    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x05),
7860     WL_NAN_XTLV_CFG_SVC_LIFE_COUNT    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x06),
7861     WL_NAN_XTLV_CFG_SVC_HASH    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x07),
7862     WL_NAN_XTLV_CFG_SEC_CSID    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x08), /* Security CSID */
7863     WL_NAN_XTLV_CFG_SEC_PMK        = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x09), /* Security PMK */
7864     WL_NAN_XTLV_CFG_SEC_PMKID    = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0A),
7865 
7866     WL_NAN_XTLV_SD_SVC_INFO        = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x01),
7867     WL_NAN_XTLV_SD_FOLLOWUP        = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x02),
7868     WL_NAN_XTLV_SD_SDF_RX        = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x03),
7869     WL_NAN_XTLV_SD_SDE_CONTROL    = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x04),
7870     WL_NAN_XTLV_SD_SDE_RANGE_LIMIT    = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x05),
7871     WL_NAN_XTLV_SD_NAN_AF        = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x06),
7872     WL_NAN_XTLV_SD_TERM        = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x07),
7873     WL_NAN_XTLV_SD_REPLIED        = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x08), /* Pub sent */
7874     WL_NAN_XTLV_SD_FUP_RECEIVED    = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x09), /* FUP Received */
7875     WL_NAN_XTLV_SD_DISC_RESULTS    = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0A), /* Pub RX */
7876 
7877     WL_NAN_XTLV_SYNC_BCN_RX        = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x01),
7878 
7879     WL_NAN_XTLV_DATA_DP_END        = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x01),
7880     WL_NAN_XTLV_DATA_DP_INFO    = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x02),
7881     WL_NAN_XTLV_DATA_DP_SEC_INST    = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x03),
7882 
7883     WL_NAN_XTLV_RANGE_INFO        = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x01)
7884 } wl_nan_tlv_t;
7885 
7886 enum wl_nan_sub_cmd_xtlv_id {
7887     /* Special command - Tag zero */
7888     WL_NAN_CMD_GLB_NAN_VER = NAN_CMD(WL_NAN_CMD_GLOBAL, 0x00),
7889 
7890      /* nan cfg sub-commands */
7891 
7892     WL_NAN_CMD_CFG_NAN_INIT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x01),
7893     WL_NAN_CMD_CFG_ROLE = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x02),
7894     WL_NAN_CMD_CFG_HOP_CNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x03),
7895     WL_NAN_CMD_CFG_HOP_LIMIT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x04),
7896     WL_NAN_CMD_CFG_WARMUP_TIME = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x05),
7897     WL_NAN_CMD_CFG_STATUS = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x06),
7898     WL_NAN_CMD_CFG_OUI = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x07),
7899     WL_NAN_CMD_CFG_COUNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x08),
7900     WL_NAN_CMD_CFG_CLEARCOUNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x09),
7901     WL_NAN_CMD_CFG_CHANNEL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0A),
7902     WL_NAN_CMD_CFG_BAND = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0B),
7903     WL_NAN_CMD_CFG_CID = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0C),
7904     WL_NAN_CMD_CFG_IF_ADDR = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0D),
7905     WL_NAN_CMD_CFG_BCN_INTERVAL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0E),
7906     WL_NAN_CMD_CFG_SDF_TXTIME = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0F),
7907     WL_NAN_CMD_CFG_SID_BEACON = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x10),
7908     WL_NAN_CMD_CFG_DW_LEN = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x11),
7909     WL_NAN_CMD_CFG_AVAIL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x12),
7910     WL_NAN_CMD_CFG_WFA_TM = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x13),
7911     WL_NAN_CMD_CFG_EVENT_MASK =  NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x14),
7912     WL_NAN_CMD_CFG_NAN_CONFIG = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x15),
7913     WL_NAN_CMD_CFG_NAN_ENAB = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x16),
7914     WL_NAN_CMD_CFG_ULW = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x17),
7915     WL_NAN_CMD_CFG_MAX = WL_NAN_CMD_CFG_NAN_ENAB,
7916     /* Add new commands before and update */
7917 
7918     /* nan election sub-commands */
7919     WL_NAN_CMD_ELECTION_JOIN = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x04), /* Deprecated */
7920     WL_NAN_CMD_ELECTION_STOP = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x07), /* Deprecate */
7921 
7922     WL_NAN_CMD_ELECTION_HOST_ENABLE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x01),
7923     WL_NAN_CMD_ELECTION_METRICS_CONFIG = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x02),
7924     WL_NAN_CMD_ELECTION_METRICS_STATE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x03),
7925     WL_NAN_CMD_ELECTION_LEAVE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x03),
7926     WL_NAN_CMD_ELECTION_MERGE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x04),
7927     WL_NAN_CMD_ELECTION_ADVERTISERS = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x05),
7928     WL_NAN_CMD_ELECTION_RSSI_THRESHOLD = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x06),
7929     WL_NAN_CMD_ELECTION_MAX = WL_NAN_CMD_ELECTION_RSSI_THRESHOLD,
7930     /* New commands go before and update */
7931 
7932     /* nan SD sub-commands */
7933     WL_NAN_CMD_SD_PARAMS = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x01),
7934     WL_NAN_CMD_SD_PUBLISH = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x02),
7935     WL_NAN_CMD_SD_PUBLISH_LIST = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x03),
7936     WL_NAN_CMD_SD_CANCEL_PUBLISH = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x04),
7937     WL_NAN_CMD_SD_SUBSCRIBE = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x05),
7938     WL_NAN_CMD_SD_SUBSCRIBE_LIST = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x06),
7939     WL_NAN_CMD_SD_CANCEL_SUBSCRIBE = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x07),
7940     WL_NAN_CMD_SD_VND_INFO = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x08),
7941     WL_NAN_CMD_SD_STATS = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x09),
7942     WL_NAN_CMD_SD_TRANSMIT = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0A),
7943     WL_NAN_CMD_SD_FUP_TRANSMIT = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0B),
7944     WL_NAN_CMD_SD_CONNECTION = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0C),
7945     WL_NAN_CMD_SD_SHOW = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0D),
7946     WL_NAN_CMD_SD_MAX = WL_NAN_CMD_SD_SHOW,
7947 
7948     /* nan time sync sub-commands */
7949 
7950     WL_NAN_CMD_SYNC_SOCIAL_CHAN = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x01),
7951     WL_NAN_CMD_SYNC_AWAKE_DWS = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x02),
7952     WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x03),
7953     WL_NAN_CMD_SYNC_MAX = WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD,
7954 
7955     /* nan2 commands */
7956     WL_NAN_CMD_DATA_CONFIG = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x01),
7957     WL_NAN_CMD_DATA_RSVD02 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x02),
7958     WL_NAN_CMD_DATA_RSVD03 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x03),
7959     WL_NAN_CMD_DATA_DATAREQ = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x04),
7960     WL_NAN_CMD_DATA_DATARESP = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x05),
7961     WL_NAN_CMD_DATA_DATAEND = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x06),
7962     WL_NAN_CMD_DATA_SCHEDUPD = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x07),
7963     WL_NAN_CMD_DATA_RSVD08 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x08),
7964     WL_NAN_CMD_DATA_CAP = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x9),
7965     WL_NAN_CMD_DATA_STATUS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0A),
7966     WL_NAN_CMD_DATA_STATS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0B),
7967     WL_NAN_CMD_DATA_RSVD0C = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0C),
7968     WL_NAN_CMD_DATA_NDP_SHOW = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0D),
7969     WL_NAN_CMD_DATA_DATACONF = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0E),
7970     WL_NAN_CMD_DATA_MIN_TX_RATE = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0F),
7971     WL_NAN_CMD_DATA_MAX_PEERS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x10),
7972     WL_NAN_CMD_DATA_PATH_MAX = WL_NAN_CMD_DATA_MAX_PEERS, /* New ones before and update */
7973 
7974     /* nan dam sub-commands */
7975     WL_NAN_CMD_DAM_CFG = NAN_CMD(WL_NAN_CMD_DAM_COMP_ID, 0x01),
7976     WL_NAN_CMD_DAM_MAX = WL_NAN_CMD_DAM_CFG,  /* New ones before and update */
7977 
7978     /* nan2.0 ranging commands */
7979     WL_NAN_CMD_RANGE_REQUEST = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x01),
7980     WL_NAN_CMD_RANGE_AUTO = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x02),
7981     WL_NAN_CMD_RANGE_RESPONSE = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x03),
7982     WL_NAN_CMD_RANGE_CANCEL = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x04),
7983 
7984     /*  nan debug sub-commands  */
7985     WL_NAN_CMD_DBG_SCAN_PARAMS = NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x01),
7986     WL_NAN_CMD_DBG_SCAN = NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x02),
7987     WL_NAN_CMD_DBG_SCAN_RESULTS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x03),
7988     /* This is now moved under CFG */
7989     WL_NAN_CMD_DBG_EVENT_MASK =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x04),
7990     WL_NAN_CMD_DBG_EVENT_CHECK =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x05),
7991     WL_NAN_CMD_DBG_DUMP =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x06),
7992     WL_NAN_CMD_DBG_CLEAR =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x07),
7993     WL_NAN_CMD_DBG_RSSI =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x08),
7994     WL_NAN_CMD_DBG_DEBUG =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x09),
7995     WL_NAN_CMD_DBG_TEST1 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0A),
7996     WL_NAN_CMD_DBG_TEST2 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0B),
7997     WL_NAN_CMD_DBG_TEST3 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0C),
7998     WL_NAN_CMD_DBG_DISC_RESULTS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0D),
7999     WL_NAN_CMD_DBG_STATS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0E),
8000     WL_NAN_CMD_DBG_LEVEL =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0F),
8001     WL_NAN_CMD_DBG_MAX = WL_NAN_CMD_DBG_LEVEL /* New ones before and update */
8002 };
8003 
8004 /** status - TBD BCME_ vs NAN status - range reserved for BCME_ */
8005 enum {
8006     /* add new status here... */
8007     WL_NAN_E_SEC_SA_NOTFOUND    = -2076,
8008     WL_NAN_E_BSSCFG_NOTFOUND    = -2075,
8009     WL_NAN_E_SCB_NOTFOUND        = -2074,
8010     WL_NAN_E_NCS_SK_KDESC_TYPE      = -2073,
8011     WL_NAN_E_NCS_SK_KEY_DESC_VER    = -2072,    /* key descr ver */
8012     WL_NAN_E_NCS_SK_KEY_TYPE        = -2071,    /* key descr type */
8013     WL_NAN_E_NCS_SK_KEYINFO_FAIL    = -2070,    /* key info (generic) */
8014     WL_NAN_E_NCS_SK_KEY_LEN         = -2069,    /* key len */
8015     WL_NAN_E_NCS_SK_KDESC_NOT_FOUND = -2068,    /* key desc not found */
8016     WL_NAN_E_NCS_SK_INVALID_PARAMS  = -2067,    /* invalid args */
8017     WL_NAN_E_NCS_SK_KDESC_INVALID   = -2066,    /* key descr is not valid */
8018     WL_NAN_E_NCS_SK_NONCE_MISMATCH  = -2065,
8019     WL_NAN_E_NCS_SK_KDATA_SAVE_FAIL = -2064,    /* not able to save key data */
8020     WL_NAN_E_NCS_SK_AUTH_TOKEN_CALC_FAIL = -2063,
8021     WL_NAN_E_NCS_SK_PTK_CALC_FAIL   = -2062,
8022     WL_NAN_E_INVALID_STARTOFFSET    = -2061,
8023     WL_NAN_E_BAD_NA_ENTRY_TYPE    = -2060,
8024     WL_NAN_E_INVALID_CHANBMP    = -2059,
8025     WL_NAN_E_INVALID_OP_CLASS    = -2058,
8026     WL_NAN_E_NO_IES            = -2057,
8027     WL_NAN_E_NO_PEER_ENTRY_AVAIL    = -2056,
8028     WL_NAN_E_INVALID_PEER        = -2055,
8029     WL_NAN_E_PEER_EXISTS        = -2054,
8030     WL_NAN_E_PEER_NOTFOUND        = -2053,
8031     WL_NAN_E_NO_MEM            = -2052,
8032     WL_NAN_E_INVALID_OPTION        = -2051,
8033     WL_NAN_E_INVALID_BAND        = -2050,
8034     WL_NAN_E_INVALID_MAC        = -2049,
8035     WL_NAN_E_BAD_INSTANCE        = -2048,
8036     WL_NAN_E_NDC_EXISTS        = -2047,
8037     WL_NAN_E_NO_NDC_ENTRY_AVAIL    = -2046,
8038     WL_NAN_E_INVALID_NDC_ENTRY      = -2045,
8039     WL_NAN_E_ERROR            = -1,
8040     WL_NAN_E_OK            = 0
8041 };
8042 
8043 typedef int32 wl_nan_status_t;
8044 
8045 /** nan cmd list entry  */
8046 enum wl_nan_sub_cmd_input_flags {
8047     WL_NAN_SUB_CMD_FLAG_NONE = 0,
8048     WL_NAN_SUB_CMD_FLAG_SKIP = 1, /* Skip to next sub-command on error */
8049     WL_NAN_SUB_CMD_FLAG_TERMINATE = 2, /* Terminate processing and return */
8050     WL_NAN_SUB_CMD_FLAG_LAST /* Keep this at the end */
8051 };
8052 
8053 /** container for nan events */
8054 typedef struct wl_nan_ioc {
8055     uint16    version;    /**< interface command or event version */
8056     uint16    id;            /**< nan ioctl cmd  ID  */
8057     uint16    len;        /**< total length of all tlv records in data[]  */
8058     uint16    pad;        /**< pad to be 32 bit aligment */
8059     uint8    data [];    /**< var len payload of bcm_xtlv_t type */
8060 } wl_nan_ioc_t;
8061 
8062 /*
8063  * NAN sub-command data structures
8064  */
8065 
8066 /*
8067  * Config component WL_NAN_CMD_CFG_XXXX sub-commands
8068  * WL_NAN_CMD_CFG_ENABLE
8069  */
8070 enum wl_nan_config_state {
8071     WL_NAN_CONFIG_STATE_DISABLE = 0,
8072     WL_NAN_CONFIG_STATE_ENABLE = 1
8073 };
8074 
8075 typedef int8 wl_nan_config_state_t;
8076 
8077 /* WL_NAN_CMD_CFG_NAN_INIT */
8078 
8079 typedef uint8 wl_nan_init_t;
8080 
8081 /* WL_NAN_CMD_CFG_NAN_VERSION */
8082 typedef uint16 wl_nan_ver_t;
8083 
8084 /* WL_NAN_CMD_CFG_NAN_CONFIG  */
8085 typedef uint32 wl_nan_cfg_ctrl_t;
8086 
8087 /*
8088  * WL_NAN_CMD_CFG_BAND, WL_NAN_CMD_CFG_RSSI_THRESHOLD(Get only)
8089  */
8090 typedef uint8 wl_nan_band_t;
8091 
8092 /*
8093  * WL_NAN_CMD_CFG_ROLE
8094  */
8095 enum wl_nan_role {
8096     WL_NAN_ROLE_AUTO = 0,
8097     WL_NAN_ROLE_NON_MASTER_NON_SYNC = 1,
8098     WL_NAN_ROLE_NON_MASTER_SYNC = 2,
8099     WL_NAN_ROLE_MASTER = 3,
8100     WL_NAN_ROLE_ANCHOR_MASTER = 4
8101 };
8102 
8103 typedef uint8 wl_nan_role_t;
8104 
8105 typedef struct wl_nan_device_state
8106 {
8107     wl_nan_role_t role;        /* Sync Master, Non-Sync Master */
8108     uint8 state;    /* TBD  */
8109     uint8 hopcount;    /* Hops to the Anchor Master */
8110     struct ether_addr immediate_master; /* Master MAC */
8111     struct ether_addr anchor_master;    /* Anchor Master MAC */
8112     struct ether_addr cluster_id; /* Cluster ID to which this device belongs to */
8113     uint8 PAD[3];
8114     uint32 tsf_high;  /* NAN Cluster TSFs */
8115     uint32 tsf_low;
8116 } wl_nan_device_state_t;
8117 
8118 /*
8119  * WL_NAN_CMD_CFG_HOP_CNT, WL_NAN_CMD_CFG_HOP_LIMIT
8120  */
8121 typedef uint8 wl_nan_hop_count_t;
8122 
8123 /*
8124  * WL_NAN_CMD_CFG_WARMUP_TIME
8125  */
8126 typedef uint32 wl_nan_warmup_time_ticks_t;
8127 
8128 /*
8129  * WL_NAN_CMD_CFG_RSSI_THRESHOLD
8130  * rssi_close and rssi_mid are used to transition master to non-master
8131  * role by NAN state machine. rssi thresholds corresponding to the band
8132  * will be updated.
8133  */
8134 /* To be deprecated */
8135 typedef struct wl_nan_rssi_threshold {
8136     wl_nan_band_t band;
8137     int8 rssi_close;
8138     int8 rssi_mid;
8139     uint8 pad;
8140 } wl_nan_rssi_threshold_t;
8141 
8142 /* WL_NAN_CMD_ELECTION_RSSI_THRESHOLD */
8143 
8144 typedef struct wl_nan_rssi_thld {
8145     int8 rssi_close_2g;
8146     int8 rssi_mid_2g;
8147     int8 rssi_close_5g;
8148     int8 rssi_mid_5g;
8149 } wl_nan_rssi_thld_t;
8150 
8151 /* WL_NAN_CMD_DATA_MAX_PEERS */
8152 
8153 typedef uint8 wl_nan_max_peers_t;
8154 
8155 #define NAN_MAX_BANDS 2
8156 /*
8157  * WL_NAN_CMD_CFG_STATUS
8158  */
8159 /* Deprecated - Begin */
8160 typedef struct wl_nan_cfg_status {
8161     uint8 enabled;
8162     uint8 inited;
8163     uint8 joined;
8164     uint8 merged;
8165     uint8 role;
8166     uint8 PAD[3];
8167     uint32 chspec[2];
8168     uint8 mr[8];                    /**< Master Rank */
8169     uint8 amr[8];            /**< Anchor Master Rank */
8170     uint32 cnt_pend_txfrm;        /**< pending TX frames */
8171     uint32 cnt_bcn_tx;        /**< TX disc/sync beacon count */
8172     uint32 cnt_bcn_rx;        /**< RX disc/sync beacon count */
8173     uint32 cnt_svc_disc_tx;        /**< TX svc disc frame count */
8174     uint32 cnt_svc_disc_rx;        /**< RX svc disc frame count */
8175     uint32 ambtt;                   /**< Anchor master beacon target time */
8176     struct ether_addr cid;          /**< Cluster id */
8177     uint8 hop_count;                /**< Hop count */
8178     uint8 PAD;
8179 } wl_nan_cfg_status_t;
8180 
8181 typedef struct wl_nan_config_status {
8182     struct ether_addr    def_cid;    /* Default Cluster id */
8183     uint8            inited;        /* NAN Initialized successfully */
8184     uint8            enabled;    /* NAN Enabled */
8185     struct ether_addr    cur_cid;    /* Default Cluster id */
8186     uint8            joined;        /* Joined or started own cluster */
8187     uint8            role;        /* Master, Non Master, NM Sync & Non-Sync */
8188     chanspec_t        chspec[NAN_MAX_BANDS]; /* Channel Spec 2.4G followed by 5G */
8189     uint8            mr[WL_NAN_MASTER_RANK_LEN]; /* Master Rank */
8190     uint8            amr[WL_NAN_MASTER_RANK_LEN]; /* Anchor Master Rank */
8191     uint32            cnt_pend_txfrm;    /* Pending Tx Frames */
8192     uint32            cnt_bcn_tx;    /* TX disc/sync beacon count */
8193     uint32            cnt_bcn_rx;    /* RX disc/sync beacon count */
8194     uint32            cnt_svc_disc_tx; /* TX svc disc frame count */
8195     uint32            cnt_svc_disc_rx; /* RX svc disc frame count */
8196     uint32            ambtt;    /* Anchor master beacon target time */
8197     uint8            hop_count; /* Hop count */
8198     uint8            pad[3];    /* Align */
8199 } wl_nan_config_status_t;
8200 /* Deprecated - End */
8201 
8202 typedef enum wl_nan_election_mode {
8203     WL_NAN_ELECTION_RUN_BY_HOST = 1,
8204     WL_NAN_ELECTION_RUN_BY_FW = 2
8205 } wl_nan_election_mode_t;
8206 
8207 typedef struct wl_nan_conf_status {
8208     struct ether_addr    nmi;        /*  NAN mgmt interface address */
8209     uint8            enabled;    /* NAN is enabled */
8210     uint8            role;        /* Current nan sync role */
8211     struct ether_addr    cid;        /*  Current Cluster id */
8212     uint8            social_chans[2];    /* Social channels */
8213     uint8            mr[8];        /* Master Rank */
8214     uint8            amr[8];        /* Anchor Master Rank */
8215     uint32            ambtt;        /* Anchor master beacon target time */
8216     uint32            cluster_tsf_h;    /* Current Cluster TSF High */
8217     uint32            cluster_tsf_l;    /* Current Cluster TSF Low */
8218     uint8            election_mode; /* Election mode, host or firmware */
8219     uint8            hop_count;    /* Current Hop count */
8220     uint8            pad[2];
8221 } wl_nan_conf_status_t;
8222 
8223 /*
8224  * WL_NAN_CMD_CFG_OUI
8225  */
8226 typedef struct wl_nan_oui_type {
8227     uint8 nan_oui[DOT11_OUI_LEN];
8228     uint8 type;
8229 } wl_nan_oui_type_t;
8230 
8231 /*
8232  * WL_NAN_CMD_CFG_COUNT
8233  */
8234 typedef struct wl_nan_count {
8235     uint32 cnt_bcn_tx;        /**< TX disc/sync beacon count */
8236     uint32 cnt_bcn_rx;        /**< RX disc/sync beacon count */
8237     uint32 cnt_svc_disc_tx;        /**< TX svc disc frame count */
8238     uint32 cnt_svc_disc_rx;        /**< RX svc disc frame count */
8239 } wl_nan_count_t;
8240 /*
8241  * Election component WL_NAN_CMD_ELECTION_XXXX sub-commands
8242  * WL_NAN_CMD_ELECTION_HOST_ENABLE
8243  */
8244 enum wl_nan_enable_flags {
8245     WL_NAN_DISABLE_FLAG_HOST_ELECTION = 0,
8246     WL_NAN_ENABLE_FLAG_HOST_ELECTION = 1
8247 };
8248 
8249 /*
8250  * 0 - disable host based election
8251  * 1 - enable host based election
8252  */
8253 typedef uint8 wl_nan_host_enable_t;
8254 
8255 /*
8256  * WL_NAN_CMD_ELECTION_METRICS_CONFIG
8257  */
8258 /* Set only */
8259 typedef struct wl_nan_election_metric_config {
8260     uint8 random_factor; /* Configured random factor */
8261     uint8 master_pref;    /* configured master preference */
8262     uint8 pad[2];
8263 } wl_nan_election_metric_config_t;
8264 
8265 /*
8266  * WL_NAN_CMD_ELECTION_METRICS_STATE
8267  */
8268 /* Get only */
8269 typedef struct wl_nan_election_metric_state {
8270     uint8 random_factor; /* random factor used in MIs */
8271     uint8 master_pref;     /* Master advertised in MIs */
8272     uint8 pad[2];
8273 } wl_nan_election_metric_state_t;
8274 
8275 /*
8276  * WL_NAN_CMD_ELECTION_LEAVE
8277  * WL_NAN_CMD_ELECTION_STOP
8278  */
8279 typedef struct ether_addr wl_nan_cluster_id_t;
8280 
8281 /*
8282  * WL_NAN_CMD_ELECTION_JOIN
8283  */
8284 typedef struct wl_nan_join {
8285     uint8 start_cluster;    /* Start a cluster */
8286     uint8 pad[3];
8287     wl_nan_cluster_id_t cluster_id;    /* Cluster ID to join */
8288 } wl_nan_join_t;
8289 
8290 /*
8291  * WL_NAN_CMD_ELECTION_MERGE
8292  * 0 - disable cluster merge
8293  * 1 - enable cluster merge
8294  */
8295 typedef uint8 wl_nan_merge_enable_t;
8296 
8297 /*
8298  * WL_NAN_CMD_CFG_ROLE
8299  * role = 0 means configuration by firmware; otherwise by host
8300  * when host configures role, also need target master address to sync to
8301  */
8302 #define NAN_SYNC_MASTER_SELF    0
8303 #define NAN_SYNC_MASTER_AM        1
8304 #define NAN_SYNC_MASTER_INTERMEDIATE    2
8305 /*     ltsf_h, ltsf_l:
8306     The local TSF timestamp filled in by FW in the WL_NAN_EVENT_BCN_RX event;
8307     rtsf_h, rtsf_l:
8308     The timestamp in the Rx beacon frame, filled in by host
8309     uint32 ambtt:
8310     the amtt in the cluster ID attribute in the Rx beacon frame
8311 */
8312 typedef struct nan_sync_master {
8313     uint8 flag;    /* 0: self, 1: anchor-master, 2: intermediate master */
8314     uint8  hop_count;
8315     struct ether_addr addr;
8316     struct ether_addr cluster_id;
8317     chanspec_t channel; /* bcn reception channel */
8318     uint32 ltsf_h;
8319     uint32 ltsf_l;
8320     uint32 rtsf_h;
8321     uint32 rtsf_l;
8322     uint8 amr[WL_NAN_MASTER_RANK_LEN];
8323     uint32 ambtt;
8324 } nan_sync_master_t;
8325 
8326 /* NAN advertiser structure */
8327 /* TODO RSDB: add chspec to indicates core corresponds correct core */
8328 typedef struct nan_adv_entry {
8329     uint8 age;    /* used to remove stale entries */
8330     uint8 hop_count;
8331     struct ether_addr addr;
8332     struct ether_addr cluster_id;
8333     chanspec_t channel; /* bcn reception channel */
8334     uint32 ltsf_h;
8335     uint32 ltsf_l;
8336     uint32 rtsf_h;
8337     uint32 rtsf_l;
8338     uint8 amr[WL_NAN_MASTER_RANK_LEN];
8339     uint32 ambtt;
8340     int8    rssi[NAN_MAX_BANDS];        /* rssi last af was received at */
8341     int8    last_rssi[NAN_MAX_BANDS];    /* rssi in the last AF */
8342 } nan_adv_entry_t;
8343 
8344 typedef struct nan_adv_table {
8345     uint8  num_adv;
8346     uint8    adv_size;
8347     uint8    pad[2];
8348     nan_adv_entry_t adv_nodes[0];
8349 } nan_adv_table_t;
8350 
8351 typedef struct wl_nan_role_cfg {
8352     wl_nan_role_t cfg_role;
8353     wl_nan_role_t cur_role;
8354     uint8 pad[2];
8355     nan_sync_master_t target_master;
8356 } wl_nan_role_cfg_t;
8357 
8358 typedef struct wl_nan_role_config {
8359     wl_nan_role_t role;
8360     struct ether_addr target_master;
8361     uint8 pad;
8362 } wl_nan_role_config_t;
8363 
8364 typedef int8 wl_nan_sd_optional_field_types_t;
8365 
8366 /* Flag bits for Publish and Subscribe (wl_nan_sd_params_t flags) */
8367 
8368 #define WL_NAN_RANGE_LIMITED        0x0040
8369 
8370 /* Event generation indicator (default is continuous) */
8371 
8372 #define WL_NAN_MATCH_ONCE        0x100000
8373 #define WL_NAN_MATCH_NEVER        0x200000
8374 
8375 /* Bits specific to Publish */
8376 
8377 #define WL_NAN_PUB_UNSOLICIT    0x1000    /* Unsolicited Tx */
8378 #define WL_NAN_PUB_SOLICIT        0x2000    /* Solicited Tx */
8379 #define WL_NAN_PUB_BOTH            0x3000    /* Both the above */
8380 
8381 #define WL_NAN_PUB_BCAST        0x4000    /* bcast solicited Tx only */
8382 #define WL_NAN_PUB_EVENT        0x8000    /* Event on each solicited Tx */
8383 #define WL_NAN_PUB_SOLICIT_PENDING    0x10000 /* Used for one-time solicited Publish */
8384 
8385 #define WL_NAN_FOLLOWUP            0x20000 /* Follow-up frames */
8386 
8387 /* Bits specific to Subscribe */
8388 
8389 #define WL_NAN_SUB_ACTIVE        0x1000 /* Active subscribe mode */
8390 #define WL_NAN_SUB_MATCH_IF_SVC_INFO    0x2000 /* Service info in publish */
8391 
8392 #define WL_NAN_TTL_UNTIL_CANCEL    0xFFFFFFFF /* Special values for time to live (ttl) parameter */
8393 
8394 /*
8395  * Publish -  runs until first transmission
8396  * Subscribe - runs until first  DiscoveryResult event
8397  */
8398 #define WL_NAN_TTL_FIRST    0
8399 
8400 /*
8401  * WL_NAN_CMD_SD_PARAMS
8402  */
8403 typedef struct wl_nan_sd_params
8404 {
8405     uint16    length; /* length including options */
8406     uint8    period; /* period of the unsolicited SDF xmission in DWs */
8407     uint8   pad;
8408     uint8    svc_hash[WL_NAN_SVC_HASH_LEN]; /* Hash for the service name */
8409     uint8    instance_id; /* Instance of the current service */
8410     int8    proximity_rssi; /* RSSI limit to Rx subscribe or pub SDF 0 no effect */
8411     uint32    flags; /* bitmap representing aforesaid optional flags */
8412     int32    ttl; /* TTL for this instance id, -1 will run till cancelled */
8413     tlv_t    optional[1]; /* optional fields in the SDF  as appropriate */
8414 } wl_nan_sd_params_t;
8415 
8416 /*
8417  * WL_NAN_CMD_SD_PUBLISH_LIST
8418  * WL_NAN_CMD_SD_SUBSCRIBE_LIST
8419  */
8420 typedef struct wl_nan_service_info
8421 {
8422     uint8 instance_id;    /* Publish instance ID */
8423     uint8 service_hash[WL_NAN_SVC_HASH_LEN]; /* Hash for service name */
8424 } wl_nan_service_info_t;
8425 
8426 typedef struct wl_nan_service_list
8427 {
8428     uint16 id_count; /* Number of registered publish/subscribe services */
8429     wl_nan_service_info_t list[1]; /* service info defined by nan_service instance */
8430 } wl_nan_service_list_t;
8431 
8432 /*
8433  * WL_NAN_CMD_CFG_BCN_INTERVAL
8434  */
8435 typedef uint16 wl_nan_disc_bcn_interval_t;
8436 
8437 /*
8438  * WL_NAN_CMD_CFG_SDF_TXTIME
8439  */
8440 typedef uint16 wl_nan_svc_disc_txtime_t;
8441 
8442 /*
8443  * WL_NAN_CMD_CFG_STOP_BCN_TX
8444  */
8445 typedef uint16 wl_nan_stop_bcn_tx_t;
8446 
8447 /*
8448  * WL_NAN_CMD_CFG_SID_BEACON
8449  */
8450 typedef struct wl_nan_sid_beacon_control {
8451     uint8 sid_enable;    /* Flag to indicate the inclusion of Service IDs in Beacons */
8452     uint8 sid_count;    /* Limit for number of SIDs to be included in Beacons */
8453     uint8 pad[2];
8454 } wl_nan_sid_beacon_control_t;
8455 
8456 /*
8457  * WL_NAN_CMD_CFG_DW_LEN
8458  */
8459 typedef uint16 wl_nan_dw_len_t;
8460 
8461 /*
8462  * WL_NAN_CMD_CFG_AWAKE_DW   Will be deprecated.
8463  */
8464 typedef struct wl_nan_awake_dw {
8465     wl_nan_band_t band;    /* 0 - b mode 1- a mode */
8466     uint8 interval;        /* 1 or 2 or 4 or 8 or 16 */
8467     uint16 pad;
8468 } wl_nan_awake_dw_t;
8469 
8470 /*
8471  * WL_NAN_CMD_CFG_AWAKE_DWS
8472  */
8473 typedef struct wl_nan_awake_dws {
8474     uint8 dw_interval_2g;    /* 2G DW interval */
8475     uint8 dw_interval_5g;    /* 5G DW interval */
8476     uint16 pad;
8477 } wl_nan_awake_dws_t;
8478 
8479 /* WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD */
8480 
8481 typedef struct wl_nan_rssi_notif_thld {
8482     int8 bcn_rssi_2g;
8483     int8 bcn_rssi_5g;
8484     int16 pad;
8485 } wl_nan_rssi_notif_thld_t;
8486 
8487 /*
8488  * WL_NAN_CMD_CFG_SOCIAL_CHAN
8489  */
8490 typedef struct wl_nan_social_channels {
8491     uint8 soc_chan_2g;    /* 2G social channel */
8492     uint8 soc_chan_5g;    /* 5G social channel */
8493     uint16 pad;
8494 } wl_nan_social_channels_t;
8495 
8496 /*
8497  * WL_NAN_CMD_SD_CANCEL_PUBLISH
8498  * WL_NAN_CMD_SD_CANCEL_SUBSCRIBE
8499  */
8500 typedef uint8 wl_nan_instance_id; /* Instance ID of an active publish instance */
8501 
8502 /*
8503  * WL_NAN_CMD_SD_VND_INFO
8504  */
8505 typedef struct wl_nan_sd_vendor_info
8506 {
8507     uint16 length; /* Size in bytes of the payload following this field */
8508     uint8 data[];    /* Vendor Information */
8509 } wl_nan_sd_vendor_info_t;
8510 
8511 /*
8512  * WL_NAN_CMD_SD_STATS
8513  */
8514 typedef struct wl_nan_sd_stats {
8515     uint32  sdftx;
8516     uint32  sdfrx;
8517     uint32  sdsrffail;
8518     uint32  sdrejrssi;
8519     uint32  sdfollowuprx;
8520     uint32  sdsubmatch;
8521     uint32  sdpubreplied;
8522     uint32  sdmftfail1;
8523     uint32  sdmftfail2;
8524     uint32  sdmftfail3;
8525     uint32  sdmftfail4;
8526 }  wl_nan_sd_stats_t;
8527 
8528 /*
8529  * WL_NAN_CMD_SD_TRANSMIT
8530  * WL_NAN_CMD_SD_FUP_TRANSMIT
8531  */
8532 typedef struct wl_nan_sd_transmit {
8533     uint8 local_service_id; /* Sender Service ID */
8534     uint8 requestor_service_id; /* Destination Service ID */
8535     struct ether_addr destination_addr; /* Destination MAC */
8536     uint16 token; /* follow_up_token when a follow-up msg is queued successfully */
8537     uint8 priority; /* requested relative prio */
8538     uint8 service_info_len; /* size in bytes of the service info payload */
8539     uint8 service_info[]; /* Service Info payload */
8540 } wl_nan_sd_transmit_t;
8541 
8542 /*
8543  * WL_NAN_CMD_SYNC_TSRESERVE
8544  */
8545 /** time slot */
8546 #define NAN_MAX_TIMESLOT    32
8547 typedef struct wl_nan_timeslot {
8548     uint32    abitmap; /**< available bitmap */
8549     uint32 chanlist[NAN_MAX_TIMESLOT];
8550 } wl_nan_timeslot_t;
8551 
8552 /*
8553  * Deprecated
8554  *
8555  * WL_NAN_CMD_SYNC_TSRELEASE
8556  */
8557 typedef uint32 wl_nan_ts_bitmap_t;
8558 
8559 /* nan passive scan params */
8560 #define NAN_SCAN_MAX_CHCNT 8
8561 typedef struct wl_nan_scan_params {
8562     uint16 scan_time;
8563     uint16 home_time;
8564     uint16 ms_intvl; /**< interval between merge scan */
8565     uint16 ms_dur;  /**< duration of merge scan */
8566     uint16 chspec_num;
8567     uint8 pad[2];
8568     chanspec_t chspec_list[NAN_SCAN_MAX_CHCNT]; /**< act. used 3, 5 rfu */
8569 } wl_nan_scan_params_t;
8570 
8571 /*
8572  * WL_NAN_CMD_DBG_SCAN
8573  */
8574 typedef struct wl_nan_dbg_scan {
8575     struct ether_addr cid;
8576     uint8 pad[2];
8577 } wl_nan_dbg_scan_t;
8578 
8579 /* NAN_DBG_LEVEL */
8580 typedef struct wl_nan_dbg_level {
8581     uint32 nan_err_level; /* for Error levels */
8582     uint32 nan_dbg_level; /* for bebug logs and trace */
8583     uint32 nan_info_level; /* for dumps like prhex */
8584 } wl_nan_dbg_level_t;
8585 
8586 /*
8587  * WL_NAN_CMD_DBG_EVENT_MASK
8588  */
8589 typedef uint32 wl_nan_event_mask_t;
8590 
8591 /*
8592  * WL_NAN_CMD_DBG_EVENT_CHECK
8593  */
8594 typedef uint8 wl_nan_dbg_ifname[BCM_MSG_IFNAME_MAX];
8595 
8596 /*
8597  * WL_NAN_CMD_DBG_DUMP
8598  * WL_NAN_CMD_DBG_CLEAR
8599  */
8600 enum wl_nan_dbg_dump_type {
8601     WL_NAN_DBG_DT_RSSI_DATA = 1,
8602     WL_NAN_DBG_DT_STATS_DATA = 2,
8603     /*
8604      * Additional enums before this line
8605      */
8606     WL_NAN_DBG_DT_INVALID
8607 };
8608 typedef int8 wl_nan_dbg_dump_type_t;
8609 
8610 /** various params and ctl swithce for nan_debug instance  */
8611 /*
8612  * WL_NAN_CMD_DBG_DEBUG
8613  */
8614 typedef struct wl_nan_debug_params {
8615     uint16    cmd;    /**< debug cmd to perform a debug action */
8616     uint16    status;
8617     uint32    msglevel; /**< msg level if enabled */
8618     uint8    enabled; /**< runtime debuging enabled */
8619     uint8 collect;
8620     uint8 PAD[2];
8621 } wl_nan_debug_params_t;
8622 
8623 
8624 typedef struct wl_nan_sched_svc_timeslot_s {
8625     uint32 abitmap; /* availability bitmap */
8626     uint32 chanlist[NAN_MAX_TIMESLOT];
8627     uint8  res; /* resolution: 0 = 16ms, 1 = 32ms, 2 = 64ms 3 = reserved. REfer NAN spec */
8628     uint8  mapid; /* mapid from NAN spec. Used to differentiate 2G Vs 5G band */
8629     uint8 PAD[2];
8630 } wl_nan_sched_svc_timeslot_t;
8631 
8632 
8633 /* nan passive scan params */
8634 #define NAN_SCAN_MAX_CHCNT 8
8635 typedef struct nan_scan_params {
8636     uint16 scan_time;
8637     uint16 home_time;
8638     uint16 ms_intvl; /**< interval between merge scan */
8639     uint16 ms_dur;  /**< duration of merge scan */
8640     uint16 chspec_num;
8641     uint8 pad[2];
8642     chanspec_t chspec_list[NAN_SCAN_MAX_CHCNT]; /**< act. used 3, 5 rfu */
8643 } nan_scan_params_t;
8644 
8645 /* nan cmd IDs */
8646 enum wl_nan_cmds {
8647      /* nan cfg /disc & dbg ioctls */
8648     WL_NAN_CMD_ENABLE = 1,
8649     WL_NAN_CMD_ATTR = 2,
8650     WL_NAN_CMD_NAN_JOIN = 3,
8651     WL_NAN_CMD_LEAVE = 4,
8652     WL_NAN_CMD_MERGE = 5,
8653     WL_NAN_CMD_STATUS = 6,
8654     WL_NAN_CMD_TSRESERVE = 7,
8655     WL_NAN_CMD_TSSCHEDULE = 8,
8656     WL_NAN_CMD_TSRELEASE = 9,
8657     WL_NAN_CMD_OUI = 10,
8658     WL_NAN_CMD_OOB_AF = 11,
8659 
8660     WL_NAN_CMD_COUNT = 15,
8661     WL_NAN_CMD_CLEARCOUNT = 16,
8662 
8663     /*  discovery engine commands */
8664     WL_NAN_CMD_PUBLISH = 20,
8665     WL_NAN_CMD_SUBSCRIBE = 21,
8666     WL_NAN_CMD_CANCEL_PUBLISH = 22,
8667     WL_NAN_CMD_CANCEL_SUBSCRIBE = 23,
8668     WL_NAN_CMD_TRANSMIT = 24,
8669     WL_NAN_CMD_CONNECTION = 25,
8670     WL_NAN_CMD_SHOW = 26,
8671     WL_NAN_CMD_STOP = 27,    /* stop nan for a given cluster ID  */
8672     /*  nan debug iovars & cmds  */
8673     WL_NAN_CMD_SCAN_PARAMS = 46,
8674     WL_NAN_CMD_SCAN = 47,
8675     WL_NAN_CMD_SCAN_RESULTS = 48,
8676     WL_NAN_CMD_EVENT_MASK = 49,
8677     WL_NAN_CMD_EVENT_CHECK = 50,
8678     WL_NAN_CMD_DUMP = 51,
8679     WL_NAN_CMD_CLEAR = 52,
8680     WL_NAN_CMD_RSSI = 53,
8681 
8682     WL_NAN_CMD_DEBUG = 60,
8683     WL_NAN_CMD_TEST1 = 61,
8684     WL_NAN_CMD_TEST2 = 62,
8685     WL_NAN_CMD_TEST3 = 63,
8686     WL_NAN_CMD_DISC_RESULTS = 64,
8687     /* nan 2.0 data path commands */
8688     WL_NAN_CMD_DATAPATH = 65
8689 };
8690 
8691 /*   NAN DP interface commands  */
8692 enum wl_nan_dp_cmds {
8693     /* nan 2.0 ioctls */
8694     WL_NAN_CMD_DP_CAP = 1000,
8695     WL_NAN_CMD_DP_CONFIG = 1001,
8696     WL_NAN_CMD_DP_CREATE = 1002,
8697     WL_NAN_CMD_DP_AUTO_CONNECT = 1003,
8698     WL_NAN_CMD_DP_DATA_REQ = 1004,
8699     WL_NAN_CMD_DP_DATA_RESP = 1005,
8700     WL_NAN_CMD_DP_SCHED_UPD = 1006,
8701     WL_NAN_CMD_DP_END = 1007,
8702     WL_NAN_CMD_DP_CONNECT = 1008,
8703     WL_NAN_CMD_DP_STATUS = 1009
8704 };
8705 
8706 /* TODO Should remove this fixed length */
8707 #define WL_NAN_DATA_SVC_SPEC_INFO_LEN 32 /* arbitrary */
8708 #define WL_NAN_DP_MAX_SVC_INFO          0xFF
8709 #define WL_NAN_DATA_NDP_INST_SUPPORT 16
8710 
8711 /* Nan flags */
8712 #define WL_NAN_DP_FLAG_SVC_INFO          (1 << 0)
8713 #define WL_NAN_DP_FLAG_CONFIRM          (1 << 1)
8714 #define WL_NAN_DP_FLAG_EXPLICIT_CFM   (1 << 2)
8715 #define WL_NAN_DP_FLAG_SECURITY          (1 << 3)
8716 
8717 /* NAN Datapath host status */
8718 #define WL_NAN_DP_STATUS_ACCEPTED     1
8719 #define WL_NAN_DP_STATUS_REJECTED     0
8720 
8721 /* to be done */
8722 typedef struct wl_nan_dp_cap {
8723     uint8 tbd;
8724 } wl_nan_dp_cap_t;
8725 
8726 
8727 /** The service hash (service id) is exactly this many bytes. */
8728 #define WL_NAN_SVC_HASH_LEN    6
8729 /** Number of hash functions per bloom filter */
8730 #define WL_NAN_HASHES_PER_BLOOM 4
8731 /* no. of max last disc results */
8732 #define WL_NAN_MAX_DISC_RESULTS    3
8733 
8734 /* NAN security related defines */
8735 /* NCS-SK related */
8736 #define WL_NAN_NCS_SK_PMK_LEN    32
8737 #define WL_NAN_NCS_SK_PMKID_LEN    16
8738 
8739 /* recent discovery results */
8740 typedef struct wl_nan_disc_result_s
8741 {
8742     wl_nan_instance_id_t instance_id;    /* instance id of pub/sub req */
8743     wl_nan_instance_id_t peer_instance_id;    /* peer instance id of pub/sub req/resp */
8744     uint8 svc_hash[WL_NAN_SVC_HASH_LEN];    /* service descp string */
8745     struct ether_addr peer_mac;    /* peer mac address */
8746 } wl_nan_disc_result_t;
8747 
8748 /* list of recent discovery results */
8749 typedef struct wl_nan_disc_results_s
8750 {
8751     wl_nan_disc_result_t disc_result[WL_NAN_MAX_DISC_RESULTS];
8752 } wl_nan_disc_results_list_t;
8753 
8754 /* nan 1.0 events */
8755 /* To be deprecated - will be replaced by event_disc_result */
8756 typedef struct wl_nan_ev_disc_result {
8757     wl_nan_instance_id_t pub_id;
8758     wl_nan_instance_id_t sub_id;
8759     struct ether_addr pub_mac;
8760     uint8 opt_tlvs[0];
8761 } wl_nan_ev_disc_result_t;
8762 
8763 typedef struct wl_nan_event_disc_result {
8764     wl_nan_instance_id_t pub_id;
8765     wl_nan_instance_id_t sub_id;
8766     struct ether_addr pub_mac;
8767     int8        publish_rssi;        /* publisher RSSI */
8768     uint8        attr_num;
8769     uint16        attr_list_len;    /* length of the all the attributes in the SDF */
8770     uint8        attr_list[0];    /* list of NAN attributes */
8771 } wl_nan_event_disc_result_t;
8772 
8773 typedef struct wl_nan_ev_p2p_avail {
8774     struct ether_addr sender;
8775     struct ether_addr p2p_dev_addr;
8776     uint8 dev_role;
8777     uint8 resolution;
8778     uint8 repeat;
8779     uint8 pad[3];
8780     chanspec_t chanspec;
8781     uint32 avail_bmap;
8782 } wl_nan_ev_p2p_avail_t;
8783 
8784 /*
8785 * discovery interface event structures *
8786 */
8787 
8788 /* mandatory parameters for OOB action frame */
8789 /* single-shot when bitmap and offset are set to 0; periodic otherwise */
8790 typedef struct wl_nan_oob_af_params_s
8791 {
8792     /* bitmap for the 32 timeslots in 512TU dw interval */
8793     uint32 ts_map;
8794     /* offset from start of dw, in us */
8795     uint32 tx_offset;
8796     struct ether_addr bssid;
8797     struct ether_addr dest;
8798     uint32 pkt_lifetime;
8799     uint16 payload_len;
8800     uint8 payload[1];
8801 } wl_nan_oob_af_params_t;
8802 
8803 /* NAN Ranging */
8804 
8805 /* Bit defines for global flags */
8806 #define WL_NAN_RANGING_ENABLE        1 /**< enable RTT */
8807 #define WL_NAN_RANGING_RANGED        2 /**< Report to host if ranged as target */
8808 typedef struct nan_ranging_config {
8809     uint32 chanspec;        /**< Ranging chanspec */
8810     uint16 timeslot;        /**< NAN RTT start time slot  1-511 */
8811     uint16 duration;        /**< NAN RTT duration in ms */
8812     struct ether_addr allow_mac;    /**< peer initiated ranging: the allowed peer mac
8813                      * address, a unicast (for one peer) or
8814                      * a broadcast for all. Setting it to all zeros
8815                      * means responding to none,same as not setting
8816                      * the flag bit NAN_RANGING_RESPOND
8817                      */
8818     uint16 flags;
8819 } wl_nan_ranging_config_t;
8820 
8821 /** list of peers for self initiated ranging */
8822 /** Bit defines for per peer flags */
8823 #define WL_NAN_RANGING_REPORT (1<<0)    /**< Enable reporting range to target */
8824 typedef struct nan_ranging_peer {
8825     uint32 chanspec;        /**< desired chanspec for this peer */
8826     uint32 abitmap;            /**< available bitmap */
8827     struct ether_addr ea;        /**< peer MAC address */
8828     uint8 frmcnt;            /**< frame count */
8829     uint8 retrycnt;            /**< retry count */
8830     uint16 flags;            /**< per peer flags, report or not */
8831     uint16 PAD;
8832 } wl_nan_ranging_peer_t;
8833 typedef struct nan_ranging_list {
8834     uint8 count;            /**< number of MAC addresses */
8835     uint8 num_peers_done;        /**< host set to 0, when read, shows number of peers
8836                      * completed, success or fail
8837                      */
8838     uint8 num_dws;            /**< time period to do the ranging, specified in dws */
8839     uint8 reserve;            /**< reserved field */
8840     wl_nan_ranging_peer_t rp[1];    /**< variable length array of peers */
8841 } wl_nan_ranging_list_t;
8842 
8843 /* ranging results, a list for self initiated ranging and one for peer initiated ranging */
8844 /* There will be one structure for each peer */
8845 #define WL_NAN_RANGING_STATUS_SUCCESS        1
8846 #define WL_NAN_RANGING_STATUS_FAIL        2
8847 #define WL_NAN_RANGING_STATUS_TIMEOUT        3
8848 #define WL_NAN_RANGING_STATUS_ABORT        4 /**< with partial results if sounding count > 0 */
8849 typedef struct nan_ranging_result {
8850     uint8 status;            /**< 1: Success, 2: Fail 3: Timeout 4: Aborted */
8851     uint8 sounding_count;        /**< number of measurements completed (0 = failure) */
8852     struct ether_addr ea;        /**< initiator MAC address */
8853     uint32 chanspec;        /**< Chanspec where the ranging was done */
8854     uint32 timestamp;        /**< 32bits of the TSF timestamp ranging was completed at */
8855     uint32 distance;        /**< mean distance in meters expressed as Q4 number.
8856                      * Only valid when sounding_count > 0. Examples:
8857                      * 0x08 = 0.5m
8858                      * 0x10 = 1m
8859                      * 0x18 = 1.5m
8860                      * set to 0xffffffff to indicate invalid number
8861                      */
8862     int32 rtt_var;            /**< standard deviation in 10th of ns of RTTs measured.
8863                      * Only valid when sounding_count > 0
8864                      */
8865     struct ether_addr tgtea;    /**< target MAC address */
8866     uint8 PAD[2];
8867 } wl_nan_ranging_result_t;
8868 typedef struct nan_ranging_event_data {
8869     uint8 mode;            /**< 1: Result of host initiated ranging */
8870                     /* 2: Result of peer initiated ranging */
8871     uint8 reserved;
8872     uint8 success_count;        /**< number of peers completed successfully */
8873     uint8 count;            /**< number of peers in the list */
8874     wl_nan_ranging_result_t rr[1];    /**< variable array of ranging peers */
8875 } wl_nan_ranging_event_data_t;
8876 
8877 enum {
8878     WL_NAN_STATS_RSSI = 1,
8879     WL_NAN_STATS_DATA = 2,
8880     WL_NAN_STATS_DP = 3,
8881 /*
8882  * ***** ADD before this line ****
8883  */
8884     WL_NAN_STATS_INVALID
8885 };
8886 typedef struct wl_nan_dp_stats {
8887     uint32 tbd; /* TBD */
8888 } wl_nan_dp_stats_t;
8889 
8890 typedef struct wl_nan_stats {
8891     /* general */
8892     uint32 cnt_dw; /* DW slots */
8893     uint32 cnt_disc_bcn_sch; /* disc beacon slots */
8894     uint32 cnt_amr_exp; /* count of ambtt expiries resetting roles */
8895     uint32 cnt_bcn_upd; /* count of beacon template updates */
8896     uint32 cnt_bcn_tx; /* count of sync & disc bcn tx */
8897     uint32 cnt_bcn_rx; /* count of sync & disc bcn rx */
8898     uint32 cnt_sync_bcn_tx; /* count of sync bcn tx within DW */
8899     uint32 cnt_disc_bcn_tx; /* count of disc bcn tx */
8900     uint32 cnt_sdftx_bcmc; /* count of bcast/mcast sdf tx */
8901     uint32 cnt_sdftx_uc; /* count of unicast sdf tx */
8902     uint32 cnt_sdftx_fail; /* count of unicast sdf tx fails */
8903     uint32 cnt_sdf_rx; /* count of  sdf rx */
8904     /* NAN roles */
8905     uint32 cnt_am; /* anchor master */
8906     uint32 cnt_master; /* master */
8907     uint32 cnt_nms; /* non master sync */
8908     uint32 cnt_nmns; /* non master non sync */
8909     /* TX */
8910     uint32 cnt_err_txtime; /* txtime in sync bcn frame not a multiple of dw intv */
8911     uint32 cnt_err_unsch_tx; /* tx while not in DW/ disc bcn slot */
8912     uint32 cnt_err_bcn_tx; /*  beacon tx error */
8913     uint32 cnt_sync_bcn_tx_miss; /* no. of times time delta between 2 cosequetive
8914                         * sync beacons is more than expected
8915                         */
8916     /* MSCH */
8917     uint32 cnt_err_msch_reg; /* error is Dw/disc reg with msch */
8918     uint32 cnt_err_wrong_ch_cb; /* count of msch calbacks in wrong channel */
8919     uint32 cnt_dw_skip;    /* count of DW rejected */
8920     uint32 cnt_disc_skip; /* count of disc bcn rejected */
8921     uint32 cnt_dw_start_early; /* msch cb not at registered time */
8922     uint32 cnt_dw_start_late; /* no. of delays in slot start */
8923     /* SCANS */
8924     uint32 cnt_mrg_scan; /* count of merge scans completed */
8925     uint32 cnt_err_ms_rej; /* number of merge scan failed */
8926     uint32 cnt_scan_results; /* no. of nan beacons scanned */
8927     uint32 cnt_join_scan_rej; /* no. of join scans rejected */
8928     uint32 cnt_nan_scan_abort; /* no. of join scans rejected */
8929     /* enable/disable */
8930     uint32 cnt_nan_enab; /* no. of times nan feature got enabled */
8931     uint32 cnt_nan_disab; /* no. of times nan feature got disabled */
8932     uint32 cnt_sync_bcn_rx; /* count of sync bcn rx within DW */
8933 } wl_nan_stats_t;
8934 
8935 #define WL_NAN_MAC_MAX_NAN_PEERS 6
8936 #define WL_NAN_MAC_MAX_RSSI_DATA_PER_PEER  10
8937 
8938 typedef struct wl_nan_nbr_rssi {
8939     uint8 rx_chan; /* channel number on which bcn rcvd */
8940     uint8 PAD[3];
8941     int32 rssi_raw;  /* received rssi value */
8942     int32 rssi_avg;  /* normalized rssi value */
8943 } wl_nan_peer_rssi_t;
8944 
8945 typedef struct wl_nan_peer_rssi_entry {
8946     struct ether_addr mac;  /* peer mac address */
8947     uint8 flags;   /* TODO:rssi data order: latest first, oldest first etc */
8948     uint8 rssi_cnt;   /* rssi data sample present */
8949     wl_nan_peer_rssi_t rssi[WL_NAN_MAC_MAX_RSSI_DATA_PER_PEER]; /* RSSI data frm peer */
8950 } wl_nan_peer_rssi_entry_t;
8951 
8952 #define WL_NAN_PEER_RSSI      0x1
8953 #define WL_NAN_PEER_RSSI_LIST 0x2
8954 
8955 typedef struct wl_nan_nbr_rssi_data {
8956     uint8 flags;   /* this is a list or single rssi data */
8957     uint8 peer_cnt; /* number of peers */
8958     uint16 pad; /* padding */
8959     wl_nan_peer_rssi_entry_t peers[1]; /* peers data list */
8960 } wl_nan_peer_rssi_data_t;
8961 
8962 /* WL_NAN_CMD_DBG_DUMP, GET Resp */
8963 typedef struct wl_nan_dbg_dump_rsp {
8964     wl_nan_dbg_dump_type_t dump_type; /* dump data type */
8965     uint8 pad[3];
8966     union {
8967         wl_nan_peer_rssi_data_t peer_rssi;
8968         wl_nan_stats_t        nan_stats;
8969     } u;
8970 } wl_nan_dbg_dump_rsp_t;
8971 
8972 enum nan_termination_status {
8973     NAN_TERM_REASON_INVALID = 1,
8974     NAN_TERM_REASON_TIMEOUT = 2,
8975     NAN_TERM_REASON_USER_REQ = 3,
8976     NAN_TERM_REASON_FAILURE = 4,
8977     NAN_TERM_REASON_COUNT_REACHED = 5,
8978     NAN_TERM_REASON_DE_SHUTDOWN = 6,
8979     NAN_TERM_REASON_DISABLE_IN_PROGRESS = 7
8980 };
8981 
8982 /* nan2 data iovar */
8983 /* nan2 qos */
8984 typedef struct wl_nan_dp_qos
8985 {
8986     uint8 tid;
8987     uint8 pad;
8988     uint16 pkt_size;
8989     uint16 mean_rate;
8990     uint16 svc_interval;
8991 } wl_nan_dp_qos_t;
8992 /* ndp config */
8993 typedef struct wl_nan_ndp_config
8994 {
8995     uint8 ndp_id;
8996     uint8 pub_id;
8997     struct ether_addr pub_addr;
8998     struct ether_addr data_addr;    /* configure local data addr */
8999     struct ether_addr init_data_addr;    /* initiator data addr */
9000     uint8 svc_spec_info[WL_NAN_DATA_SVC_SPEC_INFO_LEN];
9001     wl_nan_dp_qos_t qos;
9002     uint16 avail_len;
9003     uint8 pad[3];
9004     uint8 data[1];
9005 } wl_nan_ndp_config_t;
9006 
9007 /* nan2 device capabilities */
9008 typedef struct wl_nan_ndp_oper_cfg {
9009     uint8 awake_dw_2g;
9010     uint8 awake_dw_5g;
9011     uint8 bands_supported;
9012     uint8 op_mode;
9013 } wl_nan_ndp_oper_cfg_t;
9014 
9015 typedef uint8 wl_nan_ndp_ndpid_t;
9016 typedef uint8 wl_nan_ndp_conn_t;
9017 
9018 typedef struct wl_nan_dp_req {
9019     uint8 type;            /* 0- unicast 1 - multicast */
9020     uint8 pub_id;            /* Publisher ID */
9021     uint16 flags;
9022     struct ether_addr peer_mac; /* Peer's NMI addr */
9023     struct ether_addr mcast_mac; /* Multicast addr */
9024     wl_nan_dp_qos_t qos;
9025     uint8 tlv_params[];    /* xtlv parameters for command */
9026 } wl_nan_dp_req_t;
9027 
9028 /* TODO  Need to replace ndp_id with lndp_id */
9029 /* Return structure to data req IOVAR */
9030 typedef struct wl_nan_dp_req_ret {
9031     struct ether_addr indi;        /* Initiators data mac addr */
9032     uint8 ndp_id;            /* Initiators ndpid */
9033     uint8 pad;
9034 } wl_nan_dp_req_ret_t;
9035 
9036 typedef struct wl_nan_dp_resp {
9037     uint8 type;            /* 0- unicast 1 - multicast */
9038     uint8 status;            /* Accepted or Rejected */
9039     uint8 reason_code;
9040     /* Local NDP ID for unicast, mc_id for multicast, 0 for implicit NMSG */
9041     uint8 ndp_id;
9042     wl_nan_dp_qos_t qos;
9043     /* Initiator data address for unicast or multicast address for multicast */
9044     struct ether_addr mac_addr;
9045     uint16 flags;
9046     uint8 tlv_params[];    /* xtlv parameters for command */
9047 } wl_nan_dp_resp_t;
9048 
9049 /* Return structure to data resp IOVAR */
9050 typedef struct wl_nan_dp_resp_ret {
9051     uint8 nmsgid;            /* NMSG ID or for multicast else 0 */
9052     uint8 pad[3];
9053 } wl_nan_dp_resp_ret_t;
9054 
9055 typedef struct wl_nan_dp_conf {
9056     uint8 lndp_id;
9057     uint8 status;            /* Accepted or Rejected */
9058     uint8 pad[2];
9059 } wl_nan_dp_conf_t;
9060 
9061 typedef struct wl_nan_dp_end
9062 {
9063     uint8 lndp_id;
9064     uint8 status;
9065     uint8 pad[2];
9066 } wl_nan_dp_end_t;
9067 
9068 typedef struct wl_nan_dp_schedupd {
9069     uint8 type;        /* 0: unicast, 1: multicast */
9070     uint8 flags;
9071     struct ether_addr addr;    /* peer NMI or multicast addr */
9072     wl_nan_dp_qos_t qos;
9073     uint8 map_id;
9074     uint8 pad[3];
9075 } wl_nan_dp_schedupd_t;
9076 
9077 /* set: update with notification, unset: NDL setup handshake */
9078 #define WL_NAN_DP_SCHEDUPD_NOTIF (1 << 0)
9079 
9080 /* list ndp ids */
9081 typedef struct wl_nan_ndp_id_list {
9082     uint16 ndp_count;
9083     uint8 lndp_id[];
9084 } wl_nan_ndp_id_list_t;
9085 
9086 /* nan2 status */
9087 typedef struct ndp_session {
9088     uint8 lndp_id;
9089     uint8 state;
9090     uint8 pub_id;
9091     uint8 pad;
9092 } ndp_session_t;
9093 
9094 typedef struct wl_nan_ndp_status {
9095     struct ether_addr peer_nmi;
9096     struct ether_addr peer_ndi;
9097     ndp_session_t session;
9098     uint8 pad;
9099 } wl_nan_ndp_status_t;
9100 
9101 /* events */
9102 #define NAN_DP_SESSION_UNICAST         0
9103 #define NAN_DP_SESSION_MULTICAST       1
9104 #define NAN_DP_SECURITY_NONE           0
9105 #define NAN_DP_SECURITY_CSID           1
9106 #define NAN_DP_SECURITY_MK             2
9107 #define WL_NAN_DATA_NMSGID_LEN    8 /* 8 bytes as per nan spec */
9108 
9109 /* Common event structure for Nan Datapath
9110  * Used for sending NDP Indication, Response, Confirmation, Securty Install and Establish events
9111  */
9112 typedef struct wl_nan_ev_datapath_cmn {
9113     uint8 type;
9114     /* ndp_id is valid only if type is unicast */
9115     uint8 ndp_id;
9116     uint8 pub_id;
9117     uint8 security;
9118     /* Following two fields are valid only if type is unicast */
9119     struct ether_addr initiator_ndi;
9120     struct ether_addr responder_ndi;
9121     struct ether_addr peer_nmi;
9122     uint8 status;
9123     uint8 role;
9124     /* Following two fields are valid only if type is multicast */
9125     uint8 nmsg_id[WL_NAN_DATA_NMSGID_LEN];
9126     uint8 mc_id;
9127     uint8 pad[1];
9128     uint16 opt_tlv_len;
9129     uint8 opt_tlvs[];
9130 } wl_nan_ev_datapath_cmn_t;
9131 
9132 typedef struct wl_nan_ev_datapath_end {
9133     uint8 ndp_id;
9134     uint8 status;
9135     uint8 pad[2];
9136     struct ether_addr peer_nmi;
9137     struct ether_addr peer_ndi;
9138 } wl_nan_ev_datapath_end_t;
9139 
9140 /* NAN2.0 Ranging definitions */
9141 
9142 /* result indication bit map */
9143 #define NAN_RANGE_INDICATION_CONT        (1<<0)
9144 #define NAN_RANGE_INDICATION_INGRESS        (1<<1)
9145 #define NAN_RANGE_INIDICATION_EGRESS        (1<<2)
9146 
9147 /* responder flags */
9148 #define NAN_RANGE_FLAG_AUTO_ACCEPT    (1 << 0)
9149 #define NAN_RANGE_FLAG_RESULT_REQUIRED    (1 << 1)
9150 
9151 typedef struct wl_nan_range_req {
9152     struct ether_addr peer;
9153     uint8 publisher_id;
9154     uint8 indication; /* bit map for result event */
9155     uint32 resolution; /* default millimeters */
9156     uint32 ingress; /* ingress limit in mm */
9157     uint32 egress; /* egress limit in mm */
9158     uint32 interval; /* max interval(in TU) b/w two ranging measurements */
9159 } wl_nan_range_req_t;
9160 
9161 #define NAN_RNG_REQ_IOV_LEN    24
9162 
9163 typedef uint8 wl_nan_range_id;
9164 
9165 typedef struct wl_nan_range_resp {
9166     wl_nan_range_id range_id;
9167     uint8 flags; /* auto response, range result required */
9168     uint8 status; /* accept, reject */
9169     uint8 indication; /* bit map for result event */
9170     uint32 resolution; /* default millimeters */
9171     uint32 ingress; /* ingress limit in mm */
9172     uint32 egress; /* egress limit in mm */
9173     uint32 interval; /* max interval(in TU) b/w two ranging measurements */
9174 } wl_nan_range_resp_t;
9175 
9176 #define NAN_RNG_RESP_IOV_LEN    20
9177 
9178 #define NAN_RNG_MAX_IOV_LEN    255
9179 
9180 typedef struct wl_nan_ev_rng_req_ind {
9181     struct ether_addr peer_m_addr;
9182     uint8 rng_id;
9183     /* ftm parameters */
9184     uint8 max_burst_dur;
9185     uint8 min_ftm_delta;
9186     uint8 max_num_ftm;
9187     uint8 ftm_format_bw;
9188     /* location info availability bit map */
9189     uint8 lc_info_avail;
9190     /* Last movement indication */
9191     uint16 last_movement;
9192     uint8 pad[2];
9193 } wl_nan_ev_rng_req_ind_t;
9194 
9195 #define NAN_RNG_REQ_IND_SIZE 14
9196 
9197 typedef struct wl_nan_ev_rng_rpt_ind {
9198     uint32 dist_mm; /* in millimeter */
9199     struct ether_addr peer_m_addr;
9200     uint8 indication; /* indication definitions mentioned above */
9201     uint8 pad;
9202 } wl_nan_ev_rng_rpt_ind_t;
9203 
9204 #define NAN_RNG_RPT_IND_SIZE 11
9205 
9206 typedef struct wl_nan_ev_rng_term_ind {
9207     struct ether_addr peer_m_addr;
9208     uint8 reason_code;
9209     uint8 pad;
9210 } wl_nan_ev_rng_term_ind_t;
9211 
9212 #define NAN_RNG_TERM_IND_SIZE 7
9213 
9214 
9215 /* ********************* end of NAN section ******************************** */
9216 /* endif WL_NAN */
9217 
9218 #define P2P_NAN_IOC_BUFSZ  512 /* some sufficient ioc buff size */
9219 #define WL_P2P_NAN_IOCTL_VERSION    0x1
9220 
9221 /* container for p2p nan iovtls & events */
9222 typedef struct wl_p2p_nan_ioc {
9223     uint16  version;    /* interface command or event version */
9224     uint16  id;     /* p2p nan ioctl cmd  ID  */
9225     uint16  len;        /* total length of data[]  */
9226     uint16  pad;        /* padding */
9227     uint8   data [];   /* var len payload of bcm_xtlv_t type */
9228 } wl_p2p_nan_ioc_t;
9229 
9230 /* p2p nan cmd IDs */
9231 enum wl_p2p_nan_cmds {
9232     /* p2p nan cfg ioctls */
9233     WL_P2P_NAN_CMD_ENABLE = 1,
9234     WL_P2P_NAN_CMD_CONFIG = 2,
9235     WL_P2P_NAN_CMD_DEL_CONFIG = 3,
9236     WL_P2P_NAN_CMD_GET_INSTS = 4
9237 };
9238 
9239 #define WL_P2P_NAN_CONFIG_VERSION       1
9240 
9241 #define WL_P2P_NAN_DEVICE_P2P  0x0
9242 #define WL_P2P_NAN_DEVICE_GO   0x1
9243 #define WL_P2P_NAN_DEVICE_GC   0x2
9244 #define WL_P2P_NAN_DEVICE_INVAL   0xFF
9245 
9246 /* NAN P2P operation */
9247 typedef struct p2p_nan_config {
9248     uint16 version;            /* wl_p2p_nan_config_t structure version */
9249     uint16 len;                /* total length including version and variable IE */
9250     uint32 flags;              /* 0x1 to NEW, 0x2 to ADD, 0x4 to DEL */
9251     uint8  inst_id;            /* publisher/subscriber id */
9252     uint8  inst_type;          /* publisher/subscriber */
9253     uint8  dev_role;           /* P2P device role: 'P2P','GO' or 'GC' */
9254     uint8  pad1;               /* padding */
9255     uint8  resolution;         /* Availability bitmap resolution */
9256     uint8  repeat;             /* Whether Availabilty repeat across DW */
9257     uint16 ie_len;             /* variable ie len */
9258     struct ether_addr dev_mac; /* P2P device addres */
9259     uint16 pad2;               /* Padding */
9260     uint32 avail_bmap;         /* availability interval bitmap */
9261     uint32 chanspec;           /* Chanspec */
9262     uint8  ie[];              /* hex ie data */
9263 } wl_p2p_nan_config_t;
9264 
9265 #define WL_P2P_NAN_SERVICE_LIST_VERSION 1
9266 typedef enum wl_nan_service_type {
9267     WL_NAN_SVC_INST_PUBLISHER = 1,
9268     WL_NAN_SVC_INST_SUBSCRIBER = 2
9269 } wl_nan_service_type_t;
9270 
9271 #define WL_P2P_NAN_CONFIG_NEW   0x1
9272 #define WL_P2P_NAN_CONFIG_ADD   0x2
9273 #define WL_P2P_NAN_CONFIG_DEL   0x4
9274 
9275 typedef struct wl_nan_svc_inst {
9276     uint8  inst_id;      /* publisher/subscriber id */
9277     uint8  inst_type;    /* publisher/subscriber */
9278 } wl_nan_svc_inst_t;
9279 
9280 typedef struct wl_nan_svc_inst_list {
9281     uint16 version;           /* this structure version */
9282     uint16 len;               /* total length including version and variable svc list */
9283     uint16 count;             /* service instance count */
9284     uint16 pad;               /* padding */
9285     wl_nan_svc_inst_t svc[1]; /* service instance list */
9286 } wl_nan_svc_inst_list_t;
9287 
9288 #define NAN_POST_DISC_P2P_DATA_VER  1
9289 /* This structure will be used send peer p2p data with
9290  * NAN discovery result
9291  */
9292 typedef struct nan_post_disc_p2p_data {
9293     uint8 ver;                 /* this structure version */
9294     uint8 dev_role;            /* P2P Device role */
9295     uint8 resolution;          /* Availability bitmap resolution */
9296     uint8 repeat;              /* Whether Availabilty repeat across DW */
9297     struct ether_addr dev_mac; /* P2P device addres */
9298     uint16 pad1;               /* Padding */
9299     uint32 chanspec;           /* Chanspec */
9300     uint32 avl_bmp;                /* availability interval bitmap */
9301 } nan_post_disc_p2p_data_t;
9302 
9303 /* timeslot etc for NAN */
9304 enum {
9305     WL_TMU_TU            = 0,
9306     WL_TMU_SEC           = 1,
9307     WL_TMU_MILLI_SEC     = 2,
9308     WL_TMU_MICRO_SEC     = 3,
9309     WL_TMU_NANO_SEC      = 4,
9310     WL_TMU_PICO_SEC      = 5
9311 };
9312 typedef int16 wl_tmu_t;
9313 
9314 typedef struct {
9315     uint32   intvl;               /* time interval */
9316     wl_tmu_t tmu;                 /* time unit */
9317     uint8    pad[2];              /* padding */
9318 } wl_time_interval_t;
9319 
9320 /* availabiloty slot flags */
9321 enum {
9322     WL_AVAIL_SLOT_NONE        = 0x0000,
9323     WL_AVAIL_SLOT_COM        = 0x0001,        /* committed */
9324     WL_AVAIL_SLOT_POT        = 0x0002,        /* potential */
9325     WL_AVAIL_SLOT_PROP        = 0x0004,    /* proposed -  note: not configurable */
9326     WL_AVAIL_SLOT_PAGED        = 0x0008    /* P-NDL */
9327     /* 0x0030 - resrved for NDC index */
9328     /* 0x00c0 - resrved for usage preference */
9329 };
9330 typedef int16 wl_avail_slot_flags_t;
9331 
9332 #define WL_AVAIL_SLOT_NDC_MASK 0x0030 /* up to 4 NDCs */
9333 #define WL_AVAIL_SLOT_NDC_SHIFT 4
9334 #define WL_AVAIL_SLOT_NDC(_flags)  (((_flags) & WL_AVAIL_SLOT_NDC_MASK) \
9335      >> WL_AVAIL_SLOT_NDC_SHIFT)
9336 #define WL_AVAIL_SLOT_SET_NDC(_flags, _ndc_idx) (((_flags) & ~WL_AVAIL_SLOT_NDC_MASK) |\
9337     ((_ndc_idx) << WL_AVAIL_SLOT_NDC_SHIFT))
9338 
9339 #define WL_AVAIL_SLOT_UPREF_MASK 0x00c0 /* up to 4 usage preferences */
9340 #define WL_AVAIL_SLOT_UPREF_SHIFT 6
9341 #define WL_AVAIL_SLOT_UPREF(_flags)  (((_flags) & WL_AVAIL_SLOT_UPREF_MASK) \
9342      >> WL_AVAIL_SLOT_UPREF_SHIFT)
9343 #define WL_AVAIL_SLOT_SET_UPREF(_flags, _pref) (((_flags) & ~WL_AVAIL_SLOT_UPREF_MASK) |\
9344     ((_pref) << WL_AVAIL_SLOT_UPREF_SHIFT))
9345 
9346 typedef struct wl_avail_slot {
9347     wl_avail_slot_flags_t flags;
9348     uint16                PAD;
9349     wl_time_interval_t    start;        /* from time ref */
9350     wl_time_interval_t    duration;     /* from start */
9351     uint32                chanspec;     /* channel spec */
9352 } wl_avail_slot_t;
9353 
9354 /* time reference */
9355 enum {
9356     WL_TIME_REF_NONE        = 0,
9357     WL_TIME_REF_DEV_TSF     = 1,
9358     WL_TIME_REF_NAN_DW      = 2,
9359     WL_TIME_REF_TBTT        = 3,
9360     WL_TIME_REF_NAN_DW0     = 4
9361 };
9362 typedef int16 wl_time_ref_t;
9363 
9364 enum {
9365     WL_AVAIL_NONE        = 0x0000,
9366     WL_AVAIL_LOCAL        = 0x0001,
9367     WL_AVAIL_PEER        = 0x0002,
9368     WL_AVAIL_NDC        = 0x0003,
9369     WL_AVAIL_IMMUTABLE    = 0x0004,
9370     WL_AVAIL_RESPONSE    = 0x0005,
9371     WL_AVAIL_COUNTER    = 0x0006,
9372     WL_AVAIL_RANGING    = 0x0007,
9373     WL_AVAIL_TYPE_MAX    = WL_AVAIL_RANGING    /* New ones before and update */
9374 };
9375 #define WL_AVAIL_TYPE_MASK    0x000F
9376 #define WL_AVAIL_FLAG_RAW_MODE    0x8000
9377 typedef int16 wl_avail_flags_t;
9378 
9379 /* availability entry flags */
9380 enum {
9381     WL_AVAIL_ENTRY_NONE        = 0x0000,
9382     WL_AVAIL_ENTRY_COM        = 0x0001,        /* committed */
9383     WL_AVAIL_ENTRY_POT        = 0x0002,        /* potential */
9384     WL_AVAIL_ENTRY_COND        = 0x0004,    /* conditional */
9385     WL_AVAIL_ENTRY_PAGED        = 0x0008,    /* P-NDL */
9386     WL_AVAIL_ENTRY_USAGE        = 0x0030,    /* usage preference */
9387     WL_AVAIL_ENTRY_BIT_DUR        = 0x00c0,    /* bit duration */
9388     WL_AVAIL_ENTRY_BAND_PRESENT    = 0x0100,    /* band present */
9389     WL_AVAIL_ENTRY_CHAN_PRESENT    = 0x0200,    /* channel information present */
9390     WL_AVAIL_ENTRY_CHAN_ENTRY_PRESENT    = 0x0400,    /* channel entry (opclass+bitmap) */
9391 };
9392 
9393 /* bit duration */
9394 enum {
9395     WL_AVAIL_BIT_DUR_16    = 0,    /* 16TU */
9396     WL_AVAIL_BIT_DUR_32    = 1,    /* 32TU */
9397     WL_AVAIL_BIT_DUR_64    = 2,    /* 64TU */
9398     WL_AVAIL_BIT_DUR_128    = 3,    /* 128TU */
9399 };
9400 
9401 /* period */
9402 enum {
9403     WL_AVAIL_PERIOD_0    = 0,    /* 0TU */
9404     WL_AVAIL_PERIOD_128    = 1,    /* 128TU */
9405     WL_AVAIL_PERIOD_256    = 2,    /* 256TU */
9406     WL_AVAIL_PERIOD_512    = 3,    /* 512TU */
9407     WL_AVAIL_PERIOD_1024    = 4,    /* 1024TU */
9408     WL_AVAIL_PERIOD_2048    = 5,    /* 2048TU */
9409     WL_AVAIL_PERIOD_4096    = 6,    /* 4096TU */
9410     WL_AVAIL_PERIOD_8192    = 7,    /* 8192TU */
9411 };
9412 
9413 /* band */
9414 enum {
9415     WL_AVAIL_BAND_NONE    = 0,    /* reserved */
9416     WL_AVAIL_BAND_SUB1G    = 1,    /* sub-1 GHz */
9417     WL_AVAIL_BAND_2G    = 2,    /* 2.4 GHz */
9418     WL_AVAIL_BAND_3G    = 3,    /* reserved (for 3.6 GHz) */
9419     WL_AVAIL_BAND_5G    = 4,    /* 4.9 and 5 GHz */
9420     WL_AVAIL_BAND_60G    = 5,    /* reserved (for 60 GHz) */
9421 };
9422 
9423 #define WL_AVAIL_ENTRY_TYPE_MASK 0x0F
9424 #define WL_AVAIL_ENTRY_USAGE_MASK 0x0030 /* up to 4 usage preferences */
9425 #define WL_AVAIL_ENTRY_USAGE_SHIFT 4
9426 #define WL_AVAIL_ENTRY_USAGE_VAL(_flags)  (((_flags) & WL_AVAIL_ENTRY_USAGE_MASK) \
9427     >> WL_AVAIL_ENTRY_USAGE_SHIFT)
9428 
9429 #define WL_AVAIL_ENTRY_BIT_DUR_MASK 0x00c0 /* 0:16TU, 1:32TU, 2:64TU, 3:128TU */
9430 #define WL_AVAIL_ENTRY_BIT_DUR_SHIFT 6
9431 #define WL_AVAIL_ENTRY_BIT_DUR_VAL(_flags)  (((_flags) & WL_AVAIL_ENTRY_BIT_DUR_MASK) \
9432     >> WL_AVAIL_ENTRY_BIT_DUR_SHIFT)
9433 
9434 #define WL_AVAIL_ENTRY_BAND_MASK 0x0100 /* 0=band not present, 1=present */
9435 #define WL_AVAIL_ENTRY_BAND_SHIFT 8
9436 
9437 #define WL_AVAIL_ENTRY_CHAN_MASK 0x0200 /* 0=channel info not present, 1=present */
9438 #define WL_AVAIL_ENTRY_CHAN_SHIFT 9
9439 
9440 #define WL_AVAIL_ENTRY_CHAN_ENTRY_MASK 0x0400 /* 0=chanspec, 1=hex channel entry */
9441 #define WL_AVAIL_ENTRY_CHAN_ENTRY_SHIFT 10
9442 
9443 #define WL_AVAIL_ENTRY_OPCLASS_MASK 0xFF
9444 #define WL_AVAIL_ENTRY_CHAN_BITMAP_MASK 0xFF00
9445 #define WL_AVAIL_ENTRY_CHAN_BITMAP_SHIFT 8
9446 #define WL_AVAIL_ENTRY_CHAN_BITMAP_VAL(_info) (((_info) & WL_AVAIL_ENTRY_CHAN_BITMAP_MASK) \
9447     >> WL_AVAIL_ENTRY_CHAN_BITMAP_SHIFT)
9448 
9449 /* Used for raw channel entry field input */
9450 #define    MAX_CHAN_ENTRY_LEN 6
9451 
9452 typedef struct wl_avail_entry {
9453     uint16        length;        /* total length */
9454     uint16        start_offset;    /* in TUs, multiply by 16 for total offset */
9455     union {
9456         uint32 channel_info;    /* either chanspec or hex channel entry (opclass +
9457                      * bitmap per NAN spec), as indicated by setting
9458                      * WL_AVAIL_ENTRY_HEX_CHAN_ENTRY flag
9459                      */
9460         uint32 band;        /* defined by WL_BAND enum, 2=2.4GHz, 4=5GHz */
9461         uint8    channel_entry[MAX_CHAN_ENTRY_LEN];
9462     } u;                /* band or channel value, 0=all band/channels */
9463     uint8        pad[2];
9464     uint8        period;        /* in TUs, defined by WL_AVAIL_PERIOD enum
9465                      * 1:128, 2:256, 3:512, 4:1024, 5:2048, 6:4096,
9466                      * 7:8192
9467                      */
9468     uint8        bitmap_len;
9469     uint16        flags;        /* defined by avail entry flags enum:
9470                      * type, usage pref, bit duration, band, channel
9471                      */
9472     uint8        bitmap[];    /* time bitmap */
9473 } wl_avail_entry_t;
9474 
9475 typedef struct wl_avail {
9476     uint16        length;        /* total length */
9477     uint16        flags;        /* defined by WL_AVAIL enum
9478                      * 1=local, 2=peer, 3=ndc, 4=immutable,
9479                      * 5=response, 6=counter
9480                      */
9481     uint8        id;        /* id used for multiple maps/avail */
9482     uint8        pad[3];
9483     struct ether_addr addr;    /* peer mac address or ndc id */
9484     uint8        num_entries;
9485     uint8        entry_offset;
9486     /* add additional fields above this line */
9487     uint8        entry[];
9488 } wl_avail_t;
9489 
9490 #define WL_AVAIL_MIN_LEN(n) ((n) ? OFFSETOF(wl_avail_t, entry) + \
9491         ((n) * OFFSETOF(wl_avail_entry_t, bitmap)) : 0)
9492 
9493 /* unaligned schedule (window) */
9494 typedef struct wl_avail_ulw {
9495     uint8    id;        /* schedule ID */
9496     uint8    overwrite;    /* bit 0: overwrite all
9497                  * 1-4: map ID if overwrite all is 0
9498                  */
9499     uint16    flags;
9500     uint32    start;        /* start time of first ULW, in us */
9501     uint32    dur;        /* duration of ULW, in us */
9502     uint32    period;        /* time between consecutive ULWs, in us */
9503     union {
9504         uint32 chanspec;
9505         uint32 band;
9506         uint8 chan_entry[MAX_CHAN_ENTRY_LEN];
9507         uint8 pad[8];
9508     } u;
9509     uint8    cntdwn;        /* remaining ULWs before schedule ends */
9510     uint8    pad[3];
9511 } wl_avail_ulw_t;
9512 
9513 /* unset: NAN is not available during ULW, set: NAN is avail depending on ctrl flags */
9514 #define WL_NAN_ULW_CTRL_PRESENT        (1 << 0)
9515 /* unset: band, set: channel */
9516 #define WL_NAN_ULW_CTRL_TYPE        (1 << 1)
9517 /* set: NAN is availabile on specified band/channel */
9518 #define WL_NAN_ULW_CTRL_AVAIL        (1 << 2)
9519 /* channel is provided in raw attribute format */
9520 #define WL_NAN_ULW_CTRL_RAW_CHAN    (1 << 3)
9521 
9522 /* nan wfa testmode operations */
9523 enum {
9524     WL_NAN_WFA_TM_IGNORE_TERMINATE_NAF        = 0x00000001,
9525     WL_NAN_WFA_TM_IGNORE_RX_DATA_OUTSIDE_CRB    = 0x00000002,
9526     WL_NAN_WFA_TM_ALLOW_TX_DATA_OUTSIDE_CRB        = 0x00000004,
9527     WL_NAN_WFA_TM_ENFORCE_NDL_COUNTER        = 0x00000008,
9528     WL_NAN_WFA_TM_BYPASS_NDL_PROPOSAL_VALIDATION    = 0x00000010,
9529     /* allow data(pings) tx while ndp sec negotiation */
9530     WL_NAN_WFA_TM_SEC_SEND_PINGS_BYPASS_NDP_SM    = 0x00000020,
9531     /* generate and insert incorrect mic */
9532     WL_NAN_WFA_TM_SEC_INCORRECT_MIC                = 0x00000040,
9533     /* send m4 reject deliberately */
9534     WL_NAN_WFA_TM_SEC_REJECT_STATUS4M4        = 0x00000080,
9535     /* send mgmt frame (for eg. ndp terminate) in clear txt (bypass security) */
9536     WL_NAN_WFA_TM_SEC_SEND_MGMT_CLEAR            = 0x00000100,
9537     WL_NAN_WFA_TM_FLAG_MASK                = 0x000001ff /* add above & update mask */
9538 };
9539 typedef uint32 wl_nan_wfa_testmode_t;
9540 
9541 #define RSSI_THRESHOLD_SIZE 16
9542 #define MAX_IMP_RESP_SIZE 256
9543 
9544 typedef struct wl_proxd_rssi_bias {
9545     int32        version;            /**< version */
9546     int32        threshold[RSSI_THRESHOLD_SIZE];    /**< threshold */
9547     int32        peak_offset;            /**< peak offset */
9548     int32        bias;                /**< rssi bias */
9549     int32        gd_delta;            /**< GD - GD_ADJ */
9550     int32        imp_resp[MAX_IMP_RESP_SIZE];    /**< (Hi*Hi)+(Hr*Hr) */
9551 } wl_proxd_rssi_bias_t;
9552 
9553 typedef struct wl_proxd_rssi_bias_avg {
9554     int32        avg_threshold[RSSI_THRESHOLD_SIZE];    /**< avg threshold */
9555     int32        avg_peak_offset;            /**< avg peak offset */
9556     int32        avg_rssi;                /**< avg rssi */
9557     int32        avg_bias;                /**< avg bias */
9558 } wl_proxd_rssi_bias_avg_t;
9559 
9560 #include <packed_section_start.h>
9561 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_info {
9562     uint16        type;  /**< type: 0 channel table, 1 channel smoothing table, 2 and 3 seq */
9563     uint16        index;        /**< The current frame index, from 1 to total_frames. */
9564     uint16        tof_cmd;    /**< M_TOF_CMD      */
9565     uint16        tof_rsp;    /**< M_TOF_RSP      */
9566     uint16        tof_avb_rxl;    /**< M_TOF_AVB_RX_L */
9567     uint16        tof_avb_rxh;    /**< M_TOF_AVB_RX_H */
9568     uint16        tof_avb_txl;    /**< M_TOF_AVB_TX_L */
9569     uint16        tof_avb_txh;    /**< M_TOF_AVB_TX_H */
9570     uint16        tof_id;        /**< M_TOF_ID */
9571     uint8        tof_frame_type;
9572     uint8        tof_frame_bw;
9573     int8        tof_rssi;
9574     int32        tof_cfo;
9575     int32        gd_adj_ns;    /**< gound delay */
9576     int32        gd_h_adj_ns;    /**< group delay + threshold crossing */
9577     int16        nfft;        /**< number of samples stored in H */
9578     uint8        num_max_cores;
9579 
9580 } BWL_POST_PACKED_STRUCT wl_proxd_collect_info_t;
9581 #include <packed_section_end.h>
9582 
9583 #define K_TOF_COLLECT_H_PAD 1
9584 #define K_TOF_COLLECT_SC_20MHZ (64)
9585 /* Maximum possible size of sample capture */
9586 #define K_TOF_COLLECT_SC_80MHZ (2*K_TOF_COLLECT_SC_20MHZ)
9587 /* Maximum possible size of channel dump */
9588 #define K_TOF_COLLECT_CHAN_SIZE (2*K_TOF_COLLECT_SC_80MHZ)
9589 
9590 /*
9591 A few extra samples are required to estimate frequency offset
9592 Right now 16 samples are being used. Can be changed in future.
9593 */
9594 #define K_TOF_COLLECT_SAMP_SIZE_20MHZ (2*(K_TOF_COLLECT_SC_20MHZ)+16+K_TOF_COLLECT_H_PAD)
9595 #define K_TOF_COLLECT_RAW_SAMP_SIZE_20MHZ (2*K_TOF_COLLECT_SAMP_SIZE_20MHZ)
9596 #define K_TOF_COLLECT_H_SIZE_20MHZ (K_TOF_COLLECT_SAMP_SIZE_20MHZ)
9597 #define K_TOF_COLLECT_HRAW_SIZE_20MHZ (K_TOF_COLLECT_RAW_SAMP_SIZE_20MHZ)
9598 
9599 #define K_TOF_COLLECT_SAMP_SIZE_80MHZ (2*(K_TOF_COLLECT_SC_80MHZ)+16+K_TOF_COLLECT_H_PAD)
9600 #define K_TOF_COLLECT_RAW_SAMP_SIZE_80MHZ (2*K_TOF_COLLECT_SAMP_SIZE_80MHZ)
9601 #define K_TOF_COLLECT_H_SIZE_80MHZ (K_TOF_COLLECT_SAMP_SIZE_80MHZ)
9602 #define K_TOF_COLLECT_HRAW_SIZE_80MHZ (K_TOF_COLLECT_RAW_SAMP_SIZE_80MHZ)
9603 
9604 #define WL_PROXD_COLLECT_DATA_VERSION_1        1
9605 #include <packed_section_start.h>
9606 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_data_v1 {
9607     wl_proxd_collect_info_t  info;
9608     uint8    ri_rr[FTM_TPK_RI_RR_LEN];
9609     /**< raw data read from phy used to adjust timestamps */
9610     uint32    H[K_TOF_COLLECT_H_SIZE_20MHZ];
9611 } BWL_POST_PACKED_STRUCT wl_proxd_collect_data_t_v1;
9612 #include <packed_section_end.h>
9613 
9614 #define WL_PROXD_COLLECT_DATA_VERSION_2        2
9615 typedef struct wl_proxd_collect_data_v2 {
9616     uint16            version;
9617     uint16            len;
9618     wl_proxd_collect_info_t    info;
9619     uint8            ri_rr[FTM_TPK_RI_RR_LEN];
9620     uint8            pad[3]; /* should be based on FTM_TPK_RI_RR_LEN */
9621     /**< raw data read from phy used to adjust timestamps */
9622     uint32            H[K_TOF_COLLECT_H_SIZE_20MHZ];
9623     uint32            chan[4 * K_TOF_COLLECT_CHAN_SIZE];
9624 } wl_proxd_collect_data_t_v2;
9625 #define WL_PROXD_COLLECT_DATA_VERSION_MAX    WL_PROXD_COLLECT_DATA_VERSION_2
9626 
9627 typedef struct wl_proxd_debug_data {
9628     uint8        count;        /**< number of packets */
9629     uint8        stage;        /**< state machone stage */
9630     uint8        received;    /**< received or txed */
9631     uint8        paket_type;    /**< packet type */
9632     uint8        category;    /**< category field */
9633     uint8        action;        /**< action field */
9634     uint8        token;        /**< token number */
9635     uint8        follow_token;    /**< following token number */
9636     uint16        index;        /**< index of the packet */
9637     uint16        tof_cmd;    /**< M_TOF_CMD */
9638     uint16        tof_rsp;    /**< M_TOF_RSP */
9639     uint16        tof_avb_rxl;    /**< M_TOF_AVB_RX_L */
9640     uint16        tof_avb_rxh;    /**< M_TOF_AVB_RX_H */
9641     uint16        tof_avb_txl;    /**< M_TOF_AVB_TX_L */
9642     uint16        tof_avb_txh;    /**< M_TOF_AVB_TX_H */
9643     uint16        tof_id;        /**< M_TOF_ID */
9644     uint16        tof_status0;    /**< M_TOF_STATUS_0 */
9645     uint16        tof_status2;    /**< M_TOF_STATUS_2 */
9646     uint16        tof_chsm0;    /**< M_TOF_CHNSM_0 */
9647     uint16        tof_phyctl0;    /**< M_TOF_PHYCTL0 */
9648     uint16        tof_phyctl1;    /**< M_TOF_PHYCTL1 */
9649     uint16        tof_phyctl2;    /**< M_TOF_PHYCTL2 */
9650     uint16        tof_lsig;    /**< M_TOF_LSIG */
9651     uint16        tof_vhta0;    /**< M_TOF_VHTA0 */
9652     uint16        tof_vhta1;    /**< M_TOF_VHTA1 */
9653     uint16        tof_vhta2;    /**< M_TOF_VHTA2 */
9654     uint16        tof_vhtb0;    /**< M_TOF_VHTB0 */
9655     uint16        tof_vhtb1;    /**< M_TOF_VHTB1 */
9656     uint16        tof_apmductl;    /**< M_TOF_AMPDU_CTL */
9657     uint16        tof_apmdudlim;    /**< M_TOF_AMPDU_DLIM */
9658     uint16        tof_apmdulen;    /**< M_TOF_AMPDU_LEN */
9659 } wl_proxd_debug_data_t;
9660 
9661 /** version of the wl_wsec_info structure */
9662 #define WL_WSEC_INFO_VERSION 0x01
9663 
9664 /** start enum value for BSS properties */
9665 #define WL_WSEC_INFO_BSS_BASE 0x0100
9666 
9667 /** size of len and type fields of wl_wsec_info_tlv_t struct */
9668 #define WL_WSEC_INFO_TLV_HDR_LEN OFFSETOF(wl_wsec_info_tlv_t, data)
9669 
9670 /** Allowed wl_wsec_info properties; not all of them may be supported. */
9671 typedef enum {
9672     WL_WSEC_INFO_NONE = 0,
9673     WL_WSEC_INFO_MAX_KEYS = 1,
9674     WL_WSEC_INFO_NUM_KEYS = 2,
9675     WL_WSEC_INFO_NUM_HW_KEYS = 3,
9676     WL_WSEC_INFO_MAX_KEY_IDX = 4,
9677     WL_WSEC_INFO_NUM_REPLAY_CNTRS = 5,
9678     WL_WSEC_INFO_SUPPORTED_ALGOS = 6,
9679     WL_WSEC_INFO_MAX_KEY_LEN = 7,
9680     WL_WSEC_INFO_FLAGS = 8,
9681     /* add global/per-wlc properties above */
9682     WL_WSEC_INFO_BSS_FLAGS = (WL_WSEC_INFO_BSS_BASE + 1),
9683     WL_WSEC_INFO_BSS_WSEC = (WL_WSEC_INFO_BSS_BASE + 2),
9684     WL_WSEC_INFO_BSS_TX_KEY_ID = (WL_WSEC_INFO_BSS_BASE + 3),
9685     WL_WSEC_INFO_BSS_ALGO = (WL_WSEC_INFO_BSS_BASE + 4),
9686     WL_WSEC_INFO_BSS_KEY_LEN = (WL_WSEC_INFO_BSS_BASE + 5),
9687     WL_WSEC_INFO_BSS_ALGOS = (WL_WSEC_INFO_BSS_BASE + 6),
9688     /* add per-BSS properties above */
9689     WL_WSEC_INFO_MAX = 0xffff
9690 } wl_wsec_info_type_t;
9691 
9692 typedef struct {
9693     uint32 algos; /* set algos to be enabled/disabled */
9694     uint32 mask; /* algos outside mask unaltered */
9695 } wl_wsec_info_algos_t;
9696 
9697 /** tlv used to return wl_wsec_info properties */
9698 typedef struct {
9699     uint16 type;
9700     uint16 len;        /**< data length */
9701     uint8 data[1];    /**< data follows */
9702 } wl_wsec_info_tlv_t;
9703 
9704 /** input/output data type for wsec_info iovar */
9705 typedef struct wl_wsec_info {
9706     uint8 version; /**< structure version */
9707     uint8 pad[2];
9708     uint8 num_tlvs;
9709     wl_wsec_info_tlv_t tlvs[1]; /**< tlv data follows */
9710 } wl_wsec_info_t;
9711 
9712 /*
9713  * randmac definitions
9714  */
9715 #define WL_RANDMAC_MODULE            "randmac"
9716 #define WL_RANDMAC_API_VERSION        0x0100 /**< version 1.0 */
9717 #define WL_RANDMAC_API_MIN_VERSION    0x0100 /**< version 1.0 */
9718 
9719 /** subcommands that can apply to randmac */
9720 enum {
9721     WL_RANDMAC_SUBCMD_NONE                = 0,
9722     WL_RANDMAC_SUBCMD_GET_VERSION            = 1,
9723     WL_RANDMAC_SUBCMD_ENABLE            = 2,
9724     WL_RANDMAC_SUBCMD_DISABLE            = 3,
9725     WL_RANDMAC_SUBCMD_CONFIG            = 4,
9726     WL_RANDMAC_SUBCMD_STATS                = 5,
9727     WL_RANDMAC_SUBCMD_CLEAR_STATS            = 6,
9728 
9729     WL_RANDMAC_SUBCMD_MAX
9730 };
9731 typedef int16 wl_randmac_subcmd_t;
9732 
9733 /* Common IOVAR struct */
9734 typedef struct wl_randmac {
9735     uint16 version;
9736     uint16 len;            /* total length */
9737     wl_randmac_subcmd_t subcmd_id;    /* subcommand id */
9738     uint8 data[0];            /* subcommand data */
9739 } wl_randmac_t;
9740 
9741 #define WL_RANDMAC_IOV_HDR_SIZE OFFSETOF(wl_randmac_t, data)
9742 
9743 /* randmac version subcommand */
9744 typedef struct wl_randmac_version {
9745     uint16 version;  /* Randmac method version info */
9746     uint8 pad[2];    /* Align on 4 byte boundary */
9747 } wl_randmac_version_t;
9748 
9749 /*
9750  * Bitmask for methods supporting MAC randomization feature
9751  */
9752 #define WL_RANDMAC_USER_NONE        0x0000
9753 #define WL_RANDMAC_USER_FTM        0x0001
9754 #define WL_RANDMAC_USER_NAN        0x0002
9755 #define WL_RANDMAC_USER_SCAN        0x0004
9756 #define WL_RANDMAC_USER_ALL        0xFFFF
9757 typedef uint16 wl_randmac_method_t;
9758 
9759 enum {
9760     WL_RANDMAC_FLAGS_NONE    = 0x00,
9761     WL_RANDMAC_FLAGS_ADDR    = 0x01,
9762     WL_RANDMAC_FLAGS_MASK    = 0x02,
9763     WL_RANDMAC_FLAGS_METHOD    = 0x04,
9764     WL_RANDMAC_FLAGS_ALL    = 0xFF
9765 };
9766 typedef uint8 wl_randmac_flags_t;
9767 
9768 /* randmac statistics subcommand */
9769 typedef struct wl_randmac_stats {
9770     uint32 set_ok;        /* Set random addr success count */
9771     uint32 set_fail;    /* Set random addr failed count */
9772     uint32 set_reqs;    /* Set random addr count */
9773     uint32 reset_reqs;    /* Restore random addr count */
9774     uint32 restore_ok;    /* Restore random addr succes count */
9775     uint32 restore_fail;    /* Restore random addr failed count */
9776     uint32 events_sent;    /* randmac module events count */
9777     uint32 events_rcvd;    /* randmac events received count */
9778 } wl_randmac_stats_t;
9779 
9780 /* randmac config subcommand */
9781 typedef struct wl_randmac_config {
9782     struct ether_addr addr;            /* Randomized MAC address */
9783     struct ether_addr addr_mask;        /* bitmask for randomization */
9784     wl_randmac_method_t method;        /* Enabled methods */
9785     wl_randmac_flags_t flags;        /* What config info changed */
9786     uint8    PAD;
9787 } wl_randmac_config_t;
9788 
9789 enum {
9790     WL_RANDMAC_EVENT_NONE            = 0,    /**< not an event, reserved */
9791     WL_RANDMAC_EVENT_BSSCFG_ADDR_SET    = 1,    /* bsscfg addr randomized */
9792     WL_RANDMAC_EVENT_BSSCFG_ADDR_RESTORE    = 2,    /* bsscfg addr restored */
9793     WL_RANDMAC_EVENT_ENABLED        = 3,    /* randmac module enabled */
9794     WL_RANDMAC_EVENT_DISABLE        = 4,    /* randmac module disabled */
9795     WL_RANDMAC_EVENT_BSSCFG_STATUS    = 5,    /* bsscfg enable/disable */
9796 
9797     WL_RANDMAC_EVENT_MAX
9798 };
9799 typedef int16 wl_randmac_event_type_t;
9800 typedef int32 wl_randmac_status_t;
9801 typedef uint32 wl_randmac_event_mask_t;
9802 
9803 #define WL_RANDMAC_EVENT_MASK_ALL 0xfffffffe
9804 #define WL_RANDMAC_EVENT_MASK_EVENT(_event_type) (1 << (_event_type))
9805 #define WL_RANDMAC_EVENT_ENABLED(_mask, _event_type) (\
9806     ((_mask) & WL_RANDMAC_EVENT_MASK_EVENT(_event_type)) != 0)
9807 
9808 /** tlv IDs - data length 4 bytes unless overridden by type, alignment 32 bits */
9809 enum {
9810     WL_RANDMAC_TLV_NONE        = 0,
9811     WL_RANDMAC_TLV_METHOD        = 1,
9812     WL_RANDMAC_TLV_ADDR        = 2,
9813     WL_RANDMAC_TLV_MASK        = 3
9814 };
9815 typedef uint16 wl_randmac_tlv_id_t;
9816 
9817 typedef struct wl_randmac_tlv {
9818     wl_randmac_tlv_id_t id;
9819     uint16 len;        /* Length of variable */
9820     uint8  data[1];
9821 } wl_randmac_tlv_t;
9822 
9823 /** randmac event */
9824 typedef struct wl_randmac_event {
9825     uint16                    version;
9826     uint16                    len;    /* Length of all variables */
9827     wl_randmac_event_type_t            type;
9828     wl_randmac_method_t            method;
9829     uint8                    pad[2];
9830     wl_randmac_tlv_t            tlvs[1];    /**< variable */
9831 } wl_randmac_event_t;
9832 
9833 /*
9834  * scan MAC definitions
9835  */
9836 
9837 /** common iovar struct */
9838 typedef struct wl_scanmac {
9839     uint16 subcmd_id;    /**< subcommand id */
9840     uint16 len;        /**< total length of data[] */
9841     uint8 data[];        /**< subcommand data */
9842 } wl_scanmac_t;
9843 
9844 /* subcommand ids */
9845 #define WL_SCANMAC_SUBCMD_ENABLE   0
9846 #define WL_SCANMAC_SUBCMD_BSSCFG   1   /**< only GET supported */
9847 #define WL_SCANMAC_SUBCMD_CONFIG   2
9848 
9849 /** scanmac enable data struct */
9850 typedef struct wl_scanmac_enable {
9851     uint8 enable;    /**< 1 - enable, 0 - disable */
9852     uint8 pad[3];    /**< 4-byte struct alignment */
9853 } wl_scanmac_enable_t;
9854 
9855 /** scanmac bsscfg data struct */
9856 typedef struct wl_scanmac_bsscfg {
9857     uint32 bsscfg;    /**< bsscfg index */
9858 } wl_scanmac_bsscfg_t;
9859 
9860 /** scanmac config data struct */
9861 typedef struct wl_scanmac_config {
9862     struct ether_addr mac;    /**< 6 bytes of MAC address or MAC prefix (i.e. OUI) */
9863     struct ether_addr random_mask;    /**< randomized bits on each scan */
9864     uint16 scan_bitmap;    /**< scans to use this MAC address */
9865     uint8 pad[2];    /**< 4-byte struct alignment */
9866 } wl_scanmac_config_t;
9867 
9868 /* scan bitmap */
9869 #define WL_SCANMAC_SCAN_UNASSOC        (0x01 << 0)    /**< unassociated scans */
9870 #define WL_SCANMAC_SCAN_ASSOC_ROAM    (0x01 << 1)    /**< associated roam scans */
9871 #define WL_SCANMAC_SCAN_ASSOC_PNO    (0x01 << 2)    /**< associated PNO scans */
9872 #define WL_SCANMAC_SCAN_ASSOC_HOST    (0x01 << 3)    /**< associated host scans */
9873 /*
9874  * bonjour dongle offload definitions
9875  */
9876 
9877 /* common iovar struct */
9878 typedef struct wl_bdo {
9879     uint16 subcmd_id;    /* subcommand id */
9880     uint16 len;        /* total length of data[] */
9881     uint8 data[];        /* subcommand data */
9882 } wl_bdo_t;
9883 
9884 /* subcommand ids */
9885 #define WL_BDO_SUBCMD_DOWNLOAD        0    /* Download flattened database  */
9886 #define WL_BDO_SUBCMD_ENABLE        1    /* Start bonjour after download */
9887 #define WL_BDO_SUBCMD_MAX_DOWNLOAD    2    /* Get the max download size    */
9888 
9889 /* maximum fragment size */
9890 #define BDO_MAX_FRAGMENT_SIZE    1024
9891 
9892 /* download flattened database
9893  *
9894  * BDO must be disabled before database download else fail.
9895  *
9896  * If database size is within BDO_MAX_FRAGMENT_SIZE then only a single fragment
9897  * is required (i.e. frag_num = 0, total_size = frag_size).
9898  * If database size exceeds BDO_MAX_FRAGMENT_SIZE then multiple fragments are required.
9899  */
9900 typedef struct wl_bdo_download {
9901     uint16 total_size;    /* total database size */
9902     uint16 frag_num;    /* fragment number, 0 for first fragment, N-1 for last fragment */
9903     uint16 frag_size;    /* size of fragment (max BDO_MAX_FRAGMENT_SIZE) */
9904     uint8 pad[2];        /* 4-byte struct alignment */
9905     uint8 fragment[BDO_MAX_FRAGMENT_SIZE];  /* fragment data */
9906 } wl_bdo_download_t;
9907 
9908 /* enable
9909  *
9910  * Enable requires a downloaded database else fail.
9911  */
9912 typedef struct wl_bdo_enable {
9913     uint8 enable;    /* 1 - enable, 0 - disable */
9914     uint8 pad[3];    /* 4-byte struct alignment */
9915 } wl_bdo_enable_t;
9916 
9917 /*
9918  * Get the max download size for Bonjour Offload.
9919  */
9920 typedef struct wl_bdo_max_download {
9921     uint16 size;    /* Max download size in bytes */
9922     uint8 pad[2];    /* 4-byte struct alignment    */
9923 } wl_bdo_max_download_t;
9924 
9925 /*
9926  * TCP keepalive offload definitions
9927  */
9928 
9929 /* common iovar struct */
9930 typedef struct wl_tko {
9931     uint16 subcmd_id;    /* subcommand id */
9932     uint16 len;        /* total length of data[] */
9933     uint8 data[];        /* subcommand data */
9934 } wl_tko_t;
9935 
9936 /* subcommand ids */
9937 #define WL_TKO_SUBCMD_MAX_TCP        0    /* max TCP connections supported */
9938 #define WL_TKO_SUBCMD_PARAM        1    /* configure offload common parameters  */
9939 #define WL_TKO_SUBCMD_CONNECT        2    /* TCP connection info */
9940 #define WL_TKO_SUBCMD_ENABLE        3    /* enable/disable */
9941 #define WL_TKO_SUBCMD_STATUS        4    /* TCP connection status */
9942 
9943 /* WL_TKO_SUBCMD_MAX_CONNECT subcommand data */
9944 typedef struct wl_tko_max_tcp {
9945     uint8 max;    /* max TCP connections supported */
9946     uint8 pad[3];    /* 4-byte struct alignment */
9947 } wl_tko_max_tcp_t;
9948 
9949 /* WL_TKO_SUBCMD_PARAM subcommand data */
9950 typedef struct wl_tko_param {
9951     uint16 interval;    /* keepalive tx interval (secs) */
9952     uint16 retry_interval;    /* keepalive retry interval (secs) */
9953     uint16 retry_count;    /* retry_count */
9954     uint8 pad[2];        /* 4-byte struct alignment */
9955 } wl_tko_param_t;
9956 
9957 /* WL_TKO_SUBCMD_CONNECT subcommand data
9958  * invoke with unique 'index' for each TCP connection
9959  */
9960 typedef struct wl_tko_connect {
9961     uint8 index;        /* TCP connection index, 0 to max-1 */
9962     uint8 ip_addr_type;    /* 0 - IPv4, 1 - IPv6 */
9963     uint16 local_port;    /* local port */
9964     uint16 remote_port;    /* remote port */
9965     uint16 PAD;
9966     uint32 local_seq;    /* local sequence number */
9967     uint32 remote_seq;    /* remote sequence number */
9968     uint16 request_len;    /* TCP keepalive request packet length */
9969     uint16 response_len;    /* TCP keepalive response packet length */
9970     uint8 data[];        /* variable length field containing local/remote IPv4/IPv6,
9971                  * TCP keepalive request packet, TCP keepalive response packet
9972                  *    For IPv4, length is 4 * 2 + request_length + response_length
9973                  *       offset 0 - local IPv4
9974                  *       offset 4 - remote IPv4
9975                  *       offset 8 - TCP keepalive request packet
9976                  *       offset 8+request_length - TCP keepalive response packet
9977                  *    For IPv6, length is 16 * 2 + request_length + response_length
9978                  *       offset 0 - local IPv6
9979                  *       offset 16 - remote IPv6
9980                  *       offset 32 - TCP keepalive request packet
9981                  *       offset 32+request_length - TCP keepalive response packet
9982                  */
9983 } wl_tko_connect_t;
9984 
9985 /* WL_TKO_SUBCMD_CONNECT subcommand data to GET configured info for specific index */
9986 typedef struct wl_tko_get_connect {
9987     uint8 index;        /* TCP connection index, 0 to max-1 */
9988     uint8 pad[3];        /* 4-byte struct alignment */
9989 } wl_tko_get_connect_t;
9990 
9991 typedef struct wl_tko_enable {
9992     uint8 enable;    /* 1 - enable, 0 - disable */
9993     uint8 pad[3];    /* 4-byte struct alignment */
9994 } wl_tko_enable_t;
9995 
9996 /* WL_TKO_SUBCMD_STATUS subcommand data */
9997 /* must be invoked before tko is disabled else status is unavailable */
9998 typedef struct wl_tko_status {
9999     uint8 count;        /* number of status entries (i.e. equals
10000                  * max TCP connections supported)
10001                              */
10002     uint8 status[1];    /* variable length field contain status for
10003                  * each TCP connection index
10004                  */
10005 } wl_tko_status_t;
10006 
10007 typedef enum {
10008     TKO_STATUS_NORMAL            = 0,    /* TCP connection normal, no error */
10009     TKO_STATUS_NO_RESPONSE            = 1,    /* no response to TCP keepalive */
10010     TKO_STATUS_NO_TCP_ACK_FLAG        = 2,    /* TCP ACK flag not set */
10011     TKO_STATUS_UNEXPECT_TCP_FLAG        = 3,    /* unexpect TCP flags set other than ACK */
10012     TKO_STATUS_SEQ_NUM_INVALID        = 4,    /* ACK != sequence number */
10013     TKO_STATUS_REMOTE_SEQ_NUM_INVALID    = 5,    /* SEQ > remote sequence number */
10014     TKO_STATUS_TCP_DATA            = 6,    /* TCP data available */
10015     TKO_STATUS_UNAVAILABLE            = 255,    /* not used/configured */
10016 } tko_status_t;
10017 
10018 enum rssi_reason {
10019     RSSI_REASON_UNKNOW = 0,
10020     RSSI_REASON_LOWRSSI = 1,
10021     RSSI_REASON_NSYC = 2,
10022     RSSI_REASON_TIMEOUT = 3
10023 };
10024 
10025 enum tof_reason {
10026     TOF_REASON_OK = 0,
10027     TOF_REASON_REQEND = 1,
10028     TOF_REASON_TIMEOUT = 2,
10029     TOF_REASON_NOACK = 3,
10030     TOF_REASON_INVALIDAVB = 4,
10031     TOF_REASON_INITIAL = 5,
10032     TOF_REASON_ABORT = 6
10033 };
10034 
10035 enum rssi_state {
10036     RSSI_STATE_POLL = 0,
10037     RSSI_STATE_TPAIRING = 1,
10038     RSSI_STATE_IPAIRING = 2,
10039     RSSI_STATE_THANDSHAKE = 3,
10040     RSSI_STATE_IHANDSHAKE = 4,
10041     RSSI_STATE_CONFIRMED = 5,
10042     RSSI_STATE_PIPELINE = 6,
10043     RSSI_STATE_NEGMODE = 7,
10044     RSSI_STATE_MONITOR = 8,
10045     RSSI_STATE_LAST = 9
10046 };
10047 
10048 enum tof_state {
10049     TOF_STATE_IDLE     = 0,
10050     TOF_STATE_IWAITM = 1,
10051     TOF_STATE_TWAITM = 2,
10052     TOF_STATE_ILEGACY = 3,
10053     TOF_STATE_IWAITCL = 4,
10054     TOF_STATE_TWAITCL = 5,
10055     TOF_STATE_ICONFIRM = 6,
10056     TOF_STATE_IREPORT = 7
10057 };
10058 
10059 enum tof_mode_type {
10060     TOF_LEGACY_UNKNOWN    = 0,
10061     TOF_LEGACY_AP        = 1,
10062     TOF_NONLEGACY_AP    = 2
10063 };
10064 
10065 enum tof_way_type {
10066     TOF_TYPE_ONE_WAY = 0,
10067     TOF_TYPE_TWO_WAY = 1,
10068     TOF_TYPE_REPORT = 2
10069 };
10070 
10071 enum tof_rate_type {
10072     TOF_FRAME_RATE_VHT = 0,
10073     TOF_FRAME_RATE_LEGACY = 1
10074 };
10075 
10076 #define TOF_ADJ_TYPE_NUM    4    /**< number of assisted timestamp adjustment */
10077 enum tof_adj_mode {
10078     TOF_ADJ_SOFTWARE = 0,
10079     TOF_ADJ_HARDWARE = 1,
10080     TOF_ADJ_SEQ = 2,
10081     TOF_ADJ_NONE = 3
10082 };
10083 
10084 #define FRAME_TYPE_NUM        4    /**< number of frame type */
10085 enum frame_type {
10086     FRAME_TYPE_CCK    = 0,
10087     FRAME_TYPE_OFDM    = 1,
10088     FRAME_TYPE_11N    = 2,
10089     FRAME_TYPE_11AC    = 3
10090 };
10091 
10092 typedef struct wl_proxd_status_iovar {
10093     uint16            method;                /**< method */
10094     uint8            mode;                /**< mode */
10095     uint8            peermode;            /**< peer mode */
10096     uint8            state;                /**< state */
10097     uint8            reason;                /**< reason code */
10098     uint8            PAD[2];
10099     uint32            distance;            /**< distance */
10100     uint32            txcnt;                /**< tx pkt counter */
10101     uint32            rxcnt;                /**< rx pkt counter */
10102     struct ether_addr    peer;                /**< peer mac address */
10103     int8            avg_rssi;            /**< average rssi */
10104     int8            hi_rssi;            /**< highest rssi */
10105     int8            low_rssi;            /**< lowest rssi */
10106     uint8            PAD[3];
10107     uint32            dbgstatus;            /**< debug status */
10108     uint16            frame_type_cnt[FRAME_TYPE_NUM];    /**< frame types */
10109     uint8            adj_type_cnt[TOF_ADJ_TYPE_NUM];    /**< adj types HW/SW */
10110 } wl_proxd_status_iovar_t;
10111 
10112 /* ifdef NET_DETECT */
10113 typedef struct net_detect_adapter_features {
10114     uint8    wowl_enabled;
10115     uint8    net_detect_enabled;
10116     uint8    nlo_enabled;
10117 } net_detect_adapter_features_t;
10118 
10119 typedef enum net_detect_bss_type {
10120     nd_bss_any = 0,
10121     nd_ibss,
10122     nd_ess
10123 } net_detect_bss_type_t;
10124 
10125 typedef struct net_detect_profile {
10126     wlc_ssid_t        ssid;
10127     net_detect_bss_type_t   bss_type;    /**< Ignore for now since Phase 1 is only for ESS */
10128     uint32            cipher_type;    /**< DOT11_CIPHER_ALGORITHM enumeration values */
10129     uint32            auth_type;    /**< DOT11_AUTH_ALGORITHM enumeration values */
10130 } net_detect_profile_t;
10131 
10132 typedef struct net_detect_profile_list {
10133     uint32            num_nd_profiles;
10134     net_detect_profile_t    nd_profile[];
10135 } net_detect_profile_list_t;
10136 
10137 typedef struct net_detect_config {
10138     uint8                nd_enabled;
10139     uint8                PAD[3];
10140     uint32                scan_interval;
10141     uint32                wait_period;
10142     uint8                wake_if_connected;
10143     uint8                wake_if_disconnected;
10144     uint8                PAD[2];
10145     net_detect_profile_list_t   nd_profile_list;
10146 } net_detect_config_t;
10147 
10148 typedef enum net_detect_wake_reason {
10149     nd_reason_unknown,
10150     nd_net_detected,
10151     nd_wowl_event,
10152     nd_ucode_error
10153 } net_detect_wake_reason_t;
10154 
10155 typedef struct net_detect_wake_data {
10156     net_detect_wake_reason_t    nd_wake_reason;
10157     uint32                nd_wake_date_length;
10158     uint8                nd_wake_data[0];        /**< Wake data (currently unused) */
10159 } net_detect_wake_data_t;
10160 
10161 /* endif NET_DETECT */
10162 
10163 /* (unversioned, deprecated) */
10164 typedef struct bcnreq {
10165     uint8 bcn_mode;
10166     uint8 PAD[3];
10167     int32 dur;
10168     int32 channel;
10169     struct ether_addr da;
10170     uint16 random_int;
10171     wlc_ssid_t ssid;
10172     uint16 reps;
10173     uint8 PAD[2];
10174 } bcnreq_t;
10175 
10176 #define WL_RRM_BCN_REQ_VER        1
10177 typedef struct bcn_req {
10178     uint8 version;
10179     uint8 bcn_mode;
10180     uint8 pad_1[2];
10181     int32 dur;
10182     int32 channel;
10183     struct ether_addr da;
10184     uint16 random_int;
10185     wlc_ssid_t ssid;
10186     uint16 reps;
10187     uint8 req_elements;
10188     uint8 pad_2;
10189     chanspec_list_t chspec_list;
10190 } bcn_req_t;
10191 
10192 typedef struct rrmreq {
10193     struct ether_addr da;
10194     uint8 reg;
10195     uint8 chan;
10196     uint16 random_int;
10197     uint16 dur;
10198     uint16 reps;
10199 } rrmreq_t;
10200 
10201 typedef struct framereq {
10202     struct ether_addr da;
10203     uint8 reg;
10204     uint8 chan;
10205     uint16 random_int;
10206     uint16 dur;
10207     struct ether_addr ta;
10208     uint16 reps;
10209 } framereq_t;
10210 
10211 typedef struct statreq {
10212     struct ether_addr da;
10213     struct ether_addr peer;
10214     uint16 random_int;
10215     uint16 dur;
10216     uint8 group_id;
10217     uint8 PAD;
10218     uint16 reps;
10219 } statreq_t;
10220 
10221 typedef struct wl_rrm_config_ioc {
10222     uint16 version; /* command version */
10223     uint16 id;      /* subiovar cmd ID */
10224     uint16 len;     /* total length of all bytes in data[] */
10225     uint16 pad;     /* 4-byte boundary padding */
10226     uint8 data[1];  /* payload */
10227 } wl_rrm_config_ioc_t;
10228 
10229 enum {
10230     WL_RRM_CONFIG_NONE    = 0,    /* reserved */
10231     WL_RRM_CONFIG_GET_LCI    = 1,    /* get LCI */
10232     WL_RRM_CONFIG_SET_LCI    = 2,    /* set LCI */
10233     WL_RRM_CONFIG_GET_CIVIC    = 3,    /* get civic location */
10234     WL_RRM_CONFIG_SET_CIVIC    = 4,    /* set civic location */
10235     WL_RRM_CONFIG_MAX        = 5
10236 };
10237 
10238 #define WL_RRM_CONFIG_NAME "rrm_config"
10239 #define WL_RRM_CONFIG_MIN_LENGTH OFFSETOF(wl_rrm_config_ioc_t, data)
10240 
10241 enum {
10242     WL_RRM_EVENT_NONE        = 0,    /* not an event, reserved */
10243     WL_RRM_EVENT_FRNG_REQ    = 1,    /* Receipt of FRNG request frame */
10244     WL_RRM_EVENT_FRNG_REP    = 2,    /* Receipt of FRNG report frame */
10245 
10246     WL_RRM_EVENT_MAX
10247 };
10248 typedef int16 wl_rrm_event_type_t;
10249 
10250 typedef struct frngreq_target {
10251     uint32 bssid_info;
10252     uint8 channel;
10253     uint8 phytype;
10254     uint8 reg;
10255     uint8 pad;
10256     struct ether_addr bssid;
10257     chanspec_t chanspec;
10258     uint32 sid;
10259 } frngreq_target_t;
10260 
10261 typedef struct frngreq {
10262     wl_rrm_event_type_t event;            /* RRM event type */
10263     struct ether_addr da;
10264     uint16 max_init_delay;    /* Upper bound of random delay, in TUs */
10265     uint8 min_ap_count;        /* Min FTM ranges requested (1-15) */
10266     uint8 num_aps;            /* Number of APs to range, at least min_ap_count */
10267     uint16 max_age;            /* Max elapsed time before FTM request, 0xFFFF = any */
10268     uint16 reps;            /* Number of repetitions of this measurement type */
10269     frngreq_target_t targets[1];    /* Target BSSIDs to range */
10270 } frngreq_t;
10271 
10272 typedef struct frngrep_range {
10273     uint32 start_tsf;        /* 4 lsb of tsf */
10274     struct ether_addr bssid;
10275     uint8 pad[2];
10276     uint32 range;
10277     uint32 max_err;
10278     uint8  rsvd;
10279     uint8 pad2[3];
10280 } frngrep_range_t;
10281 
10282 typedef struct frngrep_error {
10283     uint32 start_tsf;        /* 4 lsb of tsf */
10284     struct ether_addr bssid;
10285     uint8  code;
10286     uint8 pad[1];
10287 } frngrep_error_t;
10288 
10289 typedef struct frngrep {
10290     wl_rrm_event_type_t event;            /* RRM event type */
10291     struct ether_addr da;
10292     uint8 range_entry_count;
10293     uint8 error_entry_count;
10294     uint16 dialog_token;                /* dialog token */
10295     frngrep_range_t range_entries[DOT11_FTM_RANGE_ENTRY_MAX_COUNT];
10296     frngrep_error_t error_entries[DOT11_FTM_RANGE_ERROR_ENTRY_MAX_COUNT];
10297 } frngrep_t;
10298 
10299 typedef struct wl_rrm_frng_ioc {
10300     uint16 version; /* command version */
10301     uint16 id;      /* subiovar cmd ID */
10302     uint16 len;     /* total length of all bytes in data[] */
10303     uint16 pad;     /* 4-byte boundary padding */
10304     uint8 data[];  /* payload */
10305 } wl_rrm_frng_ioc_t;
10306 
10307 enum {
10308     WL_RRM_FRNG_NONE    = 0,    /* reserved */
10309     WL_RRM_FRNG_SET_REQ    = 1,    /* send ftm ranging request */
10310     WL_RRM_FRNG_MAX        = 2
10311 };
10312 
10313 #define WL_RRM_FRNG_NAME "rrm_frng"
10314 #define WL_RRM_FRNG_MIN_LENGTH OFFSETOF(wl_rrm_frng_ioc_t, data)
10315 
10316 #define WL_RRM_RPT_VER        0
10317 #define WL_RRM_RPT_MAX_PAYLOAD    256
10318 #define WL_RRM_RPT_MIN_PAYLOAD    7
10319 #define WL_RRM_RPT_FALG_ERR    0
10320 #define WL_RRM_RPT_FALG_GRP_ID_PROPR    (1 << 0)
10321 #define WL_RRM_RPT_FALG_GRP_ID_0    (1 << 1)
10322 typedef struct {
10323     uint16 ver;        /**< version */
10324     struct ether_addr addr;    /**< STA MAC addr */
10325     uint32 timestamp;    /**< timestamp of the report */
10326     uint16 flag;        /**< flag */
10327     uint16 len;        /**< length of payload data */
10328     uint8 data[WL_RRM_RPT_MAX_PAYLOAD];
10329 } statrpt_t;
10330 
10331 typedef struct wlc_dwds_config {
10332     uint32        enable;
10333     uint32        mode; /**< STA/AP interface */
10334     struct ether_addr ea;
10335     uint8  PAD[2];
10336 } wlc_dwds_config_t;
10337 
10338 typedef struct wl_el_set_params_s {
10339     uint8 set;    /**< Set number */
10340     uint8  PAD[3];
10341     uint32 size;    /**< Size to make/expand */
10342 } wl_el_set_params_t;
10343 
10344 typedef struct wl_el_tag_params_s {
10345     uint16 tag;
10346     uint8 set;
10347     uint8 flags;
10348 } wl_el_tag_params_t;
10349 
10350 /** Video Traffic Interference Monitor config */
10351 #define INTFER_VERSION        1
10352 typedef struct wl_intfer_params {
10353     uint16 version;            /**< version */
10354     uint8 period;            /**< sample period */
10355     uint8 cnt;            /**< sample cnt */
10356     uint8 txfail_thresh;    /**< non-TCP txfail threshold */
10357     uint8 tcptxfail_thresh;    /**< tcptxfail threshold */
10358 } wl_intfer_params_t;
10359 
10360 typedef struct wl_staprio_cfg {
10361     struct ether_addr ea;    /**< mac addr */
10362     uint8 prio;        /**< scb priority */
10363 } wl_staprio_cfg_t;
10364 
10365 typedef enum wl_stamon_cfg_cmd_type {
10366     STAMON_CFG_CMD_DEL = 0,
10367     STAMON_CFG_CMD_ADD = 1,
10368     STAMON_CFG_CMD_ENB = 2,
10369     STAMON_CFG_CMD_DSB = 3,
10370     STAMON_CFG_CMD_CNT = 4,
10371     STAMON_CFG_CMD_RSTCNT = 5,
10372     STAMON_CFG_CMD_GET_STATS = 6
10373 } wl_stamon_cfg_cmd_type_t;
10374 
10375 typedef struct wlc_stamon_sta_config {
10376     wl_stamon_cfg_cmd_type_t cmd; /**< 0 - delete, 1 - add */
10377     struct ether_addr ea;
10378     uint8  PAD[2];
10379 } wlc_stamon_sta_config_t;
10380 
10381 /* ifdef SR_DEBUG */
10382 typedef struct { /* pmu_reg */
10383     uint32  pmu_control;
10384     uint32  pmu_capabilities;
10385     uint32  pmu_status;
10386     uint32  res_state;
10387     uint32  res_pending;
10388     uint32  pmu_timer1;
10389     uint32  min_res_mask;
10390     uint32  max_res_mask;
10391     uint32  pmu_chipcontrol1[4];
10392     uint32  pmu_regcontrol[5];
10393     uint32  pmu_pllcontrol[5];
10394     uint32  pmu_rsrc_up_down_timer[31];
10395     uint32  rsrc_dep_mask[31];
10396 } pmu_reg_t;
10397 /* endif SR_DEBUG */
10398 
10399 typedef struct wl_taf_define {
10400     struct ether_addr ea;    /**< STA MAC or 0xFF... */
10401     uint16 version;         /**< version */
10402     uint32 sch;             /**< method index */
10403     uint32 prio;            /**< priority */
10404     uint32 misc;            /**< used for return value */
10405     uint8  text[];         /**< used to pass and return ascii text */
10406 } wl_taf_define_t;
10407 
10408 /** Received Beacons lengths information */
10409 #define WL_LAST_BCNS_INFO_FIXED_LEN        OFFSETOF(wlc_bcn_len_hist_t, bcnlen_ring)
10410 typedef struct wlc_bcn_len_hist {
10411     uint16    ver;                /**< version field */
10412     uint16    cur_index;            /**< current pointed index in ring buffer */
10413     uint32    max_bcnlen;        /**< Max beacon length received */
10414     uint32    min_bcnlen;        /**< Min beacon length received */
10415     uint32    ringbuff_len;        /**< Length of the ring buffer 'bcnlen_ring' */
10416     uint32    bcnlen_ring[1];    /**< ring buffer storing received beacon lengths */
10417 } wlc_bcn_len_hist_t;
10418 
10419 /* WDS net interface types */
10420 #define WL_WDSIFTYPE_NONE  0x0 /**< The interface type is neither WDS nor DWDS. */
10421 #define WL_WDSIFTYPE_WDS   0x1 /**< The interface is WDS type. */
10422 #define WL_WDSIFTYPE_DWDS  0x2 /**< The interface is DWDS type. */
10423 
10424 typedef struct wl_bssload_static {
10425     uint8 is_static;
10426     uint8  PAD;
10427     uint16 sta_count;
10428     uint8 chan_util;
10429     uint8  PAD;
10430     uint16 aac;
10431 } wl_bssload_static_t;
10432 
10433 /* Buffer of size WLC_SAMPLECOLLECT_MAXLEN (=10240 for 4345a0 ACPHY)
10434  * gets copied to this, multiple times
10435  */
10436 typedef enum wl_gpaio_option {
10437     GPAIO_PMU_AFELDO,
10438     GPAIO_PMU_TXLDO,
10439     GPAIO_PMU_VCOLDO,
10440     GPAIO_PMU_LNALDO,
10441     GPAIO_PMU_ADCLDO,
10442     GPAIO_ICTAT_CAL,
10443     GPAIO_PMU_CLEAR,
10444     GPAIO_OFF,
10445     GPAIO_PMU_LOGENLDO,
10446     GPAIO_PMU_RXLDO2G,
10447     GPAIO_PMU_RXLDO5G
10448 } wl_gpaio_option_t;
10449 
10450 /** IO Var Operations - the Value of iov_op In wlc_ap_doiovar */
10451 typedef enum wlc_ap_iov_bss_operation {
10452     WLC_AP_IOV_OP_DELETE                   = -1,
10453     WLC_AP_IOV_OP_DISABLE                  = 0,
10454     WLC_AP_IOV_OP_ENABLE                   = 1,
10455     WLC_AP_IOV_OP_MANUAL_AP_BSSCFG_CREATE  = 2,
10456     WLC_AP_IOV_OP_MANUAL_STA_BSSCFG_CREATE = 3,
10457     WLC_AP_IOV_OP_MOVE                     = 4
10458 } wlc_ap_iov_bss_oper_t;
10459 
10460 /* LTE coex info */
10461 /* Analogue of HCI Set MWS Signaling cmd */
10462 typedef struct {
10463     int16    mws_rx_assert_offset;
10464     int16    mws_rx_assert_jitter;
10465     int16    mws_rx_deassert_offset;
10466     int16    mws_rx_deassert_jitter;
10467     int16    mws_tx_assert_offset;
10468     int16    mws_tx_assert_jitter;
10469     int16    mws_tx_deassert_offset;
10470     int16    mws_tx_deassert_jitter;
10471     int16    mws_pattern_assert_offset;
10472     int16    mws_pattern_assert_jitter;
10473     int16    mws_inact_dur_assert_offset;
10474     int16    mws_inact_dur_assert_jitter;
10475     int16    mws_scan_freq_assert_offset;
10476     int16    mws_scan_freq_assert_jitter;
10477     int16    mws_prio_assert_offset_req;
10478 } wci2_config_t;
10479 
10480 /** Analogue of HCI MWS Channel Params */
10481 typedef struct {
10482     uint16    mws_rx_center_freq; /**< MHz */
10483     uint16    mws_tx_center_freq;
10484     uint16    mws_rx_channel_bw;  /**< KHz */
10485     uint16    mws_tx_channel_bw;
10486     uint8    mws_channel_en;
10487     uint8    mws_channel_type;   /**< Don't care for WLAN? */
10488 } mws_params_t;
10489 
10490 #define LTECX_MAX_NUM_PERIOD_TYPES    7
10491 
10492 /* LTE Frame params */
10493 typedef struct {
10494     uint16    mws_frame_dur;
10495     int16    mws_framesync_assert_offset;
10496     uint16    mws_framesync_assert_jitter;
10497     uint16  mws_period_dur[LTECX_MAX_NUM_PERIOD_TYPES];
10498     uint8    mws_period_type[LTECX_MAX_NUM_PERIOD_TYPES];
10499     uint8    mws_num_periods;
10500 } mws_frame_config_t;
10501 
10502 /** MWS wci2 message */
10503 typedef struct {
10504     uint8    mws_wci2_data; /**< BT-SIG msg */
10505     uint8    PAD;
10506     uint16    mws_wci2_interval; /**< Interval in us */
10507     uint16    mws_wci2_repeat; /**< No of msgs to send */
10508 } mws_wci2_msg_t;
10509 /* MWS ANT map */
10510 typedef struct {
10511     uint16    combo1; /* mws ant selection 1 */
10512     uint16    combo2; /* mws ant selection 2 */
10513     uint16    combo3; /* mws ant selection 3 */
10514     uint16    combo4; /* mws ant selection 4 */
10515 } mws_ant_map_t;
10516 
10517 /* MWS SCAN_REQ Bitmap */
10518 typedef struct mws_scanreq_params {
10519     uint16 idx;
10520     uint16 bm_2g;
10521     uint16 bm_5g_lo;
10522     uint16 bm_5g_mid;
10523     uint16 bm_5g_hi;
10524 } mws_scanreq_params_t;
10525 
10526 typedef struct {
10527     uint32 config;    /**< MODE: AUTO (-1), Disable (0), Enable (1) */
10528     uint32 status;    /**< Current state: Disabled (0), Enabled (1) */
10529 } wl_config_t;
10530 
10531 #define WLC_RSDB_MODE_AUTO_MASK 0x80
10532 #define WLC_RSDB_EXTRACT_MODE(val) ((int8)((val) & (~(WLC_RSDB_MODE_AUTO_MASK))))
10533 
10534 typedef struct {
10535     uint16  request; /* type of sensor hub request */
10536     uint16  enable; /* enable/disable response for specified request */
10537     uint16  interval; /* interval between responses to the request */
10538 } shub_req_t;
10539 
10540 #define    WL_IF_STATS_T_VERSION 1    /**< current version of wl_if_stats structure */
10541 
10542 /** per interface counters */
10543 typedef struct wl_if_stats {
10544     uint16    version;        /**< version of the structure */
10545     uint16    length;            /**< length of the entire structure */
10546     uint32    PAD;            /**< padding */
10547 
10548     /* transmit stat counters */
10549     uint64    txframe;        /**< tx data frames */
10550     uint64    txbyte;            /**< tx data bytes */
10551     uint64    txerror;        /**< tx data errors (derived: sum of others) */
10552     uint64  txnobuf;        /**< tx out of buffer errors */
10553     uint64  txrunt;            /**< tx runt frames */
10554     uint64  txfail;            /**< tx failed frames */
10555     uint64    txretry;        /**< tx retry frames */
10556     uint64    txretrie;        /**< tx multiple retry frames */
10557     uint64    txfrmsnt;        /**< tx sent frames */
10558     uint64    txmulti;        /**< tx mulitcast sent frames */
10559     uint64    txfrag;            /**< tx fragments sent */
10560 
10561     /* receive stat counters */
10562     uint64    rxframe;        /**< rx data frames */
10563     uint64    rxbyte;            /**< rx data bytes */
10564     uint64    rxerror;        /**< rx data errors (derived: sum of others) */
10565     uint64    rxnobuf;        /**< rx out of buffer errors */
10566     uint64  rxrunt;            /**< rx runt frames */
10567     uint64  rxfragerr;        /**< rx fragment errors */
10568     uint64    rxmulti;        /**< rx multicast frames */
10569 
10570     uint64    txexptime;        /* DATA Tx frames suppressed due to timer expiration */
10571     uint64    txrts;            /* RTS/CTS succeeeded count */
10572     uint64    txnocts;        /* RTS/CTS faled count */
10573 
10574     uint64    txretrans;        /* Number of frame retransmissions */
10575 }
10576 wl_if_stats_t;
10577 
10578 typedef struct wl_band {
10579     uint16        bandtype;        /**< WL_BAND_2G, WL_BAND_5G */
10580     uint16        bandunit;        /**< bandstate[] index */
10581     uint16        phytype;        /**< phytype */
10582     uint16        phyrev;
10583 }
10584 wl_band_t;
10585 
10586 #define    WL_WLC_VERSION_T_VERSION 1 /**< current version of wlc_version structure */
10587 
10588 /** wlc interface version */
10589 typedef struct wl_wlc_version {
10590     uint16    version;        /**< version of the structure */
10591     uint16    length;            /**< length of the entire structure */
10592 
10593     /* epi version numbers */
10594     uint16    epi_ver_major;        /**< epi major version number */
10595     uint16    epi_ver_minor;        /**< epi minor version number */
10596     uint16    epi_rc_num;        /**< epi RC number */
10597     uint16    epi_incr_num;        /**< epi increment number */
10598 
10599     /* wlc interface version numbers */
10600     uint16    wlc_ver_major;        /**< wlc interface major version number */
10601     uint16    wlc_ver_minor;        /**< wlc interface minor version number */
10602 }
10603 wl_wlc_version_t;
10604 
10605 /* Highest version of WLC_API_VERSION supported */
10606 #define WLC_API_VERSION_MAJOR_MAX    8
10607 #define WLC_API_VERSION_MINOR_MAX    0
10608 
10609 /* begin proxd definitions */
10610 #include <packed_section_start.h>
10611 
10612 #define WL_PROXD_API_VERSION 0x0300    /**< version 3.0 */
10613 
10614 /** Minimum supported API version */
10615 #define WL_PROXD_API_MIN_VERSION 0x0300
10616 
10617 /** proximity detection methods */
10618 enum {
10619     WL_PROXD_METHOD_NONE    = 0,
10620     WL_PROXD_METHOD_RSVD1    = 1, /**< backward compatibility - RSSI, not supported */
10621     WL_PROXD_METHOD_TOF    = 2,
10622     WL_PROXD_METHOD_RSVD2    = 3, /**< 11v only - if needed */
10623     WL_PROXD_METHOD_FTM    = 4, /**< IEEE rev mc/2014 */
10624     WL_PROXD_METHOD_MAX
10625 };
10626 typedef int16 wl_proxd_method_t;
10627 
10628 /** global and method configuration flags */
10629 enum {
10630     WL_PROXD_FLAG_NONE            = 0x00000000,
10631     WL_PROXD_FLAG_RX_ENABLED        = 0x00000001, /**< respond to requests, per bss */
10632     WL_PROXD_FLAG_RX_RANGE_REQ        = 0x00000002, /**< 11mc range requests enabled */
10633     WL_PROXD_FLAG_TX_LCI            = 0x00000004, /**< tx lci, if known */
10634     WL_PROXD_FLAG_TX_CIVIC            = 0x00000008, /**< tx civic, if known */
10635     WL_PROXD_FLAG_RX_AUTO_BURST        = 0x00000010, /**< auto respond w/o host action */
10636     WL_PROXD_FLAG_TX_AUTO_BURST        = 0x00000020, /**< continue tx w/o host action */
10637     WL_PROXD_FLAG_AVAIL_PUBLISH        = 0x00000040,     /**< publish availability */
10638     WL_PROXD_FLAG_AVAIL_SCHEDULE        = 0x00000080,    /**< schedule using availability */
10639     WL_PROXD_FLAG_ASAP_CAPABLE        = 0x00000100, /* ASAP capable */
10640     WL_PROXD_FLAG_MBURST_FOLLOWUP        = 0x00000200, /* new multi-burst algorithm */
10641     WL_PROXD_FLAG_SECURE            = 0x00000400, /* per bsscfg option */
10642     WL_PROXD_FLAG_NO_TSF_SYNC        = 0x00000800, /* disable tsf sync */
10643     WL_PROXD_FLAG_ALL            = 0xffffffff
10644 };
10645 typedef uint32 wl_proxd_flags_t;
10646 
10647 #define WL_PROXD_FLAGS_AVAIL (WL_PROXD_FLAG_AVAIL_PUBLISH | \
10648     WL_PROXD_FLAG_AVAIL_SCHEDULE)
10649 
10650 /** session flags */
10651 enum {
10652     WL_PROXD_SESSION_FLAG_NONE         = 0x00000000,  /**< no flags */
10653     WL_PROXD_SESSION_FLAG_INITIATOR     = 0x00000001,  /**< local device is initiator */
10654     WL_PROXD_SESSION_FLAG_TARGET         = 0x00000002,  /**< local device is target */
10655     WL_PROXD_SESSION_FLAG_ONE_WAY        = 0x00000004,  /**< (initiated) 1-way rtt */
10656     WL_PROXD_SESSION_FLAG_AUTO_BURST    = 0x00000008,  /**< created w/ rx_auto_burst */
10657     WL_PROXD_SESSION_FLAG_PERSIST        = 0x00000010,  /**< good until cancelled */
10658     WL_PROXD_SESSION_FLAG_RTT_DETAIL    = 0x00000020,  /**< rtt detail in results */
10659     WL_PROXD_SESSION_FLAG_SECURE        = 0x00000040,  /**< sessionis secure */
10660     WL_PROXD_SESSION_FLAG_AOA        = 0x00000080,  /**< AOA along w/ RTT */
10661     WL_PROXD_SESSION_FLAG_RX_AUTO_BURST    = 0x00000100,  /**< Same as proxd flags above */
10662     WL_PROXD_SESSION_FLAG_TX_AUTO_BURST    = 0x00000200,  /**< Same as proxd flags above */
10663     WL_PROXD_SESSION_FLAG_NAN_BSS        = 0x00000400,  /**< Use NAN BSS, if applicable */
10664     WL_PROXD_SESSION_FLAG_TS1        = 0x00000800,  /**< e.g. FTM1 - ASAP-capable */
10665     WL_PROXD_SESSION_FLAG_REPORT_FAILURE    = 0x00002000, /**< report failure to target */
10666     WL_PROXD_SESSION_FLAG_INITIATOR_RPT    = 0x00004000, /**< report distance to target */
10667     WL_PROXD_SESSION_FLAG_NOCHANSWT        = 0x00008000,
10668     WL_PROXD_SESSION_FLAG_NETRUAL        = 0x00010000, /**< netrual mode */
10669     WL_PROXD_SESSION_FLAG_SEQ_EN        = 0x00020000, /**< Toast */
10670     WL_PROXD_SESSION_FLAG_NO_PARAM_OVRD    = 0x00040000, /**< no param override from target */
10671     WL_PROXD_SESSION_FLAG_ASAP        = 0x00080000, /**< ASAP session */
10672     WL_PROXD_SESSION_FLAG_REQ_LCI        = 0x00100000, /**< transmit LCI req */
10673     WL_PROXD_SESSION_FLAG_REQ_CIV        = 0x00200000, /**< transmit civic loc req */
10674     WL_PROXD_SESSION_FLAG_PRE_SCAN        = 0x00400000, /* enable pre-scan for asap=1 */
10675     WL_PROXD_SESSION_FLAG_AUTO_VHTACK    = 0x00800000, /* use vhtack based on brcm ie */
10676     WL_PROXD_SESSION_FLAG_VHTACK        = 0x01000000, /* vht ack is in use - output only */
10677     WL_PROXD_SESSION_FLAG_BDUR_NOPREF    = 0x02000000, /* burst-duration: no preference */
10678     WL_PROXD_SESSION_FLAG_NUM_FTM_NOPREF    = 0x04000000, /* num of FTM frames: no preference */
10679     WL_PROXD_SESSION_FLAG_FTM_SEP_NOPREF    = 0x08000000, /* time btw FTM frams: no pref */
10680     WL_PROXD_SESSION_FLAG_NUM_BURST_NOPREF    = 0x10000000, /* num of bursts: no pref */
10681     WL_PROXD_SESSION_FLAG_BURST_PERIOD_NOPREF = 0x20000000, /* burst period: no pref */
10682     WL_PROXD_SESSION_FLAG_MBURST_FOLLOWUP    = 0x40000000, /* new mburst algo  - reserved */
10683     WL_PROXD_SESSION_FLAG_MBURST_NODELAY    = 0x80000000, /**< good until cancelled */
10684     WL_PROXD_SESSION_FLAG_ALL        = 0xffffffff
10685 };
10686 typedef uint32 wl_proxd_session_flags_t;
10687 
10688 /** time units - mc supports up to 0.1ns resolution */
10689 enum {
10690     WL_PROXD_TMU_TU            = 0,        /**< 1024us */
10691     WL_PROXD_TMU_SEC        = 1,
10692     WL_PROXD_TMU_MILLI_SEC    = 2,
10693     WL_PROXD_TMU_MICRO_SEC    = 3,
10694     WL_PROXD_TMU_NANO_SEC    = 4,
10695     WL_PROXD_TMU_PICO_SEC    = 5
10696 };
10697 typedef int16 wl_proxd_tmu_t;
10698 
10699 /** time interval e.g. 10ns */
10700 typedef struct wl_proxd_intvl {
10701     uint32 intvl;
10702     wl_proxd_tmu_t tmu;
10703     uint8    pad[2];
10704 } wl_proxd_intvl_t;
10705 
10706 /** commands that can apply to proxd, method or a session */
10707 enum {
10708     WL_PROXD_CMD_NONE                = 0,
10709     WL_PROXD_CMD_GET_VERSION        = 1,
10710     WL_PROXD_CMD_ENABLE             = 2,
10711     WL_PROXD_CMD_DISABLE             = 3,
10712     WL_PROXD_CMD_CONFIG             = 4,
10713     WL_PROXD_CMD_START_SESSION         = 5,
10714     WL_PROXD_CMD_BURST_REQUEST         = 6,
10715     WL_PROXD_CMD_STOP_SESSION         = 7,
10716     WL_PROXD_CMD_DELETE_SESSION     = 8,
10717     WL_PROXD_CMD_GET_RESULT         = 9,
10718     WL_PROXD_CMD_GET_INFO             = 10,
10719     WL_PROXD_CMD_GET_STATUS         = 11,
10720     WL_PROXD_CMD_GET_SESSIONS         = 12,
10721     WL_PROXD_CMD_GET_COUNTERS         = 13,
10722     WL_PROXD_CMD_CLEAR_COUNTERS     = 14,
10723     WL_PROXD_CMD_COLLECT             = 15,    /* not supported, see 'wl proxd_collect' */
10724     WL_PROXD_CMD_TUNE             = 16,    /* not supported, see 'wl proxd_tune' */
10725     WL_PROXD_CMD_DUMP                 = 17,
10726     WL_PROXD_CMD_START_RANGING        = 18,
10727     WL_PROXD_CMD_STOP_RANGING        = 19,
10728     WL_PROXD_CMD_GET_RANGING_INFO    = 20,
10729     WL_PROXD_CMD_IS_TLV_SUPPORTED    = 21,
10730 
10731     WL_PROXD_CMD_MAX
10732 };
10733 typedef int16 wl_proxd_cmd_t;
10734 
10735 /* session ids:
10736  * id 0 is reserved
10737  * ids 1..0x7fff - allocated by host/app
10738  * 0x8000-0xffff - allocated by firmware, used for auto/rx
10739  */
10740 enum {
10741     WL_PROXD_SESSION_ID_GLOBAL = 0
10742 };
10743 
10744 /* Externally allocated sids */
10745 #define WL_PROXD_SID_EXT_MAX 0x7fff
10746 #define WL_PROXD_SID_EXT_ALLOC(_sid) ((_sid) > 0 && (_sid) <= WL_PROXD_SID_EXT_MAX)
10747 
10748 /* block size for reserved sid blocks */
10749 #define WL_PROXD_SID_EXT_BLKSZ 256
10750 #define WL_PROXD_SID_EXT_BLK_START(_i) (WL_PROXD_SID_EXT_MAX - (_i) * WL_PROXD_SID_EXT_BLKSZ + 1)
10751 #define WL_PROXD_SID_EXT_BLK_END(_start) ((_start) + WL_PROXD_SID_EXT_BLKSZ - 1)
10752 
10753 /* rrm block */
10754 #define WL_PROXD_SID_RRM_START WL_PROXD_SID_EXT_BLK_START(1)
10755 #define WL_PROXD_SID_RRM_END WL_PROXD_SID_EXT_BLK_END(WL_PROXD_SID_RRM_START)
10756 
10757 /* nan block */
10758 #define WL_PROXD_SID_NAN_START WL_PROXD_SID_EXT_BLK_START(2)
10759 #define WL_PROXD_SID_NAN_END WL_PROXD_SID_EXT_BLK_END(WL_PROXD_SID_NAN_START)
10760 
10761 /** maximum number sessions that can be allocated, may be less if tunable */
10762 #define WL_PROXD_MAX_SESSIONS 16
10763 
10764 typedef uint16 wl_proxd_session_id_t;
10765 
10766 /** status - TBD BCME_ vs proxd status - range reserved for BCME_ */
10767 enum {
10768     WL_PROXD_E_NOAVAIL        = -1056,
10769     WL_PROXD_E_EXT_SCHED        = -1055,
10770     WL_PROXD_E_NOT_BCM            = -1054,
10771     WL_PROXD_E_FRAME_TYPE        = -1053,
10772     WL_PROXD_E_VERNOSUPPORT        = -1052,
10773     WL_PROXD_E_SEC_NOKEY        = -1051,
10774     WL_PROXD_E_SEC_POLICY        = -1050,
10775     WL_PROXD_E_SCAN_INPROCESS    = -1049,
10776     WL_PROXD_E_BAD_PARTIAL_TSF    = -1048,
10777     WL_PROXD_E_SCANFAIL            = -1047,
10778     WL_PROXD_E_NOTSF            = -1046,
10779     WL_PROXD_E_POLICY            = -1045,
10780     WL_PROXD_E_INCOMPLETE        = -1044,
10781     WL_PROXD_E_OVERRIDDEN        = -1043,
10782     WL_PROXD_E_ASAP_FAILED        = -1042,
10783     WL_PROXD_E_NOTSTARTED        = -1041,
10784     WL_PROXD_E_INVALIDMEAS        = -1040,
10785     WL_PROXD_E_INCAPABLE        = -1039,
10786     WL_PROXD_E_MISMATCH            = -1038,
10787     WL_PROXD_E_DUP_SESSION        = -1037,
10788     WL_PROXD_E_REMOTE_FAIL        = -1036,
10789     WL_PROXD_E_REMOTE_INCAPABLE = -1035,
10790     WL_PROXD_E_SCHED_FAIL        = -1034,
10791     WL_PROXD_E_PROTO            = -1033,
10792     WL_PROXD_E_EXPIRED            = -1032,
10793     WL_PROXD_E_TIMEOUT            = -1031,
10794     WL_PROXD_E_NOACK            = -1030,
10795     WL_PROXD_E_DEFERRED            = -1029,
10796     WL_PROXD_E_INVALID_SID        = -1028,
10797     WL_PROXD_E_REMOTE_CANCEL     = -1027,
10798     WL_PROXD_E_CANCELED            = -1026,    /**< local */
10799     WL_PROXD_E_INVALID_SESSION    = -1025,
10800     WL_PROXD_E_BAD_STATE        = -1024,
10801     WL_PROXD_E_ERROR            = -1,
10802     WL_PROXD_E_OK                = 0
10803 };
10804 typedef int32 wl_proxd_status_t;
10805 
10806 /* proxd errors from phy */
10807 #define PROXD_TOF_INIT_ERR_BITS 16
10808 
10809 enum {
10810     WL_PROXD_PHY_ERR_LB_CORR_THRESH    = (1 << 0), /* Loopback Correlation threshold */
10811     WL_PROXD_PHY_ERR_RX_CORR_THRESH    = (1 << 1), /* Received Correlation threshold */
10812     WL_PROXD_PHY_ERR_LB_PEAK_POWER     = (1 << 2), /* Loopback Peak power   */
10813     WL_PROXD_PHY_ERR_RX_PEAK_POWER     = (1 << 3), /* Received Peak power   */
10814     WL_PROXD_PHY_ERR_BITFLIP           = (1 << 4), /* Bitflips */
10815     WL_PROXD_PHY_ERR_SNR               = (1 << 5), /* SNR */
10816     WL_PROXD_PHY_RX_STRT_WIN_OFF       = (1 << 6), /* Receive start window is off */
10817     WL_PROXD_PHY_RX_END_WIN_OFF        = (1 << 7), /* Receive End window is off */
10818     WL_PROXD_PHY_ERR_LOW_CONFIDENCE    = (1 << 15), /* Low confidence on meas distance */
10819 };
10820 typedef uint32 wl_proxd_phy_error_t;
10821 
10822 /** session states */
10823 enum {
10824     WL_PROXD_SESSION_STATE_NONE                = 0,
10825     WL_PROXD_SESSION_STATE_CREATED            = 1,
10826     WL_PROXD_SESSION_STATE_CONFIGURED        = 2,
10827     WL_PROXD_SESSION_STATE_STARTED            = 3,
10828     WL_PROXD_SESSION_STATE_DELAY            = 4,
10829     WL_PROXD_SESSION_STATE_USER_WAIT        = 5,
10830     WL_PROXD_SESSION_STATE_SCHED_WAIT        = 6,
10831     WL_PROXD_SESSION_STATE_BURST            = 7,
10832     WL_PROXD_SESSION_STATE_STOPPING            = 8,
10833     WL_PROXD_SESSION_STATE_ENDED            = 9,
10834     WL_PROXD_SESSION_STATE_START_WAIT        = 10,
10835     WL_PROXD_SESSION_STATE_DESTROYING        = -1
10836 };
10837 typedef int16 wl_proxd_session_state_t;
10838 
10839 /** RTT sample flags */
10840 enum {
10841     WL_PROXD_RTT_SAMPLE_NONE = 0x00,
10842     WL_PROXD_RTT_SAMPLE_DISCARD    = 0x01
10843 };
10844 typedef uint8 wl_proxd_rtt_sample_flags_t;
10845 typedef int16 wl_proxd_rssi_t;
10846 typedef uint16 wl_proxd_snr_t;
10847 typedef uint16 wl_proxd_bitflips_t;
10848 
10849 typedef struct wl_proxd_rtt_sample {
10850     uint8                id;            /**< id for the sample - non-zero */
10851     wl_proxd_rtt_sample_flags_t    flags;
10852     wl_proxd_rssi_t            rssi;
10853     wl_proxd_intvl_t            rtt;        /**< round trip time */
10854     uint32                ratespec;
10855     wl_proxd_snr_t                  snr;
10856     wl_proxd_bitflips_t             bitflips;
10857     wl_proxd_status_t               status;
10858     int32                           distance;
10859     wl_proxd_phy_error_t        tof_phy_error;
10860     wl_proxd_phy_error_t        tof_tgt_phy_error; /* target phy error bit map */
10861     wl_proxd_snr_t                  tof_tgt_snr;
10862     wl_proxd_bitflips_t             tof_tgt_bitflips;
10863     uint8                           coreid;
10864     uint8                           pad[3];
10865 } wl_proxd_rtt_sample_t;
10866 
10867 /** result flags */
10868 enum {
10869     WL_PRXOD_RESULT_FLAG_NONE    = 0x0000,
10870     WL_PROXD_RESULT_FLAG_NLOS    = 0x0001,    /**< LOS - if available */
10871     WL_PROXD_RESULT_FLAG_LOS    = 0x0002,    /**< NLOS - if available */
10872     WL_PROXD_RESULT_FLAG_FATAL    = 0x0004,    /**< Fatal error during burst */
10873     WL_PROXD_RESULT_FLAG_VHTACK    = 0x0008,    /* VHTACK or Legacy ACK used */
10874     WL_PROXD_REQUEST_SENT        = 0x0010,    /* FTM request was sent */
10875     WL_PROXD_REQUEST_ACKED        = 0x0020,    /* FTM request was acked */
10876     WL_PROXD_LTFSEQ_STARTED        = 0x0040,    /* LTF sequence started */
10877     WL_PROXD_RESULT_FLAG_ALL     = 0xffff
10878 };
10879 typedef int16 wl_proxd_result_flags_t;
10880 
10881 /** rtt measurement result */
10882 typedef struct wl_proxd_rtt_result {
10883     wl_proxd_session_id_t        sid;
10884     wl_proxd_result_flags_t        flags;
10885     wl_proxd_status_t        status;
10886     struct ether_addr        peer;
10887     wl_proxd_session_state_t    state;        /**< current state */
10888     union {
10889         wl_proxd_intvl_t        retry_after;    /* hint for errors */
10890         wl_proxd_intvl_t        burst_duration; /* burst duration */
10891     } u;
10892     wl_proxd_rtt_sample_t        avg_rtt;
10893     uint32                avg_dist;    /* 1/256m units */
10894     uint16                sd_rtt;        /* RTT standard deviation */
10895     uint8                num_valid_rtt;    /* valid rtt cnt */
10896     uint8                num_ftm;    /* actual num of ftm cnt (Configured) */
10897     uint16                burst_num;    /* in a session */
10898     uint16                num_rtt;    /* 0 if no detail */
10899     uint16                num_meas;    /* number of ftm frames seen OTA */
10900     uint8                           pad[2];
10901     wl_proxd_rtt_sample_t        rtt[1];        /* variable */
10902 } wl_proxd_rtt_result_t;
10903 
10904 /** aoa measurement result */
10905 typedef struct wl_proxd_aoa_result {
10906     wl_proxd_session_id_t            sid;
10907     wl_proxd_result_flags_t            flags;
10908     wl_proxd_status_t                status;
10909     struct ether_addr                peer;
10910     wl_proxd_session_state_t        state;
10911     uint16                            burst_num;
10912     uint8                            pad[2];
10913     /* wl_proxd_aoa_sample_t sample_avg; TBD */
10914 } BWL_POST_PACKED_STRUCT wl_proxd_aoa_result_t;
10915 #include <packed_section_end.h>
10916 
10917 /** global stats */
10918 typedef struct wl_proxd_counters {
10919     uint32 tx;                    /**< tx frame count */
10920     uint32 rx;                    /**< rx frame count */
10921     uint32 burst;                /**< total number of burst */
10922     uint32 sessions;            /**< total number of sessions */
10923     uint32 max_sessions;        /**< max concurrency */
10924     uint32 sched_fail;            /**< scheduling failures */
10925     uint32 timeouts;            /**< timeouts */
10926     uint32 protoerr;            /**< protocol errors */
10927     uint32 noack;                /**< tx w/o ack */
10928     uint32 txfail;                /**< any tx falure */
10929     uint32 lci_req_tx;            /**< tx LCI requests */
10930     uint32 lci_req_rx;            /**< rx LCI requests */
10931     uint32 lci_rep_tx;            /**< tx LCI reports */
10932     uint32 lci_rep_rx;            /**< rx LCI reports */
10933     uint32 civic_req_tx;        /**< tx civic requests */
10934     uint32 civic_req_rx;        /**< rx civic requests */
10935     uint32 civic_rep_tx;        /**< tx civic reports */
10936     uint32 civic_rep_rx;        /**< rx civic reports */
10937     uint32 rctx;                /**< ranging contexts created */
10938     uint32 rctx_done;            /**< count of ranging done */
10939     uint32 publish_err;     /**< availability publishing errors */
10940     uint32 on_chan;         /**< count of scheduler onchan */
10941     uint32 off_chan;        /**< count of scheduler offchan */
10942     uint32 tsf_lo;          /* local tsf or session tsf */
10943     uint32 tsf_hi;
10944     uint32 num_meas;
10945 } wl_proxd_counters_t;
10946 
10947 typedef struct wl_proxd_counters wl_proxd_session_counters_t;
10948 
10949 enum {
10950     WL_PROXD_CAP_NONE         = 0x0000,
10951     WL_PROXD_CAP_ALL         = 0xffff
10952 };
10953 typedef int16 wl_proxd_caps_t;
10954 
10955 /** method capabilities */
10956 enum {
10957     WL_PROXD_FTM_CAP_NONE = 0x0000,
10958     WL_PROXD_FTM_CAP_FTM1 = 0x0001
10959 };
10960 typedef uint16 wl_proxd_ftm_caps_t;
10961 
10962 typedef struct wl_proxd_tlv_id_list {
10963     uint16            num_ids;
10964     uint16            ids[1];
10965 } wl_proxd_tlv_id_list_t;
10966 
10967 typedef struct wl_proxd_session_id_list {
10968     uint16 num_ids;
10969     wl_proxd_session_id_t ids[1];
10970 } wl_proxd_session_id_list_t;
10971 
10972 typedef struct wl_proxd_tpk {
10973     struct ether_addr    peer;
10974     uint8 tpk[TPK_FTM_LEN];
10975 } wl_proxd_tpk_t;
10976 
10977 /* tlvs returned for get_info on ftm method
10978  *    configuration:
10979  *    proxd flags
10980  *    event mask
10981  *    debug mask
10982  *    session defaults (session tlvs)
10983  * status tlv - not supported for ftm method
10984  * info tlv
10985  */
10986 typedef struct wl_proxd_ftm_info {
10987     wl_proxd_ftm_caps_t caps;
10988     uint16 max_sessions;
10989     uint16 num_sessions;
10990     uint16 rx_max_burst;
10991 } wl_proxd_ftm_info_t;
10992 
10993 enum {
10994     WL_PROXD_WAIT_NONE  = 0x0000,
10995     WL_PROXD_WAIT_KEY    = 0x0001,
10996     WL_PROXD_WAIT_SCHED    = 0x0002,
10997     WL_PROXD_WAIT_TSF    = 0x0004
10998 };
10999 typedef int16 wl_proxd_wait_reason_t;
11000 
11001 /* tlvs returned for get_info on session
11002  * session config (tlvs)
11003  * session info tlv
11004  */
11005 typedef struct wl_proxd_ftm_session_info {
11006     uint16 sid;
11007     uint8 bss_index;
11008     uint8 pad;
11009     struct ether_addr bssid;
11010     wl_proxd_session_state_t state;
11011     wl_proxd_status_t status;
11012     uint16    burst_num;
11013     wl_proxd_wait_reason_t wait_reason;
11014     uint32    meas_start_lo; /* sn tsf of 1st meas for cur/prev burst */
11015     uint32    meas_start_hi;
11016 } wl_proxd_ftm_session_info_t;
11017 
11018 typedef struct wl_proxd_ftm_session_status {
11019     uint16 sid;
11020     wl_proxd_session_state_t state;
11021     wl_proxd_status_t status;
11022     uint16    burst_num;
11023     uint16    pad;
11024 } wl_proxd_ftm_session_status_t;
11025 
11026 /** rrm range request */
11027 typedef struct wl_proxd_range_req {
11028     uint16             num_repeat;
11029     uint16            init_delay_range;    /**< in TUs */
11030     uint8            pad;
11031     uint8            num_nbr;        /**< number of (possible) neighbors */
11032     nbr_element_t        nbr[1];
11033 } wl_proxd_range_req_t;
11034 
11035 #define WL_PROXD_LCI_LAT_OFF     0
11036 #define WL_PROXD_LCI_LONG_OFF     5
11037 #define WL_PROXD_LCI_ALT_OFF     10
11038 
11039 #define WL_PROXD_LCI_GET_LAT(_lci, _lat, _lat_err) { \
11040     unsigned _off = WL_PROXD_LCI_LAT_OFF; \
11041     _lat_err = (_lci)->data[(_off)] & 0x3f; \
11042     _lat = (_lci)->data[(_off)+1]; \
11043     _lat |= (_lci)->data[(_off)+2] << 8; \
11044     _lat |= (_lci)->data[_(_off)+3] << 16; \
11045     _lat |= (_lci)->data[(_off)+4] << 24; \
11046     _lat <<= 2; \
11047     _lat |= (_lci)->data[(_off)] >> 6; \
11048 }
11049 
11050 #define WL_PROXD_LCI_GET_LONG(_lci, _lcilong, _long_err) { \
11051     unsigned _off = WL_PROXD_LCI_LONG_OFF; \
11052     _long_err = (_lci)->data[(_off)] & 0x3f; \
11053     _lcilong = (_lci)->data[(_off)+1]; \
11054     _lcilong |= (_lci)->data[(_off)+2] << 8; \
11055     _lcilong |= (_lci)->data[_(_off)+3] << 16; \
11056     _lcilong |= (_lci)->data[(_off)+4] << 24; \
11057     __lcilong <<= 2; \
11058     _lcilong |= (_lci)->data[(_off)] >> 6; \
11059 }
11060 
11061 #define WL_PROXD_LCI_GET_ALT(_lci, _alt_type, _alt, _alt_err) { \
11062     unsigned _off = WL_PROXD_LCI_ALT_OFF; \
11063     _alt_type = (_lci)->data[_off] & 0x0f; \
11064     _alt_err = (_lci)->data[(_off)] >> 4; \
11065     _alt_err |= ((_lci)->data[(_off)+1] & 0x03) << 4; \
11066     _alt = (_lci)->data[(_off)+2]; \
11067     _alt |= (_lci)->data[(_off)+3] << 8; \
11068     _alt |= (_lci)->data[_(_off)+4] << 16; \
11069     _alt <<= 6; \
11070     _alt |= (_lci)->data[(_off) + 1] >> 2; \
11071 }
11072 
11073 #define WL_PROXD_LCI_VERSION(_lci) ((_lci)->data[15] >> 6)
11074 
11075 /* availability. advertising mechanism bss specific */
11076 /** availablity flags */
11077 enum {
11078     WL_PROXD_AVAIL_NONE = 0,
11079     WL_PROXD_AVAIL_NAN_PUBLISHED = 0x0001,
11080     WL_PROXD_AVAIL_SCHEDULED = 0x0002        /**< scheduled by proxd */
11081 };
11082 typedef int16 wl_proxd_avail_flags_t;
11083 
11084 /** time reference */
11085 enum {
11086     WL_PROXD_TREF_NONE = 0,
11087     WL_PROXD_TREF_DEV_TSF = 1,
11088     WL_PROXD_TREF_NAN_DW = 2,
11089     WL_PROXD_TREF_TBTT = 3,
11090     WL_PROXD_TREF_MAX        /* last entry */
11091 };
11092 typedef int16 wl_proxd_time_ref_t;
11093 
11094 /** proxd channel-time slot */
11095 typedef struct {
11096     wl_proxd_intvl_t start;         /**< from ref */
11097     wl_proxd_intvl_t duration;      /**< from start */
11098     uint32  chanspec;
11099 } wl_proxd_time_slot_t;
11100 
11101 typedef struct wl_proxd_avail24 {
11102     wl_proxd_avail_flags_t flags; /**< for query only */
11103     wl_proxd_time_ref_t time_ref;
11104     uint16    max_slots; /**< for query only */
11105     uint16  num_slots;
11106     wl_proxd_time_slot_t slots[1];    /**< ROM compat - not used */
11107     wl_proxd_intvl_t     repeat;
11108     wl_proxd_time_slot_t ts0[1];
11109 } wl_proxd_avail24_t;
11110 #define WL_PROXD_AVAIL24_TIMESLOT(_avail24, _i) (&(_avail24)->ts0[(_i)])
11111 #define WL_PROXD_AVAIL24_TIMESLOT_OFFSET(_avail24) OFFSETOF(wl_proxd_avail24_t, ts0)
11112 #define WL_PROXD_AVAIL24_TIMESLOTS(_avail24) WL_PROXD_AVAIL24_TIMESLOT(_avail24, 0)
11113 #define WL_PROXD_AVAIL24_SIZE(_avail24, _num_slots) (\
11114     WL_PROXD_AVAIL24_TIMESLOT_OFFSET(_avail24) + \
11115     (_num_slots) * sizeof(*WL_PROXD_AVAIL24_TIMESLOT(_avail24, 0)))
11116 
11117 typedef struct wl_proxd_avail {
11118     wl_proxd_avail_flags_t flags; /**< for query only */
11119     wl_proxd_time_ref_t time_ref;
11120     uint16    max_slots; /**< for query only */
11121     uint16  num_slots;
11122     wl_proxd_intvl_t     repeat;
11123     wl_proxd_time_slot_t slots[1];
11124 } wl_proxd_avail_t;
11125 #define WL_PROXD_AVAIL_TIMESLOT(_avail, _i) (&(_avail)->slots[(_i)])
11126 #define WL_PROXD_AVAIL_TIMESLOT_OFFSET(_avail) OFFSETOF(wl_proxd_avail_t, slots)
11127 
11128 #define WL_PROXD_AVAIL_TIMESLOTS(_avail) WL_PROXD_AVAIL_TIMESLOT(_avail, 0)
11129 #define WL_PROXD_AVAIL_SIZE(_avail, _num_slots) (\
11130     WL_PROXD_AVAIL_TIMESLOT_OFFSET(_avail) + \
11131     (_num_slots) * sizeof(*WL_PROXD_AVAIL_TIMESLOT(_avail, 0)))
11132 
11133 /* collect support TBD */
11134 
11135 /** debugging */
11136 enum {
11137     WL_PROXD_DEBUG_NONE        = 0x00000000,
11138     WL_PROXD_DEBUG_LOG        = 0x00000001,
11139     WL_PROXD_DEBUG_IOV        = 0x00000002,
11140     WL_PROXD_DEBUG_EVENT        = 0x00000004,
11141     WL_PROXD_DEBUG_SESSION        = 0x00000008,
11142     WL_PROXD_DEBUG_PROTO        = 0x00000010,
11143     WL_PROXD_DEBUG_SCHED        = 0x00000020,
11144     WL_PROXD_DEBUG_RANGING        = 0x00000040,
11145     WL_PROXD_DEBUG_NAN        = 0x00000080,
11146     WL_PROXD_DEBUG_PKT        = 0x00000100,
11147     WL_PROXD_DEBUG_SEC        = 0x00000200,
11148     WL_PROXD_DEBUG_EVENTLOG        = 0x80000000,    /* map/enable EVNET_LOG_TAG_PROXD_INFO */
11149     WL_PROXD_DEBUG_ALL        = 0xffffffff
11150 };
11151 typedef uint32 wl_proxd_debug_mask_t;
11152 
11153 /** tlv IDs - data length 4 bytes unless overridden by type, alignment 32 bits */
11154 enum {
11155     WL_PROXD_TLV_ID_NONE            = 0,
11156     WL_PROXD_TLV_ID_METHOD            = 1,
11157     WL_PROXD_TLV_ID_FLAGS            = 2,
11158     WL_PROXD_TLV_ID_CHANSPEC        = 3,    /**< note: uint32 */
11159     WL_PROXD_TLV_ID_TX_POWER        = 4,
11160     WL_PROXD_TLV_ID_RATESPEC        = 5,
11161     WL_PROXD_TLV_ID_BURST_DURATION        = 6,    /**< intvl - length of burst */
11162     WL_PROXD_TLV_ID_BURST_PERIOD        = 7,    /**< intvl - between bursts */
11163     WL_PROXD_TLV_ID_BURST_FTM_SEP        = 8,    /**< intvl - between FTMs */
11164     WL_PROXD_TLV_ID_BURST_NUM_FTM        = 9,    /**< uint16 - per burst */
11165     WL_PROXD_TLV_ID_NUM_BURST        = 10,    /**< uint16 */
11166     WL_PROXD_TLV_ID_FTM_RETRIES        = 11,    /**< uint16 at FTM level */
11167     WL_PROXD_TLV_ID_BSS_INDEX        = 12,    /**< uint8 */
11168     WL_PROXD_TLV_ID_BSSID            = 13,
11169     WL_PROXD_TLV_ID_INIT_DELAY        = 14,    /**< intvl - optional,non-standalone only */
11170     WL_PROXD_TLV_ID_BURST_TIMEOUT        = 15,    /**< expect response within - intvl */
11171     WL_PROXD_TLV_ID_EVENT_MASK        = 16,    /**< interested events - in/out */
11172     WL_PROXD_TLV_ID_FLAGS_MASK        = 17,    /**< interested flags - in only */
11173     WL_PROXD_TLV_ID_PEER_MAC        = 18,    /**< mac address of peer */
11174     WL_PROXD_TLV_ID_FTM_REQ            = 19,    /**< dot11_ftm_req */
11175     WL_PROXD_TLV_ID_LCI_REQ            = 20,
11176     WL_PROXD_TLV_ID_LCI            = 21,
11177     WL_PROXD_TLV_ID_CIVIC_REQ        = 22,
11178     WL_PROXD_TLV_ID_CIVIC            = 23,
11179     WL_PROXD_TLV_ID_AVAIL24            = 24,    /**< ROM compatibility */
11180     WL_PROXD_TLV_ID_SESSION_FLAGS        = 25,
11181     WL_PROXD_TLV_ID_SESSION_FLAGS_MASK    = 26,    /**< in only */
11182     WL_PROXD_TLV_ID_RX_MAX_BURST        = 27,    /**< uint16 - limit bursts per session */
11183     WL_PROXD_TLV_ID_RANGING_INFO        = 28,    /**< ranging info */
11184     WL_PROXD_TLV_ID_RANGING_FLAGS        = 29,    /**< uint16 */
11185     WL_PROXD_TLV_ID_RANGING_FLAGS_MASK    = 30,    /**< uint16, in only */
11186     WL_PROXD_TLV_ID_NAN_MAP_ID        = 31,
11187     WL_PROXD_TLV_ID_DEV_ADDR        = 32,
11188     WL_PROXD_TLV_ID_AVAIL            = 33,    /**< wl_proxd_avail_t  */
11189     WL_PROXD_TLV_ID_TLV_ID            = 34,    /* uint16 tlv-id */
11190     WL_PROXD_TLV_ID_FTM_REQ_RETRIES        = 35,    /* uint16 FTM request retries */
11191     WL_PROXD_TLV_ID_TPK            = 36,    /* 32byte TPK  */
11192     WL_PROXD_TLV_ID_RI_RR            = 36,    /* RI_RR */
11193     WL_PROXD_TLV_ID_TUNE            = 37,    /* wl_proxd_pararms_tof_tune_t */
11194 
11195     /* output - 512 + x */
11196     WL_PROXD_TLV_ID_STATUS            = 512,
11197     WL_PROXD_TLV_ID_COUNTERS        = 513,
11198     WL_PROXD_TLV_ID_INFO            = 514,
11199     WL_PROXD_TLV_ID_RTT_RESULT        = 515,
11200     WL_PROXD_TLV_ID_AOA_RESULT        = 516,
11201     WL_PROXD_TLV_ID_SESSION_INFO        = 517,
11202     WL_PROXD_TLV_ID_SESSION_STATUS        = 518,
11203     WL_PROXD_TLV_ID_SESSION_ID_LIST        = 519,
11204 
11205     /* debug tlvs can be added starting 1024 */
11206     WL_PROXD_TLV_ID_DEBUG_MASK        = 1024,
11207     WL_PROXD_TLV_ID_COLLECT            = 1025,    /**< output only */
11208     WL_PROXD_TLV_ID_STRBUF            = 1026,
11209 
11210     WL_PROXD_TLV_ID_COLLECT_HEADER        = 1025,    /* wl_proxd_collect_header_t */
11211     WL_PROXD_TLV_ID_COLLECT_INFO        = 1028,    /* wl_proxd_collect_info_t */
11212     WL_PROXD_TLV_ID_COLLECT_DATA        = 1029,    /* wl_proxd_collect_data_t */
11213     WL_PROXD_TLV_ID_COLLECT_CHAN_DATA    = 1030,    /* wl_proxd_collect_data_t */
11214 
11215     WL_PROXD_TLV_ID_MAX
11216 };
11217 
11218 typedef struct wl_proxd_tlv {
11219     uint16 id;
11220     uint16 len;
11221     uint8  data[1];
11222 } wl_proxd_tlv_t;
11223 
11224 /** proxd iovar - applies to proxd, method or session */
11225 typedef struct wl_proxd_iov {
11226     uint16                  version;
11227     uint16                  len;
11228     wl_proxd_cmd_t          cmd;
11229     wl_proxd_method_t       method;
11230     wl_proxd_session_id_t   sid;
11231     uint8                   PAD[2];
11232     wl_proxd_tlv_t          tlvs[1];    /**< variable */
11233 } wl_proxd_iov_t;
11234 
11235 #define WL_PROXD_IOV_HDR_SIZE OFFSETOF(wl_proxd_iov_t, tlvs)
11236 
11237 /* The following event definitions may move to bcmevent.h, but sharing proxd types
11238  * across needs more invasive changes unrelated to proxd
11239  */
11240 enum {
11241     WL_PROXD_EVENT_NONE            = 0,    /**< not an event, reserved */
11242     WL_PROXD_EVENT_SESSION_CREATE        = 1,
11243     WL_PROXD_EVENT_SESSION_START        = 2,
11244     WL_PROXD_EVENT_FTM_REQ            = 3,
11245     WL_PROXD_EVENT_BURST_START        = 4,
11246     WL_PROXD_EVENT_BURST_END        = 5,
11247     WL_PROXD_EVENT_SESSION_END        = 6,
11248     WL_PROXD_EVENT_SESSION_RESTART        = 7,
11249     WL_PROXD_EVENT_BURST_RESCHED        = 8,    /**< burst rescheduled-e.g. partial TSF */
11250     WL_PROXD_EVENT_SESSION_DESTROY        = 9,
11251     WL_PROXD_EVENT_RANGE_REQ        = 10,
11252     WL_PROXD_EVENT_FTM_FRAME        = 11,
11253     WL_PROXD_EVENT_DELAY            = 12,
11254     WL_PROXD_EVENT_VS_INITIATOR_RPT        = 13,    /**< (target) rx initiator-report */
11255     WL_PROXD_EVENT_RANGING            = 14,
11256     WL_PROXD_EVENT_LCI_MEAS_REP        = 15,    /* LCI measurement report */
11257     WL_PROXD_EVENT_CIVIC_MEAS_REP        = 16,    /* civic measurement report */
11258     WL_PROXD_EVENT_COLLECT            = 17,
11259     WL_PROXD_EVENT_START_WAIT        = 18,    /* waiting to start */
11260 
11261     WL_PROXD_EVENT_MAX
11262 };
11263 typedef int16 wl_proxd_event_type_t;
11264 
11265 /** proxd event mask - upto 32 events for now */
11266 typedef uint32 wl_proxd_event_mask_t;
11267 
11268 #define WL_PROXD_EVENT_MASK_ALL 0xfffffffe
11269 #define WL_PROXD_EVENT_MASK_EVENT(_event_type) (1 << (_event_type))
11270 #define WL_PROXD_EVENT_ENABLED(_mask, _event_type) (\
11271     ((_mask) & WL_PROXD_EVENT_MASK_EVENT(_event_type)) != 0)
11272 
11273 /** proxd event - applies to proxd, method or session */
11274 typedef struct wl_proxd_event {
11275     uint16                    version;
11276     uint16                    len;
11277     wl_proxd_event_type_t     type;
11278     wl_proxd_method_t         method;
11279     wl_proxd_session_id_t     sid;
11280     uint8                    pad[2];
11281     wl_proxd_tlv_t             tlvs[1];    /**< variable */
11282 } wl_proxd_event_t;
11283 
11284 enum {
11285     WL_PROXD_RANGING_STATE_NONE = 0,
11286     WL_PROXD_RANGING_STATE_NOTSTARTED = 1,
11287     WL_PROXD_RANGING_STATE_INPROGRESS = 2,
11288     WL_PROXD_RANGING_STATE_DONE = 3
11289 };
11290 typedef int16 wl_proxd_ranging_state_t;
11291 
11292 /** proxd ranging flags */
11293 enum {
11294     WL_PROXD_RANGING_FLAG_NONE = 0x0000,  /**< no flags */
11295     WL_PROXD_RANGING_FLAG_DEL_SESSIONS_ON_STOP = 0x0001,
11296     WL_PROXD_RANGING_FLAG_ALL = 0xffff
11297 };
11298 typedef uint16 wl_proxd_ranging_flags_t;
11299 
11300 struct wl_proxd_ranging_info {
11301     wl_proxd_status_t   status;
11302     wl_proxd_ranging_state_t state;
11303     wl_proxd_ranging_flags_t flags;
11304     uint16    num_sids;
11305     uint16    num_done;
11306 };
11307 typedef struct wl_proxd_ranging_info wl_proxd_ranging_info_t;
11308 
11309 #include <packed_section_start.h>
11310 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_event_data {
11311     uint32                  H_LB[K_TOF_COLLECT_H_SIZE_20MHZ];
11312     uint32                  H_RX[K_TOF_COLLECT_H_SIZE_20MHZ];
11313     uint8                   ri_rr[FTM_TPK_LEN];
11314     wl_proxd_phy_error_t    phy_err_mask;
11315 } BWL_POST_PACKED_STRUCT wl_proxd_collect_event_data_t;
11316 #include <packed_section_end.h>
11317 
11318 /** Data returned by the bssload_report iovar. This is also the WLC_E_BSS_LOAD event data */
11319 #include <packed_section_start.h>
11320 typedef BWL_PRE_PACKED_STRUCT struct wl_bssload {
11321     uint16 sta_count;        /**< station count */
11322     uint16 aac;            /**< available admission capacity */
11323     uint8 chan_util;        /**< channel utilization */
11324 } BWL_POST_PACKED_STRUCT wl_bssload_t;
11325 #include <packed_section_end.h>
11326 
11327 /**
11328  * Maximum number of configurable BSS Load levels.  The number of BSS Load
11329  * ranges is always 1 more than the number of configured levels.  eg. if
11330  * 3 levels of 10, 20, 30 are configured then this defines 4 load ranges:
11331  * 0-10, 11-20, 21-30, 31-255.  A WLC_E_BSS_LOAD event is generated each time
11332  * the utilization level crosses into another range, subject to the rate limit.
11333  */
11334 #define MAX_BSSLOAD_LEVELS 8
11335 #define MAX_BSSLOAD_RANGES (MAX_BSSLOAD_LEVELS + 1)
11336 
11337 /** BSS Load event notification configuration. */
11338 typedef struct wl_bssload_cfg {
11339     uint32 rate_limit_msec;    /**< # of events posted to application will be limited to
11340                  * one per specified period (0 to disable rate limit).
11341                  */
11342     uint8 num_util_levels;    /**< Number of entries in util_levels[] below */
11343     uint8 util_levels[MAX_BSSLOAD_LEVELS];
11344                 /**< Variable number of BSS Load utilization levels in
11345                  * low to high order.  An event will be posted each time
11346                  * a received beacon's BSS Load IE channel utilization
11347                  * value crosses a level.
11348                  */
11349     uint8 PAD[3];
11350 } wl_bssload_cfg_t;
11351 
11352 /** Multiple roaming profile suport */
11353 #define WL_MAX_ROAM_PROF_BRACKETS    4
11354 
11355 #define WL_ROAM_PROF_VER_0    0
11356 #define WL_ROAM_PROF_VER_1    1
11357 #define WL_MAX_ROAM_PROF_VER    WL_ROAM_PROF_VER_1
11358 
11359 #define WL_ROAM_PROF_NONE    (0 << 0)
11360 #define WL_ROAM_PROF_LAZY    (1 << 0)
11361 #define WL_ROAM_PROF_NO_CI    (1 << 1)
11362 #define WL_ROAM_PROF_SUSPEND    (1 << 2)
11363 #define WL_ROAM_PROF_SYNC_DTIM    (1 << 6)
11364 #define WL_ROAM_PROF_DEFAULT    (1 << 7)    /**< backward compatible single default profile */
11365 
11366 #define WL_FACTOR_TABLE_MAX_LIMIT 5
11367 
11368 #define WL_CU_2G_ROAM_TRIGGER (-60)
11369 #define WL_CU_5G_ROAM_TRIGGER (-70)
11370 
11371 #define WL_CU_SCORE_DELTA_DEFAULT 20
11372 
11373 #define WL_MAX_CHANNEL_USAGE 0x0FF
11374 #define WL_CU_PERCENTAGE_DISABLE 0
11375 #define WL_CU_PERCENTAGE_DEFAULT 70
11376 #define WL_CU_PERCENTAGE_MAX 100
11377 #define WL_CU_CALC_DURATION_DEFAULT 10 /* seconds */
11378 #define WL_CU_CALC_DURATION_MAX 60 /* seconds */
11379 
11380 typedef struct wl_roam_prof_v2 {
11381     int8    roam_flags;        /**< bit flags */
11382     int8    roam_trigger;        /**< RSSI trigger level per profile/RSSI bracket */
11383     int8    rssi_lower;
11384     int8    roam_delta;
11385 
11386     /* if channel_usage if zero, roam_delta is rssi delta required for new AP */
11387     /* if channel_usage if non-zero, roam_delta is score delta(%) required for new AP */
11388     int8    rssi_boost_thresh;    /**< Min RSSI to qualify for RSSI boost */
11389     int8    rssi_boost_delta;    /**< RSSI boost for AP in the other band */
11390     uint16    nfscan;            /**< number of full scan to start with */
11391     uint16    fullscan_period;
11392     uint16    init_scan_period;
11393     uint16    backoff_multiplier;
11394     uint16    max_scan_period;
11395     uint8    channel_usage;
11396     uint8    cu_avg_calc_dur;
11397     uint8    pad[2];
11398 } wl_roam_prof_v2_t;
11399 
11400 typedef struct wl_roam_prof_v1 {
11401     int8    roam_flags;        /**< bit flags */
11402     int8    roam_trigger;        /**< RSSI trigger level per profile/RSSI bracket */
11403     int8    rssi_lower;
11404     int8    roam_delta;
11405 
11406     /* if channel_usage if zero, roam_delta is rssi delta required for new AP */
11407     /* if channel_usage if non-zero, roam_delta is score delta(%) required for new AP */
11408     int8    rssi_boost_thresh;    /**< Min RSSI to qualify for RSSI boost */
11409     int8    rssi_boost_delta;    /**< RSSI boost for AP in the other band */
11410     uint16    nfscan;            /**< number of full scan to start with */
11411     uint16    fullscan_period;
11412     uint16    init_scan_period;
11413     uint16    backoff_multiplier;
11414     uint16    max_scan_period;
11415 } wl_roam_prof_v1_t;
11416 
11417 typedef struct wl_roam_prof_band_v2 {
11418     uint32    band;            /**< Must be just one band */
11419     uint16    ver;            /**< version of this struct */
11420     uint16    len;            /**< length in bytes of this structure */
11421     wl_roam_prof_v2_t roam_prof[WL_MAX_ROAM_PROF_BRACKETS];
11422 } wl_roam_prof_band_v2_t;
11423 
11424 typedef struct wl_roam_prof_band_v1 {
11425     uint32    band;            /**< Must be just one band */
11426     uint16    ver;            /**< version of this struct */
11427     uint16    len;            /**< length in bytes of this structure */
11428     wl_roam_prof_v1_t roam_prof[WL_MAX_ROAM_PROF_BRACKETS];
11429 } wl_roam_prof_band_v1_t;
11430 
11431 #define BSS_MAXTABLE_SIZE 10
11432 #define WNM_BSS_SELECT_FACTOR_VERSION   1
11433 typedef struct wnm_bss_select_factor_params {
11434     uint8 low;
11435     uint8 high;
11436     uint8 factor;
11437     uint8 pad;
11438 } wnm_bss_select_factor_params_t;
11439 
11440 #define WNM_BSS_SELECT_FIXED_SIZE OFFSETOF(wnm_bss_select_factor_cfg_t, params)
11441 typedef struct wnm_bss_select_factor_cfg {
11442     uint8 version;
11443     uint8 band;
11444     uint16 type;
11445     uint16 pad;
11446     uint16 count;
11447     wnm_bss_select_factor_params_t params[1];
11448 } wnm_bss_select_factor_cfg_t;
11449 
11450 #define WNM_BSS_SELECT_WEIGHT_VERSION   1
11451 typedef struct wnm_bss_select_weight_cfg {
11452     uint8 version;
11453     uint8 band;
11454     uint16 type;
11455     uint16 weight; /* weightage for each type between 0 to 100 */
11456 } wnm_bss_select_weight_cfg_t;
11457 
11458 #define WNM_BSS_SELECT_TYPE_RSSI   0
11459 #define WNM_BSS_SELECT_TYPE_CU   1
11460 
11461 #define WNM_BSSLOAD_MONITOR_VERSION   1
11462 typedef struct wnm_bssload_monitor_cfg {
11463     uint8 version;
11464     uint8 band;
11465     uint8 duration; /* duration between 1 to 20sec */
11466 } wnm_bssload_monitor_cfg_t;
11467 
11468 #define WNM_ROAM_TRIGGER_VERSION   1
11469 typedef struct wnm_roam_trigger_cfg {
11470     uint8 version;
11471     uint8 band;
11472     uint16 type;
11473     int16 trigger; /* trigger for each type in new roam algorithm */
11474 } wnm_roam_trigger_cfg_t;
11475 
11476 /* Data structures for Interface Create/Remove  */
11477 
11478 #define WL_INTERFACE_CREATE_VER    (0)
11479 #define WL_INTERFACE_CREATE_VER_1    1
11480 #define WL_INTERFACE_CREATE_VER_2    2
11481 #define WL_INTERFACE_CREATE_VER_3    3
11482 
11483 /*
11484  * The flags filed of the wl_interface_create is designed to be
11485  * a Bit Mask. As of now only Bit 0 and Bit 1 are used as mentioned below.
11486  * The rest of the bits can be used, incase we have to provide
11487  * more information to the dongle
11488  */
11489 
11490 /*
11491  * Bit 0 of flags field is used to inform whether the interface requested to
11492  * be created is STA or AP.
11493  * 0 - Create a STA interface
11494  * 1 - Create an AP interface
11495  * NOTE: This Bit 0 is applicable for the WL_INTERFACE_CREATE_VER < 2
11496  */
11497 #define WL_INTERFACE_CREATE_STA    (0 << 0)
11498 #define WL_INTERFACE_CREATE_AP    (1 << 0)
11499 
11500 /*
11501  * From revision >= 2 Bit 0 of flags field will not used be for STA or AP interface creation.
11502  * "iftype" field shall be used for identifying the interface type.
11503  */
11504 typedef enum wl_interface_type {
11505     WL_INTERFACE_TYPE_STA = 0,
11506     WL_INTERFACE_TYPE_AP = 1,
11507     WL_INTERFACE_TYPE_AWDL = 2,
11508     WL_INTERFACE_TYPE_NAN = 3,
11509     WL_INTERFACE_TYPE_MAX
11510 } wl_interface_type_t;
11511 
11512 /*
11513  * Bit 1 of flags field is used to inform whether MAC is present in the
11514  * data structure or not.
11515  * 0 - Ignore mac_addr field
11516  * 1 - Use the mac_addr field
11517  */
11518 #define WL_INTERFACE_MAC_DONT_USE    (0 << 1)
11519 #define WL_INTERFACE_MAC_USE        (1 << 1)
11520 
11521 /*
11522  * Bit 2 of flags field is used to inform whether core or wlc index
11523  * is present in the data structure or not.
11524  * 0 - Ignore wlc_index field
11525  * 1 - Use the wlc_index field
11526  */
11527 #define WL_INTERFACE_WLC_INDEX_DONT_USE    (0 << 2)
11528 #define WL_INTERFACE_WLC_INDEX_USE    (1 << 2)
11529 
11530 /*
11531  * Bit 3 of flags field is used to create interface on the host requested interface index
11532  * 0 - Ignore if_index field
11533  * 1 - Use the if_index field
11534  */
11535 #define WL_INTERFACE_IF_INDEX_USE       (1 << 3)
11536 
11537 /*
11538  * Bit 4 of flags field is used to assign BSSID
11539  * 0 - Ignore bssid field
11540  * 1 - Use the bssid field
11541  */
11542 #define WL_INTERFACE_BSSID_INDEX_USE    (1 << 4)
11543 
11544 #ifdef WLMESH
11545 typedef struct wl_interface_info {
11546     uint16  ver;            /* version of this struct */
11547     struct ether_addr    mac_addr;  /* MAC address of the interface */
11548     char    ifname[BCM_MSG_IFNAME_MAX]; /* name of interface */
11549     uint8   bsscfgidx;      /* source bsscfg index */
11550 } wl_interface_info_t;
11551 #endif
11552 
11553 typedef struct wl_interface_create {
11554     uint16    ver;            /* version of this struct */
11555     uint32  flags;            /* flags that defines the operation */
11556     struct    ether_addr   mac_addr;    /* Optional Mac address */
11557 } wl_interface_create_t;
11558 
11559 typedef struct wl_interface_create_v1 {
11560     uint16  ver;                    /**< version of this struct */
11561     uint8   pad1[2];                /**< Padding bytes */
11562     uint32  flags;                  /**< flags that defines the operation */
11563     struct  ether_addr   mac_addr;  /**< Optional Mac address */
11564     uint8   pad2[2];                /**< Padding bytes */
11565     uint32  wlc_index;              /**< Optional wlc index */
11566 } wl_interface_create_v1_t;
11567 
11568 typedef struct wl_interface_create_v2 {
11569     uint16  ver;                    /**< version of this struct */
11570     uint8   pad1[2];                /**< Padding bytes */
11571     uint32  flags;                  /**< flags that defines the operation */
11572     struct  ether_addr   mac_addr;  /**< Optional Mac address */
11573     uint8   iftype;                 /**< Type of interface created */
11574     uint8   pad2;                   /**< Padding bytes */
11575     uint32  wlc_index;              /**< Optional wlc index */
11576 } wl_interface_create_v2_t;
11577 
11578 typedef struct wl_interface_create_v3 {
11579     uint16    ver;            /**< version of this struct */
11580     uint16    len;            /**< length of whole structure including variable length */
11581     uint16    fixed_len;        /**< Fixed length of this structure excluding data[] */
11582     uint8    iftype;            /**< Type of interface created */
11583     uint8    wlc_index;        /**< Optional wlc index */
11584     uint32  flags;            /**< flags that defines the operation */
11585     struct    ether_addr   mac_addr;    /**< Optional Mac address */
11586     struct    ether_addr   bssid;    /**< Optional BSSID */
11587     uint8    if_index;        /**< interface index requested by Host */
11588     uint8    pad[3];            /**< Padding bytes to ensure data[] is at 32 bit aligned */
11589     uint8    data[];            /**< Optional application/Module specific data */
11590 } wl_interface_create_v3_t;
11591 
11592 #define WL_INTERFACE_INFO_VER_1        1
11593 #define WL_INTERFACE_INFO_VER_2        2
11594 
11595 typedef struct wl_interface_info_v1 {
11596     uint16  ver;                    /**< version of this struct */
11597     struct ether_addr    mac_addr;  /**< MAC address of the interface */
11598     char    ifname[BCM_MSG_IFNAME_MAX]; /**< name of interface */
11599     uint8   bsscfgidx;              /**< source bsscfg index */
11600     uint8    PAD;
11601 } wl_interface_info_v1_t;
11602 
11603 typedef struct wl_interface_info_v2 {
11604     uint16                  ver;                    /**< version of this struct */
11605     uint16                  length;                 /**< length of the whole structure */
11606     struct  ether_addr      mac_addr;               /**< MAC address of the interface */
11607     uint8                   bsscfgidx;              /**< source bsscfg index */
11608     uint8                   if_index;               /**< Interface index allocated by FW */
11609     char                    ifname[BCM_MSG_IFNAME_MAX]; /**< name of interface */
11610 } wl_interface_info_v2_t;
11611 
11612 #define PHY_RXIQEST_AVERAGING_DELAY 10
11613 
11614 typedef struct wl_iqest_params {
11615     uint32 rxiq;
11616     uint8 niter;
11617     uint8 delay;
11618     uint8 PAD[2];
11619 } wl_iqest_params_t;
11620 
11621 typedef struct wl_iqest_sweep_params {
11622     wl_iqest_params_t params;
11623     uint8 nchannels;
11624     uint8 channel[3];    /** variable */
11625 } wl_iqest_sweep_params_t;
11626 
11627 typedef struct wl_iqest_value {
11628     uint8 channel;
11629     uint8 PAD[3];
11630     uint32 rxiq;
11631 } wl_iqest_value_t;
11632 
11633 typedef struct wl_iqest_result {
11634     uint8 nvalues;
11635     uint8 PAD[3];
11636     wl_iqest_value_t value[1];
11637 } wl_iqest_result_t;
11638 
11639 /* BTCX AIBSS (Oxygen) Status */
11640 typedef struct wlc_btc_aibss_info {
11641     uint32    prev_tsf_l;        // Lower 32 bits of last read of TSF
11642     uint32    prev_tsf_h;        // Higher 32 bits of last read of TSF
11643     uint32    last_btinfo;        // Last read of BT info
11644     uint32    local_btinfo;        // Local BT INFO BitMap
11645     uint8    bt_out_of_sync_cnt;    // BT not in sync with strobe
11646     uint8    esco_off_cnt;        // Count incremented when ESCO is off
11647     uint8    strobe_enabled;        // Set only in AIBSS mode
11648     uint8    strobe_on;        // strobe to BT is on for Oxygen
11649     uint8    local_bt_in_sync;    // Sync status of local BT when strobe is on
11650     uint8    other_bt_in_sync;    // Sync state of BT in other devices in AIBSS
11651     uint8    local_bt_is_master;    // Local BT is master
11652     uint8    sco_prot_on;        // eSCO Protection on in local device
11653     uint8    other_esco_present;    // eSCO status in other devices in AIBSS
11654     uint8    rx_agg_change;        // Indicates Rx Agg size needs to change
11655     uint8    rx_agg_modified;    // Rx Agg size modified
11656     uint8    acl_grant_set;        // ACL grants on for speeding up sync
11657     uint8    write_ie_err_cnt;    // BTCX Ie write error cnt
11658     uint8    parse_ie_err_cnt;    // BTCX IE parse error cnt
11659     uint8    wci2_fail_cnt;        // WCI2 init failure cnt
11660     uint8    strobe_enable_err_cnt;    // Strobe enable err cnt
11661     uint8    strobe_init_err_cnt;    // Strobe init err cnt
11662     uint8    tsf_jump_cnt;        // TSF jump cnt
11663     uint8    acl_grant_cnt;        // ALC grant cnt
11664     uint8    pad1;
11665     uint16    ibss_tsf_shm;        // SHM address of strobe TSF
11666     uint16    pad2;
11667 } wlc_btc_aibss_info_t;
11668 
11669 #define WLC_BTC_AIBSS_STATUS_VER    1
11670 #define WLC_BTC_AIBSS_STATUS_LEN    (sizeof(wlc_btc_aibss_status_t) - 2 * (sizeof(uint16)))
11671 
11672 typedef struct wlc_btc_aibss_status {
11673     uint16    version;        // Version #
11674     uint16    len;            // Length of the structure(excluding len & version)
11675     int32    mode;            // Current value of btc_mode
11676     uint16    bth_period;             // bt coex period. read from shm.
11677     uint16    agg_off_bm;        // AGG OFF BM read from SHM
11678     uint8    bth_active;             // bt active session
11679     uint8    pad[3];
11680     wlc_btc_aibss_info_t aibss_info;    // Structure definition above
11681 } wlc_btc_aibss_status_t;
11682 
11683 typedef enum {
11684     STATE_NONE = 0,
11685 
11686     /* WLAN -> BT */
11687     W2B_DATA_SET = 21,
11688     B2W_ACK_SET = 22,
11689     W2B_DATA_CLEAR = 23,
11690     B2W_ACK_CLEAR = 24,
11691 
11692     /* BT -> WLAN */
11693     B2W_DATA_SET = 31,
11694     W2B_ACK_SET = 32,
11695     B2W_DATA_CLEAR = 33,
11696     W2B_ACK_CLEAR = 34
11697 } bwte_gci_intstate_t;
11698 
11699 #define WL_BWTE_STATS_VERSION 1 /* version of bwte_stats_t */
11700 typedef struct {
11701     uint32 version;
11702 
11703     bwte_gci_intstate_t inttobt;
11704     bwte_gci_intstate_t intfrombt;
11705 
11706     uint32 bt2wl_intrcnt; /* bt->wlan interrrupt count */
11707     uint32 wl2bt_intrcnt; /* wlan->bt interrupt count  */
11708 
11709     uint32 wl2bt_dset_cnt;
11710     uint32 wl2bt_dclear_cnt;
11711     uint32 wl2bt_aset_cnt;
11712     uint32 wl2bt_aclear_cnt;
11713 
11714     uint32 bt2wl_dset_cnt;
11715     uint32 bt2wl_dclear_cnt;
11716     uint32 bt2wl_aset_cnt;
11717     uint32 bt2wl_aclear_cnt;
11718 
11719     uint32 state_error_1;
11720     uint32 state_error_2;
11721     uint32 state_error_3;
11722     uint32 state_error_4;
11723 } bwte_stats_t;
11724 
11725 #define TBOW_MAX_SSID_LEN        32
11726 #define TBOW_MAX_PASSPHRASE_LEN  63
11727 
11728 #define WL_TBOW_SETUPINFO_T_VERSION 1 /* version of tbow_setup_netinfo_t */
11729 typedef struct tbow_setup_netinfo {
11730     uint32 version;
11731     uint8 opmode;
11732     uint8 pad;
11733     uint8 macaddr[ETHER_ADDR_LEN];
11734     uint32 ssid_len;
11735     uint8 ssid[TBOW_MAX_SSID_LEN];
11736     uint8 passphrase_len;
11737     uint8 passphrase[TBOW_MAX_PASSPHRASE_LEN];
11738     chanspec_t chanspec;
11739     uint8 PAD[2];
11740     uint32 channel;
11741 } tbow_setup_netinfo_t;
11742 
11743 typedef enum tbow_ho_opmode {
11744     TBOW_HO_MODE_START_GO = 0,
11745     TBOW_HO_MODE_START_STA,
11746     TBOW_HO_MODE_START_GC,
11747     TBOW_HO_MODE_TEST_GO,
11748     TBOW_HO_MODE_STOP_GO = 0x10,
11749     TBOW_HO_MODE_STOP_STA,
11750     TBOW_HO_MODE_STOP_GC,
11751     TBOW_HO_MODE_TEARDOWN
11752 } tbow_ho_opmode_t;
11753 
11754 /* Beacon trim feature statistics */
11755 /* configuration */
11756 #define BCNTRIMST_PER            0    /* Number of beacons to trim (0: disable) */
11757 #define BCNTRIMST_TIMEND        1    /* Number of bytes till TIM IE */
11758 #define BCNTRIMST_TSFLMT        2    /* TSF tolerance value (usecs) */
11759 /* internal use */
11760 #define BCNTRIMST_CUR            3    /* PSM's local beacon trim counter */
11761 #define BCNTRIMST_PREVLEN        4    /* Beacon length excluding the TIM IE */
11762 #define BCNTRIMST_TIMLEN        5    /* TIM IE Length */
11763 #define BCNTRIMST_RSSI            6    /* Partial beacon RSSI */
11764 #define BCNTRIMST_CHAN            7    /* Partial beacon channel */
11765 /* debug stat (off by default) */
11766 #define BCNTRIMST_DUR            8    /* RX duration until beacon trimmed */
11767 #define BCNTRIMST_RXMBSS        9    /* MYBSSID beacon received */
11768 #define BCNTRIMST_CANTRIM        10    /* # beacons which were trimmed */
11769 #define BCNTRIMST_LENCHG        11    /* # beacons not trimmed due to length change */
11770 #define BCNTRIMST_TSFDRF        12    /* # beacons not trimmed due to large TSF delta */
11771 #define BCNTRIMST_NOTIM            13    /* # beacons not trimmed due to TIM missing */
11772 
11773 #define BCNTRIMST_NUM            14
11774 
11775 #define WL_BCNTRIM_STATUS_VERSION_1 1
11776 typedef struct wl_bcntrim_status_query_v1 {
11777     uint16  version;
11778     uint16  len;     /* Total length includes fixed fields */
11779     uint8   reset;   /* reset after reading the stats */
11780     uint8   pad[3];  /* 4-byte alignment */
11781 } wl_bcntrim_status_query_v1_t;
11782 
11783 typedef struct wl_bcntrim_status_v1 {
11784     uint16  version;
11785     uint16  len;            /* Total length includes fixed fields and variable data[] */
11786     uint8   curr_slice_id;  /* slice index of the interface */
11787     uint8   applied_cfg;    /* applied bcntrim N threshold */
11788     uint8   pad[2];         /* 4-byte alignment */
11789     uint32  fw_status;      /* Bits representing bcntrim disable reason in FW */
11790     uint32  total_disable_dur;    /* total duration (msec) bcntrim remains
11791                                      disabled due to FW disable reasons
11792                                    */
11793     uint32  data[];         /* variable length data containing stats */
11794 } wl_bcntrim_status_v1_t;
11795 
11796 #define BCNTRIM_STATS_MAX            10      /* Total stats part of the status data[] */
11797 
11798 /* Bits for FW status */
11799 #define WL_BCNTRIM_DISABLE_HOST      0x1  /* Host disabled bcntrim through bcntrim IOVar */
11800 #define WL_BCNTRIM_DISABLE_PHY_RATE  0x2  /* bcntrim disabled because beacon rx rate is
11801                                          higher than phy_rate_thresh
11802                                        */
11803 #define WL_BCNTRIM_DISABLE_QUIET_IE  0x4  /* bcntrim disable when Quiet IE present */
11804 
11805 #define WL_BCNTRIM_CFG_VERSION_1     1
11806 /* Common IOVAR struct */
11807 typedef struct wl_bcntrim_cfg_v1 {
11808     uint16  version;
11809     uint16 len;          /* Total length includes fixed fields and variable data[] */
11810     uint16 subcmd_id;    /* subcommand id */
11811     uint16 pad;          /* pad/reserved */
11812     uint8 data[];        /* subcommand data; could be empty */
11813 } wl_bcntrim_cfg_v1_t;
11814 
11815 /* subcommands ids */
11816 enum {
11817     WL_BCNTRIM_CFG_SUBCMD_PHY_RATE_THRESH =       0,   /* PHY rate threshold above
11818                                                           which bcntrim is not applied
11819                                                         */
11820     WL_BCNTRIM_CFG_SUBCMD_OVERRIDE_DISABLE_MASK = 1,   /* Override bcntrim disable reasons */
11821     WL_BCNTRIM_CFG_SUBCMD_TSF_DRIFT_LIMIT =       2    /* TSF drift limit to consider bcntrim */
11822 };
11823 
11824 #define BCNTRIM_MAX_PHY_RATE    48     /* in 500Kbps */
11825 #define BCNTRIM_MAX_TSF_DRIFT   65535  /* in usec */
11826 #define WL_BCNTRIM_OVERRIDE_DISABLE_MASK  (WL_BCNTRIM_DISABLE_QUIET_IE)
11827 
11828 /* WL_BCNTRIM_CFG_SUBCMD_PHY_RATE_TRESH */
11829 typedef struct wl_bcntrim_cfg_phy_rate_thresh {
11830     uint32 rate;      /* beacon rate (in 500kbps units)  */
11831 } wl_bcntrim_cfg_phy_rate_thresh_t;
11832 
11833 /* WL_BCNTRIM_CFG_SUBCMD_OVERRIDE_DISABLE_MASK */
11834 typedef struct wl_bcntrim_cfg_override_disable_mask {
11835     uint32  mask;     /* bits representing individual disable reason to override */
11836 } wl_bcntrim_cfg_override_disable_mask_t;
11837 
11838 /* WL_BCNTRIM_CFG_SUBCMD_TSF_DRIFT_LIMIT */
11839 typedef struct wl_bcntrim_cfg_tsf_drift_limit {
11840     uint16   drift;   /* tsf drift limit specified in usec */
11841     uint8    pad[2];  /* 4-byte alignment */
11842 } wl_bcntrim_cfg_tsf_drift_limit_t;
11843 
11844 
11845 /* --------------  TX Power Cap --------------- */
11846 #define TXPWRCAP_MAX_NUM_CORES 8
11847 #define TXPWRCAP_MAX_NUM_ANTENNAS (TXPWRCAP_MAX_NUM_CORES * 2)
11848 
11849 #define TXPWRCAP_NUM_SUBBANDS 5
11850 
11851 /* IOVAR txcapconfig enum's */
11852 #define TXPWRCAPCONFIG_WCI2 0
11853 #define TXPWRCAPCONFIG_HOST 1
11854 #define TXPWRCAPCONFIG_WCI2_AND_HOST 2
11855 
11856 /* IOVAR txcapstate enum's */
11857 #define TXPWRCAPSTATE_LOW_CAP  0
11858 #define TXPWRCAPSTATE_HIGH_CAP 1
11859 #define TXPWRCAPSTATE_HOST_LOW_WCI2_LOW_CAP    0
11860 #define TXPWRCAPSTATE_HOST_LOW_WCI2_HIGH_CAP    1
11861 #define TXPWRCAPSTATE_HOST_HIGH_WCI2_LOW_CAP    2
11862 #define TXPWRCAPSTATE_HOST_HIGH_WCI2_HIGH_CAP    3
11863 
11864 /* IOVAR txcapconfig and txcapstate structure is shared: SET and GET */
11865 #define TXPWRCAPCTL_VERSION 2
11866 typedef struct wl_txpwrcap_ctl {
11867     uint8   version;
11868     uint8   ctl[TXPWRCAP_NUM_SUBBANDS];
11869 } wl_txpwrcap_ctl_t;
11870 
11871 /* IOVAR txcapdump structure: GET only */
11872 #define TXPWRCAP_DUMP_VERSION 2
11873 typedef struct wl_txpwrcap_dump {
11874     uint8   version;
11875     uint8    pad0;
11876     uint8   current_country[2];
11877     uint32    current_channel;
11878     uint8   config[TXPWRCAP_NUM_SUBBANDS];
11879     uint8   state[TXPWRCAP_NUM_SUBBANDS];
11880     uint8    high_cap_state_enabled;
11881     uint8    wci2_cell_status_last;
11882     uint8   download_present;
11883     uint8    num_subbands;
11884     uint8    num_antennas;
11885     uint8   num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
11886     uint8    num_cc_groups;
11887     uint8   current_country_cc_group_info_index;
11888     int8    low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
11889     int8    high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
11890     uint8    PAD[3];
11891 } wl_txpwrcap_dump_t;
11892 
11893 typedef struct wl_txpwrcap_dump_v3 {
11894     uint8   version;
11895     uint8    pad0;
11896     uint8   current_country[2];
11897     uint32    current_channel;
11898     uint8   config[TXPWRCAP_NUM_SUBBANDS];
11899     uint8   state[TXPWRCAP_NUM_SUBBANDS];
11900     uint8    high_cap_state_enabled;
11901     uint8    wci2_cell_status_last;
11902     uint8   download_present;
11903     uint8    num_subbands;
11904     uint8    num_antennas;
11905     uint8   num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
11906     uint8    num_cc_groups;
11907     uint8   current_country_cc_group_info_index;
11908     uint8    cap_states_per_cc_group;
11909     int8    host_low_wci2_low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
11910     int8    host_low_wci2_high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
11911     int8    host_high_wci2_low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
11912     int8    host_high_wci2_high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
11913     uint8    PAD[2];
11914 } wl_txpwrcap_dump_v3_t;
11915 
11916 typedef struct wl_txpwrcap_tbl {
11917     uint8 num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
11918     /* Stores values for valid antennas */
11919     int8 pwrcap_cell_on[TXPWRCAP_MAX_NUM_ANTENNAS]; /* qdBm units */
11920     int8 pwrcap_cell_off[TXPWRCAP_MAX_NUM_ANTENNAS]; /* qdBm units */
11921 } wl_txpwrcap_tbl_t;
11922 
11923 /* ##### Ecounters section ##### */
11924 #define ECOUNTERS_VERSION_1    1
11925 
11926 /* Input structure for ecounters IOVAR */
11927 typedef struct ecounters_config_request {
11928     uint16 version;        /* config version */
11929     uint16 set;        /* Set where data will go. */
11930     uint16 size;        /* Size of the set. */
11931     uint16 timeout;        /* timeout in seconds. */
11932     uint16 num_events;    /* Number of events to report. */
11933     uint16 ntypes;        /* Number of entries in type array. */
11934     uint16 type[1];        /* Statistics Types (tags) to retrieve. */
11935 } ecounters_config_request_t;
11936 
11937 #define ECOUNTERS_EVENTMSGS_VERSION_1        1
11938 #define ECOUNTERS_TRIGGER_CONFIG_VERSION_1    1
11939 
11940 #define ECOUNTERS_EVENTMSGS_EXT_MASK_OFFSET    \
11941         OFFSETOF(ecounters_eventmsgs_ext_t, mask[0])
11942 
11943 #define ECOUNTERS_TRIG_CONFIG_TYPE_OFFSET    \
11944         OFFSETOF(ecounters_trigger_config_t, type[0])
11945 
11946 typedef struct ecounters_eventmsgs_ext {
11947     uint8 version;
11948     uint8 len;
11949     uint8 mask[1];
11950 } ecounters_eventmsgs_ext_t;
11951 
11952 typedef struct ecounters_trigger_config {
11953     uint16 version;        /* version */
11954     uint16 set;        /* set where data should go */
11955     uint16 rsvd;        /* reserved */
11956     uint16 pad;        /* pad/reserved */
11957     uint16 ntypes;        /* number of types/tags */
11958     uint16 type[1];        /* list of types */
11959 } ecounters_trigger_config_t;
11960 
11961 #define ECOUNTERS_TRIGGER_REASON_VERSION_1    1
11962 /* Triggered due to timer based ecounters */
11963 #define ECOUNTERS_TRIGGER_REASON_TIMER        0
11964 /* Triggered due to event based configuration */
11965 #define ECOUNTERS_TRIGGER_REASON_EVENTS        1
11966 #define ECOUNTERS_TRIGGER_REASON_MAX        1
11967 
11968 typedef struct ecounters_trigger_reason {
11969     uint16 version;            /* version */
11970     uint16 trigger_reason;        /* trigger reason */
11971     uint32 sub_reason_code;        /* sub reason code */
11972     uint32 trigger_time_now;    /* time in ms  at trigger */
11973     uint32 host_ref_time;        /* host ref time */
11974 } ecounters_trigger_reason_t;
11975 
11976 #define WL_LQM_VERSION_1 1
11977 
11978 /* For wl_lqm_t flags field */
11979 #define WL_LQM_CURRENT_BSS_VALID 0x1
11980 #define WL_LQM_TARGET_BSS_VALID 0x2
11981 
11982 typedef struct {
11983     struct ether_addr BSSID;
11984     chanspec_t chanspec;
11985     int32 rssi;
11986     int32 snr;
11987 } wl_rx_signal_metric_t;
11988 
11989 typedef struct {
11990     uint8 version;
11991     uint8 flags;
11992     uint16 pad;
11993     int32 noise_level; /* current noise level */
11994     wl_rx_signal_metric_t current_bss;
11995     wl_rx_signal_metric_t target_bss;
11996 } wl_lqm_t;
11997 
11998 /* ##### Ecounters v2 section ##### */
11999 
12000 #define ECOUNTERS_VERSION_2    2
12001 
12002 /* Enumeration of various ecounters request types. This namespace is different from
12003  * global reportable stats namespace.
12004 */
12005 enum {
12006     WL_ECOUNTERS_XTLV_REPORT_REQ = 1
12007 };
12008 
12009 /* Input structure for ecounters IOVAR */
12010 typedef struct ecounters_config_request_v2 {
12011     uint16 version;        /* config version */
12012     uint16 len;        /* Length of this struct including variable len */
12013     uint16 logset;        /* Set where data will go. */
12014     uint16 reporting_period;    /* reporting_period */
12015     uint16 num_reports;    /* Number of timer expirations to report on */
12016     uint8 pad[2];        /* Reserved for future use */
12017     uint8 ecounters_xtlvs[];    /* Statistics Types (tags) to retrieve. */
12018 } ecounters_config_request_v2_t;
12019 
12020 #define ECOUNTERS_STATS_TYPES_FLAG_SLICE    0x1
12021 #define ECOUNTERS_STATS_TYPES_FLAG_IFACE    0x2
12022 #define ECOUNTERS_STATS_TYPES_FLAG_GLOBAL    0x4
12023 
12024 /* Slice mask bits */
12025 #define ECOUNTERS_STATS_TYPES_SLICE_MASK_SLICE0    0x1
12026 #define ECOUNTERS_STATS_TYPES_SLICE_MASK_SLICE1    0x2
12027 
12028 typedef struct ecounters_stats_types_report_req {
12029     /* flags: bit0 = slice, bit1 = iface, bit2 = global,
12030      * rest reserved
12031      */
12032     uint16 flags;
12033     uint16 if_index;    /* host interface index */
12034     uint16 slice_mask;    /* bit0 = slice0, bit1=slice1, rest reserved */
12035     uint8 pad[2];    /* padding */
12036     uint8 stats_types_req[]; /* XTLVs of requested types */
12037 } ecounters_stats_types_report_req_t;
12038 
12039 /* -------------- dynamic BTCOEX --------------- */
12040 #define DCTL_TROWS    2            /**< currently practical number of rows  */
12041 #define DCTL_TROWS_MAX    4            /**<  2 extra rows RFU */
12042 /* DYNCTL profile flags */
12043 #define DCTL_FLAGS_DISABLED    0        /**< default value: all features disabled */
12044 #define DCTL_FLAGS_DYNCTL    (1 << 0)    /**<  1 - enabled, 0 - legacy only */
12045 #define DCTL_FLAGS_DESENSE    (1 << 1)    /**< auto desense is enabled */
12046 #define DCTL_FLAGS_MSWITCH    (1 << 2)    /**< mode switching is enabled */
12047 #define DCTL_FLAGS_PWRCTRL    (1 << 3)    /**< Tx power control is enabled */
12048 /* for now AGG on/off is handled separately  */
12049 #define DCTL_FLAGS_TX_AGG_OFF    (1 << 4)    /**< TBD: allow TX agg Off */
12050 #define DCTL_FLAGS_RX_AGG_OFF    (1 << 5)    /**< TBD: allow RX agg Off */
12051 /* used for dry run testing only */
12052 #define DCTL_FLAGS_DRYRUN    (1 << 7)    /**< Enables dynctl dry run mode  */
12053 #define IS_DYNCTL_ON(prof)    ((prof->flags & DCTL_FLAGS_DYNCTL) != 0)
12054 #define IS_DESENSE_ON(prof)    ((prof->flags & DCTL_FLAGS_DESENSE) != 0)
12055 #define IS_MSWITCH_ON(prof)    ((prof->flags & DCTL_FLAGS_MSWITCH) != 0)
12056 #define IS_PWRCTRL_ON(prof)    ((prof->flags & DCTL_FLAGS_PWRCTRL) != 0)
12057 /* desense level currently in use */
12058 #define DESENSE_OFF    0
12059 #define DFLT_DESENSE_MID    12
12060 #define DFLT_DESENSE_HIGH    2
12061 
12062 /**
12063  * dynctl data points(a set of btpwr & wlrssi thresholds)
12064  * for mode & desense switching
12065  */
12066 typedef struct btc_thr_data {
12067     int8    mode;    /**< used by desense sw */
12068     int8    bt_pwr;    /**< BT tx power threshold */
12069     int8    bt_rssi;    /**< BT rssi threshold */
12070     /* wl rssi range when mode or desense change may be needed */
12071     int8    wl_rssi_high;
12072     int8    wl_rssi_low;
12073 } btc_thr_data_t;
12074 
12075 /* dynctl. profile data structure  */
12076 #define DCTL_PROFILE_VER 0x01
12077 #include <packed_section_start.h>
12078 typedef BWL_PRE_PACKED_STRUCT struct  dctl_prof {
12079     uint8 version;  /**< dynctl profile version */
12080     /* dynctl profile flags bit:0 - dynctl On, bit:1 dsns On, bit:2 mode sw On, */
12081     uint8 flags;  /**< bit[6:3] reserved, bit7 - Dryrun (sim) - On */
12082     /**  wl desense levels to apply */
12083     uint8    dflt_dsns_level;
12084     uint8    low_dsns_level;
12085     uint8    mid_dsns_level;
12086     uint8    high_dsns_level;
12087     /** mode switching hysteresis in dBm */
12088     int8    msw_btrssi_hyster;
12089     /** default btcoex mode */
12090     uint8    default_btc_mode;
12091     /** num of active rows in mode switching table */
12092     uint8    msw_rows;
12093     /** num of rows in desense table */
12094     uint8    dsns_rows;
12095     /** dynctl mode switching data table  */
12096     btc_thr_data_t msw_data[DCTL_TROWS_MAX];
12097     /** dynctl desense switching data table */
12098     btc_thr_data_t dsns_data[DCTL_TROWS_MAX];
12099 } BWL_POST_PACKED_STRUCT dctl_prof_t;
12100 #include <packed_section_end.h>
12101 
12102 /**  dynctl status info */
12103 #include <packed_section_start.h>
12104 typedef BWL_PRE_PACKED_STRUCT struct  dynctl_status {
12105     uint8 sim_on;    /**< true if simulation is On */
12106     uint16    bt_pwr_shm; /**< BT per/task power as read from ucode  */
12107     int8    bt_pwr;        /**< BT pwr extracted & converted to dBm */
12108     int8    bt_rssi;    /**< BT rssi in dBm */
12109     int8    wl_rssi;    /**< last wl rssi reading used by btcoex */
12110     uint8    dsns_level; /**< current desense level */
12111     uint8    btc_mode;   /**< current btcoex mode */
12112     /* add more status items if needed,  pad to 4 BB if needed */
12113 } BWL_POST_PACKED_STRUCT dynctl_status_t;
12114 #include <packed_section_end.h>
12115 
12116 /**  dynctl simulation (dryrun data) */
12117 #include <packed_section_start.h>
12118 typedef BWL_PRE_PACKED_STRUCT struct  dynctl_sim {
12119     uint8 sim_on;    /**< simulation mode on/off */
12120     int8 btpwr;        /**< simulated BT power in dBm */
12121     int8 btrssi;    /**< simulated BT rssi in dBm */
12122     int8 wlrssi;    /**< simulated WL rssi in dBm */
12123 } BWL_POST_PACKED_STRUCT dynctl_sim_t;
12124 /* no default structure packing */
12125 #include <packed_section_end.h>
12126 
12127 /** PTK key maintained per SCB */
12128 #define RSN_TEMP_ENCR_KEY_LEN 16
12129 typedef struct wpa_ptk {
12130     uint8 kck[RSN_KCK_LENGTH]; /**< EAPOL-Key Key Confirmation Key (KCK) */
12131     uint8 kek[RSN_KEK_LENGTH]; /**< EAPOL-Key Key Encryption Key (KEK) */
12132     uint8 tk1[RSN_TEMP_ENCR_KEY_LEN]; /**< Temporal Key 1 (TK1) */
12133     uint8 tk2[RSN_TEMP_ENCR_KEY_LEN]; /**< Temporal Key 2 (TK2) */
12134 } wpa_ptk_t;
12135 
12136 /** GTK key maintained per SCB */
12137 typedef struct wpa_gtk {
12138     uint32 idx;
12139     uint32 key_len;
12140     uint8  key[DOT11_MAX_KEY_SIZE];
12141 } wpa_gtk_t;
12142 
12143 /** FBT Auth Response Data structure */
12144 typedef struct wlc_fbt_auth_resp {
12145     uint8 macaddr[ETHER_ADDR_LEN]; /**< station mac address */
12146     uint8 pad[2];
12147     uint8 pmk_r1_name[WPA2_PMKID_LEN];
12148     wpa_ptk_t ptk; /**< pairwise key */
12149     wpa_gtk_t gtk; /**< group key */
12150     uint32 ie_len;
12151     uint8 status;  /**< Status of parsing FBT authentication
12152                     Request in application
12153                     */
12154     uint8 ies[1]; /**< IEs contains MDIE, RSNIE,
12155                     FBTIE (ANonce, SNonce,R0KH-ID, R1KH-ID)
12156                     */
12157 } wlc_fbt_auth_resp_t;
12158 
12159 /** FBT Action Response frame */
12160 typedef struct wlc_fbt_action_resp {
12161     uint16 version; /**< structure version */
12162     uint16 length; /**< length of structure */
12163     uint8 macaddr[ETHER_ADDR_LEN]; /**< station mac address */
12164     uint8 data_len;  /**< len of ie from Category */
12165     uint8 data[1]; /**< data contains category, action, sta address, target ap,
12166                         status code,fbt response frame body
12167                         */
12168 } wlc_fbt_action_resp_t;
12169 
12170 #define MACDBG_PMAC_ADDR_INPUT_MAXNUM 16
12171 #define MACDBG_PMAC_OBJ_TYPE_LEN 8
12172 
12173 typedef struct _wl_macdbg_pmac_param_t {
12174     char type[MACDBG_PMAC_OBJ_TYPE_LEN];
12175     uint8 step;
12176     uint8 w_en;
12177     uint16 num;
12178     uint32 bitmap;
12179     uint8 addr_raw;
12180     uint8 addr_num;
12181     uint16 addr[MACDBG_PMAC_ADDR_INPUT_MAXNUM];
12182     uint8 pad0[2];
12183     uint32 w_val;
12184 } wl_macdbg_pmac_param_t;
12185 
12186 /** IOVAR 'svmp_sampcol' parameter. Used to set and read SVMP_SAMPLE_COLLECT's setting */
12187 typedef struct wl_svmp_sampcol_param {
12188     uint32 version;           /* version */
12189     uint8  enable;
12190     uint8  trigger_mode;      /* SVMP_SAMPCOL_TRIGGER */
12191     uint8  trigger_mode_s[2]; /* SVMP_SAMPCOL_PKTPROC */
12192     uint8  data_samplerate;   /* SVMP_SAMPCOL_SAMPLERATE */
12193     uint8  data_sel_phy1;     /* SVMP_SAMPCOL_PHY1MUX */
12194     uint8  data_sel_rx1;      /* SVMP_SAMPCOL_RX1MUX without iqCompOut */
12195     uint8  data_sel_dualcap;  /* SVMP_SAMPCOL_RX1MUX */
12196     uint8  pack_mode;         /* SVMP_SAMPCOL_PACK */
12197     uint8  pack_order;
12198     uint8  pack_cfix_fmt;
12199     uint8  pack_1core_sel;
12200     uint16 waitcnt;
12201     uint16 caplen;
12202     uint32 buff_addr_start;   /* in word-size (2-bytes) */
12203     uint32 buff_addr_end;     /* note: Tcl in byte-size, HW in vector-size (8-bytes) */
12204     uint8  int2vasip;
12205     uint8  PAD;
12206     uint16 status;
12207 } wl_svmp_sampcol_t;
12208 
12209 #define WL_SVMP_SAMPCOL_PARAMS_VERSION    1
12210 
12211 enum {
12212     SVMP_SAMPCOL_TRIGGER_PKTPROC_TRANSITION = 0,
12213     SVMP_SAMPCOL_TRIGGER_FORCE_IMMEDIATE,
12214     SVMP_SAMPCOL_TRIGGER_RADAR_DET
12215 };
12216 
12217 enum {
12218     SVMP_SAMPCOL_PHY1MUX_GPIOOUT = 0,
12219     SVMP_SAMPCOL_PHY1MUX_FFT,
12220     SVMP_SAMPCOL_PHY1MUX_DBGHX,
12221     SVMP_SAMPCOL_PHY1MUX_RX1MUX
12222 };
12223 
12224 enum {
12225     SVMP_SAMPCOL_RX1MUX_FARROWOUT = 4,
12226     SVMP_SAMPCOL_RX1MUX_IQCOMPOUT,
12227     SVMP_SAMPCOL_RX1MUX_DCFILTEROUT,
12228     SVMP_SAMPCOL_RX1MUX_RXFILTEROUT,
12229     SVMP_SAMPCOL_RX1MUX_ACIFILTEROUT
12230 };
12231 
12232 enum {
12233     SVMP_SAMPCOL_SAMPLERATE_1XBW = 0,
12234     SVMP_SAMPCOL_SAMPLERATE_2XBW
12235 };
12236 
12237 enum {
12238     SVMP_SAMPCOL_PACK_DUALCAP = 0,
12239     SVMP_SAMPCOL_PACK_4CORE,
12240     SVMP_SAMPCOL_PACK_2CORE,
12241     SVMP_SAMPCOL_PACK_1CORE
12242 };
12243 
12244 enum {
12245     SVMP_SAMPCOL_PKTPROC_RESET = 0,
12246     SVMP_SAMPCOL_PKTPROC_CARRIER_SEARCH,
12247     SVMP_SAMPCOL_PKTPROC_WAIT_FOR_NB_PWR,
12248     SVMP_SAMPCOL_PKTPROC_WAIT_FOR_W1_PWR,
12249     SVMP_SAMPCOL_PKTPROC_WAIT_FOR_W2_PWR,
12250     SVMP_SAMPCOL_PKTPROC_OFDM_PHY,
12251     SVMP_SAMPCOL_PKTPROC_TIMING_SEARCH,
12252     SVMP_SAMPCOL_PKTPROC_CHAN_EST_1,
12253     SVMP_SAMPCOL_PKTPROC_LEG_SIG_DEC,
12254     SVMP_SAMPCOL_PKTPROC_SIG_DECODE_1,
12255     SVMP_SAMPCOL_PKTPROC_SIG_DECODE_2,
12256     SVMP_SAMPCOL_PKTPROC_HT_AGC,
12257     SVMP_SAMPCOL_PKTPROC_CHAN_EST_2,
12258     SVMP_SAMPCOL_PKTPROC_PAY_DECODE,
12259     SVMP_SAMPCOL_PKTPROC_DSSS_CCK_PHY,
12260     SVMP_SAMPCOL_PKTPROC_WAIT_ENERGY_DROP,
12261     SVMP_SAMPCOL_PKTPROC_WAIT_NCLKS,
12262     SVMP_SAMPCOL_PKTPROC_PAY_DEC_EXT,
12263     SVMP_SAMPCOL_PKTPROC_SIG_FAIL_DELAY,
12264     SVMP_SAMPCOL_PKTPROC_RIFS_SEARCH,
12265     SVMP_SAMPCOL_PKTPROC_BOARD_SWITCH_DIV_SEARCH,
12266     SVMP_SAMPCOL_PKTPROC_DSSS_CCK_BOARD_SWITCH_DIV_SEARCH,
12267     SVMP_SAMPCOL_PKTPROC_CHAN_EST_3,
12268     SVMP_SAMPCOL_PKTPROC_CHAN_EST_4,
12269     SVMP_SAMPCOL_PKTPROC_FINE_TIMING_SEARCH,
12270     SVMP_SAMPCOL_PKTPROC_SET_CLIP_GAIN,
12271     SVMP_SAMPCOL_PKTPROC_NAP,
12272     SVMP_SAMPCOL_PKTPROC_VHT_SIGA_DEC,
12273     SVMP_SAMPCOL_PKTPROC_VHT_SIGB_DEC,
12274     SVMP_SAMPCOL_PKTPROC_PKT_ABORT,
12275     SVMP_SAMPCOL_PKTPROC_DCCAL
12276 };
12277 
12278 /** IOVAR 'svmp_mem' parameter. Used to read/clear svmp memory */
12279 typedef struct svmp_mem {
12280     uint32 addr;    /**< offset to read svmp memory from vasip base address */
12281     uint16 len;    /**< length in count of uint16's */
12282     uint16 val;    /**< set the range of addr/len with a value */
12283 } svmp_mem_t;
12284 
12285 /** IOVAR 'mu_rate' parameter. read/set mu rate for upto four users */
12286 #define MU_RATE_CFG_VERSION    1
12287 typedef struct mu_rate {
12288     uint16    version;    /**< version of the structure as defined by MU_RATE_CFG_VERSION */
12289     uint16    length;        /**< length of entire structure */
12290     uint8    auto_rate;    /**< enable/disable auto rate */
12291     uint8    PAD;
12292     uint16    rate_user[4];    /**< rate per each of four users, set to -1 for no change */
12293 } mu_rate_t;
12294 
12295 /** IOVAR 'mu_group' parameter. Used to set and read MU group recommendation setting */
12296 #define WL_MU_GROUP_AUTO_COMMAND      -1
12297 #define WL_MU_GROUP_PARAMS_VERSION     3
12298 #define WL_MU_GROUP_METHOD_NAMELEN    64
12299 #define WL_MU_GROUP_NGROUP_MAX        15
12300 #define WL_MU_GROUP_NUSER_MAX          4
12301 #define WL_MU_GROUP_METHOD_MIN         0
12302 #define WL_MU_GROUP_NUMBER_AUTO_MIN    1
12303 #define WL_MU_GROUP_NUMBER_AUTO_MAX   15
12304 #define WL_MU_GROUP_NUMBER_FORCED_MAX  8
12305 #define WL_MU_GROUP_METHOD_OLD         0
12306 #define WL_MU_GROUP_MODE_AUTO          0
12307 #define WL_MU_GROUP_MODE_FORCED        1
12308 #define WL_MU_GROUP_FORCED_1GROUP      1
12309 #define WL_MU_GROUP_ENTRY_EMPTY       -1
12310 typedef struct mu_group {
12311     uint32 version;          /* version */
12312     int16  forced;           /* forced group recommendation */
12313     int16  forced_group_mcs; /* forced group with mcs */
12314     int16  forced_group_num; /* forced group number */
12315     int16  group_option[WL_MU_GROUP_NGROUP_MAX][WL_MU_GROUP_NUSER_MAX];
12316                              /* set mode for forced grouping and read mode for auto grouping */
12317     int16  group_GID[WL_MU_GROUP_NGROUP_MAX];
12318     int16  group_method;     /* methof for VASIP group recommendation */
12319     int16  group_number;     /* requested number for VASIP group recommendation */
12320     int16  auto_group_num;   /* exact number from VASIP group recommendation */
12321     int8   group_method_name[WL_MU_GROUP_METHOD_NAMELEN];
12322     uint8  PAD[2];
12323 } mu_group_t;
12324 
12325 typedef struct mupkteng_sta {
12326     struct ether_addr ea;
12327     uint8  PAD[2];
12328     int32 nrxchain;
12329     int32 idx;
12330 } mupkteng_sta_t;
12331 
12332 typedef struct mupkteng_client {
12333     int32 rspec;
12334     int32 idx;
12335     int32 flen;
12336     int32 nframes;
12337 } mupkteng_client_t;
12338 
12339 typedef struct mupkteng_tx {
12340     mupkteng_client_t client[8];
12341     int32 nclients;
12342     int32 ntx;
12343 } mupkteng_tx_t;
12344 
12345 /*
12346  * MU Packet engine interface.
12347  * The following two definitions will go into
12348  * wlioctl_defs.h
12349  * when wl utility changes are merged to EAGLE TOB & Trunk
12350  */
12351 
12352 #define WL_MUPKTENG_PER_TX_START        0x10
12353 #define WL_MUPKTENG_PER_TX_STOP                0x20
12354 
12355 /** IOVAR 'mu_policy' parameter. Used to configure MU admission control policies */
12356 #define WL_MU_POLICY_PARAMS_VERSION     1
12357 #define WL_MU_POLICY_SCHED_DEFAULT    60
12358 #define WL_MU_POLICY_DISABLED        0
12359 #define WL_MU_POLICY_ENABLED        1
12360 #define WL_MU_POLICY_NRX_MIN        1
12361 #define WL_MU_POLICY_NRX_MAX        2
12362 typedef struct mu_policy {
12363     uint16 version;
12364     uint16 length;
12365     uint32 sched_timer;
12366     uint32 pfmon;
12367     uint32 pfmon_gpos;
12368     uint32 samebw;
12369     uint32 nrx;
12370     uint32 max_muclients;
12371 } mu_policy_t;
12372 
12373 #define WL_NAN_BAND_STR_SIZE 5       /* sizeof ("auto") */
12374 
12375 /** Definitions of different NAN Bands */
12376 /* do not change the order */
12377 enum {
12378         NAN_BAND_B = 0,
12379         NAN_BAND_A,
12380         NAN_BAND_AUTO,
12381         NAN_BAND_INVALID = 0xFF
12382 };
12383 
12384 /* ifdef WL11ULB */
12385 /* ULB Mode configured via "ulb_mode" IOVAR */
12386 enum {
12387     ULB_MODE_DISABLED = 0,
12388     ULB_MODE_STD_ALONE_MODE = 1,    /* Standalone ULB Mode */
12389     ULB_MODE_DYN_MODE = 2,      /* Dynamic ULB Mode */
12390     /* Add all other enums before this */
12391     MAX_SUPP_ULB_MODES
12392 };
12393 
12394 /* ULB BWs configured via "ulb_bw" IOVAR during Standalone Mode Only.
12395  * Values of this enumeration are also used to specify 'Current Operational Bandwidth'
12396  * and 'Primary Operational Bandwidth' sub-fields in 'ULB Operations' field (used in
12397  * 'ULB Operations' Attribute or 'ULB Mode Switch' Attribute)
12398  */
12399 typedef enum {
12400     ULB_BW_DISABLED = 0,
12401     ULB_BW_10MHZ    = 1,    /* Standalone ULB BW in 10 MHz BW */
12402     ULB_BW_5MHZ = 2,    /* Standalone ULB BW in 5 MHz BW */
12403     ULB_BW_2P5MHZ   = 3,    /* Standalone ULB BW in 2.5 MHz BW */
12404     /* Add all other enums before this */
12405     MAX_SUPP_ULB_BW
12406 } ulb_bw_type_t;
12407 /* endif WL11ULB */
12408 
12409 
12410 #define WL_MESH_IOCTL_VERSION     1
12411 #define MESH_IOC_BUFSZ            512 /* sufficient ioc buff size for mesh */
12412 /* container for mesh iovtls & events */
12413 typedef struct wl_mesh_ioc {
12414     uint16  version;        /* interface command or event version */
12415     uint16  id;             /* mesh ioctl cmd  ID  */
12416     uint16  len;            /* total length of all tlv records in data[]  */
12417     uint16  pad;            /* pad to be 32 bit aligment */
12418     uint8   data[];       /* var len payload of bcm_xtlv_t type */
12419 } wl_mesh_ioc_t;
12420 
12421 enum wl_mesh_cmds {
12422     WL_MESH_CMD_ENABLE = 1,
12423     WL_MESH_CMD_JOIN = 2,
12424     WL_MESH_CMD_PEER_STATUS = 3,
12425     WL_MESH_CMD_ADD_ROUTE = 4,
12426     WL_MESH_CMD_DEL_ROUTE = 5,
12427     WL_MESH_CMD_ADD_FILTER = 6,
12428     WL_MESH_CMD_ENAB_AL_METRIC = 7
12429 };
12430 
12431 enum wl_mesh_cmd_xtlv_id {
12432     WL_MESH_XTLV_ENABLE = 1,
12433     WL_MESH_XTLV_JOIN = 2,
12434     WL_MESH_XTLV_STATUS = 3,
12435     WL_MESH_XTLV_ADD_ROUTE = 4,
12436     WL_MESH_XTLV_DEL_ROUTE = 5,
12437     WL_MESH_XTLV_ADD_FILTER = 6,
12438     WL_MESH_XTLV_ENAB_AIRLINK = 7
12439 };
12440 /* endif WLMESH */
12441 
12442 #ifdef WLMESH
12443 #ifndef SAE_MAX_PASSWD_LEN
12444 #define SAE_MAX_PASSWD_LEN    32
12445 #endif
12446 #endif
12447 
12448 /* Fast BSS Transition parameter configuration */
12449 #define FBT_PARAM_CURRENT_VERSION 0
12450 
12451 typedef struct _wl_fbt_params {
12452     uint16    version;        /* version of the structure
12453                     * as defined by FBT_PARAM_CURRENT_VERSION
12454                     */
12455     uint16    length;            /* length of the entire structure */
12456 
12457     uint16 param_type;        /* type of parameter defined below */
12458     uint16 param_len;        /* length of the param_value */
12459     uint8 param_value[1];        /* variable length */
12460 } wl_fbt_params_t;
12461 
12462 #define WL_FBT_PARAM_TYPE_RSNIE            0
12463 #define WL_FBT_PARAM_TYPE_FTIE            0x1
12464 #define WL_FBT_PARAM_TYPE_SNONCE        0x2
12465 #define WL_FBT_PARAM_TYPE_MDE            0x3
12466 #define WL_FBT_PARAM_TYPE_PMK_R0_NAME        0x4
12467 #define WL_FBT_PARAM_TYPE_R0_KHID        0x5
12468 #define WL_FBT_PARAM_TYPE_R1_KHID        0x6
12469 #define WL_FBT_PARAM_TYPE_FIRST_INVALID        0x7
12470 
12471 /* Assoc Mgr commands for fine control of assoc */
12472 #define WL_ASSOC_MGR_CURRENT_VERSION  0x0
12473 
12474 typedef struct {
12475     uint16    version;        /* version of the structure as
12476                      * defined by WL_ASSOC_MGR_CURRENT_VERSION
12477                      */
12478     uint16    length;            /* length of the entire structure */
12479 
12480     uint16 cmd;
12481     uint16 params;
12482 } wl_assoc_mgr_cmd_t;
12483 
12484 #define WL_ASSOC_MGR_CMD_PAUSE_ON_EVT        0 /* have assoc pause on certain events */
12485 #define WL_ASSOC_MGR_CMD_ABORT_ASSOC        1
12486 
12487 #define WL_ASSOC_MGR_PARAMS_EVENT_NONE            0 /* use this to resume as well as clear */
12488 #define WL_ASSOC_MGR_PARAMS_PAUSE_EVENT_AUTH_RESP    1
12489 
12490 #define WL_WINVER_STRUCT_VER_1 (1)
12491 
12492 typedef struct wl_winver {
12493     /* Version and length of this structure. Length includes all fields in wl_winver_t */
12494     uint16 struct_version;
12495     uint16 struct_length;
12496 
12497     /* Windows operating system version info (Microsoft provided) */
12498     struct {
12499         uint32 major_ver;
12500         uint32 minor_ver;
12501         uint32 build;
12502     } os_runtime;
12503 
12504     /* NDIS runtime version (Microsoft provided) */
12505     struct {
12506         uint16 major_ver;
12507         uint16 minor_ver;
12508     } ndis_runtime;
12509 
12510     /* NDIS Driver version (Broadcom provided) */
12511     struct {
12512         uint16 major_ver;
12513         uint16 minor_ver;
12514     } ndis_driver;
12515 
12516     /* WDI Upper Edge (UE) Driver version (Microsoft provided) */
12517     struct {
12518         uint8 major_ver;
12519         uint8 minor_ver;
12520         uint8 suffix;
12521     } wdi_ue;
12522 
12523     /* WDI Lower Edge (LE) Driver version (Broadcom provided) */
12524     struct {
12525         uint8 major_ver;
12526         uint8 minor_ver;
12527         uint8 suffix;
12528     } wdi_le;
12529     uint8 PAD[2];
12530 } wl_winver_t;
12531 
12532 /* defined(WLRCC) || defined(ROAM_CHANNEL_CACHE) */
12533 #define MAX_ROAM_CHANNEL      20
12534 typedef struct {
12535     int32 n;
12536     chanspec_t channels[MAX_ROAM_CHANNEL];
12537 } wl_roam_channel_list_t;
12538 /* endif RCC || ROAM_CHANNEL_CACHE */
12539 
12540 /* values for IOV_MFP arg */
12541 enum {
12542     WL_MFP_NONE = 0,
12543     WL_MFP_CAPABLE,
12544     WL_MFP_REQUIRED
12545 };
12546 
12547 typedef enum {
12548     CHANSW_UNKNOWN = 0,    /* channel switch due to unknown reason */
12549     CHANSW_SCAN = 1,    /* channel switch due to scan */
12550     CHANSW_PHYCAL = 2,    /* channel switch due to phy calibration */
12551     CHANSW_INIT = 3,    /* channel set at WLC up time */
12552     CHANSW_ASSOC = 4,    /* channel switch due to association */
12553     CHANSW_ROAM = 5,    /* channel switch due to roam */
12554     CHANSW_MCHAN = 6,    /* channel switch triggered by mchan module */
12555     CHANSW_IOVAR = 7,    /* channel switch due to IOVAR */
12556     CHANSW_CSA_DFS = 8,    /* channel switch due to chan switch  announcement from AP */
12557     CHANSW_APCS = 9,    /* Channel switch from AP channel select module */
12558     CHANSW_AWDL = 10,    /* channel switch due to AWDL */
12559     CHANSW_FBT = 11,    /* Channel switch from FBT module for action frame response */
12560     CHANSW_UPDBW = 12,    /* channel switch at update bandwidth */
12561     CHANSW_ULB = 13,    /* channel switch at ULB */
12562     CHANSW_LAST = 14    /* last channel switch reason */
12563 } chansw_reason_t;
12564 
12565 /*
12566  * WOWL unassociated mode power svae pattern.
12567  */
12568 typedef struct wowl_radio_duty_cycle {
12569     uint16 wake_interval;
12570     uint16  sleep_interval;
12571 } wowl_radio_duty_cycle_t;
12572 
12573 typedef struct nd_ra_ol_limits {
12574     uint16 version;         /* version of the iovar buffer */
12575     uint16 type;            /* type of data provided */
12576     uint16 length;          /* length of the entire structure */
12577     uint16 pad1;            /* pad union to 4 byte boundary */
12578     union {
12579         struct {
12580             uint16 min_time;         /* seconds, min time for RA offload hold */
12581             uint16 lifetime_percent;
12582             /* percent, lifetime percentage for offload hold time */
12583         } lifetime_relative;
12584         struct {
12585             uint16 hold_time;        /* seconds, RA offload hold time */
12586             uint16 pad2;             /* unused */
12587         } fixed;
12588     } limits;
12589 } nd_ra_ol_limits_t;
12590 
12591 #define ND_RA_OL_LIMITS_VER 1
12592 
12593 /* nd_ra_ol_limits sub-types */
12594 #define ND_RA_OL_LIMITS_REL_TYPE   0     /* relative, percent of RA lifetime */
12595 #define ND_RA_OL_LIMITS_FIXED_TYPE 1     /* fixed time */
12596 
12597 /* buffer lengths for the different nd_ra_ol_limits types */
12598 #define ND_RA_OL_LIMITS_REL_TYPE_LEN   12
12599 #define ND_RA_OL_LIMITS_FIXED_TYPE_LEN  10
12600 
12601 /*
12602  * Temperature Throttling control mode
12603  */
12604 typedef struct wl_temp_control {
12605     uint8 enable;
12606     uint8 PAD;
12607     uint16 control_bit;
12608 } wl_temp_control_t;
12609 
12610 /* SensorHub Interworking mode */
12611 
12612 #define SHUB_CONTROL_VERSION    1
12613 #define SHUB_CONTROL_LEN    12
12614 
12615 typedef struct {
12616     uint16  verison;
12617     uint16  length;
12618     uint16  cmd;
12619     uint16  op_mode;
12620     uint16  interval;
12621     uint16  enable;
12622 } shub_control_t;
12623 
12624 /* WLC_MAJOR_VER <= 5 */
12625 /* Data structures for non-TLV format */
12626 
12627 /* Data structures for rsdb caps */
12628 /*
12629  * The flags field of the rsdb_caps_response is designed to be
12630  * a Bit Mask. As of now only Bit 0 is used as mentioned below.
12631  */
12632 
12633 /* Bit-0 in flags is used to indicate if the cores can operate synchronously
12634 * i.e either as 2x2 MIMO or 2(1x1 SISO). This is true only for 4349 variants
12635 * 0 - device can operate only in rsdb mode (eg: 4364)
12636 * 1 - device can operate in both rsdb and mimo (eg : 4359 variants)
12637 */
12638 
12639 #define WL_RSDB_CAPS_VER 2
12640 #define SYNCHRONOUS_OPERATION_TRUE    (1 << 0)
12641 #define WL_RSDB_CAPS_FIXED_LEN  OFFSETOF(rsdb_caps_response_t, num_chains)
12642 
12643 typedef struct rsdb_caps_response {
12644     uint8 ver;        /* Version */
12645     uint8 len;        /* length of this structure excluding ver and len */
12646     uint8 rsdb;        /* TRUE for rsdb chip */
12647     uint8 num_of_cores;    /* no of d11 cores */
12648     uint16 flags;        /* Flags to indicate various capabilities */
12649     uint8 num_chains[1];    /* Tx/Rx chains for each core */
12650 } rsdb_caps_response_t;
12651 
12652 /* Data structures for rsdb bands */
12653 
12654 #define WL_RSDB_BANDS_VER       2
12655 #define WL_RSDB_BANDS_FIXED_LEN  OFFSETOF(rsdb_bands_t, band)
12656 
12657 typedef struct rsdb_bands
12658 {
12659     uint8 ver;
12660     uint8 len;
12661     uint16 num_cores;    /* num of D11 cores */
12662     int16 band[1];        /* The band operating on each of the d11 cores */
12663 } rsdb_bands_t;
12664 
12665 /* rsdb config */
12666 
12667 #define WL_RSDB_CONFIG_VER 3
12668 #define ALLOW_SIB_PARALLEL_SCAN    (1 << 0)
12669 #define MAX_BANDS 2
12670 
12671 #define WL_RSDB_CONFIG_LEN sizeof(rsdb_config_t)
12672 
12673 
12674 typedef uint8 rsdb_opmode_t;
12675 typedef uint32 rsdb_flags_t;
12676 
12677 typedef enum rsdb_modes {
12678     WLC_SDB_MODE_NOSDB_MAIN = 1, /* 2X2 or MIMO mode (applicable only for 4355) */
12679     WLC_SDB_MODE_NOSDB_AUX = 2,
12680     WLC_SDB_MODE_SDB_MAIN = 3, /* This is RSDB mode(default) applicable only for 4364 */
12681     WLC_SDB_MODE_SDB_AUX = 4,
12682     WLC_SDB_MODE_SDB_AUTO = 5, /* Same as WLC_RSDB_MODE_RSDB(1+1) mode above */
12683 } rsdb_modes_t;
12684 
12685 typedef struct rsdb_config {
12686     uint8 ver;
12687     uint8 len;
12688     uint16 reserved;
12689     rsdb_opmode_t non_infra_mode;
12690     rsdb_opmode_t infra_mode[MAX_BANDS];
12691     rsdb_flags_t flags[MAX_BANDS];
12692     rsdb_opmode_t current_mode;   /* Valid only in GET, returns the current mode */
12693     uint8  pad[3];
12694 } rsdb_config_t;
12695 
12696 /* WLC_MAJOR_VER > =5 */
12697 /* TLV definitions and data structures for rsdb subcmds */
12698 
12699 enum wl_rsdb_cmd_ids {
12700     /* RSDB ioctls */
12701     WL_RSDB_CMD_VER = 0,
12702     WL_RSDB_CMD_CAPS = 1,
12703     WL_RSDB_CMD_BANDS = 2,
12704     WL_RSDB_CMD_CONFIG = 3,
12705     /* Add before this !! */
12706     WL_RSDB_CMD_LAST
12707 };
12708 #define WL_RSDB_IOV_VERSION    0x1
12709 
12710 typedef struct rsdb_caps_response_v1 {
12711     uint8 rsdb;        /* TRUE for rsdb chip */
12712     uint8 num_of_cores;    /* no of d11 cores */
12713     uint16 flags;        /* Flags to indicate various capabilities */
12714     uint8 num_chains[MAX_NUM_D11CORES];    /* Tx/Rx chains for each core */
12715     uint8 band_cap[MAX_NUM_D11CORES]; /* band cap bitmask per slice */
12716 } rsdb_caps_response_v1_t;
12717 
12718 typedef struct rsdb_bands_v1
12719 {
12720     uint8 num_cores;        /* num of D11 cores */
12721     uint8 pad;            /* padding bytes for 4 byte alignment */
12722     int8 band[MAX_NUM_D11CORES];    /* The band operating on each of the d11 cores */
12723 } rsdb_bands_v1_t;
12724 
12725 typedef struct rsdb_config_xtlv {
12726     rsdb_opmode_t reserved1;    /* Non_infra mode is no more applicable */
12727     rsdb_opmode_t infra_mode[MAX_BANDS]; /* Target mode for Infra association */
12728     uint8 pad;    /* pad bytes for 4 byte alignment */
12729     rsdb_flags_t  flags[MAX_BANDS];
12730     rsdb_opmode_t current_mode; /* GET only; has current mode of operation */
12731     uint8 pad1[3];
12732 } rsdb_config_xtlv_t;
12733 
12734 /* Definitions for slot_bss chanseq iovar */
12735 #define WL_SLOT_BSS_VERSION 1
12736 
12737 enum wl_slotted_bss_cmd_id {
12738     WL_SLOTTED_BSS_CMD_VER = 0,
12739     WL_SLOTTED_BSS_CMD_CHANSEQ = 1
12740 };
12741 typedef uint16 chan_seq_type_t;
12742 enum chan_seq_type {
12743     CHAN_SEQ_TYPE_AWDL = 1,
12744     CHAN_SEQ_TYPE_SLICE = 2,
12745     CHAN_SEQ_TYPE_NAN = 3
12746 };
12747 typedef uint8 sched_flag_t;
12748 enum sched_flag {
12749     NO_SDB_SCHED = 0x1,
12750     SDB_TDM_SCHED = 0x2,
12751     SDB_SPLIT_BAND_SCHED = 0x4, /* default mode for 4357 */
12752     MAIN_ONLY = 0x8,
12753     AUX_ONLY = 0x10,
12754     SDB_DUAL_TIME = (MAIN_ONLY | AUX_ONLY),
12755     NO_SDB_MAIN_ONLY = (NO_SDB_SCHED | MAIN_ONLY), /* default mode for 4364 */
12756     SDB_TDM_SCHED_MAIN = (SDB_TDM_SCHED | MAIN_ONLY),
12757     SDB_TDM_SCHED_AUX = (SDB_TDM_SCHED | AUX_ONLY),
12758     SDB_TDM_SCHED_DUAL_TIME = (SDB_TDM_SCHED | SDB_DUAL_TIME),
12759     SDB_SPLIT_BAND_SCHED_DUAL_TIME = (SDB_SPLIT_BAND_SCHED | SDB_DUAL_TIME)
12760 };
12761 
12762 typedef struct chan_seq_tlv_data {
12763     uint32 flags;
12764     uint8 data[1];
12765 } chan_seq_tlv_data_t;
12766 
12767 typedef struct chan_seq_tlv {
12768     chan_seq_type_t type;
12769     uint16 len;
12770     chan_seq_tlv_data_t chanseq_data[1];
12771 } chan_seq_tlv_t;
12772 
12773 typedef struct sb_channel_sequence {
12774     sched_flag_t sched_flags; /* (sdb-tdm or sdb-sb or Dual-Time) */
12775     uint8 num_seq; /* number of chan_seq_tlv following */
12776     uint16 pad;
12777     chan_seq_tlv_t seq[1];
12778 } sb_channel_sequence_t;
12779 
12780 typedef struct slice_chan_seq {
12781     uint8 slice_index;  /* 0(Main) or 1 (Aux) */
12782     uint8 num_chanspecs;
12783     uint16 pad;
12784     chanspec_t chanspecs[1];
12785 } slice_chan_seq_t;
12786 
12787 #define WL_SLICE_CHAN_SEQ_FIXED_LEN   OFFSETOF(slice_chan_seq_t, chanspecs)
12788 
12789 typedef struct sim_pm_params {
12790     uint32 enabled;
12791     uint16 cycle;
12792     uint16 up;
12793 } sim_pm_params_t;
12794 
12795 /* Bits for fw_status */
12796 #define NAP_DISABLED_HOST        0x01   /* Host has disabled through nap_enable */
12797 #define NAP_DISABLED_RSSI        0x02   /* Disabled because of nap_rssi_threshold */
12798 
12799 /* Bits for hw_status */
12800 #define NAP_HWCFG            0x01   /* State of NAP config bit in phy HW */
12801 
12802 /* ifdef WL_NATOE */
12803 #define WL_NATOE_IOCTL_VERSION        1
12804 #define WL_NATOE_IOC_BUFSZ        512    /* sufficient ioc buff size for natoe */
12805 #define WL_NATOE_DBG_STATS_BUFSZ    2048
12806 
12807 /* config natoe STA and AP IP's structure */
12808 typedef struct {
12809     uint32 sta_ip;
12810     uint32 sta_netmask;
12811     uint32 sta_router_ip;
12812     uint32 sta_dnsip;
12813     uint32 ap_ip;
12814     uint32 ap_netmask;
12815 } wl_natoe_config_ips_t;
12816 
12817 /* natoe ports config structure */
12818 typedef struct {
12819     uint16 start_port_num;
12820     uint16 no_of_ports;
12821 } wl_natoe_ports_config_t;
12822 
12823 /* natoe ports exception info */
12824 typedef struct {
12825     uint16 sta_port_num;
12826     uint16 dst_port_num;    /* for SIP type protocol, dst_port_num info can be ignored by FW */
12827     uint32 ip;              /* for SIP ip is APcli_ip and for port clash it is dst_ip */
12828     uint8  entry_type;      /* Create/Destroy */
12829     uint8  pad[3];
12830 } wl_natoe_exception_port_t;
12831 
12832 /* container for natoe ioctls & events */
12833 typedef struct wl_natoe_ioc {
12834     uint16  version;        /* interface command or event version */
12835     uint16  id;             /* natoe ioctl cmd  ID  */
12836     uint16  len;            /* total length of all tlv records in data[]  */
12837     uint16  pad;            /* pad to be 32 bit aligment */
12838     uint8   data[];       /* var len payload of bcm_xtlv_t type */
12839 } wl_natoe_ioc_t;
12840 
12841 enum wl_natoe_cmds {
12842     WL_NATOE_CMD_ENABLE = 1,
12843     WL_NATOE_CMD_CONFIG_IPS = 2,
12844     WL_NATOE_CMD_CONFIG_PORTS = 3,
12845     WL_NATOE_CMD_DBG_STATS = 4,
12846     WL_NATOE_CMD_EXCEPTION_PORT = 5,
12847     WL_NATOE_CMD_SKIP_PORT = 6,
12848     WL_NATOE_CMD_TBL_CNT = 7
12849 };
12850 
12851 enum wl_natoe_cmd_xtlv_id {
12852     WL_NATOE_XTLV_ENABLE = 1,
12853     WL_NATOE_XTLV_CONFIG_IPS = 2,
12854     WL_NATOE_XTLV_CONFIG_PORTS = 3,
12855     WL_NATOE_XTLV_DBG_STATS = 4,
12856     WL_NATOE_XTLV_EXCEPTION_PORT = 5,
12857     WL_NATOE_XTLV_SKIP_PORT = 6,
12858     WL_NATOE_XTLV_TBL_CNT = 7
12859 };
12860 
12861 /* endif WL_NATOE */
12862 
12863 enum wl_idauth_cmd_ids {
12864     WL_IDAUTH_CMD_CONFIG                = 1,
12865     WL_IDAUTH_CMD_PEER_INFO                = 2,
12866     WL_IDAUTH_CMD_COUNTERS                = 3,
12867     WL_IDAUTH_CMD_LAST
12868 };
12869 enum wl_idauth_xtlv_id {
12870     WL_IDAUTH_XTLV_AUTH_ENAB            = 0x1,
12871     WL_IDAUTH_XTLV_GTK_ROTATION            = 0x2,
12872     WL_IDAUTH_XTLV_EAPOL_COUNT            = 0x3,
12873     WL_IDAUTH_XTLV_EAPOL_INTRVL            = 0x4,
12874     WL_IDAUTH_XTLV_BLKLIST_COUNT            = 0x5,
12875     WL_IDAUTH_XTLV_BLKLIST_AGE            = 0x6,
12876     WL_IDAUTH_XTLV_PEERS_INFO            = 0x7,
12877     WL_IDAUTH_XTLV_COUNTERS                = 0x8
12878 };
12879 enum wl_idauth_stats {
12880     WL_AUTH_PEER_STATE_AUTHORISED            = 0x01,
12881     WL_AUTH_PEER_STATE_BLACKLISTED            = 0x02,
12882     WL_AUTH_PEER_STATE_4WAY_HS_ONGOING        = 0x03,
12883     WL_AUTH_PEER_STATE_LAST
12884 };
12885 typedef struct {
12886     uint16 state;                /* Peer State: Authorised or Blacklisted */
12887     struct ether_addr peer_addr;        /* peer Address */
12888     uint32 blklist_end_time;        /* Time of blacklist end */
12889 } auth_peer_t;
12890 typedef struct wl_idauth_counters {
12891     uint32 auth_reqs;            /* No of auth req recvd */
12892     uint32 mic_fail;            /* No of mic fails */
12893     uint32 four_way_hs_fail;        /* No of 4-way handshake fails */
12894 } wl_idauth_counters_t;
12895 
12896 #define WLC_UTRACE_LEN  512
12897 #define WLC_UTRACE_READ_END 0
12898 #define WLC_UTRACE_MORE_DATA 1
12899 typedef struct wl_utrace_capture_args_v1 {
12900     uint32 length;
12901     uint32 flag;
12902 } wl_utrace_capture_args_v1_t;
12903 
12904 #define UTRACE_CAPTURE_VER_2    2
12905 typedef struct wl_utrace_capture_args_v2 {
12906     /* structure control */
12907     uint16 version;        /**< structure version */
12908     uint16 length;        /**< length of the response */
12909     uint32 flag;        /* Indicates if there is more data or not */
12910 } wl_utrace_capture_args_v2_t;
12911 
12912 /* XTLV IDs for the Health Check "hc" iovar top level container */
12913 enum {
12914     WL_HC_XTLV_ID_CAT_HC = 1,        /* category for HC as a whole */
12915     WL_HC_XTLV_ID_CAT_DATAPATH_TX = 2,    /* Datapath Tx */
12916     WL_HC_XTLV_ID_CAT_DATAPATH_RX = 3,    /* Datapath Rx */
12917     WL_HC_XTLV_ID_CAT_SCAN    = 4,        /* Scan */
12918 };
12919 
12920 /* Health Check: Common XTLV IDs for sub-elements in the top level container
12921  * Number starts at 0x8000 to be out of the way for category specific IDs.
12922  */
12923 enum {
12924     WL_HC_XTLV_ID_ERR       = 0x8000,       /* for sub-command  err return */
12925     WL_HC_XTLV_ID_IDLIST    = 0x8001,       /* container for uint16 IDs */
12926 };
12927 
12928 /* Health Check: Datapath TX IDs */
12929 enum {
12930     WL_HC_TX_XTLV_ID_VAL_STALL_THRESHOLD   = 1,     /* stall_threshold */
12931     WL_HC_TX_XTLV_ID_VAL_STALL_SAMPLE_SIZE = 2,     /* stall_sample_size */
12932     WL_HC_TX_XTLV_ID_VAL_STALL_TIMEOUT     = 3,     /* stall_timeout */
12933     WL_HC_TX_XTLV_ID_VAL_STALL_FORCE       = 4,     /* stall_force */
12934     WL_HC_TX_XTLV_ID_VAL_STALL_EXCLUDE     = 5,     /* stall_exclude */
12935     WL_HC_TX_XTLV_ID_VAL_FC_TIMEOUT        = 6,     /* flow ctl timeout */
12936     WL_HC_TX_XTLV_ID_VAL_FC_FORCE          = 7,     /* flow ctl force failure */
12937     WL_HC_TX_XTLV_ID_VAL_DELAY_TO_TRAP     = 8,     /* delay threshold for forced trap */
12938     WL_HC_TX_XTLV_ID_VAL_DELAY_TO_RPT      = 9,     /* delay threshold for event log report */
12939 };
12940 
12941 /* Health Check: Datapath RX IDs */
12942 enum {
12943     WL_HC_RX_XTLV_ID_VAL_DMA_STALL_TIMEOUT = 1,     /* dma_stall_timeout */
12944     WL_HC_RX_XTLV_ID_VAL_DMA_STALL_FORCE   = 2,     /* dma_stall test trigger */
12945     WL_HC_RX_XTLV_ID_VAL_STALL_THRESHOLD   = 3,     /* stall_threshold */
12946     WL_HC_RX_XTLV_ID_VAL_STALL_SAMPLE_SIZE = 4,     /* stall_sample_size */
12947     WL_HC_RX_XTLV_ID_VAL_STALL_FORCE       = 5,     /* stall test trigger */
12948 };
12949 
12950 /* Health Check: Datapath SCAN IDs */
12951 enum {
12952     WL_HC_XTLV_ID_VAL_SCAN_STALL_THRESHOLD    = 1,    /* scan stall threshold */
12953 };
12954 
12955 /* IDs of Health Check report structures for sub types of health checks within WL */
12956 enum {
12957     WL_HC_DD_UNDEFINED = 0,        /* Undefined */
12958     WL_HC_DD_RX_DMA_STALL = 1,    /* RX DMA stall check */
12959     WL_HC_DD_RX_STALL = 2,        /* RX stall check */
12960     WL_HC_DD_TX_STALL = 3,        /* TX stall check */
12961     WL_HC_DD_SCAN_STALL = 4,    /* SCAN stall check */
12962     WL_HC_DD_MAX
12963 };
12964 
12965 /*
12966  * Health Check report structures for sub types of health checks within WL
12967  */
12968 
12969 /* Health Check report structure for Rx DMA Stall check */
12970 typedef struct {
12971     uint16 type;
12972     uint16 length;
12973     uint16 timeout;
12974     uint16 stalled_dma_bitmap;
12975 } wl_rx_dma_hc_info_t;
12976 
12977 /* Health Check report structure for Tx packet failure check */
12978 typedef struct {
12979     uint16 type;
12980     uint16 length;
12981     uint32 stall_bitmap;
12982     uint32 stall_bitmap1;
12983     uint32 failure_ac;
12984     uint32 threshold;
12985     uint32 tx_all;
12986     uint32 tx_failure_all;
12987 } wl_tx_hc_info_t;
12988 
12989 /* Health Check report structure for Rx dropped packet failure check */
12990 typedef struct {
12991     uint16 type;
12992     uint16 length;
12993     uint32 bsscfg_idx;
12994     uint32 rx_hc_pkts;
12995     uint32 rx_hc_dropped_all;
12996     uint32 rx_hc_alert_th;
12997 } wl_rx_hc_info_t;
12998 
12999 /* HE top level command IDs */
13000 enum {
13001     WL_HE_CMD_ENAB = 0,
13002     WL_HE_CMD_FEATURES = 1,
13003     WL_HE_CMD_TWT_SETUP = 2,
13004     WL_HE_CMD_TWT_TEARDOWN = 3,
13005     WL_HE_CMD_TWT_INFO = 4,
13006     WL_HE_CMD_BSSCOLOR = 5,
13007     WL_HE_CMD_PARTIAL_BSSCOLOR = 6,
13008     WL_HE_CMD_LAST
13009 };
13010 
13011 #define WL_HEB_VERSION    0
13012 
13013 /* HEB top level command IDs */
13014 enum {
13015     WL_HEB_CMD_ENAB = 0,
13016     WL_HEB_CMD_NUM_HEB = 1,
13017     WL_HEB_CMD_COUNTERS = 1,
13018     WL_HEB_CMD_CLEAR_COUNTERS = 2,
13019     WL_HEB_CMD_LAST
13020 };
13021 
13022 /* HEB counters structures */
13023 typedef struct {
13024     uint16 pre_event;
13025     uint16 start_event;
13026     uint16 end_event;
13027     uint16 missed;
13028 } wl_heb_int_cnt_t;
13029 
13030 typedef struct {
13031     /* structure control */
13032     uint16 version;    /* structure version */
13033     uint16 length;    /* data length (starting after this field) */
13034     wl_heb_int_cnt_t heb_int_cnt[1];
13035 } wl_heb_cnt_t;
13036 
13037 
13038 /* TWT Setup descriptor */
13039 typedef struct {
13040     /* Setup Command. */
13041     uint8 setup_cmd;    /* See TWT_SETUP_CMD_XXXX in 802.11ah.h,
13042                  * valid when bcast_twt is FALSE.
13043                  */
13044     /* Flow attributes */
13045     uint8 flow_flags;    /* See WL_TWT_FLOW_FLAG_XXXX below */
13046     uint8 flow_id;        /* must be between 0 and 7 */
13047     /* Target Wake Time */
13048     uint8 wake_type;    /* See WL_TWT_TIME_TYPE_XXXX below */
13049     uint32 wake_time_h;    /* target wake time - BSS TSF (us) */
13050     uint32 wake_time_l;
13051     uint32 wake_dur;    /* target wake duration in us units */
13052     uint32 wake_int;    /* target wake interval */
13053 } wl_twt_sdesc_t;
13054 
13055 /* Flow flags */
13056 #define WL_TWT_FLOW_FLAG_BROADCAST    (1<<0)
13057 #define WL_TWT_FLOW_FLAG_IMPLICIT    (1<<1)
13058 #define WL_TWT_FLOW_FLAG_UNANNOUNCED    (1<<2)
13059 #define WL_TWT_FLOW_FLAG_TRIGGER    (1<<3)
13060 
13061 /* Flow id */
13062 #define WL_TWT_FLOW_ID_FID    0x07    /* flow id */
13063 #define WL_TWT_FLOW_ID_GID_MASK    0x70    /* group id - broadcast TWT only */
13064 #define WL_TWT_FLOW_ID_GID_SHIFT 4
13065 
13066 /* Wake type */
13067 /* TODO: not yet finalized */
13068 #define WL_TWT_TIME_TYPE_BSS    0    /* The time specified in wake_time_h/l is
13069                      * the BSS TSF time.
13070                      */
13071 #define WL_TWT_TIME_TYPE_OFFSET    1    /* The time specified in wake_time_h/l is an offset
13072                      * of the TSF time when the iovar is processed.
13073                      */
13074 
13075 #define WL_TWT_SETUP_VER    0
13076 
13077 /* HE TWT Setup command */
13078 typedef struct {
13079     /* structure control */
13080     uint16 version;    /* structure version */
13081     uint16 length;    /* data length (starting after this field) */
13082     /* peer address */
13083     struct ether_addr peer;    /* leave it all 0s' for AP */
13084     /* session id */
13085     uint8 dialog;    /* an arbitrary number to identify the seesion */
13086     uint8 pad;
13087     /* setup descriptor */
13088     wl_twt_sdesc_t desc;
13089 } wl_twt_setup_t;
13090 
13091 #define WL_TWT_TEARDOWN_VER    0
13092 
13093 /* HE TWT Teardown command */
13094 typedef struct {
13095     /* structure control */
13096     uint16 version;    /* structure version */
13097     uint16 length;    /* data length (starting after this field) */
13098     /* peer address */
13099     struct ether_addr peer;    /* leave it all 0s' for AP */
13100     /* flow attributes */
13101     uint8 flow_flags;    /* See WL_TWT_FLOW_FLAG_XXXX above.
13102                  * (only BORADCAST) is applicable)
13103                  */
13104     uint8 flow_id;        /* must be between 0 and 7 */
13105 } wl_twt_teardown_t;
13106 
13107 /* twt information descriptor */
13108 typedef struct {
13109     uint8 flow_flags;    /* See WL_TWT_INFO_FLAG_XXX below */
13110     uint8 flow_id;
13111     uint8 pad[2];
13112     uint32 next_twt_h;
13113     uint32 next_twt_l;
13114 } wl_twt_idesc_t;
13115 
13116 /* Flow flags */
13117 #define WL_TWT_INFO_FLAG_RESP_REQ    (1<<0)    /* Request response */
13118 
13119 #define WL_TWT_INFO_VER    0
13120 
13121 /* HE TWT Information command */
13122 typedef struct {
13123     /* structure control */
13124     uint16 version;    /* structure version */
13125     uint16 length;    /* data length (starting after this field) */
13126     /* peer address */
13127     struct ether_addr peer;    /* leave it all 0s' for AP */
13128     uint8 pad[2];
13129     /* information descriptor */
13130     wl_twt_idesc_t desc;
13131 } wl_twt_info_t;
13132 
13133 /* Current version for wlc_clm_power_limits_req_t structure and flags */
13134 #define WLC_CLM_POWER_LIMITS_REQ_VERSION 1
13135 /* "clm_power_limits" iovar request structure */
13136 typedef struct wlc_clm_power_limits_req {
13137     /* Input. Structure and flags version */
13138     uint32 version;
13139     /* Full length of buffer (includes this structure and space for TLV-encoded PPR) */
13140     uint32 buflen;
13141     /* Input. Flags (see WLC_CLM_POWER_LIMITS_INPUT_FLAG_... below) */
13142     uint32 input_flags;
13143     /* Input. CC of region whose data is being requested */
13144     char cc[WLC_CNTRY_BUF_SZ];
13145     /* Input. Channel/subchannel in chanspec_t format */
13146     uint32 chanspec;
13147     /* Subchannel encoded as clm_limits_type_t */
13148     uint32 clm_subchannel;
13149     /* Input. 0-based antenna index */
13150     uint32 antenna_idx;
13151     /* Output. General flags (see WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_... below) */
13152     uint32 output_flags;
13153     /* Output. 2.4G country flags, encoded as clm_flags_t enum */
13154     uint32 clm_country_flags_2g;
13155     /* Output. 5G country flags, encoded as clm_flags_t enum */
13156     uint32 clm_country_flags_5g;
13157     /* Output. Length of TLV-encoded PPR data that follows this structure */
13158     uint32 ppr_tlv_size;
13159     /* Output. Beginning of buffer for TLV-encoded PPR data */
13160     uint8 ppr_tlv[1];
13161 } wlc_clm_power_limits_req_t;
13162 
13163 /* Input. Do not apply SAR limits */
13164 #define WLC_CLM_POWER_LIMITS_INPUT_FLAG_NO_SAR                0x00000001
13165 /* Input. Do not apply board limits */
13166 #define WLC_CLM_POWER_LIMITS_INPUT_FLAG_NO_BOARD            0x00000002
13167 /* Output. Limits taken from product-specific country data */
13168 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_PRODUCT_LIMITS            0x00000001
13169 /* Output. Limits taken from product-specific worldwide data */
13170 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_WORLDWIDE_LIMITS        0x00000002
13171 /* Output. Limits taken from country-default (all-product) data */
13172 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_DEFAULT_COUNTRY_LIMITS        0x00000004
13173 
13174 /*
13175  * WOG (Wake On Googlecast)
13176  */
13177 
13178 #define MAX_GCAST_APPID_CNT_LIMIT 50
13179 #define MAX_DNS_LABEL 63
13180 
13181 typedef struct wog_appid {
13182     uint8 appID[MAX_DNS_LABEL+1];
13183 } wog_appid_t;
13184 
13185 enum {
13186     WOG_APPID_ADD,
13187     WOG_APPID_DEL,
13188     WOG_APPID_CLEAR,
13189     WOG_APPID_LIST,
13190     WOG_MAX_APPID_CNT
13191 };
13192 
13193 #define WOG_APPID_IOV_VER 1
13194 typedef struct wog_appid_iov {
13195     /* version for iovar */
13196     uint32 ver;
13197     /* add/del/clear/list operation */
13198     uint32 operation;
13199     /* for adding or deleting multiple items */
13200     /* for WOG_MAX_APPID_CNT, this value is used for max count for AppID */
13201     uint32 cnt;
13202     /* Application IDs */
13203     /* If FW found an AppID from this list, FW will respond to discovery */
13204     /* without wake up the host */
13205     wog_appid_t appids[1];
13206 } wog_appid_iov_t;
13207 
13208 /* dns service record */
13209 /* service name : _googlecast */
13210 typedef struct wog_srv_record {
13211     uint32 ttl;
13212     uint16 port; /* tcp 8008 or 8009 */
13213     uint8 PAD[2];
13214 } wog_srv_record_t;
13215 
13216 #define GCAST_MAX_MODEL_NAME_LEN 16
13217 #define GCAST_MAX_FNAME_LEN 64
13218 #define GCAST_MAX_RS_LEN 60
13219 
13220 #define GCAST_UUID_LEN 32
13221 #define GCAST_PUBLICKEY_ID_LEN 64
13222 #define GCAST_VER_LEN 2
13223 typedef struct wog_txt_record {
13224     uint32 ttl;
13225     /* id : UUID for the receiver */
13226     char id[GCAST_UUID_LEN+1];
13227 
13228     /* Cast protocol version supported. Begins at 2 */
13229     /* and is incremented by 1 with each version */
13230     char ver[GCAST_VER_LEN+1];
13231 
13232     /* 256bit receiver Subject Public Key Identifier from the SSL cert */
13233     char public_key[GCAST_PUBLICKEY_ID_LEN+1];
13234 
13235     /* A bitfield of device capabilities. */
13236     /* bit 0 : video_out (1:has video out, 0:no video) */
13237     /* bit 1 : video_in */
13238     /* bit 2 : audio_out */
13239     /* bit 3 : audio_in */
13240     /* bit 4 : dev_mode */
13241     /*     (1:dev mode enabled, 0: not enabled) */
13242     char capability;
13243 
13244     /* Receiver status flag 0:IDLE, 1(BUSY/JOIN) */
13245     /* IDLE : The receiver is idle */
13246     /*       and doesn't need to be connected now. */
13247     /* BUSY/JOIN : The receiver is hosting an activity */
13248     /*     and invites the sender to join */
13249     char receiver_status_flag;
13250 
13251     uint8 PAD0[1];
13252 
13253     char friendly_name[GCAST_MAX_FNAME_LEN+1];
13254     uint8 PAD1[3];
13255 
13256     char model_name[GCAST_MAX_MODEL_NAME_LEN+1];
13257     uint8 PAD2[3];
13258 
13259     /* Receiver Status text for Cast Protocol v2 */
13260     /* Spec says that if the status text exceeds 60 characters in length, */
13261     /* it is truncated at 60 caracters and */
13262     /* a UTF-8 ellipsis character is appended to indicate trucation. */
13263     /* But our dongle won't use UTF-8 ellipsis. It's not a big deal. */
13264     char receiver_status[GCAST_MAX_RS_LEN+1];
13265     uint8 PAD3[3];
13266 } wog_txt_record_t;
13267 
13268 /* ip will be taken from the ip of wog_info_t */
13269 typedef struct wog_a_record {
13270     uint32 ttl;
13271 } wog_a_record_t;
13272 
13273 /* Google Cast protocl uses mDNS SD for its discovery */
13274 #define WOG_SD_RESP_VER 1
13275 typedef struct wog_sd_resp {
13276     /* version for iovar */
13277     int32 ver;
13278     /* device name of Google Cast receiver */
13279     char device_name[MAX_DNS_LABEL+1];
13280     /* IP address of Google Cast receiver */
13281     uint8 ip[4];
13282     /* ttl of PTR response */
13283     uint32 ptr_ttl;
13284     /* DNS TXT record */
13285     wog_txt_record_t txt;
13286     /* DNS SRV record */
13287     wog_srv_record_t srv;
13288     /* DNS A record */
13289     wog_a_record_t a;
13290 } wog_sd_resp_t;
13291 
13292 enum wl_mbo_cmd_ids {
13293     WL_MBO_CMD_ADD_CHAN_PREF = 1,
13294     WL_MBO_CMD_DEL_CHAN_PREF = 2,
13295     WL_MBO_CMD_LIST_CHAN_PREF = 3,
13296     WL_MBO_CMD_CELLULAR_DATA_CAP = 4,
13297     WL_MBO_CMD_DUMP_COUNTERS = 5,
13298     WL_MBO_CMD_CLEAR_COUNTERS = 6,
13299     WL_MBO_CMD_FORCE_ASSOC = 7,
13300     WL_MBO_CMD_BSSTRANS_REJECT = 8,
13301     WL_MBO_CMD_SEND_NOTIF = 9,
13302     /* Add before this !! */
13303     WL_MBO_CMD_LAST
13304 };
13305 
13306 enum wl_mbo_xtlv_id {
13307     WL_MBO_XTLV_OPCLASS            = 0x1,
13308     WL_MBO_XTLV_CHAN               = 0x2,
13309     WL_MBO_XTLV_PREFERENCE         = 0x3,
13310     WL_MBO_XTLV_REASON_CODE        = 0x4,
13311     WL_MBO_XTLV_CELL_DATA_CAP      = 0x5,
13312     WL_MBO_XTLV_COUNTERS           = 0x6,
13313     WL_MBO_XTLV_ENABLE             = 0x7,
13314     WL_MBO_XTLV_SUB_ELEM_TYPE      = 0x8
13315 };
13316 
13317 typedef struct wl_mbo_counters {
13318     /* No of transition req recvd */
13319     uint16 trans_req_rcvd;
13320     /* No of transition req with disassoc imminent */
13321     uint16 trans_req_disassoc;
13322     /* No of transition req with BSS Termination */
13323     uint16 trans_req_bss_term;
13324     /* No of trans req w/ unspecified reason */
13325     uint16 trans_resn_unspec;
13326     /* No of trans req w/ reason frame loss */
13327     uint16 trans_resn_frm_loss;
13328     /* No of trans req w/ reason traffic delay */
13329     uint16 trans_resn_traffic_delay;
13330     /* No of trans req w/ reason insufficient buffer */
13331     uint16 trans_resn_insuff_bw;
13332     /* No of trans req w/ reason load balance */
13333     uint16 trans_resn_load_bal;
13334     /* No of trans req w/ reason low rssi */
13335     uint16 trans_resn_low_rssi;
13336     /* No of trans req w/ reason excessive retransmission */
13337     uint16 trans_resn_xcess_retransmn;
13338     /* No of trans req w/ reason gray zone */
13339     uint16 trans_resn_gray_zone;
13340     /* No of trans req w/ reason switch to premium AP */
13341     uint16 trans_resn_prem_ap_sw;
13342     /* No of transition rejection sent */
13343     uint16 trans_rejn_sent;
13344     /* No of trans rejn reason excessive frame loss */
13345     uint16 trans_rejn_xcess_frm_loss;
13346     /* No of trans rejn reason excessive traffic delay */
13347     uint16 trans_rejn_xcess_traffic_delay;
13348     /* No of trans rejn reason insufficient QoS capability */
13349     uint16 trans_rejn_insuffic_qos_cap;
13350     /* No of trans rejn reason low RSSI */
13351     uint16 trans_rejn_low_rssi;
13352     /* No of trans rejn reason high interference */
13353     uint16 trans_rejn_high_interference;
13354     /* No of trans rejn reason service unavilable */
13355     uint16 trans_rejn_service_unavail;
13356     /* No of beacon request rcvd */
13357     uint16 bcn_req_rcvd;
13358     /* No of beacon report sent */
13359     uint16 bcn_rep_sent;
13360     /* No of null beacon report sent */
13361     uint16 null_bcn_rep_sent;
13362     /* No of wifi to cell switch */
13363     uint16 wifi_to_cell;
13364 } wl_mbo_counters_t;
13365 
13366 /* otpread command */
13367 #define WL_OTPREAD_VER 1
13368 
13369 typedef struct {
13370     uint16 version;        /* cmd structure version */
13371     uint16 cmd_len;        /* cmd struct len */
13372     uint32 rdmode;        /* otp read mode */
13373     uint32 rdoffset;    /* byte offset into otp to start read */
13374     uint32 rdsize;        /* number of bytes to read */
13375 } wl_otpread_cmd_t;
13376 
13377 /* "otpecc_rows" command */
13378 typedef struct {
13379     uint16 version;        /* version of this structure */
13380     uint16 len;            /* len in bytes of this structure */
13381     uint32 cmdtype;        /* command type : 0 : read row data, 1 : ECC lock  */
13382     uint32 rowoffset;    /* start row offset */
13383     uint32 numrows;        /* number of rows */
13384     uint8  rowdata[];    /* read rows data */
13385 } wl_otpecc_rows_t;
13386 
13387 #define WL_OTPECC_ROWS_VER  1
13388 
13389 #define WL_OTPECC_ROWS_CMD_READ  0
13390 #define WL_OTPECC_ROWS_CMD_LOCK  1
13391 
13392 #define WL_OTPECC_ARGIDX_CMDTYPE        0    /* command type */
13393 #define WL_OTPECC_ARGIDX_ROWOFFSET        1    /* start row offset */
13394 #define WL_OTPECC_ARGIDX_NUMROWS        2    /* number of rows */
13395 
13396 /* "otpeccrows" raw data size per row */
13397 #define WL_ECCDUMP_ROW_SIZE_BYTE    6 /* 4 bytes row data + 2 bytes ECC status */
13398 #define WL_ECCDUMP_ROW_SIZE_WORD    3
13399 
13400 /* otpECCstatus */
13401 #define OTP_ECC_ENAB_SHIFT        13
13402 #define OTP_ECC_ENAB_MASK        0x7
13403 #define OTP_ECC_CORR_ST_SHIFT    12
13404 #define OTP_ECC_CORR_ST_MASK    0x1
13405 #define OTP_ECC_DBL_ERR_SHIFT    11
13406 #define OTP_ECC_DBL_ERR_MASK    0x1
13407 #define OTP_ECC_DED_ST_SHIFT    10
13408 #define OTP_ECC_DED_ST_MASK        0x1
13409 #define OTP_ECC_SEC_ST_SHIFT    9
13410 #define OTP_ECC_SEC_ST_MASK        0x1
13411 #define OTP_ECC_DATA_SHIFT        0
13412 #define OTP_ECC_DATA_MASK        0x7f
13413 
13414 /* OTP_ECC_CORR_ST field */
13415 #define OTP_ECC_MODE        1
13416 #define OTP_NO_ECC_MODE        0
13417 
13418 /* OTP_ECC_ENAB field (bit15:13) :
13419  * When 2 or 3 bits are set,
13420  * it indicates that OTP ECC is enabled on the last row read.
13421  * Otherwise, ECC is disabled
13422  */
13423 #define OTP_ECC_ENAB(val) \
13424     (bcm_bitcount((uint8 *)&(val), sizeof(uint8)) > 1)
13425 
13426 #define WL_LEAKY_AP_STATS_GT_TYPE    0
13427 #define WL_LEAKY_AP_STATS_PKT_TYPE    1
13428 typedef struct wlc_leaked_infra_guard_marker {
13429     /* type field for this TLV: WL_LEAKY_AP_STATS_GT_TYPE */
13430     uint16  type;
13431     /* length field for this TLV */
13432     uint16  len;
13433     /* guard sample sequence number; Updated by 1 on every guard sample */
13434     uint32  seq_number;
13435     /* Guard time start time (tsf; PS indicated and acked) */
13436     uint32  start_time;
13437     /* tsf timestamp for the GT end event */
13438     uint32  gt_tsf_l;
13439     /* Guard time period in ms */
13440     uint16  guard_duration;
13441     /* Number PPDUs in the notification */
13442     uint16  num_pkts;
13443     /* Flags to indicate some states see below */
13444     uint8   flag;
13445     /* pad for 32-bit alignment */
13446     uint8   reserved[3];
13447 } wlc_leaked_infra_guard_marker_t;
13448 
13449 /* Flag information */
13450 #define WL_LEAKED_GUARD_TIME_NONE    0               /* Not in any guard time */
13451 #define WL_LEAKED_GUARD_TIME_FRTS    (0x01 << 0)     /* Normal FRTS power save */
13452 #define WL_LEAKED_GUARD_TIME_SCAN    (0x01 << 1)     /* Channel switch due to scanning */
13453 #define WL_LEAKED_GUARD_TIME_AWDL_PSF    (0x01 << 2)     /* Channel switch due to AWDL PSF */
13454 #define WL_LEAKED_GUARD_TIME_AWDL_AW    (0x01 << 3)     /* Channel switch due to AWDL AW */
13455 #define WL_LEAKED_GUARD_TIME_INFRA_STA    (0x01 << 4)    /* generic type infra sta channel switch */
13456 #define WL_LEAKED_GUARD_TIME_TERMINATED (0x01 << 7)     /* indicate a GT is terminated early */
13457 
13458 typedef struct wlc_leaked_infra_packet_stat {
13459     uint16  type;            /* type field for this TLV: WL_LEAKY_AP_STATS_PKT_TYPE */
13460     uint16  len;            /* length field for this TLV */
13461     uint16  ppdu_len_bytes;        /* PPDU packet length in bytes */
13462     uint16  num_mpdus;        /* number of the MPDUs in the PPDU */
13463     uint32  ppdu_time;        /* PPDU arrival time at the begining of the guard time */
13464     uint32  rate;            /* PPDU packet rate; Received packet's data rate */
13465     uint16  seq_number;        /* sequence number */
13466     int8    rssi;            /* RSSI */
13467     uint8   tid;            /* tid */
13468 } wlc_leaked_infra_packet_stat_t;
13469 
13470 /* Wake timer structure definition */
13471 #define WAKE_TIMER_VERSION 1
13472 #define WAKE_TIMER_NOLIMIT 0xFFFF
13473 
13474 typedef struct wake_timer {
13475     uint16 ver;
13476     uint16 len;
13477     uint16 limit;   /* number of events to deliver
13478             * 0-disable, 0xffff-indefinite, num_events otherwise
13479             */
13480     uint16 count;    /* number of events delivered since enable (get only) */
13481     uint16 period;    /* timeout/period in milliseconds */
13482 } wake_timer_t;
13483 
13484 typedef struct wl_desense_restage_gain {
13485     uint16 version;
13486     uint16 length;
13487     uint32 band;
13488     uint8 num_cores;
13489     uint8 desense_array[WL_TX_CHAINS_MAX];
13490     uint8 PAD[3];
13491 } wl_desense_restage_gain_t;
13492 
13493 #define MAX_UCM_CHAINS 5
13494 #define MAX_UCM_PROFILES 4
13495 #define UCM_PROFILE_VERSION_1 1
13496 
13497 /* UCM per chain attribute struct */
13498 typedef struct wlc_btcx_chain_attr {
13499     uint16 length;            /* chain attr length, version is same as profile version */
13500     int8 desense_level;        /* per chain desense level */
13501     int8 ack_pwr_strong_rssi;    /* per chain ack power at strong rssi */
13502     int8 ack_pwr_weak_rssi;        /* per chain ack power at weak rssi */
13503     int8 tx_pwr_strong_rssi;    /* per chain tx power at strong rssi */
13504     int8 tx_pwr_weak_rssi;        /* per chain tx power at weak rssi */
13505     uint8 PAD[1];            /* additional bytes for alignment */
13506 } wlc_btcx_chain_attr_t;
13507 
13508 typedef struct wlc_btcx_profile_v1 {
13509     uint16 version;            /* UCM profile version */
13510     uint16 length;            /* profile size */
13511     uint16 fixed_length;        /* size of the fixed portion of the profile */
13512     uint8 init;            /* profile initialized or not */
13513     uint8 chain_attr_count;        /* Number of elements in chain_attr array */
13514     uint8 profile_index;        /* profile index */
13515     uint8 mode_strong_wl_bt;    /* Mode under strong WLAN and BT RSSI */
13516     uint8 mode_weak_wl;        /* Mode under weak WLAN RSSI */
13517     uint8 mode_weak_bt;        /* Mode under weak BT RSSI */
13518     uint8 mode_weak_wl_bt;        /* Mode under weak BT and WLAN RSSI */
13519     int8 mode_wl_hi_lo_rssi_thresh;    /* Strong to weak WLAN RSSI threshold for mode selection */
13520     int8 mode_wl_lo_hi_rssi_thresh;    /* Weak to strong WLAN RSSI threshold for mode selection */
13521     int8 mode_bt_hi_lo_rssi_thresh;    /* Strong to weak BT RSSI threshold for mode selection */
13522     int8 mode_bt_lo_hi_rssi_thresh;    /* Weak to strong BT RSSI threshold for mode selection */
13523     int8 desense_wl_hi_lo_rssi_thresh;    /* Strong to weak RSSI threshold for desense */
13524     int8 desense_wl_lo_hi_rssi_thresh;    /* Weak to strong RSSI threshold for desense */
13525     int8 ack_pwr_wl_hi_lo_rssi_thresh;    /* Strong to weak RSSI threshold for ACK power */
13526     int8 ack_pwr_wl_lo_hi_rssi_thresh;    /* Weak to strong RSSI threshold for ACK power */
13527     int8 tx_pwr_wl_hi_lo_rssi_thresh;    /* Strong to weak RSSI threshold for Tx power */
13528     int8 tx_pwr_wl_lo_hi_rssi_thresh;    /* Weak to strong RSSI threshold for Tx power */
13529     uint8 PAD[1];                /* additional bytes for 4 byte alignment */
13530     wlc_btcx_chain_attr_t chain_attr[];    /* variable length array with chain attributes */
13531 } wlc_btcx_profile_v1_t;
13532 
13533 #define SSSR_D11_RESET_SEQ_STEPS   5
13534 #define SSSR_REG_INFO_VER   0
13535 
13536 typedef struct sssr_reg_info {
13537     uint16 version;
13538     uint16 length;  /* length of the structure validated at host */
13539     struct {
13540         struct {
13541             uint32 pmuintmask0;
13542             uint32 pmuintmask1;
13543             uint32 resreqtimer;
13544             uint32 macresreqtimer;
13545             uint32 macresreqtimer1;
13546         } base_regs;
13547     } pmu_regs;
13548     struct {
13549         struct {
13550             uint32 intmask;
13551             uint32 powerctrl;
13552             uint32 clockcontrolstatus;
13553             uint32 powerctrl_mask;
13554         } base_regs;
13555     } chipcommon_regs;
13556     struct {
13557         struct {
13558             uint32 clockcontrolstatus;
13559             uint32 clockcontrolstatus_val;
13560         } base_regs;
13561         struct {
13562             uint32 resetctrl;
13563             uint32 itopoobb;
13564         } wrapper_regs;
13565     } arm_regs;
13566     struct {
13567         struct {
13568             uint32 ltrstate;
13569             uint32 clockcontrolstatus;
13570             uint32 clockcontrolstatus_val;
13571         } base_regs;
13572         struct {
13573             uint32 itopoobb;
13574         } wrapper_regs;
13575     } pcie_regs;
13576     struct {
13577         struct {
13578             uint32 ioctrl;
13579         } wrapper_regs;
13580         uint32 vasip_sr_addr;
13581         uint32 vasip_sr_size;
13582     } vasip_regs;
13583     struct {
13584         struct {
13585             uint32 xmtaddress;
13586             uint32 xmtdata;
13587             uint32 clockcontrolstatus;
13588             uint32 clockcontrolstatus_val;
13589         } base_regs;
13590         struct {
13591             uint32 resetctrl;
13592             uint32 itopoobb;
13593             uint32 ioctrl;
13594             uint32 ioctrl_resetseq_val[SSSR_D11_RESET_SEQ_STEPS];
13595         } wrapper_regs;
13596         uint32 sr_size;
13597     } mac_regs[MAX_NUM_D11CORES];
13598 } sssr_reg_info_t;
13599 
13600 /* ADaptive Power Save(ADPS) structure definition */
13601 #define WL_ADPS_IOV_MAJOR_VER    1
13602 #define WL_ADPS_IOV_MINOR_VER    0
13603 #define WL_ADPS_IOV_MAJOR_VER_SHIFT    8
13604 #define WL_ADPS_IOV_VER \
13605     ((WL_ADPS_IOV_MAJOR_VER << WL_ADPS_IOV_MAJOR_VER_SHIFT) | WL_ADPS_IOV_MINOR_VER)
13606 
13607 #define ADPS_NUM_DIR    2
13608 #define ADPS_RX        0
13609 #define ADPS_TX        1
13610 
13611 #define WL_ADPS_IOV_MODE    0x0001
13612 #define WL_ADPS_IOV_RSSI    0x0002
13613 #define WL_ADPS_IOV_DUMP    0x0003
13614 #define WL_ADPS_IOV_DUMP_CLEAR    0x0004
13615 
13616 #define ADPS_SUMMARY_STEP_NUM   2
13617 #define ADPS_SUMMARY_STEP_LOW    0
13618 #define ADPS_SUMMARY_STEP_HIGH    1
13619 
13620 #define ADPS_SUB_IOV_VERSION_1    1
13621 #define ADPS_SUB_IOV_VERSION_2    2
13622 
13623 typedef struct wl_adps_params_v1 {
13624     uint16 version;
13625     uint16 length;
13626     uint8 band;        /* band - 2G or 5G */
13627     uint8 mode;        /* operation mode, default = 0 (ADPS disable) */
13628     uint16 padding;
13629 } wl_adps_params_v1_t;
13630 
13631 typedef struct wl_adps_rssi {
13632     int32 thresh_hi;    /* rssi threshold to resume ADPS operation */
13633     int32 thresh_lo;    /* rssi threshold to suspend ADPS operation */
13634 } wl_adps_rssi_t;
13635 
13636 typedef struct wl_adps_rssi_params_v1 {
13637     uint16 version;
13638     uint16 length;
13639     uint8 band;
13640     uint8 padding[3];
13641     wl_adps_rssi_t rssi;
13642 } wl_adps_rssi_params_v1_t;
13643 
13644 typedef struct adps_stat_elem {
13645     uint32 duration;    /* each step duration time (mSec) */
13646     uint32 counts;        /* each step hit count number */
13647 } adps_stat_elem_t;
13648 
13649 typedef struct wl_adps_dump_summary_v1 {
13650     uint16 version;
13651     uint16 length;
13652     uint8 mode;                    /* operation mode: On/Off */
13653     uint8 flags;                    /* restrict flags */
13654     uint8 current_step;                /* current step */
13655     uint8 padding;
13656     adps_stat_elem_t stat[ADPS_SUMMARY_STEP_NUM];    /* statistics */
13657 } wl_adps_dump_summary_v1_t;
13658 
13659 typedef struct wlc_btc_2gchain_dis {
13660     uint16 ver;
13661     uint16 len;
13662     uint8 chain_dis;
13663     uint8 flag;
13664 } wlc_btc_2gchain_dis_t;
13665 
13666 #define WLC_BTC_2GCHAIN_DIS_REASSOC    0x1
13667 #define WLC_BTC_2GCHAIN_DIS_VER1    0x1
13668 #define WLC_BTC_2GCHAIN_DIS_VER1_LEN    6
13669 
13670 enum wl_rpsnoa_cmd_ids {
13671     WL_RPSNOA_CMD_ENABLE = 1,
13672     WL_RPSNOA_CMD_STATUS,
13673     WL_RPSNOA_CMD_PARAMS,
13674     WL_RPSNOA_CMD_LAST
13675 };
13676 
13677 typedef struct rpsnoa_cmnhdr {
13678     uint16 ver;        /* cmd structure version */
13679     uint16 len;        /* cmd structure len */
13680     uint32 subcmd;
13681     uint32 cnt;
13682 } rpsnoa_cmnhdr_t;
13683 
13684 typedef struct rpsnoa_data {
13685     int16 band;
13686     int16 value;
13687 } rpsnoa_data_t;
13688 
13689 typedef struct rpsnoa_param {
13690     uint16 band;
13691     uint8 level;
13692     uint8 stas_assoc_check;
13693     uint32 pps;
13694     uint32 quiet_time;
13695 } rpsnoa_param_t;
13696 
13697 typedef struct rpsnoa_iovar {
13698     rpsnoa_cmnhdr_t hdr;
13699     rpsnoa_data_t data[1];
13700 } rpsnoa_iovar_t;
13701 
13702 typedef struct rpsnoa_iovar_params {
13703     rpsnoa_cmnhdr_t hdr;
13704     rpsnoa_param_t param[1];
13705 } rpsnoa_iovar_params_t;
13706 
13707 /* Per-interface reportable stats types */
13708 enum wl_ifstats_xtlv_id {
13709     /* global */
13710     WL_IFSTATS_XTLV_SLICE_INDEX = 1,
13711     WL_IFSTATS_XTLV_IF_INDEX = 2,
13712     WL_IFSTATS_XTLV_MAC_ADDR = 3,
13713     WL_IFSTATS_XTLV_REPORT_CMD = 4,    /* Comes in an iovar */
13714     WL_IFSTATS_XTLV_BUS_PCIE = 5,
13715 
13716     /* Report data across all SCBs using ecounters */
13717     WL_IFSTATS_XTLV_WL_STA_INFO_ECOUNTERS = 0x100,
13718 
13719     /* Per-slice information
13720      * Per-interface reporting could also include slice specific data
13721      */
13722     /* xtlv container for reporting */
13723     WL_IFSTATS_XTLV_WL_SLICE = 0x301,
13724     /* Per-slice AMPDU stats */
13725     WL_IFSTATS_XTLV_WL_SLICE_AMPDU_DUMP = 0x302,
13726     /* Per-slice BTCOEX stats */
13727     WL_IFSTATS_XTLV_WL_SLICE_BTCOEX = 0x303,
13728     /* V11_WLCNTRS used in ecounters */
13729     WL_IFSTATS_XTLV_WL_SLICE_V11_WLCNTRS = 0x304,
13730     /* V30_WLCNTRS Used in ecounters */
13731     WL_IFSTATS_XTLV_WL_SLICE_V30_WLCNTRS = 0x305,
13732 
13733     /* Per-interface */
13734     /* XTLV container for reporting */
13735     WL_IFSTATS_XTLV_IF = 0x501,
13736     /* Generic stats applicable to all IFs */
13737     WL_IFSTATS_XTLV_GENERIC = 0x502,
13738     /* Infra specific */
13739     WL_IFSTATS_XTLV_INFRA_SPECIFIC = 0x503,
13740     /* MGT counters infra and softAP */
13741     WL_IFSTATS_XTLV_MGT_CNT = 0x504,
13742     /* AMPDU stats on per-IF */
13743     WL_IFSTATS_XTLV_AMPDU_DUMP = 0x505,
13744     WL_IFSTATS_XTLV_IF_SPECIFIC = 0x506
13745 };
13746 
13747 /* interface specific mgt count */
13748 #define WL_MGT_STATS_VERSION_V1    1
13749 /* Associated stats type: WL_IFSTATS_MGT_CNT */
13750 typedef struct {
13751     uint16    version;
13752     uint8   pad[2];
13753 
13754     /* detailed control/management frames */
13755     uint32    txnull;
13756     uint32    rxnull;
13757     uint32    txqosnull;
13758     uint32    rxqosnull;
13759     uint32    txassocreq;
13760     uint32    rxassocreq;
13761     uint32    txreassocreq;
13762     uint32    rxreassocreq;
13763     uint32    txdisassoc;
13764     uint32    rxdisassoc;
13765     uint32    txassocrsp;
13766     uint32    rxassocrsp;
13767     uint32    txreassocrsp;
13768     uint32    rxreassocrsp;
13769     uint32    txauth;
13770     uint32    rxauth;
13771     uint32    txdeauth;
13772     uint32    rxdeauth;
13773     uint32    txprobereq;
13774     uint32    rxprobereq;
13775     uint32    txprobersp;
13776     uint32    rxprobersp;
13777     uint32    txaction;
13778     uint32    rxaction;
13779     uint32    txpspoll;
13780     uint32    rxpspoll;
13781 } wl_if_mgt_stats_t;
13782 
13783 #define WL_INFRA_STATS_VERSION_V1    1
13784 /* Associated stats type: WL_IFSTATS_INFRA_SPECIFIC */
13785 typedef struct wl_infra_stats {
13786     uint16 version;             /**< version of the structure */
13787     uint8  pad[2];
13788     uint32 rxbeaconmbss;
13789     uint32 tbtt;
13790 } wl_if_infra_stats_t;
13791 
13792 typedef struct csa_event_data {
13793     chanspec_t chan_old;
13794     dot11_ext_csa_ie_t ecsa;
13795     dot11_mesh_csp_ie_t mcsp;
13796     dot11_wide_bw_chan_switch_ie_t wbcs;
13797     uint8 PAD;
13798 } csa_event_data_t;
13799 
13800 #endif /* _wlioctl_h_ */
13801