Home | History | Annotate | Download | only in include
      1 /*
      2  * Custom OID/ioctl definitions for
      3  * Broadcom 802.11abg Networking Device Driver
      4  *
      5  * Definitions subject to change without notice.
      6  *
      7  * Copyright (C) 1999-2013, Broadcom Corporation
      8  *
      9  * Permission to use, copy, modify, and/or distribute this software for any
     10  * purpose with or without fee is hereby granted, provided that the above
     11  * copyright notice and this permission notice appear in all copies.
     12  *
     13  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     15  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
     16  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
     18  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
     19  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     20  *
     21  *
     22  * $Id: wlioctl.h 386120 2013-02-19 19:25:44Z $
     23  */
     24 
     25 #ifndef _wlioctl_h_
     26 #define	_wlioctl_h_
     27 
     28 #include <typedefs.h>
     29 #include <proto/ethernet.h>
     30 #include <proto/bcmeth.h>
     31 #include <proto/bcmevent.h>
     32 #include <proto/802.11.h>
     33 #include <bcmwifi_channels.h>
     34 #include <bcmwifi_rates.h>
     35 
     36 #ifndef LINUX_POSTMOGRIFY_REMOVAL
     37 #include <bcm_mpool_pub.h>
     38 #include <bcmcdc.h>
     39 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
     40 
     41 /*  LINUX_POSTMOGRIFY_REMOVAL: undefined during compile phase, so its
     42  *  a no-op for most cases. For hybrid and other open source releases,
     43  *  its defined during a second pass and mogrified out for distribution.
     44  */
     45 
     46 
     47 #ifndef LINUX_POSTMOGRIFY_REMOVAL
     48 
     49 #ifndef INTF_NAME_SIZ
     50 #define INTF_NAME_SIZ	16
     51 #endif
     52 
     53 /* Used to send ioctls over the transport pipe */
     54 typedef struct remote_ioctl {
     55 	cdc_ioctl_t 	msg;
     56 	uint		data_len;
     57 	char            intf_name[INTF_NAME_SIZ];
     58 } rem_ioctl_t;
     59 #define REMOTE_SIZE	sizeof(rem_ioctl_t)
     60 
     61 
     62 typedef struct {
     63 	uint32 num;
     64 	chanspec_t list[1];
     65 } chanspec_list_t;
     66 
     67 #define ACTION_FRAME_SIZE 1800
     68 
     69 typedef struct wl_action_frame {
     70 	struct ether_addr 	da;
     71 	uint16 			len;
     72 	uint32 			packetId;
     73 	uint8			data[ACTION_FRAME_SIZE];
     74 } wl_action_frame_t;
     75 
     76 #define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame)
     77 
     78 typedef struct ssid_info
     79 {
     80 	uint8		ssid_len;	/* the length of SSID */
     81 	uint8		ssid[32];	/* SSID string */
     82 } ssid_info_t;
     83 
     84 typedef struct wl_af_params {
     85 	uint32 			channel;
     86 	int32 			dwell_time;
     87 	struct ether_addr 	BSSID;
     88 	wl_action_frame_t	action_frame;
     89 } wl_af_params_t;
     90 
     91 #define WL_WIFI_AF_PARAMS_SIZE sizeof(struct wl_af_params)
     92 
     93 #define MFP_TEST_FLAG_NORMAL	0
     94 #define MFP_TEST_FLAG_ANY_KEY	1
     95 typedef struct wl_sa_query {
     96 	uint32			flag;
     97 	uint8 			action;
     98 	uint16 			id;
     99 	struct ether_addr 	da;
    100 } wl_sa_query_t;
    101 
    102 #endif /*  LINUX_POSTMOGRIFY_REMOVAL */
    103 
    104 /* require default structure packing */
    105 #define BWL_DEFAULT_PACKING
    106 #include <packed_section_start.h>
    107 
    108 
    109 #ifndef LINUX_POSTMOGRIFY_REMOVAL
    110 /* Legacy structure to help keep backward compatible wl tool and tray app */
    111 
    112 #define	LEGACY_WL_BSS_INFO_VERSION	107	/* older version of wl_bss_info struct */
    113 
    114 typedef struct wl_bss_info_107 {
    115 	uint32		version;		/* version field */
    116 	uint32		length;			/* byte length of data in this record,
    117 						 * starting at version and including IEs
    118 						 */
    119 	struct ether_addr BSSID;
    120 	uint16		beacon_period;		/* units are Kusec */
    121 	uint16		capability;		/* Capability information */
    122 	uint8		SSID_len;
    123 	uint8		SSID[32];
    124 	struct {
    125 		uint	count;			/* # rates in this set */
    126 		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
    127 	} rateset;				/* supported rates */
    128 	uint8		channel;		/* Channel no. */
    129 	uint16		atim_window;		/* units are Kusec */
    130 	uint8		dtim_period;		/* DTIM period */
    131 	int16		RSSI;			/* receive signal strength (in dBm) */
    132 	int8		phy_noise;		/* noise (in dBm) */
    133 	uint32		ie_length;		/* byte length of Information Elements */
    134 	/* variable length Information Elements */
    135 } wl_bss_info_107_t;
    136 
    137 /*
    138  * Per-BSS information structure.
    139  */
    140 
    141 #define	LEGACY2_WL_BSS_INFO_VERSION	108		/* old version of wl_bss_info struct */
    142 
    143 /* BSS info structure
    144  * Applications MUST CHECK ie_offset field and length field to access IEs and
    145  * next bss_info structure in a vector (in wl_scan_results_t)
    146  */
    147 typedef struct wl_bss_info_108 {
    148 	uint32		version;		/* version field */
    149 	uint32		length;			/* byte length of data in this record,
    150 						 * starting at version and including IEs
    151 						 */
    152 	struct ether_addr BSSID;
    153 	uint16		beacon_period;		/* units are Kusec */
    154 	uint16		capability;		/* Capability information */
    155 	uint8		SSID_len;
    156 	uint8		SSID[32];
    157 	struct {
    158 		uint	count;			/* # rates in this set */
    159 		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
    160 	} rateset;				/* supported rates */
    161 	chanspec_t	chanspec;		/* chanspec for bss */
    162 	uint16		atim_window;		/* units are Kusec */
    163 	uint8		dtim_period;		/* DTIM period */
    164 	int16		RSSI;			/* receive signal strength (in dBm) */
    165 	int8		phy_noise;		/* noise (in dBm) */
    166 
    167 	uint8		n_cap;			/* BSS is 802.11N Capable */
    168 	uint32		nbss_cap;		/* 802.11N BSS Capabilities (based on HT_CAP_*) */
    169 	uint8		ctl_ch;			/* 802.11N BSS control channel number */
    170 	uint32		reserved32[1];		/* Reserved for expansion of BSS properties */
    171 	uint8		flags;			/* flags */
    172 	uint8		reserved[3];		/* Reserved for expansion of BSS properties */
    173 	uint8		basic_mcs[MCSSET_LEN];	/* 802.11N BSS required MCS set */
    174 
    175 	uint16		ie_offset;		/* offset at which IEs start, from beginning */
    176 	uint32		ie_length;		/* byte length of Information Elements */
    177 	/* Add new fields here */
    178 	/* variable length Information Elements */
    179 } wl_bss_info_108_t;
    180 
    181 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
    182 
    183 #define	WL_BSS_INFO_VERSION	109		/* current version of wl_bss_info struct */
    184 
    185 /* BSS info structure
    186  * Applications MUST CHECK ie_offset field and length field to access IEs and
    187  * next bss_info structure in a vector (in wl_scan_results_t)
    188  */
    189 typedef struct wl_bss_info {
    190 	uint32		version;		/* version field */
    191 	uint32		length;			/* byte length of data in this record,
    192 						 * starting at version and including IEs
    193 						 */
    194 	struct ether_addr BSSID;
    195 	uint16		beacon_period;		/* units are Kusec */
    196 	uint16		capability;		/* Capability information */
    197 	uint8		SSID_len;
    198 	uint8		SSID[32];
    199 	struct {
    200 		uint	count;			/* # rates in this set */
    201 		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
    202 	} rateset;				/* supported rates */
    203 	chanspec_t	chanspec;		/* chanspec for bss */
    204 	uint16		atim_window;		/* units are Kusec */
    205 	uint8		dtim_period;		/* DTIM period */
    206 	int16		RSSI;			/* receive signal strength (in dBm) */
    207 	int8		phy_noise;		/* noise (in dBm) */
    208 
    209 	uint8		n_cap;			/* BSS is 802.11N Capable */
    210 	uint32		nbss_cap;		/* 802.11N+AC BSS Capabilities */
    211 	uint8		ctl_ch;			/* 802.11N BSS control channel number */
    212 	uint8		padding1[3];		/* explicit struct alignment padding */
    213 	uint16		vht_rxmcsmap;		/* VHT rx mcs map (802.11ac VHT_CAP_MCS_MAP_*) */
    214 	uint16		vht_txmcsmap;		/* VHT tx mcs map (802.11ac VHT_CAP_MCS_MAP_*) */
    215 	uint8		flags;			/* flags */
    216 	uint8		vht_cap;		/* BSS is vht capable */
    217 	uint8		reserved[2];		/* Reserved for expansion of BSS properties */
    218 	uint8		basic_mcs[MCSSET_LEN];	/* 802.11N BSS required MCS set */
    219 
    220 	uint16		ie_offset;		/* offset at which IEs start, from beginning */
    221 	uint32		ie_length;		/* byte length of Information Elements */
    222 	int16		SNR;			/* average SNR of during frame reception */
    223 	/* Add new fields here */
    224 	/* variable length Information Elements */
    225 } wl_bss_info_t;
    226 
    227 /* bss_info_cap_t flags */
    228 #define WL_BSS_FLAGS_FROM_BEACON	0x01	/* bss_info derived from beacon */
    229 #define WL_BSS_FLAGS_FROM_CACHE		0x02	/* bss_info collected from cache */
    230 #define WL_BSS_FLAGS_RSSI_ONCHANNEL 0x04 /* rssi info was received on channel (vs offchannel) */
    231 
    232 /* bssinfo flag for nbss_cap */
    233 #define VHT_BI_SGI_80MHZ			0x00000100
    234 
    235 #ifndef LINUX_POSTMOGRIFY_REMOVAL
    236 
    237 typedef struct wl_bsscfg {
    238 	uint32	wsec;
    239 	uint32	WPA_auth;
    240 	uint32	wsec_index;
    241 	uint32	associated;
    242 	uint32	BSS;
    243 	uint32	phytest_on;
    244 	struct ether_addr	prev_BSSID;
    245 	struct ether_addr	BSSID;
    246 	uint32  targetbss_wpa2_flags;
    247 	uint32 assoc_type;
    248 	uint32 assoc_state;
    249 } wl_bsscfg_t;
    250 
    251 typedef struct wl_bss_config {
    252 	uint32	atim_window;
    253 	uint32	beacon_period;
    254 	uint32	chanspec;
    255 } wl_bss_config_t;
    256 
    257 #define DLOAD_HANDLER_VER			1	/* Downloader version */
    258 #define DLOAD_FLAG_VER_MASK		0xf000	/* Downloader version mask */
    259 #define DLOAD_FLAG_VER_SHIFT	12	/* Downloader version shift */
    260 
    261 #define DL_CRC_NOT_INUSE 			0x0001
    262 
    263 /* generic download types & flags */
    264 enum {
    265 	DL_TYPE_UCODE = 1,
    266 	DL_TYPE_CLM = 2
    267 };
    268 
    269 /* ucode type values */
    270 enum {
    271 	UCODE_FW,
    272 	INIT_VALS,
    273 	BS_INIT_VALS
    274 };
    275 
    276 struct wl_dload_data {
    277 	uint16 flag;
    278 	uint16 dload_type;
    279 	uint32 len;
    280 	uint32 crc;
    281 	uint8  data[1];
    282 };
    283 typedef struct wl_dload_data wl_dload_data_t;
    284 
    285 struct wl_ucode_info {
    286 	uint32 ucode_type;
    287 	uint32 num_chunks;
    288 	uint32 chunk_len;
    289 	uint32 chunk_num;
    290 	uint8  data_chunk[1];
    291 };
    292 typedef struct wl_ucode_info wl_ucode_info_t;
    293 
    294 struct wl_clm_dload_info {
    295 	uint32 ds_id;
    296 	uint32 clm_total_len;
    297 	uint32 num_chunks;
    298 	uint32 chunk_len;
    299 	uint32 chunk_offset;
    300 	uint8  data_chunk[1];
    301 };
    302 typedef struct wl_clm_dload_info wl_clm_dload_info_t;
    303 
    304 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
    305 
    306 typedef struct wlc_ssid {
    307 	uint32		SSID_len;
    308 	uchar		SSID[DOT11_MAX_SSID_LEN];
    309 } wlc_ssid_t;
    310 
    311 #ifndef LINUX_POSTMOGRIFY_REMOVAL
    312 
    313 #define MAX_PREFERRED_AP_NUM     5
    314 typedef struct wlc_fastssidinfo {
    315 	uint32				SSID_channel[MAX_PREFERRED_AP_NUM];
    316 	wlc_ssid_t		SSID_info[MAX_PREFERRED_AP_NUM];
    317 } wlc_fastssidinfo_t;
    318 
    319 typedef BWL_PRE_PACKED_STRUCT struct wnm_url {
    320 	uint8   len;
    321 	uint8   data[1];
    322 } BWL_POST_PACKED_STRUCT wnm_url_t;
    323 
    324 typedef struct chan_scandata {
    325 	uint8		txpower;
    326 	uint8		pad;
    327 	chanspec_t	channel;	/* Channel num, bw, ctrl_sb and band */
    328 	uint32		channel_mintime;
    329 	uint32		channel_maxtime;
    330 } chan_scandata_t;
    331 
    332 typedef enum wl_scan_type {
    333 	EXTDSCAN_FOREGROUND_SCAN,
    334 	EXTDSCAN_BACKGROUND_SCAN,
    335 	EXTDSCAN_FORCEDBACKGROUND_SCAN
    336 } wl_scan_type_t;
    337 
    338 #define WLC_EXTDSCAN_MAX_SSID		5
    339 
    340 typedef struct wl_extdscan_params {
    341 	int8 		nprobes;		/* 0, passive, otherwise active */
    342 	int8    	split_scan;		/* split scan */
    343 	int8		band;			/* band */
    344 	int8		pad;
    345 	wlc_ssid_t 	ssid[WLC_EXTDSCAN_MAX_SSID]; /* ssid list */
    346 	uint32		tx_rate;		/* in 500ksec units */
    347 	wl_scan_type_t	scan_type;		/* enum */
    348 	int32 		channel_num;
    349 	chan_scandata_t channel_list[1];	/* list of chandata structs */
    350 } wl_extdscan_params_t;
    351 
    352 #define WL_EXTDSCAN_PARAMS_FIXED_SIZE 	(sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
    353 
    354 #define WL_BSSTYPE_INFRA 1
    355 #define WL_BSSTYPE_INDEP 0
    356 #define WL_BSSTYPE_ANY   2
    357 
    358 /* Bitmask for scan_type */
    359 #define WL_SCANFLAGS_PASSIVE	0x01	/* force passive scan */
    360 #define WL_SCANFLAGS_RESERVED	0x02	/* Reserved */
    361 #define WL_SCANFLAGS_PROHIBITED	0x04	/* allow scanning prohibited channels */
    362 #define WL_SCANFLAGS_OFFCHAN	0x08	/* allow scanning/reporting off-channel APs */
    363 #define WL_SCANFLAGS_HOTSPOT	0x10	/* automatic ANQP to hotspot APs */
    364 
    365 #define WL_SCAN_PARAMS_SSID_MAX 	10
    366 
    367 typedef struct wl_scan_params {
    368 	wlc_ssid_t ssid;		/* default: {0, ""} */
    369 	struct ether_addr bssid;	/* default: bcast */
    370 	int8 bss_type;			/* default: any,
    371 					 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
    372 					 */
    373 	uint8 scan_type;		/* flags, 0 use default */
    374 	int32 nprobes;			/* -1 use default, number of probes per channel */
    375 	int32 active_time;		/* -1 use default, dwell time per channel for
    376 					 * active scanning
    377 					 */
    378 	int32 passive_time;		/* -1 use default, dwell time per channel
    379 					 * for passive scanning
    380 					 */
    381 	int32 home_time;		/* -1 use default, dwell time for the home channel
    382 					 * between channel scans
    383 					 */
    384 	int32 channel_num;		/* count of channels and ssids that follow
    385 					 *
    386 					 * low half is count of channels in channel_list, 0
    387 					 * means default (use all available channels)
    388 					 *
    389 					 * high half is entries in wlc_ssid_t array that
    390 					 * follows channel_list, aligned for int32 (4 bytes)
    391 					 * meaning an odd channel count implies a 2-byte pad
    392 					 * between end of channel_list and first ssid
    393 					 *
    394 					 * if ssid count is zero, single ssid in the fixed
    395 					 * parameter portion is assumed, otherwise ssid in
    396 					 * the fixed portion is ignored
    397 					 */
    398 	uint16 channel_list[1];		/* list of chanspecs */
    399 } wl_scan_params_t;
    400 
    401 /* size of wl_scan_params not including variable length array */
    402 #define WL_SCAN_PARAMS_FIXED_SIZE 64
    403 
    404 /* masks for channel and ssid count */
    405 #define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff
    406 #define WL_SCAN_PARAMS_NSSID_SHIFT 16
    407 
    408 #define WL_SCAN_ACTION_START      1
    409 #define WL_SCAN_ACTION_CONTINUE   2
    410 #define WL_SCAN_ACTION_ABORT      3
    411 
    412 #define ISCAN_REQ_VERSION 1
    413 
    414 /* incremental scan struct */
    415 typedef struct wl_iscan_params {
    416 	uint32 version;
    417 	uint16 action;
    418 	uint16 scan_duration;
    419 	wl_scan_params_t params;
    420 } wl_iscan_params_t;
    421 
    422 /* 3 fields + size of wl_scan_params, not including variable length array */
    423 #define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
    424 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
    425 
    426 typedef struct wl_scan_results {
    427 	uint32 buflen;
    428 	uint32 version;
    429 	uint32 count;
    430 	wl_bss_info_t bss_info[1];
    431 } wl_scan_results_t;
    432 
    433 #ifndef LINUX_POSTMOGRIFY_REMOVAL
    434 /* size of wl_scan_results not including variable length array */
    435 #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
    436 
    437 /* wl_iscan_results status values */
    438 #define WL_SCAN_RESULTS_SUCCESS	0
    439 #define WL_SCAN_RESULTS_PARTIAL	1
    440 #define WL_SCAN_RESULTS_PENDING	2
    441 #define WL_SCAN_RESULTS_ABORTED	3
    442 #define WL_SCAN_RESULTS_NO_MEM  4
    443 
    444 /* Used in EXT_STA */
    445 #define DNGL_RXCTXT_SIZE	45
    446 
    447 
    448 #define ESCAN_REQ_VERSION 1
    449 
    450 typedef struct wl_escan_params {
    451 	uint32 version;
    452 	uint16 action;
    453 	uint16 sync_id;
    454 	wl_scan_params_t params;
    455 } wl_escan_params_t;
    456 
    457 #define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
    458 
    459 typedef struct wl_escan_result {
    460 	uint32 buflen;
    461 	uint32 version;
    462 	uint16 sync_id;
    463 	uint16 bss_count;
    464 	wl_bss_info_t bss_info[1];
    465 } wl_escan_result_t;
    466 
    467 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
    468 
    469 /* incremental scan results struct */
    470 typedef struct wl_iscan_results {
    471 	uint32 status;
    472 	wl_scan_results_t results;
    473 } wl_iscan_results_t;
    474 
    475 /* size of wl_iscan_results not including variable length array */
    476 #define WL_ISCAN_RESULTS_FIXED_SIZE \
    477 	(WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
    478 
    479 typedef struct wl_probe_params {
    480 	wlc_ssid_t ssid;
    481 	struct ether_addr bssid;
    482 	struct ether_addr mac;
    483 } wl_probe_params_t;
    484 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
    485 
    486 #define WL_MAXRATES_IN_SET		16	/* max # of rates in a rateset */
    487 typedef struct wl_rateset {
    488 	uint32	count;			/* # rates in this set */
    489 	uint8	rates[WL_MAXRATES_IN_SET];	/* rates in 500kbps units w/hi bit set if basic */
    490 } wl_rateset_t;
    491 
    492 typedef struct wl_rateset_args {
    493 	uint32	count;			/* # rates in this set */
    494 	uint8	rates[WL_MAXRATES_IN_SET];	/* rates in 500kbps units w/hi bit set if basic */
    495 	uint8   mcs[MCSSET_LEN];        /* supported mcs index bit map */
    496 	uint16 vht_mcs[VHT_CAP_MCS_MAP_NSS_MAX]; /* supported mcs index bit map per nss */
    497 } wl_rateset_args_t;
    498 
    499 /* uint32 list */
    500 typedef struct wl_uint32_list {
    501 	/* in - # of elements, out - # of entries */
    502 	uint32 count;
    503 	/* variable length uint32 list */
    504 	uint32 element[1];
    505 } wl_uint32_list_t;
    506 
    507 /* used for association with a specific BSSID and chanspec list */
    508 typedef struct wl_assoc_params {
    509 	struct ether_addr bssid;	/* 00:00:00:00:00:00: broadcast scan */
    510 	uint16 bssid_cnt;		/* 0: use chanspec_num, and the single bssid,
    511 					 * otherwise count of chanspecs in chanspec_list
    512 					 * AND paired bssids following chanspec_list
    513 					 */
    514 	int32 chanspec_num;		/* 0: all available channels,
    515 					 * otherwise count of chanspecs in chanspec_list
    516 					 */
    517 	chanspec_t chanspec_list[1];	/* list of chanspecs */
    518 } wl_assoc_params_t;
    519 #define WL_ASSOC_PARAMS_FIXED_SIZE 	OFFSETOF(wl_assoc_params_t, chanspec_list)
    520 
    521 /* used for reassociation/roam to a specific BSSID and channel */
    522 typedef wl_assoc_params_t wl_reassoc_params_t;
    523 #define WL_REASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
    524 
    525 /* used for association to a specific BSSID and channel */
    526 typedef wl_assoc_params_t wl_join_assoc_params_t;
    527 #define WL_JOIN_ASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
    528 
    529 /* used for join with or without a specific bssid and channel list */
    530 typedef struct wl_join_params {
    531 	wlc_ssid_t ssid;
    532 	wl_assoc_params_t params;	/* optional field, but it must include the fixed portion
    533 					 * of the wl_assoc_params_t struct when it does present.
    534 					 */
    535 } wl_join_params_t;
    536 
    537 #ifndef  LINUX_POSTMOGRIFY_REMOVAL
    538 #define WL_JOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_join_params_t, params) + \
    539 					 WL_ASSOC_PARAMS_FIXED_SIZE)
    540 /* scan params for extended join */
    541 typedef struct wl_join_scan_params {
    542 	uint8 scan_type;		/* 0 use default, active or passive scan */
    543 	int32 nprobes;			/* -1 use default, number of probes per channel */
    544 	int32 active_time;		/* -1 use default, dwell time per channel for
    545 					 * active scanning
    546 					 */
    547 	int32 passive_time;		/* -1 use default, dwell time per channel
    548 					 * for passive scanning
    549 					 */
    550 	int32 home_time;		/* -1 use default, dwell time for the home channel
    551 					 * between channel scans
    552 					 */
    553 } wl_join_scan_params_t;
    554 
    555 /* extended join params */
    556 typedef struct wl_extjoin_params {
    557 	wlc_ssid_t ssid;		/* {0, ""}: wildcard scan */
    558 	wl_join_scan_params_t scan;
    559 	wl_join_assoc_params_t assoc;	/* optional field, but it must include the fixed portion
    560 					 * of the wl_join_assoc_params_t struct when it does
    561 					 * present.
    562 					 */
    563 } wl_extjoin_params_t;
    564 #define WL_EXTJOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_extjoin_params_t, assoc) + \
    565 					 WL_JOIN_ASSOC_PARAMS_FIXED_SIZE)
    566 
    567 /* All builds use the new 11ac ratespec/chanspec */
    568 #undef  D11AC_IOTYPES
    569 #define D11AC_IOTYPES
    570 
    571 #ifndef D11AC_IOTYPES
    572 
    573 /* defines used by the nrate iovar */
    574 #define NRATE_MCS_INUSE	0x00000080	/* MSC in use,indicates b0-6 holds an mcs */
    575 #define NRATE_RATE_MASK 0x0000007f	/* rate/mcs value */
    576 #define NRATE_STF_MASK	0x0000ff00	/* stf mode mask: siso, cdd, stbc, sdm */
    577 #define NRATE_STF_SHIFT	8			/* stf mode shift */
    578 #define NRATE_OVERRIDE	0x80000000	/* bit indicates override both rate & mode */
    579 #define NRATE_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicate to override mcs only */
    580 #define NRATE_SGI_MASK  0x00800000      /* sgi mode */
    581 #define NRATE_SGI_SHIFT 23              /* sgi mode */
    582 #define NRATE_LDPC_CODING 0x00400000    /* bit indicates adv coding in use */
    583 #define NRATE_LDPC_SHIFT 22             /* ldpc shift */
    584 
    585 #define NRATE_STF_SISO	0		/* stf mode SISO */
    586 #define NRATE_STF_CDD	1		/* stf mode CDD */
    587 #define NRATE_STF_STBC	2		/* stf mode STBC */
    588 #define NRATE_STF_SDM	3		/* stf mode SDM */
    589 
    590 #else /* D11AC_IOTYPES */
    591 
    592 /* WL_RSPEC defines for rate information */
    593 #define WL_RSPEC_RATE_MASK      0x000000FF      /* rate or HT MCS value */
    594 #define WL_RSPEC_VHT_MCS_MASK   0x0000000F      /* VHT MCS value */
    595 #define WL_RSPEC_VHT_NSS_MASK   0x000000F0      /* VHT Nss value */
    596 #define WL_RSPEC_VHT_NSS_SHIFT  4               /* VHT Nss value shift */
    597 #define WL_RSPEC_TXEXP_MASK     0x00000300
    598 #define WL_RSPEC_TXEXP_SHIFT    8
    599 #define WL_RSPEC_BW_MASK        0x00070000      /* bandwidth mask */
    600 #define WL_RSPEC_BW_SHIFT       16              /* bandwidth shift */
    601 #define WL_RSPEC_STBC           0x00100000      /* STBC encoding, Nsts = 2 x Nss */
    602 #define WL_RSPEC_TXBF           0x00200000      /* bit indicates TXBF mode */
    603 #define WL_RSPEC_LDPC           0x00400000      /* bit indicates adv coding in use */
    604 #define WL_RSPEC_SGI            0x00800000      /* Short GI mode */
    605 #define WL_RSPEC_ENCODING_MASK  0x03000000      /* Encoding of Rate/MCS field */
    606 #define WL_RSPEC_OVERRIDE_RATE  0x40000000      /* bit indicate to override mcs only */
    607 #define WL_RSPEC_OVERRIDE_MODE  0x80000000      /* bit indicates override both rate & mode */
    608 
    609 /* WL_RSPEC_ENCODING field defs */
    610 #define WL_RSPEC_ENCODE_RATE    0x00000000      /* Legacy rate is stored in RSPEC_RATE_MASK */
    611 #define WL_RSPEC_ENCODE_HT      0x01000000      /* HT MCS is stored in RSPEC_RATE_MASK */
    612 #define WL_RSPEC_ENCODE_VHT     0x02000000      /* VHT MCS and Nss is stored in RSPEC_RATE_MASK */
    613 
    614 /* WL_RSPEC_BW field defs */
    615 #define WL_RSPEC_BW_UNSPECIFIED 0
    616 #define WL_RSPEC_BW_20MHZ       0x00010000
    617 #define WL_RSPEC_BW_40MHZ       0x00020000
    618 #define WL_RSPEC_BW_80MHZ       0x00030000
    619 #define WL_RSPEC_BW_160MHZ      0x00040000
    620 
    621 /* Legacy defines for the nrate iovar */
    622 #define OLD_NRATE_MCS_INUSE         0x00000080 /* MSC in use,indicates b0-6 holds an mcs */
    623 #define OLD_NRATE_RATE_MASK         0x0000007f /* rate/mcs value */
    624 #define OLD_NRATE_STF_MASK          0x0000ff00 /* stf mode mask: siso, cdd, stbc, sdm */
    625 #define OLD_NRATE_STF_SHIFT         8          /* stf mode shift */
    626 #define OLD_NRATE_OVERRIDE          0x80000000 /* bit indicates override both rate & mode */
    627 #define OLD_NRATE_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicate to override mcs only */
    628 #define OLD_NRATE_SGI               0x00800000 /* sgi mode */
    629 #define OLD_NRATE_LDPC_CODING       0x00400000 /* bit indicates adv coding in use */
    630 
    631 #define OLD_NRATE_STF_SISO	0		/* stf mode SISO */
    632 #define OLD_NRATE_STF_CDD	1		/* stf mode CDD */
    633 #define OLD_NRATE_STF_STBC	2		/* stf mode STBC */
    634 #define OLD_NRATE_STF_SDM	3		/* stf mode SDM */
    635 
    636 #endif /* D11AC_IOTYPES */
    637 
    638 #define ANTENNA_NUM_1	1		/* total number of antennas to be used */
    639 #define ANTENNA_NUM_2	2
    640 #define ANTENNA_NUM_3	3
    641 #define ANTENNA_NUM_4	4
    642 
    643 #define ANT_SELCFG_AUTO		0x80	/* bit indicates antenna sel AUTO */
    644 #define ANT_SELCFG_MASK		0x33	/* antenna configuration mask */
    645 #define ANT_SELCFG_MAX		4	/* max number of antenna configurations */
    646 #define ANT_SELCFG_TX_UNICAST	0	/* unicast tx antenna configuration */
    647 #define ANT_SELCFG_RX_UNICAST	1	/* unicast rx antenna configuration */
    648 #define ANT_SELCFG_TX_DEF	2	/* default tx antenna configuration */
    649 #define ANT_SELCFG_RX_DEF	3	/* default rx antenna configuration */
    650 
    651 #define MAX_STREAMS_SUPPORTED	4	/* max number of streams supported */
    652 
    653 typedef struct {
    654 	uint8 ant_config[ANT_SELCFG_MAX];	/* antenna configuration */
    655 	uint8 num_antcfg;	/* number of available antenna configurations */
    656 } wlc_antselcfg_t;
    657 
    658 #define HIGHEST_SINGLE_STREAM_MCS	7 /* MCS values greater than this enable multiple streams */
    659 
    660 #define MAX_CCA_CHANNELS 38	/* Max number of 20 Mhz wide channels */
    661 #define MAX_CCA_SECS     60	/* CCA keeps this many seconds history */
    662 
    663 #define IBSS_MED        15	/* Mediom in-bss congestion percentage */
    664 #define IBSS_HI         25	/* Hi in-bss congestion percentage */
    665 #define OBSS_MED        12
    666 #define OBSS_HI         25
    667 #define INTERFER_MED    5
    668 #define INTERFER_HI     10
    669 
    670 #define  CCA_FLAG_2G_ONLY		0x01	/* Return a channel from 2.4 Ghz band */
    671 #define  CCA_FLAG_5G_ONLY		0x02	/* Return a channel from 2.4 Ghz band */
    672 #define  CCA_FLAG_IGNORE_DURATION	0x04	/* Ignore dwell time for each channel */
    673 #define  CCA_FLAGS_PREFER_1_6_11	0x10
    674 #define  CCA_FLAG_IGNORE_INTERFER 	0x20 /* do not exlude channel based on interfer level */
    675 
    676 #define CCA_ERRNO_BAND 		1	/* After filtering for band pref, no choices left */
    677 #define CCA_ERRNO_DURATION	2	/* After filtering for duration, no choices left */
    678 #define CCA_ERRNO_PREF_CHAN	3	/* After filtering for chan pref, no choices left */
    679 #define CCA_ERRNO_INTERFER	4	/* After filtering for interference, no choices left */
    680 #define CCA_ERRNO_TOO_FEW	5	/* Only 1 channel was input */
    681 
    682 typedef struct {
    683 	uint32 duration;	/* millisecs spent sampling this channel */
    684 	uint32 congest_ibss;	/* millisecs in our bss (presumably this traffic will */
    685 				/*  move if cur bss moves channels) */
    686 	uint32 congest_obss;	/* traffic not in our bss */
    687 	uint32 interference;	/* millisecs detecting a non 802.11 interferer. */
    688 	uint32 timestamp;	/* second timestamp */
    689 } cca_congest_t;
    690 
    691 typedef struct {
    692 	chanspec_t chanspec;	/* Which channel? */
    693 	uint8 num_secs;		/* How many secs worth of data */
    694 	cca_congest_t  secs[1];	/* Data */
    695 } cca_congest_channel_req_t;
    696 
    697 /* interference source detection and identification mode */
    698 #define ITFR_MODE_DISABLE	0	/* disable feature */
    699 #define ITFR_MODE_MANUAL_ENABLE	1	/* enable manual detection */
    700 #define ITFR_MODE_AUTO_ENABLE	2	/* enable auto detection */
    701 
    702 /* interference sources */
    703 enum interference_source {
    704 	ITFR_NONE = 0,		/* interference */
    705 	ITFR_PHONE,		/* wireless phone */
    706 	ITFR_VIDEO_CAMERA,	/* wireless video camera */
    707 	ITFR_MICROWAVE_OVEN,	/* microwave oven */
    708 	ITFR_BABY_MONITOR,	/* wireless baby monitor */
    709 	ITFR_BLUETOOTH,		/* bluetooth */
    710 	ITFR_VIDEO_CAMERA_OR_BABY_MONITOR,	/* wireless camera or baby monitor */
    711 	ITFR_BLUETOOTH_OR_BABY_MONITOR,	/* bluetooth or baby monitor */
    712 	ITFR_VIDEO_CAMERA_OR_PHONE,	/* video camera or phone */
    713 	ITFR_UNIDENTIFIED	/* interference from unidentified source */
    714 };
    715 
    716 /* structure for interference source report */
    717 typedef struct {
    718 	uint32 flags;	/* flags.  bit definitions below */
    719 	uint32 source;	/* last detected interference source */
    720 	uint32 timestamp;	/* second timestamp on interferenced flag change */
    721 } interference_source_rep_t;
    722 
    723 /* bit definitions for flags in interference source report */
    724 #define ITFR_INTERFERENCED	1	/* interference detected */
    725 #define ITFR_HOME_CHANNEL	2	/* home channel has interference */
    726 #define ITFR_NOISY_ENVIRONMENT	4	/* noisy environemnt so feature stopped */
    727 
    728 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
    729 
    730 #define WLC_CNTRY_BUF_SZ	4		/* Country string is 3 bytes + NUL */
    731 
    732 #ifndef LINUX_POSTMOGRIFY_REMOVAL
    733 
    734 typedef struct wl_country {
    735 	char country_abbrev[WLC_CNTRY_BUF_SZ];	/* nul-terminated country code used in
    736 						 * the Country IE
    737 						 */
    738 	int32 rev;				/* revision specifier for ccode
    739 						 * on set, -1 indicates unspecified.
    740 						 * on get, rev >= 0
    741 						 */
    742 	char ccode[WLC_CNTRY_BUF_SZ];		/* nul-terminated built-in country code.
    743 						 * variable length, but fixed size in
    744 						 * struct allows simple allocation for
    745 						 * expected country strings <= 3 chars.
    746 						 */
    747 } wl_country_t;
    748 
    749 typedef struct wl_channels_in_country {
    750 	uint32 buflen;
    751 	uint32 band;
    752 	char country_abbrev[WLC_CNTRY_BUF_SZ];
    753 	uint32 count;
    754 	uint32 channel[1];
    755 } wl_channels_in_country_t;
    756 
    757 typedef struct wl_country_list {
    758 	uint32 buflen;
    759 	uint32 band_set;
    760 	uint32 band;
    761 	uint32 count;
    762 	char country_abbrev[1];
    763 } wl_country_list_t;
    764 
    765 #define WL_NUM_RPI_BINS		8
    766 #define WL_RM_TYPE_BASIC	1
    767 #define WL_RM_TYPE_CCA		2
    768 #define WL_RM_TYPE_RPI		3
    769 
    770 #define WL_RM_FLAG_PARALLEL	(1<<0)
    771 
    772 #define WL_RM_FLAG_LATE		(1<<1)
    773 #define WL_RM_FLAG_INCAPABLE	(1<<2)
    774 #define WL_RM_FLAG_REFUSED	(1<<3)
    775 
    776 typedef struct wl_rm_req_elt {
    777 	int8	type;
    778 	int8	flags;
    779 	chanspec_t	chanspec;
    780 	uint32	token;		/* token for this measurement */
    781 	uint32	tsf_h;		/* TSF high 32-bits of Measurement start time */
    782 	uint32	tsf_l;		/* TSF low 32-bits */
    783 	uint32	dur;		/* TUs */
    784 } wl_rm_req_elt_t;
    785 
    786 typedef struct wl_rm_req {
    787 	uint32	token;		/* overall measurement set token */
    788 	uint32	count;		/* number of measurement requests */
    789 	void	*cb;		/* completion callback function: may be NULL */
    790 	void	*cb_arg;	/* arg to completion callback function */
    791 	wl_rm_req_elt_t	req[1];	/* variable length block of requests */
    792 } wl_rm_req_t;
    793 #define WL_RM_REQ_FIXED_LEN	OFFSETOF(wl_rm_req_t, req)
    794 
    795 typedef struct wl_rm_rep_elt {
    796 	int8	type;
    797 	int8	flags;
    798 	chanspec_t	chanspec;
    799 	uint32	token;		/* token for this measurement */
    800 	uint32	tsf_h;		/* TSF high 32-bits of Measurement start time */
    801 	uint32	tsf_l;		/* TSF low 32-bits */
    802 	uint32	dur;		/* TUs */
    803 	uint32	len;		/* byte length of data block */
    804 	uint8	data[1];	/* variable length data block */
    805 } wl_rm_rep_elt_t;
    806 #define WL_RM_REP_ELT_FIXED_LEN	24	/* length excluding data block */
    807 
    808 #define WL_RPI_REP_BIN_NUM 8
    809 typedef struct wl_rm_rpi_rep {
    810 	uint8	rpi[WL_RPI_REP_BIN_NUM];
    811 	int8	rpi_max[WL_RPI_REP_BIN_NUM];
    812 } wl_rm_rpi_rep_t;
    813 
    814 typedef struct wl_rm_rep {
    815 	uint32	token;		/* overall measurement set token */
    816 	uint32	len;		/* length of measurement report block */
    817 	wl_rm_rep_elt_t	rep[1];	/* variable length block of reports */
    818 } wl_rm_rep_t;
    819 #define WL_RM_REP_FIXED_LEN	8
    820 
    821 
    822 typedef enum sup_auth_status {
    823 	/* Basic supplicant authentication states */
    824 	WLC_SUP_DISCONNECTED = 0,
    825 	WLC_SUP_CONNECTING,
    826 	WLC_SUP_IDREQUIRED,
    827 	WLC_SUP_AUTHENTICATING,
    828 	WLC_SUP_AUTHENTICATED,
    829 	WLC_SUP_KEYXCHANGE,
    830 	WLC_SUP_KEYED,
    831 	WLC_SUP_TIMEOUT,
    832 	WLC_SUP_LAST_BASIC_STATE,
    833 
    834 	/* Extended supplicant authentication states */
    835 	/* Waiting to receive handshake msg M1 */
    836 	WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
    837 	/* Preparing to send handshake msg M2 */
    838 	WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
    839 	/* Waiting to receive handshake msg M3 */
    840 	WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
    841 	WLC_SUP_KEYXCHANGE_PREP_M4,	/* Preparing to send handshake msg M4 */
    842 	WLC_SUP_KEYXCHANGE_WAIT_G1,	/* Waiting to receive handshake msg G1 */
    843 	WLC_SUP_KEYXCHANGE_PREP_G2	/* Preparing to send handshake msg G2 */
    844 } sup_auth_status_t;
    845 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
    846 
    847 /* Enumerate crypto algorithms */
    848 #define	CRYPTO_ALGO_OFF			0
    849 #define	CRYPTO_ALGO_WEP1		1
    850 #define	CRYPTO_ALGO_TKIP		2
    851 #define	CRYPTO_ALGO_WEP128		3
    852 #define CRYPTO_ALGO_AES_CCM		4
    853 #define CRYPTO_ALGO_AES_OCB_MSDU	5
    854 #define CRYPTO_ALGO_AES_OCB_MPDU	6
    855 #if !defined(BCMEXTCCX)
    856 #define CRYPTO_ALGO_NALG		7
    857 #else
    858 #define CRYPTO_ALGO_CKIP		7
    859 #define CRYPTO_ALGO_CKIP_MMH		8
    860 #define CRYPTO_ALGO_WEP_MMH		9
    861 #define CRYPTO_ALGO_NALG		10
    862 #endif
    863 #define CRYPTO_ALGO_PMK			12	/* for 802.1x supp to set PMK before 4-way */
    864 #define CRYPTO_ALGO_BIP			13  /* 802.11w BIP (aes cmac) */
    865 
    866 #define WSEC_GEN_MIC_ERROR	0x0001
    867 #define WSEC_GEN_REPLAY		0x0002
    868 #define WSEC_GEN_ICV_ERROR	0x0004
    869 #define WSEC_GEN_MFP_ACT_ERROR	0x0008
    870 #define WSEC_GEN_MFP_DISASSOC_ERROR	0x0010
    871 #define WSEC_GEN_MFP_DEAUTH_ERROR	0x0020
    872 
    873 #define WL_SOFT_KEY	(1 << 0)	/* Indicates this key is using soft encrypt */
    874 #define WL_PRIMARY_KEY	(1 << 1)	/* Indicates this key is the primary (ie tx) key */
    875 #if defined(BCMEXTCCX)
    876 #define WL_CKIP_KP	(1 << 4)	/* CMIC */
    877 #define WL_CKIP_MMH	(1 << 5)	/* CKIP */
    878 #else
    879 #define WL_KF_RES_4	(1 << 4)	/* Reserved for backward compat */
    880 #define WL_KF_RES_5	(1 << 5)	/* Reserved for backward compat */
    881 #endif
    882 #define WL_IBSS_PEER_GROUP_KEY	(1 << 6)	/* Indicates a group key for a IBSS PEER */
    883 
    884 typedef struct wl_wsec_key {
    885 	uint32		index;		/* key index */
    886 	uint32		len;		/* key length */
    887 	uint8		data[DOT11_MAX_KEY_SIZE];	/* key data */
    888 	uint32		pad_1[18];
    889 	uint32		algo;		/* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
    890 	uint32		flags;		/* misc flags */
    891 	uint32		pad_2[2];
    892 	int		pad_3;
    893 	int		iv_initialized;	/* has IV been initialized already? */
    894 	int		pad_4;
    895 	/* Rx IV */
    896 	struct {
    897 		uint32	hi;		/* upper 32 bits of IV */
    898 		uint16	lo;		/* lower 16 bits of IV */
    899 	} rxiv;
    900 	uint32		pad_5[2];
    901 	struct ether_addr ea;		/* per station */
    902 } wl_wsec_key_t;
    903 
    904 #define WSEC_MIN_PSK_LEN	8
    905 #define WSEC_MAX_PSK_LEN	64
    906 
    907 /* Flag for key material needing passhash'ing */
    908 #define WSEC_PASSPHRASE		(1<<0)
    909 
    910 /* receptacle for WLC_SET_WSEC_PMK parameter */
    911 typedef struct {
    912 	ushort	key_len;		/* octets in key material */
    913 	ushort	flags;			/* key handling qualification */
    914 	uint8	key[WSEC_MAX_PSK_LEN];	/* PMK material */
    915 } wsec_pmk_t;
    916 
    917 /* wireless security bitvec */
    918 #define WEP_ENABLED		0x0001
    919 #define TKIP_ENABLED		0x0002
    920 #define AES_ENABLED		0x0004
    921 #define WSEC_SWFLAG		0x0008
    922 #define SES_OW_ENABLED		0x0040	/* to go into transition mode without setting wep */
    923 
    924 /* wsec macros for operating on the above definitions */
    925 #define WSEC_WEP_ENABLED(wsec)	((wsec) & WEP_ENABLED)
    926 #define WSEC_TKIP_ENABLED(wsec)	((wsec) & TKIP_ENABLED)
    927 #define WSEC_AES_ENABLED(wsec)	((wsec) & AES_ENABLED)
    928 
    929 #define WSEC_ENABLED(wsec)	((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
    930 #define WSEC_SES_OW_ENABLED(wsec)	((wsec) & SES_OW_ENABLED)
    931 
    932 #define MFP_CAPABLE		0x0200
    933 #define MFP_REQUIRED	0x0400
    934 #define MFP_SHA256		0x0800 /* a special configuration for STA for WIFI test tool */
    935 
    936 /* WPA authentication mode bitvec */
    937 #define WPA_AUTH_DISABLED	0x0000	/* Legacy (i.e., non-WPA) */
    938 #define WPA_AUTH_NONE		0x0001	/* none (IBSS) */
    939 #define WPA_AUTH_UNSPECIFIED	0x0002	/* over 802.1x */
    940 #define WPA_AUTH_PSK		0x0004	/* Pre-shared key */
    941 #if defined(BCMEXTCCX)
    942 #define WPA_AUTH_CCKM		0x0008	/* CCKM */
    943 #define WPA2_AUTH_CCKM		0x0010	/* CCKM2 */
    944 #endif
    945 /* #define WPA_AUTH_8021X 0x0020 */	/* 802.1x, reserved */
    946 #define WPA2_AUTH_UNSPECIFIED	0x0040	/* over 802.1x */
    947 #define WPA2_AUTH_PSK		0x0080	/* Pre-shared key */
    948 #define BRCM_AUTH_PSK           0x0100  /* BRCM specific PSK */
    949 #define BRCM_AUTH_DPT		0x0200	/* DPT PSK without group keys */
    950 #define WPA2_AUTH_MFP           0x1000  /* MFP (11w) in contrast to CCX */
    951 #define WPA2_AUTH_TPK		0x2000 	/* TDLS Peer Key */
    952 #define WPA2_AUTH_FT		0x4000 	/* Fast Transition. */
    953 #define WPA_AUTH_PFN_ANY	0xffffffff	/* for PFN, match only ssid */
    954 
    955 /* pmkid */
    956 #define	MAXPMKID		16
    957 
    958 typedef struct _pmkid {
    959 	struct ether_addr	BSSID;
    960 	uint8			PMKID[WPA2_PMKID_LEN];
    961 } pmkid_t;
    962 
    963 typedef struct _pmkid_list {
    964 	uint32	npmkid;
    965 	pmkid_t	pmkid[1];
    966 } pmkid_list_t;
    967 
    968 typedef struct _pmkid_cand {
    969 	struct ether_addr	BSSID;
    970 	uint8			preauth;
    971 } pmkid_cand_t;
    972 
    973 typedef struct _pmkid_cand_list {
    974 	uint32	npmkid_cand;
    975 	pmkid_cand_t	pmkid_cand[1];
    976 } pmkid_cand_list_t;
    977 
    978 #ifndef LINUX_POSTMOGRIFY_REMOVAL
    979 typedef struct wl_assoc_info {
    980 	uint32		req_len;
    981 	uint32		resp_len;
    982 	uint32		flags;
    983 	struct dot11_assoc_req req;
    984 	struct ether_addr reassoc_bssid; /* used in reassoc's */
    985 	struct dot11_assoc_resp resp;
    986 } wl_assoc_info_t;
    987 
    988 /* flags */
    989 #define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */
    990 
    991 typedef struct wl_led_info {
    992 	uint32      index;      /* led index */
    993 	uint32      behavior;
    994 	uint8       activehi;
    995 } wl_led_info_t;
    996 
    997 
    998 /* srom read/write struct passed through ioctl */
    999 typedef struct {
   1000 	uint	byteoff;	/* byte offset */
   1001 	uint	nbytes;		/* number of bytes */
   1002 	uint16	buf[1];
   1003 } srom_rw_t;
   1004 
   1005 /* similar cis (srom or otp) struct [iovar: may not be aligned] */
   1006 typedef struct {
   1007 	uint32	source;		/* cis source */
   1008 	uint32	byteoff;	/* byte offset */
   1009 	uint32	nbytes;		/* number of bytes */
   1010 	/* data follows here */
   1011 } cis_rw_t;
   1012 
   1013 #define WLC_CIS_DEFAULT	0	/* built-in default */
   1014 #define WLC_CIS_SROM	1	/* source is sprom */
   1015 #define WLC_CIS_OTP	2	/* source is otp */
   1016 
   1017 /* R_REG and W_REG struct passed through ioctl */
   1018 typedef struct {
   1019 	uint32	byteoff;	/* byte offset of the field in d11regs_t */
   1020 	uint32	val;		/* read/write value of the field */
   1021 	uint32	size;		/* sizeof the field */
   1022 	uint	band;		/* band (optional) */
   1023 } rw_reg_t;
   1024 
   1025 /* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */
   1026 /* PCL - Power Control Loop */
   1027 /* current gain setting is replaced by user input */
   1028 #define WL_ATTEN_APP_INPUT_PCL_OFF	0	/* turn off PCL, apply supplied input */
   1029 #define WL_ATTEN_PCL_ON			1	/* turn on PCL */
   1030 /* current gain setting is maintained */
   1031 #define WL_ATTEN_PCL_OFF		2	/* turn off PCL. */
   1032 
   1033 typedef struct {
   1034 	uint16	auto_ctrl;	/* WL_ATTEN_XX */
   1035 	uint16	bb;		/* Baseband attenuation */
   1036 	uint16	radio;		/* Radio attenuation */
   1037 	uint16	txctl1;		/* Radio TX_CTL1 value */
   1038 } atten_t;
   1039 
   1040 /* Per-AC retry parameters */
   1041 struct wme_tx_params_s {
   1042 	uint8  short_retry;
   1043 	uint8  short_fallback;
   1044 	uint8  long_retry;
   1045 	uint8  long_fallback;
   1046 	uint16 max_rate;  /* In units of 512 Kbps */
   1047 };
   1048 
   1049 typedef struct wme_tx_params_s wme_tx_params_t;
   1050 
   1051 #define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
   1052 
   1053 typedef struct wl_plc_nodelist {
   1054 	uint count;			/* Number of nodes */
   1055 	struct _node {
   1056 		struct ether_addr ea;	/* Node ether address */
   1057 		uint32 node_type;	/* Node type */
   1058 		uint32 cost;		/* PLC affinity */
   1059 	} node[1];
   1060 } wl_plc_nodelist_t;
   1061 
   1062 typedef struct wl_plc_params {
   1063 	uint32	cmd;			/* Command */
   1064 	bool	plc_failover;		/* PLC failover control/status */
   1065 	struct	ether_addr node_ea;	/* Node ether address */
   1066 	uint32	cost;			/* Link cost or mac cost */
   1067 } wl_plc_params_t;
   1068 
   1069 #define	PLC_CMD_FAILOVER	1
   1070 #define	PLC_CMD_MAC_COST	2
   1071 #define	PLC_CMD_LINK_COST	3
   1072 #define	PLC_CMD_NODE_LIST	4
   1073 
   1074 #define NODE_TYPE_UNKNOWN	0	/* Unknown link */
   1075 #define NODE_TYPE_WIFI_ONLY	1	/* Pure Wireless STA node */
   1076 #define NODE_TYPE_PLC_ONLY	2	/* Pure PLC only node */
   1077 #define NODE_TYPE_WIFI_PLC	3	/* WiFi PLC capable node */
   1078 
   1079 /* defines used by poweridx iovar - it controls power in a-band */
   1080 /* current gain setting is maintained */
   1081 #define WL_PWRIDX_PCL_OFF	-2	/* turn off PCL.  */
   1082 #define WL_PWRIDX_PCL_ON	-1	/* turn on PCL */
   1083 #define WL_PWRIDX_LOWER_LIMIT	-2	/* lower limit */
   1084 #define WL_PWRIDX_UPPER_LIMIT	63	/* upper limit */
   1085 /* value >= 0 causes
   1086  *	- input to be set to that value
   1087  *	- PCL to be off
   1088  */
   1089 
   1090 /* Used to get specific link/ac parameters */
   1091 typedef struct {
   1092 	int ac;
   1093 	uint8 val;
   1094 	struct ether_addr ea;
   1095 } link_val_t;
   1096 
   1097 #define BCM_MAC_STATUS_INDICATION	(0x40010200L)
   1098 
   1099 typedef struct {
   1100 	uint16			ver;		/* version of this struct */
   1101 	uint16			len;		/* length in bytes of this structure */
   1102 	uint16			cap;		/* sta's advertised capabilities */
   1103 	uint32			flags;		/* flags defined below */
   1104 	uint32			idle;		/* time since data pkt rx'd from sta */
   1105 	struct ether_addr	ea;		/* Station address */
   1106 	wl_rateset_t		rateset;	/* rateset in use */
   1107 	uint32			in;		/* seconds elapsed since associated */
   1108 	uint32			listen_interval_inms; /* Min Listen interval in ms for this STA */
   1109 	uint32			tx_pkts;	/* # of packets transmitted */
   1110 	uint32			tx_failures;	/* # of packets failed */
   1111 	uint32			rx_ucast_pkts;	/* # of unicast packets received */
   1112 	uint32			rx_mcast_pkts;	/* # of multicast packets received */
   1113 	uint32			tx_rate;	/* Rate of last successful tx frame */
   1114 	uint32			rx_rate;	/* Rate of last successful rx frame */
   1115 	uint32			rx_decrypt_succeeds;	/* # of packet decrypted successfully */
   1116 	uint32			rx_decrypt_failures;	/* # of packet decrypted unsuccessfully */
   1117 } sta_info_t;
   1118 
   1119 #define WL_OLD_STAINFO_SIZE	OFFSETOF(sta_info_t, tx_pkts)
   1120 
   1121 #define WL_STA_VER		3
   1122 
   1123 /* Flags for sta_info_t indicating properties of STA */
   1124 #define WL_STA_BRCM		0x1		/* Running a Broadcom driver */
   1125 #define WL_STA_WME		0x2		/* WMM association */
   1126 #define WL_STA_UNUSED		0x4
   1127 #define WL_STA_AUTHE		0x8		/* Authenticated */
   1128 #define WL_STA_ASSOC		0x10		/* Associated */
   1129 #define WL_STA_AUTHO		0x20		/* Authorized */
   1130 #define WL_STA_WDS		0x40		/* Wireless Distribution System */
   1131 #define WL_STA_WDS_LINKUP	0x80		/* WDS traffic/probes flowing properly */
   1132 #define WL_STA_PS		0x100		/* STA is in power save mode from AP's viewpoint */
   1133 #define WL_STA_APSD_BE		0x200		/* APSD delv/trigger for AC_BE is default enabled */
   1134 #define WL_STA_APSD_BK		0x400		/* APSD delv/trigger for AC_BK is default enabled */
   1135 #define WL_STA_APSD_VI		0x800		/* APSD delv/trigger for AC_VI is default enabled */
   1136 #define WL_STA_APSD_VO		0x1000		/* APSD delv/trigger for AC_VO is default enabled */
   1137 #define WL_STA_N_CAP		0x2000		/* STA 802.11n capable */
   1138 #define WL_STA_SCBSTATS		0x4000		/* Per STA debug stats */
   1139 
   1140 #define WL_WDS_LINKUP		WL_STA_WDS_LINKUP	/* deprecated */
   1141 
   1142 /* Values for TX Filter override mode */
   1143 #define WLC_TXFILTER_OVERRIDE_DISABLED  0
   1144 #define WLC_TXFILTER_OVERRIDE_ENABLED   1
   1145 
   1146 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1147 
   1148 /* Used to get specific STA parameters */
   1149 typedef struct {
   1150 	uint32	val;
   1151 	struct ether_addr ea;
   1152 } scb_val_t;
   1153 
   1154 /* Used by iovar versions of some ioctls, i.e. WLC_SCB_AUTHORIZE et al */
   1155 typedef struct {
   1156 	uint32 code;
   1157 	scb_val_t ioctl_args;
   1158 } authops_t;
   1159 
   1160 /* channel encoding */
   1161 typedef struct channel_info {
   1162 	int hw_channel;
   1163 	int target_channel;
   1164 	int scan_channel;
   1165 } channel_info_t;
   1166 
   1167 /* For ioctls that take a list of MAC addresses */
   1168 struct maclist {
   1169 	uint count;			/* number of MAC addresses */
   1170 	struct ether_addr ea[1];	/* variable length array of MAC addresses */
   1171 };
   1172 
   1173 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1174 /* get pkt count struct passed through ioctl */
   1175 typedef struct get_pktcnt {
   1176 	uint rx_good_pkt;
   1177 	uint rx_bad_pkt;
   1178 	uint tx_good_pkt;
   1179 	uint tx_bad_pkt;
   1180 	uint rx_ocast_good_pkt; /* unicast packets destined for others */
   1181 } get_pktcnt_t;
   1182 
   1183 /* NINTENDO2 */
   1184 #define LQ_IDX_MIN              0
   1185 #define LQ_IDX_MAX              1
   1186 #define LQ_IDX_AVG              2
   1187 #define LQ_IDX_SUM              2
   1188 #define LQ_IDX_LAST             3
   1189 #define LQ_STOP_MONITOR         0
   1190 #define LQ_START_MONITOR        1
   1191 
   1192 /* Get averages RSSI, Rx PHY rate and SNR values */
   1193 typedef struct {
   1194 	int rssi[LQ_IDX_LAST];  /* Array to keep min, max, avg rssi */
   1195 	int snr[LQ_IDX_LAST];   /* Array to keep min, max, avg snr */
   1196 	int isvalid;            /* Flag indicating whether above data is valid */
   1197 } wl_lq_t; /* Link Quality */
   1198 
   1199 typedef enum wl_wakeup_reason_type {
   1200 	LCD_ON = 1,
   1201 	LCD_OFF,
   1202 	DRC1_WAKE,
   1203 	DRC2_WAKE,
   1204 	REASON_LAST
   1205 } wl_wr_type_t;
   1206 
   1207 typedef struct {
   1208 /* Unique filter id */
   1209 	uint32	id;
   1210 
   1211 /* stores the reason for the last wake up */
   1212 	uint8	reason;
   1213 } wl_wr_t;
   1214 
   1215 /* Get MAC specific rate histogram command */
   1216 typedef struct {
   1217 	struct	ether_addr ea;	/* MAC Address */
   1218 	uint8	ac_cat;	/* Access Category */
   1219 	uint8	num_pkts;	/* Number of packet entries to be averaged */
   1220 } wl_mac_ratehisto_cmd_t;	/* MAC Specific Rate Histogram command */
   1221 
   1222 /* Get MAC rate histogram response */
   1223 typedef struct {
   1224 	uint32	rate[DOT11_RATE_MAX + 1];	/* Rates */
   1225 	uint32	mcs[WL_RATESET_SZ_HT_MCS * WL_TX_CHAINS_MAX];	/* MCS counts */
   1226 	uint32	vht[WL_RATESET_SZ_VHT_MCS][WL_TX_CHAINS_MAX];	/* VHT counts */
   1227 	uint32	tsf_timer[2][2];	/* Start and End time for 8bytes value */
   1228 } wl_mac_ratehisto_res_t;	/* MAC Specific Rate Histogram Response */
   1229 
   1230 /* Values for TX Filter override mode */
   1231 #define WLC_TXFILTER_OVERRIDE_DISABLED  0
   1232 #define WLC_TXFILTER_OVERRIDE_ENABLED   1
   1233 
   1234 #define WL_IOCTL_ACTION_GET				0x0
   1235 #define WL_IOCTL_ACTION_SET				0x1
   1236 #define WL_IOCTL_ACTION_OVL_IDX_MASK	0x1e
   1237 #define WL_IOCTL_ACTION_OVL_RSV			0x20
   1238 #define WL_IOCTL_ACTION_OVL				0x40
   1239 #define WL_IOCTL_ACTION_MASK			0x7e
   1240 #define WL_IOCTL_ACTION_OVL_SHIFT		1
   1241 
   1242 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1243 
   1244 /* Linux network driver ioctl encoding */
   1245 typedef struct wl_ioctl {
   1246 	uint cmd;	/* common ioctl definition */
   1247 	void *buf;	/* pointer to user buffer */
   1248 	uint len;	/* length of user buffer */
   1249 	uint8 set;		/* 1=set IOCTL; 0=query IOCTL */
   1250 	uint used;	/* bytes read or written (optional) */
   1251 	uint needed;	/* bytes needed (optional) */
   1252 } wl_ioctl_t;
   1253 
   1254 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1255 
   1256 /* reference to wl_ioctl_t struct used by usermode driver */
   1257 #define ioctl_subtype	set		/* subtype param */
   1258 #define ioctl_pid	used		/* pid param */
   1259 #define ioctl_status	needed		/* status param */
   1260 
   1261 /*
   1262  * Structure for passing hardware and software
   1263  * revision info up from the driver.
   1264  */
   1265 typedef struct wlc_rev_info {
   1266 	uint		vendorid;	/* PCI vendor id */
   1267 	uint		deviceid;	/* device id of chip */
   1268 	uint		radiorev;	/* radio revision */
   1269 	uint		chiprev;	/* chip revision */
   1270 	uint		corerev;	/* core revision */
   1271 	uint		boardid;	/* board identifier (usu. PCI sub-device id) */
   1272 	uint		boardvendor;	/* board vendor (usu. PCI sub-vendor id) */
   1273 	uint		boardrev;	/* board revision */
   1274 	uint		driverrev;	/* driver version */
   1275 	uint		ucoderev;	/* microcode version */
   1276 	uint		bus;		/* bus type */
   1277 	uint		chipnum;	/* chip number */
   1278 	uint		phytype;	/* phy type */
   1279 	uint		phyrev;		/* phy revision */
   1280 	uint		anarev;		/* anacore rev */
   1281 	uint		chippkg;	/* chip package info */
   1282 	uint		nvramrev;	/* nvram revision number */
   1283 } wlc_rev_info_t;
   1284 
   1285 #define WL_REV_INFO_LEGACY_LENGTH	48
   1286 
   1287 #define WL_BRAND_MAX 10
   1288 typedef struct wl_instance_info {
   1289 	uint instance;
   1290 	char brand[WL_BRAND_MAX];
   1291 } wl_instance_info_t;
   1292 
   1293 /* structure to change size of tx fifo */
   1294 typedef struct wl_txfifo_sz {
   1295 	uint16	magic;
   1296 	uint16	fifo;
   1297 	uint16	size;
   1298 } wl_txfifo_sz_t;
   1299 /* magic pattern used for mismatch driver and wl */
   1300 #define WL_TXFIFO_SZ_MAGIC	0xa5a5
   1301 
   1302 /* Transfer info about an IOVar from the driver */
   1303 /* Max supported IOV name size in bytes, + 1 for nul termination */
   1304 #define WLC_IOV_NAME_LEN 30
   1305 typedef struct wlc_iov_trx_s {
   1306 	uint8 module;
   1307 	uint8 type;
   1308 	char name[WLC_IOV_NAME_LEN];
   1309 } wlc_iov_trx_t;
   1310 
   1311 /* check this magic number */
   1312 #define WLC_IOCTL_MAGIC		0x14e46c77
   1313 
   1314 /* bump this number if you change the ioctl interface */
   1315 #ifdef D11AC_IOTYPES
   1316 #define WLC_IOCTL_VERSION	2
   1317 #define WLC_IOCTL_VERSION_LEGACY_IOTYPES	1
   1318 #else
   1319 #define WLC_IOCTL_VERSION	1
   1320 #endif /* D11AC_IOTYPES */
   1321 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1322 
   1323 #define	WLC_IOCTL_MAXLEN		8192	/* max length ioctl buffer required */
   1324 #define	WLC_IOCTL_SMLEN			256	/* "small" length ioctl buffer required */
   1325 #define WLC_IOCTL_MEDLEN		1536    /* "med" length ioctl buffer required */
   1326 #if defined(LCNCONF) || defined(LCN40CONF)
   1327 #define WLC_SAMPLECOLLECT_MAXLEN	8192	/* Max Sample Collect buffer */
   1328 #else
   1329 #define WLC_SAMPLECOLLECT_MAXLEN	10240	/* Max Sample Collect buffer for two cores */
   1330 #endif
   1331 
   1332 /* common ioctl definitions */
   1333 #define WLC_GET_MAGIC				0
   1334 #define WLC_GET_VERSION				1
   1335 #define WLC_UP					2
   1336 #define WLC_DOWN				3
   1337 #define WLC_GET_LOOP				4
   1338 #define WLC_SET_LOOP				5
   1339 #define WLC_DUMP				6
   1340 #define WLC_GET_MSGLEVEL			7
   1341 #define WLC_SET_MSGLEVEL			8
   1342 #define WLC_GET_PROMISC				9
   1343 #define WLC_SET_PROMISC				10
   1344 /* #define WLC_OVERLAY_IOCTL			11 */ /* not supported */
   1345 #define WLC_GET_RATE				12
   1346 #define WLC_GET_MAX_RATE			13
   1347 #define WLC_GET_INSTANCE			14
   1348 /* #define WLC_GET_FRAG				15 */ /* no longer supported */
   1349 /* #define WLC_SET_FRAG				16 */ /* no longer supported */
   1350 /* #define WLC_GET_RTS				17 */ /* no longer supported */
   1351 /* #define WLC_SET_RTS				18 */ /* no longer supported */
   1352 #define WLC_GET_INFRA				19
   1353 #define WLC_SET_INFRA				20
   1354 #define WLC_GET_AUTH				21
   1355 #define WLC_SET_AUTH				22
   1356 #define WLC_GET_BSSID				23
   1357 #define WLC_SET_BSSID				24
   1358 #define WLC_GET_SSID				25
   1359 #define WLC_SET_SSID				26
   1360 #define WLC_RESTART				27
   1361 #define WLC_TERMINATED             		28
   1362 /* #define WLC_DUMP_SCB				28 */ /* no longer supported */
   1363 #define WLC_GET_CHANNEL				29
   1364 #define WLC_SET_CHANNEL				30
   1365 #define WLC_GET_SRL				31
   1366 #define WLC_SET_SRL				32
   1367 #define WLC_GET_LRL				33
   1368 #define WLC_SET_LRL				34
   1369 #define WLC_GET_PLCPHDR				35
   1370 #define WLC_SET_PLCPHDR				36
   1371 #define WLC_GET_RADIO				37
   1372 #define WLC_SET_RADIO				38
   1373 #define WLC_GET_PHYTYPE				39
   1374 #define WLC_DUMP_RATE				40
   1375 #define WLC_SET_RATE_PARAMS			41
   1376 #define WLC_GET_FIXRATE				42
   1377 #define WLC_SET_FIXRATE				43
   1378 /* #define WLC_GET_WEP				42 */ /* no longer supported */
   1379 /* #define WLC_SET_WEP				43 */ /* no longer supported */
   1380 #define WLC_GET_KEY				44
   1381 #define WLC_SET_KEY				45
   1382 #define WLC_GET_REGULATORY			46
   1383 #define WLC_SET_REGULATORY			47
   1384 #define WLC_GET_PASSIVE_SCAN			48
   1385 #define WLC_SET_PASSIVE_SCAN			49
   1386 #define WLC_SCAN				50
   1387 #define WLC_SCAN_RESULTS			51
   1388 #define WLC_DISASSOC				52
   1389 #define WLC_REASSOC				53
   1390 #define WLC_GET_ROAM_TRIGGER			54
   1391 #define WLC_SET_ROAM_TRIGGER			55
   1392 #define WLC_GET_ROAM_DELTA			56
   1393 #define WLC_SET_ROAM_DELTA			57
   1394 #define WLC_GET_ROAM_SCAN_PERIOD		58
   1395 #define WLC_SET_ROAM_SCAN_PERIOD		59
   1396 #define WLC_EVM					60	/* diag */
   1397 #define WLC_GET_TXANT				61
   1398 #define WLC_SET_TXANT				62
   1399 #define WLC_GET_ANTDIV				63
   1400 #define WLC_SET_ANTDIV				64
   1401 /* #define WLC_GET_TXPWR			65 */ /* no longer supported */
   1402 /* #define WLC_SET_TXPWR			66 */ /* no longer supported */
   1403 #define WLC_GET_CLOSED				67
   1404 #define WLC_SET_CLOSED				68
   1405 #define WLC_GET_MACLIST				69
   1406 #define WLC_SET_MACLIST				70
   1407 #define WLC_GET_RATESET				71
   1408 #define WLC_SET_RATESET				72
   1409 /* #define WLC_GET_LOCALE			73 */ /* no longer supported */
   1410 #define WLC_LONGTRAIN				74
   1411 #define WLC_GET_BCNPRD				75
   1412 #define WLC_SET_BCNPRD				76
   1413 #define WLC_GET_DTIMPRD				77
   1414 #define WLC_SET_DTIMPRD				78
   1415 #define WLC_GET_SROM				79
   1416 #define WLC_SET_SROM				80
   1417 #define WLC_GET_WEP_RESTRICT			81
   1418 #define WLC_SET_WEP_RESTRICT			82
   1419 #define WLC_GET_COUNTRY				83
   1420 #define WLC_SET_COUNTRY				84
   1421 #define WLC_GET_PM				85
   1422 #define WLC_SET_PM				86
   1423 #define WLC_GET_WAKE				87
   1424 #define WLC_SET_WAKE				88
   1425 /* #define WLC_GET_D11CNTS			89 */ /* -> "counters" iovar */
   1426 #define WLC_GET_FORCELINK			90	/* ndis only */
   1427 #define WLC_SET_FORCELINK			91	/* ndis only */
   1428 #define WLC_FREQ_ACCURACY			92	/* diag */
   1429 #define WLC_CARRIER_SUPPRESS			93	/* diag */
   1430 #define WLC_GET_PHYREG				94
   1431 #define WLC_SET_PHYREG				95
   1432 #define WLC_GET_RADIOREG			96
   1433 #define WLC_SET_RADIOREG			97
   1434 #define WLC_GET_REVINFO				98
   1435 #define WLC_GET_UCANTDIV			99
   1436 #define WLC_SET_UCANTDIV			100
   1437 #define WLC_R_REG				101
   1438 #define WLC_W_REG				102
   1439 /* #define WLC_DIAG_LOOPBACK			103	old tray diag */
   1440 /* #define WLC_RESET_D11CNTS			104 */ /* -> "reset_d11cnts" iovar */
   1441 #define WLC_GET_MACMODE				105
   1442 #define WLC_SET_MACMODE				106
   1443 #define WLC_GET_MONITOR				107
   1444 #define WLC_SET_MONITOR				108
   1445 #define WLC_GET_GMODE				109
   1446 #define WLC_SET_GMODE				110
   1447 #define WLC_GET_LEGACY_ERP			111
   1448 #define WLC_SET_LEGACY_ERP			112
   1449 #define WLC_GET_RX_ANT				113
   1450 #define WLC_GET_CURR_RATESET			114	/* current rateset */
   1451 #define WLC_GET_SCANSUPPRESS			115
   1452 #define WLC_SET_SCANSUPPRESS			116
   1453 #define WLC_GET_AP				117
   1454 #define WLC_SET_AP				118
   1455 #define WLC_GET_EAP_RESTRICT			119
   1456 #define WLC_SET_EAP_RESTRICT			120
   1457 #define WLC_SCB_AUTHORIZE			121
   1458 #define WLC_SCB_DEAUTHORIZE			122
   1459 #define WLC_GET_WDSLIST				123
   1460 #define WLC_SET_WDSLIST				124
   1461 #define WLC_GET_ATIM				125
   1462 #define WLC_SET_ATIM				126
   1463 #define WLC_GET_RSSI				127
   1464 #define WLC_GET_PHYANTDIV			128
   1465 #define WLC_SET_PHYANTDIV			129
   1466 #define WLC_AP_RX_ONLY				130
   1467 #define WLC_GET_TX_PATH_PWR			131
   1468 #define WLC_SET_TX_PATH_PWR			132
   1469 #define WLC_GET_WSEC				133
   1470 #define WLC_SET_WSEC				134
   1471 #define WLC_GET_PHY_NOISE			135
   1472 #define WLC_GET_BSS_INFO			136
   1473 #define WLC_GET_PKTCNTS				137
   1474 #define WLC_GET_LAZYWDS				138
   1475 #define WLC_SET_LAZYWDS				139
   1476 #define WLC_GET_BANDLIST			140
   1477 
   1478 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1479 #define WLC_GET_BAND				141
   1480 #define WLC_SET_BAND				142
   1481 #define WLC_SCB_DEAUTHENTICATE			143
   1482 #define WLC_GET_SHORTSLOT			144
   1483 #define WLC_GET_SHORTSLOT_OVERRIDE		145
   1484 #define WLC_SET_SHORTSLOT_OVERRIDE		146
   1485 #define WLC_GET_SHORTSLOT_RESTRICT		147
   1486 #define WLC_SET_SHORTSLOT_RESTRICT		148
   1487 #define WLC_GET_GMODE_PROTECTION		149
   1488 #define WLC_GET_GMODE_PROTECTION_OVERRIDE	150
   1489 #define WLC_SET_GMODE_PROTECTION_OVERRIDE	151
   1490 #define WLC_UPGRADE				152
   1491 /* #define WLC_GET_MRATE			153 */ /* no longer supported */
   1492 /* #define WLC_SET_MRATE			154 */ /* no longer supported */
   1493 #define WLC_GET_IGNORE_BCNS			155
   1494 #define WLC_SET_IGNORE_BCNS			156
   1495 #define WLC_GET_SCB_TIMEOUT			157
   1496 #define WLC_SET_SCB_TIMEOUT			158
   1497 #define WLC_GET_ASSOCLIST			159
   1498 #define WLC_GET_CLK				160
   1499 #define WLC_SET_CLK				161
   1500 #define WLC_GET_UP				162
   1501 #define WLC_OUT					163
   1502 #define WLC_GET_WPA_AUTH			164
   1503 #define WLC_SET_WPA_AUTH			165
   1504 #define WLC_GET_UCFLAGS				166
   1505 #define WLC_SET_UCFLAGS				167
   1506 #define WLC_GET_PWRIDX				168
   1507 #define WLC_SET_PWRIDX				169
   1508 #define WLC_GET_TSSI				170
   1509 #define WLC_GET_SUP_RATESET_OVERRIDE		171
   1510 #define WLC_SET_SUP_RATESET_OVERRIDE		172
   1511 /* #define WLC_SET_FAST_TIMER			173 */ /* no longer supported */
   1512 /* #define WLC_GET_FAST_TIMER			174 */ /* no longer supported */
   1513 /* #define WLC_SET_SLOW_TIMER			175 */ /* no longer supported */
   1514 /* #define WLC_GET_SLOW_TIMER			176 */ /* no longer supported */
   1515 /* #define WLC_DUMP_PHYREGS			177 */ /* no longer supported */
   1516 #define WLC_GET_PROTECTION_CONTROL		178
   1517 #define WLC_SET_PROTECTION_CONTROL		179
   1518 #endif /* LINUX_POSTMOGRIFY_REMOVAL  */
   1519 #define WLC_GET_PHYLIST				180
   1520 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1521 #define WLC_ENCRYPT_STRENGTH			181	/* ndis only */
   1522 #define WLC_DECRYPT_STATUS			182	/* ndis only */
   1523 #define WLC_GET_KEY_SEQ				183
   1524 #define WLC_GET_SCAN_CHANNEL_TIME		184
   1525 #define WLC_SET_SCAN_CHANNEL_TIME		185
   1526 #define WLC_GET_SCAN_UNASSOC_TIME		186
   1527 #define WLC_SET_SCAN_UNASSOC_TIME		187
   1528 #define WLC_GET_SCAN_HOME_TIME			188
   1529 #define WLC_SET_SCAN_HOME_TIME			189
   1530 #define WLC_GET_SCAN_NPROBES			190
   1531 #define WLC_SET_SCAN_NPROBES			191
   1532 #define WLC_GET_PRB_RESP_TIMEOUT		192
   1533 #define WLC_SET_PRB_RESP_TIMEOUT		193
   1534 #define WLC_GET_ATTEN				194
   1535 #define WLC_SET_ATTEN				195
   1536 #define WLC_GET_SHMEM				196	/* diag */
   1537 #define WLC_SET_SHMEM				197	/* diag */
   1538 /* #define WLC_GET_GMODE_PROTECTION_CTS		198 */ /* no longer supported */
   1539 /* #define WLC_SET_GMODE_PROTECTION_CTS		199 */ /* no longer supported */
   1540 #define WLC_SET_WSEC_TEST			200
   1541 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1542 #define WLC_SCB_DEAUTHENTICATE_FOR_REASON	201
   1543 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1544 #define WLC_TKIP_COUNTERMEASURES		202
   1545 #define WLC_GET_PIOMODE				203
   1546 #define WLC_SET_PIOMODE				204
   1547 #define WLC_SET_ASSOC_PREFER			205
   1548 #define WLC_GET_ASSOC_PREFER			206
   1549 #define WLC_SET_ROAM_PREFER			207
   1550 #define WLC_GET_ROAM_PREFER			208
   1551 #define WLC_SET_LED				209
   1552 #define WLC_GET_LED				210
   1553 #define WLC_GET_INTERFERENCE_MODE		211
   1554 #define WLC_SET_INTERFERENCE_MODE		212
   1555 #define WLC_GET_CHANNEL_QA			213
   1556 #define WLC_START_CHANNEL_QA			214
   1557 #define WLC_GET_CHANNEL_SEL			215
   1558 #define WLC_START_CHANNEL_SEL			216
   1559 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1560 #define WLC_GET_VALID_CHANNELS			217
   1561 #define WLC_GET_FAKEFRAG			218
   1562 #define WLC_SET_FAKEFRAG			219
   1563 #define WLC_GET_PWROUT_PERCENTAGE		220
   1564 #define WLC_SET_PWROUT_PERCENTAGE		221
   1565 #define WLC_SET_BAD_FRAME_PREEMPT		222
   1566 #define WLC_GET_BAD_FRAME_PREEMPT		223
   1567 #define WLC_SET_LEAP_LIST			224
   1568 #define WLC_GET_LEAP_LIST			225
   1569 #define WLC_GET_CWMIN				226
   1570 #define WLC_SET_CWMIN				227
   1571 #define WLC_GET_CWMAX				228
   1572 #define WLC_SET_CWMAX				229
   1573 #define WLC_GET_WET				230
   1574 #define WLC_SET_WET				231
   1575 #define WLC_GET_PUB				232
   1576 /* #define WLC_SET_GLACIAL_TIMER		233 */ /* no longer supported */
   1577 /* #define WLC_GET_GLACIAL_TIMER		234 */ /* no longer supported */
   1578 #define WLC_GET_KEY_PRIMARY			235
   1579 #define WLC_SET_KEY_PRIMARY			236
   1580 
   1581 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1582 
   1583 /* #define WLC_DUMP_RADIOREGS			237 */ /* no longer supported */
   1584 #define WLC_GET_ACI_ARGS			238
   1585 #define WLC_SET_ACI_ARGS			239
   1586 #define WLC_UNSET_CALLBACK			240
   1587 #define WLC_SET_CALLBACK			241
   1588 #define WLC_GET_RADAR				242
   1589 #define WLC_SET_RADAR				243
   1590 #define WLC_SET_SPECT_MANAGMENT			244
   1591 #define WLC_GET_SPECT_MANAGMENT			245
   1592 #define WLC_WDS_GET_REMOTE_HWADDR		246	/* handled in wl_linux.c/wl_vx.c */
   1593 #define WLC_WDS_GET_WPA_SUP			247
   1594 #define WLC_SET_CS_SCAN_TIMER			248
   1595 #define WLC_GET_CS_SCAN_TIMER			249
   1596 #define WLC_MEASURE_REQUEST			250
   1597 #define WLC_INIT				251
   1598 #define WLC_SEND_QUIET				252
   1599 #define WLC_KEEPALIVE			253
   1600 #define WLC_SEND_PWR_CONSTRAINT			254
   1601 #define WLC_UPGRADE_STATUS			255
   1602 #define WLC_CURRENT_PWR				256
   1603 #define WLC_GET_SCAN_PASSIVE_TIME		257
   1604 #define WLC_SET_SCAN_PASSIVE_TIME		258
   1605 #define WLC_LEGACY_LINK_BEHAVIOR		259
   1606 #define WLC_GET_CHANNELS_IN_COUNTRY		260
   1607 #define WLC_GET_COUNTRY_LIST			261
   1608 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1609 #define WLC_GET_VAR				262	/* get value of named variable */
   1610 #define WLC_SET_VAR				263	/* set named variable to value */
   1611 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1612 #define WLC_NVRAM_GET				264	/* deprecated */
   1613 #define WLC_NVRAM_SET				265
   1614 #define WLC_NVRAM_DUMP				266
   1615 #define WLC_REBOOT				267
   1616 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1617 #define WLC_SET_WSEC_PMK			268
   1618 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1619 #define WLC_GET_AUTH_MODE			269
   1620 #define WLC_SET_AUTH_MODE			270
   1621 #define WLC_GET_WAKEENTRY			271
   1622 #define WLC_SET_WAKEENTRY			272
   1623 #define WLC_NDCONFIG_ITEM			273	/* currently handled in wl_oid.c */
   1624 #define WLC_NVOTPW				274
   1625 #define WLC_OTPW				275
   1626 #define WLC_IOV_BLOCK_GET			276
   1627 #define WLC_IOV_MODULES_GET			277
   1628 #define WLC_SOFT_RESET				278
   1629 #define WLC_GET_ALLOW_MODE			279
   1630 #define WLC_SET_ALLOW_MODE			280
   1631 #define WLC_GET_DESIRED_BSSID			281
   1632 #define WLC_SET_DESIRED_BSSID			282
   1633 #define	WLC_DISASSOC_MYAP			283
   1634 #define WLC_GET_NBANDS				284	/* for Dongle EXT_STA support */
   1635 #define WLC_GET_BANDSTATES			285	/* for Dongle EXT_STA support */
   1636 #define WLC_GET_WLC_BSS_INFO			286	/* for Dongle EXT_STA support */
   1637 #define WLC_GET_ASSOC_INFO			287	/* for Dongle EXT_STA support */
   1638 #define WLC_GET_OID_PHY				288	/* for Dongle EXT_STA support */
   1639 #define WLC_SET_OID_PHY				289	/* for Dongle EXT_STA support */
   1640 #define WLC_SET_ASSOC_TIME			290	/* for Dongle EXT_STA support */
   1641 #define WLC_GET_DESIRED_SSID			291	/* for Dongle EXT_STA support */
   1642 #define WLC_GET_CHANSPEC			292	/* for Dongle EXT_STA support */
   1643 #define WLC_GET_ASSOC_STATE			293	/* for Dongle EXT_STA support */
   1644 #define WLC_SET_PHY_STATE			294	/* for Dongle EXT_STA support */
   1645 #define WLC_GET_SCAN_PENDING			295	/* for Dongle EXT_STA support */
   1646 #define WLC_GET_SCANREQ_PENDING			296	/* for Dongle EXT_STA support */
   1647 #define WLC_GET_PREV_ROAM_REASON		297	/* for Dongle EXT_STA support */
   1648 #define WLC_SET_PREV_ROAM_REASON		298	/* for Dongle EXT_STA support */
   1649 #define WLC_GET_BANDSTATES_PI			299	/* for Dongle EXT_STA support */
   1650 #define WLC_GET_PHY_STATE			300	/* for Dongle EXT_STA support */
   1651 #define WLC_GET_BSS_WPA_RSN			301	/* for Dongle EXT_STA support */
   1652 #define WLC_GET_BSS_WPA2_RSN			302	/* for Dongle EXT_STA support */
   1653 #define WLC_GET_BSS_BCN_TS			303	/* for Dongle EXT_STA support */
   1654 #define WLC_GET_INT_DISASSOC			304	/* for Dongle EXT_STA support */
   1655 #define WLC_SET_NUM_PEERS			305     /* for Dongle EXT_STA support */
   1656 #define WLC_GET_NUM_BSS				306	/* for Dongle EXT_STA support */
   1657 #define WLC_PHY_SAMPLE_COLLECT			307	/* phy sample collect mode */
   1658 /* #define WLC_UM_PRIV				308 */	/* Deprecated: usermode driver */
   1659 #define WLC_GET_CMD				309
   1660 /* #define WLC_LAST				310 */	/* Never used - can be reused */
   1661 #define WLC_SET_INTERFERENCE_OVERRIDE_MODE	311	/* set inter mode override */
   1662 #define WLC_GET_INTERFERENCE_OVERRIDE_MODE	312	/* get inter mode override */
   1663 /* #define WLC_GET_WAI_RESTRICT			313 */	/* for WAPI, deprecated use iovar instead */
   1664 /* #define WLC_SET_WAI_RESTRICT			314 */	/* for WAPI, deprecated use iovar instead */
   1665 /* #define WLC_SET_WAI_REKEY			315 */	/* for WAPI, deprecated use iovar instead */
   1666 #define WLC_SET_NAT_CONFIG			316	/* for configuring NAT filter driver */
   1667 #define WLC_GET_NAT_STATE			317
   1668 #define WLC_GET_RSSI_QDB			318 /* qdB portion of the RSSI */
   1669 #define WLC_LAST				319
   1670 
   1671 #ifndef EPICTRL_COOKIE
   1672 #define EPICTRL_COOKIE		0xABADCEDE
   1673 #endif
   1674 
   1675 /* vx wlc ioctl's offset */
   1676 #define CMN_IOCTL_OFF 0x180
   1677 
   1678 /*
   1679  * custom OID support
   1680  *
   1681  * 0xFF - implementation specific OID
   1682  * 0xE4 - first byte of Broadcom PCI vendor ID
   1683  * 0x14 - second byte of Broadcom PCI vendor ID
   1684  * 0xXX - the custom OID number
   1685  */
   1686 
   1687 /* begin 0x1f values beyond the start of the ET driver range. */
   1688 #define WL_OID_BASE		0xFFE41420
   1689 
   1690 /* NDIS overrides */
   1691 #define OID_WL_GETINSTANCE	(WL_OID_BASE + WLC_GET_INSTANCE)
   1692 #define OID_WL_GET_FORCELINK	(WL_OID_BASE + WLC_GET_FORCELINK)
   1693 #define OID_WL_SET_FORCELINK	(WL_OID_BASE + WLC_SET_FORCELINK)
   1694 #define	OID_WL_ENCRYPT_STRENGTH	(WL_OID_BASE + WLC_ENCRYPT_STRENGTH)
   1695 #define OID_WL_DECRYPT_STATUS	(WL_OID_BASE + WLC_DECRYPT_STATUS)
   1696 #define OID_LEGACY_LINK_BEHAVIOR (WL_OID_BASE + WLC_LEGACY_LINK_BEHAVIOR)
   1697 #define OID_WL_NDCONFIG_ITEM	(WL_OID_BASE + WLC_NDCONFIG_ITEM)
   1698 
   1699 /* EXT_STA Dongle suuport */
   1700 #define OID_STA_CHANSPEC	(WL_OID_BASE + WLC_GET_CHANSPEC)
   1701 #define OID_STA_NBANDS		(WL_OID_BASE + WLC_GET_NBANDS)
   1702 #define OID_STA_GET_PHY		(WL_OID_BASE + WLC_GET_OID_PHY)
   1703 #define OID_STA_SET_PHY		(WL_OID_BASE + WLC_SET_OID_PHY)
   1704 #define OID_STA_ASSOC_TIME	(WL_OID_BASE + WLC_SET_ASSOC_TIME)
   1705 #define OID_STA_DESIRED_SSID	(WL_OID_BASE + WLC_GET_DESIRED_SSID)
   1706 #define OID_STA_SET_PHY_STATE	(WL_OID_BASE + WLC_SET_PHY_STATE)
   1707 #define OID_STA_SCAN_PENDING	(WL_OID_BASE + WLC_GET_SCAN_PENDING)
   1708 #define OID_STA_SCANREQ_PENDING (WL_OID_BASE + WLC_GET_SCANREQ_PENDING)
   1709 #define OID_STA_GET_ROAM_REASON (WL_OID_BASE + WLC_GET_PREV_ROAM_REASON)
   1710 #define OID_STA_SET_ROAM_REASON (WL_OID_BASE + WLC_SET_PREV_ROAM_REASON)
   1711 #define OID_STA_GET_PHY_STATE	(WL_OID_BASE + WLC_GET_PHY_STATE)
   1712 #define OID_STA_INT_DISASSOC	(WL_OID_BASE + WLC_GET_INT_DISASSOC)
   1713 #define OID_STA_SET_NUM_PEERS	(WL_OID_BASE + WLC_SET_NUM_PEERS)
   1714 #define OID_STA_GET_NUM_BSS	(WL_OID_BASE + WLC_GET_NUM_BSS)
   1715 
   1716 /* NAT filter driver support */
   1717 #define OID_NAT_SET_CONFIG	(WL_OID_BASE + WLC_SET_NAT_CONFIG)
   1718 #define OID_NAT_GET_STATE	(WL_OID_BASE + WLC_GET_NAT_STATE)
   1719 
   1720 #define WL_DECRYPT_STATUS_SUCCESS	1
   1721 #define WL_DECRYPT_STATUS_FAILURE	2
   1722 #define WL_DECRYPT_STATUS_UNKNOWN	3
   1723 
   1724 /* allows user-mode app to poll the status of USB image upgrade */
   1725 #define WLC_UPGRADE_SUCCESS			0
   1726 #define WLC_UPGRADE_PENDING			1
   1727 
   1728 #ifdef CONFIG_USBRNDIS_RETAIL
   1729 /* struct passed in for WLC_NDCONFIG_ITEM */
   1730 typedef struct {
   1731 	char *name;
   1732 	void *param;
   1733 } ndconfig_item_t;
   1734 #endif
   1735 
   1736 
   1737 /* WLC_GET_AUTH, WLC_SET_AUTH values */
   1738 #define WL_AUTH_OPEN_SYSTEM		0	/* d11 open authentication */
   1739 #define WL_AUTH_SHARED_KEY		1	/* d11 shared authentication */
   1740 #define WL_AUTH_OPEN_SHARED		2	/* try open, then shared if open failed w/rc 13 */
   1741 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1742 
   1743 /* Bit masks for radio disabled status - returned by WL_GET_RADIO */
   1744 #define WL_RADIO_SW_DISABLE		(1<<0)
   1745 #define WL_RADIO_HW_DISABLE		(1<<1)
   1746 #define WL_RADIO_MPC_DISABLE		(1<<2)
   1747 #define WL_RADIO_COUNTRY_DISABLE	(1<<3)	/* some countries don't support any channel */
   1748 
   1749 #define	WL_SPURAVOID_OFF	0
   1750 #define	WL_SPURAVOID_ON1	1
   1751 #define	WL_SPURAVOID_ON2	2
   1752 
   1753 
   1754 #define WL_4335_SPURAVOID_ON1	1
   1755 #define WL_4335_SPURAVOID_ON2	2
   1756 #define WL_4335_SPURAVOID_ON3	3
   1757 #define WL_4335_SPURAVOID_ON4	4
   1758 #define WL_4335_SPURAVOID_ON5	5
   1759 #define WL_4335_SPURAVOID_ON6	6
   1760 #define WL_4335_SPURAVOID_ON7	7
   1761 #define WL_4335_SPURAVOID_ON8	8
   1762 #define WL_4335_SPURAVOID_ON9	9
   1763 
   1764 /* Override bit for WLC_SET_TXPWR.  if set, ignore other level limits */
   1765 #define WL_TXPWR_OVERRIDE	(1U<<31)
   1766 #define WL_TXPWR_NEG   (1U<<30)
   1767 
   1768 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1769 #define WL_PHY_PAVARS_LEN	32	/* Phy type, Band range, chain, a1[0], b0[0], b1[0] ... */
   1770 
   1771 #define WL_PHY_PAVAR_VER	1	/* pavars version */
   1772 #define WL_PHY_PAVARS2_NUM	3	/* a1, b0, b1 */
   1773 typedef struct wl_pavars2 {
   1774 	uint16 ver;		/* version of this struct */
   1775 	uint16 len;		/* len of this structure */
   1776 	uint16 inuse;		/* driver return 1 for a1,b0,b1 in current band range */
   1777 	uint16 phy_type;	/* phy type */
   1778 	uint16 bandrange;
   1779 	uint16 chain;
   1780 	uint16 inpa[WL_PHY_PAVARS2_NUM];	/* phy pavars for one band range */
   1781 } wl_pavars2_t;
   1782 
   1783 typedef struct wl_po {
   1784 	uint16	phy_type;	/* Phy type */
   1785 	uint16	band;
   1786 	uint16	cckpo;
   1787 	uint32	ofdmpo;
   1788 	uint16	mcspo[8];
   1789 } wl_po_t;
   1790 
   1791 /* a large TX Power as an init value to factor out of MIN() calculations,
   1792  * keep low enough to fit in an int8, units are .25 dBm
   1793  */
   1794 #define WLC_TXPWR_MAX		(127)	/* ~32 dBm = 1,500 mW */
   1795 
   1796 /* "diag" iovar argument and error code */
   1797 #define WL_DIAG_INTERRUPT			1	/* d11 loopback interrupt test */
   1798 #define WL_DIAG_LOOPBACK			2	/* d11 loopback data test */
   1799 #define WL_DIAG_MEMORY				3	/* d11 memory test */
   1800 #define WL_DIAG_LED				4	/* LED test */
   1801 #define WL_DIAG_REG				5	/* d11/phy register test */
   1802 #define WL_DIAG_SROM				6	/* srom read/crc test */
   1803 #define WL_DIAG_DMA				7	/* DMA test */
   1804 #define WL_DIAG_LOOPBACK_EXT			8	/* enhenced d11 loopback data test */
   1805 
   1806 #define WL_DIAGERR_SUCCESS			0
   1807 #define WL_DIAGERR_FAIL_TO_RUN			1	/* unable to run requested diag */
   1808 #define WL_DIAGERR_NOT_SUPPORTED		2	/* diag requested is not supported */
   1809 #define WL_DIAGERR_INTERRUPT_FAIL		3	/* loopback interrupt test failed */
   1810 #define WL_DIAGERR_LOOPBACK_FAIL		4	/* loopback data test failed */
   1811 #define WL_DIAGERR_SROM_FAIL			5	/* srom read failed */
   1812 #define WL_DIAGERR_SROM_BADCRC			6	/* srom crc failed */
   1813 #define WL_DIAGERR_REG_FAIL			7	/* d11/phy register test failed */
   1814 #define WL_DIAGERR_MEMORY_FAIL			8	/* d11 memory test failed */
   1815 #define WL_DIAGERR_NOMEM			9	/* diag test failed due to no memory */
   1816 #define WL_DIAGERR_DMA_FAIL			10	/* DMA test failed */
   1817 
   1818 #define WL_DIAGERR_MEMORY_TIMEOUT		11	/* d11 memory test didn't finish in time */
   1819 #define WL_DIAGERR_MEMORY_BADPATTERN		12	/* d11 memory test result in bad pattern */
   1820 
   1821 /* band types */
   1822 #define	WLC_BAND_AUTO		0	/* auto-select */
   1823 #define	WLC_BAND_5G		1	/* 5 Ghz */
   1824 #define	WLC_BAND_2G		2	/* 2.4 Ghz */
   1825 #define	WLC_BAND_ALL		3	/* all bands */
   1826 
   1827 /* band range returned by band_range iovar */
   1828 #define WL_CHAN_FREQ_RANGE_2G      0
   1829 #define WL_CHAN_FREQ_RANGE_5GL     1
   1830 #define WL_CHAN_FREQ_RANGE_5GM     2
   1831 #define WL_CHAN_FREQ_RANGE_5GH     3
   1832 
   1833 #define WL_CHAN_FREQ_RANGE_5GLL_5BAND    4
   1834 #define WL_CHAN_FREQ_RANGE_5GLH_5BAND    5
   1835 #define WL_CHAN_FREQ_RANGE_5GML_5BAND    6
   1836 #define WL_CHAN_FREQ_RANGE_5GMH_5BAND    7
   1837 #define WL_CHAN_FREQ_RANGE_5GH_5BAND     8
   1838 
   1839 #define WL_CHAN_FREQ_RANGE_5G_BAND0     1
   1840 #define WL_CHAN_FREQ_RANGE_5G_BAND1     2
   1841 #define WL_CHAN_FREQ_RANGE_5G_BAND2     3
   1842 #define WL_CHAN_FREQ_RANGE_5G_BAND3     4
   1843 
   1844 #define WL_CHAN_FREQ_RANGE_5G_4BAND    	5
   1845 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
   1846 
   1847 /* phy types (returned by WLC_GET_PHYTPE) */
   1848 #define	WLC_PHY_TYPE_A		0
   1849 #define	WLC_PHY_TYPE_B		1
   1850 #define	WLC_PHY_TYPE_G		2
   1851 #define	WLC_PHY_TYPE_N		4
   1852 #define	WLC_PHY_TYPE_LP		5
   1853 #define	WLC_PHY_TYPE_SSN	6
   1854 #define	WLC_PHY_TYPE_HT		7
   1855 #define	WLC_PHY_TYPE_LCN	8
   1856 #define	WLC_PHY_TYPE_LCN40	10
   1857 #define WLC_PHY_TYPE_AC		11
   1858 #define	WLC_PHY_TYPE_NULL	0xf
   1859 
   1860 /* Values for PM */
   1861 #define PM_OFF	0
   1862 #define PM_MAX	1
   1863 #define PM_FAST 2
   1864 #define PM_FORCE_OFF 3 		/* use this bit to force PM off even bt is active */
   1865 
   1866 #ifndef LINUX_POSTMOGRIFY_REMOVAL
   1867 /* MAC list modes */
   1868 #define WLC_MACMODE_DISABLED	0	/* MAC list disabled */
   1869 #define WLC_MACMODE_DENY	1	/* Deny specified (i.e. allow unspecified) */
   1870 #define WLC_MACMODE_ALLOW	2	/* Allow specified (i.e. deny unspecified) */
   1871 
   1872 /*
   1873  * 54g modes (basic bits may still be overridden)
   1874  *
   1875  * GMODE_LEGACY_B			Rateset: 1b, 2b, 5.5, 11
   1876  *					Preamble: Long
   1877  *					Shortslot: Off
   1878  * GMODE_AUTO				Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
   1879  *					Extended Rateset: 6, 9, 12, 48
   1880  *					Preamble: Long
   1881  *					Shortslot: Auto
   1882  * GMODE_ONLY				Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
   1883  *					Extended Rateset: 6b, 9, 12b, 48
   1884  *					Preamble: Short required
   1885  *					Shortslot: Auto
   1886  * GMODE_B_DEFERRED			Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
   1887  *					Extended Rateset: 6, 9, 12, 48
   1888  *					Preamble: Long
   1889  *					Shortslot: On
   1890  * GMODE_PERFORMANCE			Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
   1891  *					Preamble: Short required
   1892  *					Shortslot: On and required
   1893  * GMODE_LRS				Rateset: 1b, 2b, 5.5b, 11b
   1894  *					Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
   1895  *					Preamble: Long
   1896  *					Shortslot: Auto
   1897  */
   1898 #define GMODE_LEGACY_B		0
   1899 #define GMODE_AUTO		1
   1900 #define GMODE_ONLY		2
   1901 #define GMODE_B_DEFERRED	3
   1902 #define GMODE_PERFORMANCE	4
   1903 #define GMODE_LRS		5
   1904 #define GMODE_MAX		6
   1905 
   1906 /* values for PLCPHdr_override */
   1907 #define WLC_PLCP_AUTO	-1
   1908 #define WLC_PLCP_SHORT	0
   1909 #define WLC_PLCP_LONG	1
   1910 
   1911 /* values for g_protection_override and n_protection_override */
   1912 #define WLC_PROTECTION_AUTO		-1
   1913 #define WLC_PROTECTION_OFF		0
   1914 #define WLC_PROTECTION_ON		1
   1915 #define WLC_PROTECTION_MMHDR_ONLY	2
   1916 #define WLC_PROTECTION_CTS_ONLY		3
   1917 
   1918 /* values for g_protection_control and n_protection_control */
   1919 #define WLC_PROTECTION_CTL_OFF		0
   1920 #define WLC_PROTECTION_CTL_LOCAL	1
   1921 #define WLC_PROTECTION_CTL_OVERLAP	2
   1922 
   1923 /* values for n_protection */
   1924 #define WLC_N_PROTECTION_OFF		0
   1925 #define WLC_N_PROTECTION_OPTIONAL	1
   1926 #define WLC_N_PROTECTION_20IN40		2
   1927 #define WLC_N_PROTECTION_MIXEDMODE	3
   1928 
   1929 /* values for n_preamble_type */
   1930 #define WLC_N_PREAMBLE_MIXEDMODE	0
   1931 #define WLC_N_PREAMBLE_GF		1
   1932 #define WLC_N_PREAMBLE_GF_BRCM          2
   1933 
   1934 /* values for band specific 40MHz capabilities (deprecated) */
   1935 #define WLC_N_BW_20ALL			0
   1936 #define WLC_N_BW_40ALL			1
   1937 #define WLC_N_BW_20IN2G_40IN5G		2
   1938 
   1939 #define WLC_BW_20MHZ_BIT		(1<<0)
   1940 #define WLC_BW_40MHZ_BIT		(1<<1)
   1941 #define WLC_BW_80MHZ_BIT		(1<<2)
   1942 
   1943 /* Bandwidth capabilities */
   1944 #define WLC_BW_CAP_20MHZ		(WLC_BW_20MHZ_BIT)
   1945 #define WLC_BW_CAP_40MHZ		(WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
   1946 #define WLC_BW_CAP_80MHZ		(WLC_BW_80MHZ_BIT|WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
   1947 #define WLC_BW_CAP_UNRESTRICTED		0xFF
   1948 
   1949 #define WL_BW_CAP_20MHZ(bw_cap)	(((bw_cap) & WLC_BW_20MHZ_BIT) ? TRUE : FALSE)
   1950 #define WL_BW_CAP_40MHZ(bw_cap)	(((bw_cap) & WLC_BW_40MHZ_BIT) ? TRUE : FALSE)
   1951 #define WL_BW_CAP_80MHZ(bw_cap)	(((bw_cap) & WLC_BW_80MHZ_BIT) ? TRUE : FALSE)
   1952 
   1953 /* values to force tx/rx chain */
   1954 #define WLC_N_TXRX_CHAIN0		0
   1955 #define WLC_N_TXRX_CHAIN1		1
   1956 
   1957 /* bitflags for SGI support (sgi_rx iovar) */
   1958 #define WLC_N_SGI_20			0x01
   1959 #define WLC_N_SGI_40			0x02
   1960 #define WLC_VHT_SGI_80			0x04
   1961 
   1962 /* when sgi_tx==WLC_SGI_ALL, bypass rate selection, enable sgi for all mcs */
   1963 #define WLC_SGI_ALL				0x02
   1964 
   1965 #define LISTEN_INTERVAL			10
   1966 /* interference mitigation options */
   1967 #define	INTERFERE_OVRRIDE_OFF	-1	/* interference override off */
   1968 #define	INTERFERE_NONE	0	/* off */
   1969 #define	NON_WLAN	1	/* foreign/non 802.11 interference, no auto detect */
   1970 #define	WLAN_MANUAL	2	/* ACI: no auto detection */
   1971 #define	WLAN_AUTO	3	/* ACI: auto detect */
   1972 #define	WLAN_AUTO_W_NOISE	4	/* ACI: auto - detect and non 802.11 interference */
   1973 #define AUTO_ACTIVE	(1 << 7) /* Auto is currently active */
   1974 
   1975 /* AP environment */
   1976 #define AP_ENV_DETECT_NOT_USED		0 /* We aren't using AP environment detection */
   1977 #define AP_ENV_DENSE			1 /* "Corporate" or other AP dense environment */
   1978 #define AP_ENV_SPARSE			2 /* "Home" or other sparse environment */
   1979 #define AP_ENV_INDETERMINATE		3 /* AP environment hasn't been identified */
   1980 
   1981 typedef struct wl_aci_args {
   1982 	int enter_aci_thresh; /* Trigger level to start detecting ACI */
   1983 	int exit_aci_thresh; /* Trigger level to exit ACI mode */
   1984 	int usec_spin; /* microsecs to delay between rssi samples */
   1985 	int glitch_delay; /* interval between ACI scans when glitch count is consistently high */
   1986 	uint16 nphy_adcpwr_enter_thresh;	/* ADC power to enter ACI mitigation mode */
   1987 	uint16 nphy_adcpwr_exit_thresh;	/* ADC power to exit ACI mitigation mode */
   1988 	uint16 nphy_repeat_ctr;		/* Number of tries per channel to compute power */
   1989 	uint16 nphy_num_samples;	/* Number of samples to compute power on one channel */
   1990 	uint16 nphy_undetect_window_sz;	/* num of undetects to exit ACI Mitigation mode */
   1991 	uint16 nphy_b_energy_lo_aci;	/* low ACI power energy threshold for bphy */
   1992 	uint16 nphy_b_energy_md_aci;	/* mid ACI power energy threshold for bphy */
   1993 	uint16 nphy_b_energy_hi_aci;	/* high ACI power energy threshold for bphy */
   1994 	uint16 nphy_noise_noassoc_glitch_th_up; /* wl interference 4 */
   1995 	uint16 nphy_noise_noassoc_glitch_th_dn;
   1996 	uint16 nphy_noise_assoc_glitch_th_up;
   1997 	uint16 nphy_noise_assoc_glitch_th_dn;
   1998 	uint16 nphy_noise_assoc_aci_glitch_th_up;
   1999 	uint16 nphy_noise_assoc_aci_glitch_th_dn;
   2000 	uint16 nphy_noise_assoc_enter_th;
   2001 	uint16 nphy_noise_noassoc_enter_th;
   2002 	uint16 nphy_noise_assoc_rx_glitch_badplcp_enter_th;
   2003 	uint16 nphy_noise_noassoc_crsidx_incr;
   2004 	uint16 nphy_noise_assoc_crsidx_incr;
   2005 	uint16 nphy_noise_crsidx_decr;
   2006 } wl_aci_args_t;
   2007 
   2008 #define TRIGGER_NOW				0
   2009 #define TRIGGER_CRS				0x01
   2010 #define TRIGGER_CRSDEASSERT			0x02
   2011 #define TRIGGER_GOODFCS				0x04
   2012 #define TRIGGER_BADFCS				0x08
   2013 #define TRIGGER_BADPLCP				0x10
   2014 #define TRIGGER_CRSGLITCH			0x20
   2015 #define WL_ACI_ARGS_LEGACY_LENGTH	16	/* bytes of pre NPHY aci args */
   2016 #define	WL_SAMPLECOLLECT_T_VERSION	2	/* version of wl_samplecollect_args_t struct */
   2017 typedef struct wl_samplecollect_args {
   2018 	/* version 0 fields */
   2019 	uint8 coll_us;
   2020 	int cores;
   2021 	/* add'l version 1 fields */
   2022 	uint16 version;     /* see definition of WL_SAMPLECOLLECT_T_VERSION */
   2023 	uint16 length;      /* length of entire structure */
   2024 	int8 trigger;
   2025 	uint16 timeout;
   2026 	uint16 mode;
   2027 	uint32 pre_dur;
   2028 	uint32 post_dur;
   2029 	uint8 gpio_sel;
   2030 	bool downsamp;
   2031 	bool be_deaf;
   2032 	bool agc;		/* loop from init gain and going down */
   2033 	bool filter;		/* override high pass corners to lowest */
   2034 	/* add'l version 2 fields */
   2035 	uint8 trigger_state;
   2036 	uint8 module_sel1;
   2037 	uint8 module_sel2;
   2038 	uint16 nsamps;
   2039 	int bitStart;
   2040 	uint32 gpioCapMask;
   2041 } wl_samplecollect_args_t;
   2042 
   2043 #define	WL_SAMPLEDATA_HEADER_TYPE	1
   2044 #define WL_SAMPLEDATA_HEADER_SIZE	80	/* sample collect header size (bytes) */
   2045 #define	WL_SAMPLEDATA_TYPE		2
   2046 #define	WL_SAMPLEDATA_SEQ		0xff	/* sequence # */
   2047 #define	WL_SAMPLEDATA_MORE_DATA		0x100	/* more data mask */
   2048 #define	WL_SAMPLEDATA_T_VERSION		1	/* version of wl_samplecollect_args_t struct */
   2049 /* version for unpacked sample data, int16 {(I,Q),Core(0..N)} */
   2050 #define	WL_SAMPLEDATA_T_VERSION_SPEC_AN 2
   2051 
   2052 typedef struct wl_sampledata {
   2053 	uint16 version;	/* structure version */
   2054 	uint16 size;	/* size of structure */
   2055 	uint16 tag;	/* Header/Data */
   2056 	uint16 length;	/* data length */
   2057 	uint32 flag;	/* bit def */
   2058 } wl_sampledata_t;
   2059 
   2060 /* WL_OTA START */
   2061 
   2062 #define WL_OTA_ARG_PARSE_BLK_SIZE 	1200
   2063 #define WL_OTA_TEST_MAX_NUM_RATE	30
   2064 #define WL_OTA_TEST_MAX_NUM_SEQ		100
   2065 
   2066 /* OTA Test Status */
   2067 enum {
   2068 	WL_OTA_TEST_IDLE,	/* Default Idle state */
   2069 	WL_OTA_TEST_ACTIVE,	/* Test Running */
   2070 	WL_OTA_TEST_SUCCESS,	/* Successfully Finished Test */
   2071 	WL_OTA_TEST_FAIL	/* Test Failed in the Middle */
   2072 };
   2073 /* OTA SYNC Status */
   2074 enum {
   2075 	WL_OTA_SYNC_IDLE,	/* Idle state */
   2076 	WL_OTA_SYNC_ACTIVE,	/* Waiting for Sync */
   2077 	WL_OTA_SYNC_FAIL	/* Sync pkt not recieved */
   2078 };
   2079 
   2080 /* Various error states dut can get stuck during test */
   2081 enum {
   2082 	WL_OTA_SKIP_TEST_CAL_FAIL = 1,		/* Phy calibration failed */
   2083 	WL_OTA_SKIP_TEST_SYNCH_FAIL,		/* Sync Packet not recieved */
   2084 	WL_OTA_SKIP_TEST_FILE_DWNLD_FAIL,	/* Cmd flow file download failed */
   2085 	WL_OTA_SKIP_TEST_NO_TEST_FOUND,	/* No test found in Flow file */
   2086 	WL_OTA_SKIP_TEST_WL_NOT_UP,		/* WL UP failed */
   2087 	WL_OTA_SKIP_TEST_UNKNOWN_CALL		/* Unintentional scheduling on ota test */
   2088 };
   2089 
   2090 /* Differentiator for ota_tx and ota_rx */
   2091 enum {
   2092 	WL_OTA_TEST_TX,		/* ota_tx */
   2093 	WL_OTA_TEST_RX		/* ota_rx */
   2094 };
   2095 
   2096 /* Catch 3 modes of operation: 20Mhz, 40Mhz, 20 in 40 Mhz */
   2097 enum {
   2098 	WL_OTA_TEST_BW_20_IN_40MHZ,	/* 20 in 40 operation */
   2099 	WL_OTA_TEST_BW_20MHZ,		/* 20 Mhz operation */
   2100 	WL_OTA_TEST_BW_40MHZ		/* full 40Mhz operation */
   2101 };
   2102 typedef struct ota_rate_info {
   2103 	uint8 rate_cnt;					/* Total number of rates */
   2104 	uint8 rate_val_mbps[WL_OTA_TEST_MAX_NUM_RATE];	/* array of rates from 1mbps to 130mbps */
   2105 							/* for legacy rates : ratein mbps * 2 */
   2106 							/* for HT rates : mcs index */
   2107 } ota_rate_info_t;
   2108 
   2109 typedef struct ota_power_info {
   2110 	int8 pwr_ctrl_on;	/* power control on/off */
   2111 	int8 start_pwr;		/* starting power/index */
   2112 	int8 delta_pwr;		/* delta power/index */
   2113 	int8 end_pwr;		/* end power/index */
   2114 } ota_power_info_t;
   2115 
   2116 typedef struct ota_packetengine {
   2117 	uint16 delay;           /* Inter-packet delay */
   2118 				/* for ota_tx, delay is tx ifs in micro seconds */
   2119 				/* for ota_rx, delay is wait time in milliseconds */
   2120 	uint16 nframes;         /* Number of frames */
   2121 	uint16 length;          /* Packet length */
   2122 } ota_packetengine_t;
   2123 
   2124 /* Test info vector */
   2125 typedef struct wl_ota_test_args {
   2126 	uint8 cur_test;			/* test phase */
   2127 	uint8 chan;			/* channel */
   2128 	uint8 bw;			/* bandwidth */
   2129 	char control_band;		/* control band */
   2130 	uint8 stf_mode;			/* stf mode */
   2131 	ota_rate_info_t rt_info;	/* Rate info */
   2132 	ota_packetengine_t pkteng;	/* packeteng info */
   2133 	uint8 txant;			/* tx antenna */
   2134 	uint8 rxant;			/* rx antenna */
   2135 	ota_power_info_t pwr_info;	/* power sweep info */
   2136 	uint8 wait_for_sync;		/* wait for sync or not */
   2137 } wl_ota_test_args_t;
   2138 
   2139 typedef struct wl_ota_test_vector {
   2140 	wl_ota_test_args_t test_arg[WL_OTA_TEST_MAX_NUM_SEQ];	/* Test argument struct */
   2141 	uint16 test_cnt;					/* Total no of test */
   2142 	bool file_dwnld_valid;					/* File successfully downloaded */
   2143 	uint8 sync_timeout;					/* sync packet timeout */
   2144 	int8 sync_fail_action;					/* sync fail action */
   2145 	struct ether_addr sync_mac;				/* macaddress for sync pkt */
   2146 	struct ether_addr tx_mac;				/* macaddress for tx */
   2147 	struct ether_addr rx_mac;				/* macaddress for rx */
   2148 	int8 loop_test;					/* dbg feature to loop the test */
   2149 } wl_ota_test_vector_t;
   2150 
   2151 
   2152 /* struct copied back form dongle to host to query the status */
   2153 typedef struct wl_ota_test_status {
   2154 	int16 cur_test_cnt;		/* test phase */
   2155 	int8 skip_test_reason;		/* skip test reasoin */
   2156 	wl_ota_test_args_t test_arg;	/* cur test arg details */
   2157 	uint16 test_cnt;		/* total no of test downloaded */
   2158 	bool file_dwnld_valid;		/* file successfully downloaded ? */
   2159 	uint8 sync_timeout;		/* sync timeout */
   2160 	int8 sync_fail_action;		/* sync fail action */
   2161 	struct ether_addr sync_mac;	/* macaddress for sync pkt */
   2162 	struct ether_addr tx_mac;	/* tx mac address */
   2163 	struct ether_addr rx_mac;	/* rx mac address */
   2164 	uint8  test_stage;		/* check the test status */
   2165 	int8 loop_test;		/* Debug feature to puts test enfine in a loop */
   2166 	uint8 sync_status;		/* sync status */
   2167 } wl_ota_test_status_t;
   2168 
   2169 /* WL_OTA END */
   2170 
   2171 /* wl_radar_args_t */
   2172 typedef struct {
   2173 	int npulses; 	/* required number of pulses at n * t_int */
   2174 	int ncontig; 	/* required number of pulses at t_int */
   2175 	int min_pw; 	/* minimum pulse width (20 MHz clocks) */
   2176 	int max_pw; 	/* maximum pulse width (20 MHz clocks) */
   2177 	uint16 thresh0;	/* Radar detection, thresh 0 */
   2178 	uint16 thresh1;	/* Radar detection, thresh 1 */
   2179 	uint16 blank;	/* Radar detection, blank control */
   2180 	uint16 fmdemodcfg;	/* Radar detection, fmdemod config */
   2181 	int npulses_lp;  /* Radar detection, minimum long pulses */
   2182 	int min_pw_lp; /* Minimum pulsewidth for long pulses */
   2183 	int max_pw_lp; /* Maximum pulsewidth for long pulses */
   2184 	int min_fm_lp; /* Minimum fm for long pulses */
   2185 	int max_span_lp;  /* Maximum deltat for long pulses */
   2186 	int min_deltat; /* Minimum spacing between pulses */
   2187 	int max_deltat; /* Maximum spacing between pulses */
   2188 	uint16 autocorr;	/* Radar detection, autocorr on or off */
   2189 	uint16 st_level_time;	/* Radar detection, start_timing level */
   2190 	uint16 t2_min; /* minimum clocks needed to remain in state 2 */
   2191 	uint32 version; /* version */
   2192 	uint32 fra_pulse_err;	/* sample error margin for detecting French radar pulsed */
   2193 	int npulses_fra;  /* Radar detection, minimum French pulses set */
   2194 	int npulses_stg2;  /* Radar detection, minimum staggered-2 pulses set */
   2195 	int npulses_stg3;  /* Radar detection, minimum staggered-3 pulses set */
   2196 	uint16 percal_mask;	/* defines which period cal is masked from radar detection */
   2197 	int quant;	/* quantization resolution to pulse positions */
   2198 	uint32 min_burst_intv_lp;	/* minimum burst to burst interval for bin3 radar */
   2199 	uint32 max_burst_intv_lp;	/* maximum burst to burst interval for bin3 radar */
   2200 	int nskip_rst_lp;	/* number of skipped pulses before resetting lp buffer */
   2201 	int max_pw_tol;	/* maximum tollerance allowed in detected pulse width for radar detection */
   2202 	uint16 feature_mask; /* 16-bit mask to specify enabled features */
   2203 } wl_radar_args_t;
   2204 
   2205 #define WL_RADAR_ARGS_VERSION 2
   2206 
   2207 typedef struct {
   2208 	uint32 version; /* version */
   2209 	uint16 thresh0_20_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 20MHz */
   2210 	uint16 thresh1_20_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
   2211 	uint16 thresh0_40_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
   2212 	uint16 thresh1_40_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
   2213 	uint16 thresh0_80_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 80MHz */
   2214 	uint16 thresh1_80_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 80MHz */
   2215 	uint16 thresh0_160_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 160MHz */
   2216 	uint16 thresh1_160_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 160MHz */
   2217 	uint16 thresh0_20_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
   2218 	uint16 thresh1_20_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
   2219 	uint16 thresh0_40_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
   2220 	uint16 thresh1_40_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
   2221 	uint16 thresh0_80_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 80MHz */
   2222 	uint16 thresh1_80_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 80MHz */
   2223 	uint16 thresh0_160_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 160MHz */
   2224 	uint16 thresh1_160_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 160MHz */
   2225 } wl_radar_thr_t;
   2226 
   2227 #define WL_RADAR_THR_VERSION	2
   2228 #define WL_THRESHOLD_LO_BAND	70	/* range from 5250MHz - 5350MHz */
   2229 
   2230 /* radar iovar SET defines */
   2231 #define WL_RADAR_DETECTOR_OFF		0	/* radar detector off */
   2232 #define WL_RADAR_DETECTOR_ON		1	/* radar detector on */
   2233 #define WL_RADAR_SIMULATED		2	/* force radar detector to declare
   2234 						 * detection once
   2235 						 */
   2236 #define WL_RSSI_ANT_VERSION	1	/* current version of wl_rssi_ant_t */
   2237 #define WL_ANT_RX_MAX		2	/* max 2 receive antennas */
   2238 #define WL_ANT_HT_RX_MAX	3	/* max 3 receive antennas/cores */
   2239 #define WL_ANT_IDX_1		0	/* antenna index 1 */
   2240 #define WL_ANT_IDX_2		1	/* antenna index 2 */
   2241 
   2242 #ifndef WL_RSSI_ANT_MAX
   2243 #define WL_RSSI_ANT_MAX		4	/* max possible rx antennas */
   2244 #elif WL_RSSI_ANT_MAX != 4
   2245 #error "WL_RSSI_ANT_MAX does not match"
   2246 #endif
   2247 
   2248 /* RSSI per antenna */
   2249 typedef struct {
   2250 	uint32	version;		/* version field */
   2251 	uint32	count;			/* number of valid antenna rssi */
   2252 	int8 rssi_ant[WL_RSSI_ANT_MAX];	/* rssi per antenna */
   2253 } wl_rssi_ant_t;
   2254 
   2255 /* dfs_status iovar-related defines */
   2256 
   2257 /* cac - channel availability check,
   2258  * ism - in-service monitoring
   2259  * csa - channel switching announcement
   2260  */
   2261 
   2262 /* cac state values */
   2263 #define WL_DFS_CACSTATE_IDLE		0	/* state for operating in non-radar channel */
   2264 #define	WL_DFS_CACSTATE_PREISM_CAC	1	/* CAC in progress */
   2265 #define WL_DFS_CACSTATE_ISM		2	/* ISM in progress */
   2266 #define WL_DFS_CACSTATE_CSA		3	/* csa */
   2267 #define WL_DFS_CACSTATE_POSTISM_CAC	4	/* ISM CAC */
   2268 #define WL_DFS_CACSTATE_PREISM_OOC	5	/* PREISM OOC */
   2269 #define WL_DFS_CACSTATE_POSTISM_OOC	6	/* POSTISM OOC */
   2270 #define WL_DFS_CACSTATES		7	/* this many states exist */
   2271 
   2272 /* data structure used in 'dfs_status' wl interface, which is used to query dfs status */
   2273 typedef struct {
   2274 	uint state;		/* noted by WL_DFS_CACSTATE_XX. */
   2275 	uint duration;		/* time spent in ms in state. */
   2276 	/* as dfs enters ISM state, it removes the operational channel from quiet channel
   2277 	 * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
   2278 	 */
   2279 	chanspec_t chanspec_cleared;
   2280 	/* chanspec cleared used to be a uint, add another to uint16 to maintain size */
   2281 	uint16 pad;
   2282 } wl_dfs_status_t;
   2283 
   2284 #define NUM_PWRCTRL_RATES 12
   2285 
   2286 typedef struct {
   2287 	uint8 txpwr_band_max[NUM_PWRCTRL_RATES];	/* User set target */
   2288 	uint8 txpwr_limit[NUM_PWRCTRL_RATES];		/* reg and local power limit */
   2289 	uint8 txpwr_local_max;				/* local max according to the AP */
   2290 	uint8 txpwr_local_constraint;			/* local constraint according to the AP */
   2291 	uint8 txpwr_chan_reg_max;			/* Regulatory max for this channel */
   2292 	uint8 txpwr_target[2][NUM_PWRCTRL_RATES];	/* Latest target for 2.4 and 5 Ghz */
   2293 	uint8 txpwr_est_Pout[2];			/* Latest estimate for 2.4 and 5 Ghz */
   2294 	uint8 txpwr_opo[NUM_PWRCTRL_RATES];		/* On G phy, OFDM power offset */
   2295 	uint8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];	/* Max CCK power for this band (SROM) */
   2296 	uint8 txpwr_bphy_ofdm_max;			/* Max OFDM power for this band (SROM) */
   2297 	uint8 txpwr_aphy_max[NUM_PWRCTRL_RATES];	/* Max power for A band (SROM) */
   2298 	int8  txpwr_antgain[2];				/* Ant gain for each band - from SROM */
   2299 	uint8 txpwr_est_Pout_gofdm;			/* Pwr estimate for 2.4 OFDM */
   2300 } tx_power_legacy_t;
   2301 
   2302 #define WL_TX_POWER_RATES_LEGACY    45
   2303 #define WL_TX_POWER_MCS20_FIRST         12
   2304 #define WL_TX_POWER_MCS20_NUM           16
   2305 #define WL_TX_POWER_MCS40_FIRST         28
   2306 #define WL_TX_POWER_MCS40_NUM           17
   2307 
   2308 typedef struct {
   2309 	uint32 flags;
   2310 	chanspec_t chanspec;                 /* txpwr report for this channel */
   2311 	chanspec_t local_chanspec;           /* channel on which we are associated */
   2312 	uint8 local_max;                 /* local max according to the AP */
   2313 	uint8 local_constraint;              /* local constraint according to the AP */
   2314 	int8  antgain[2];                /* Ant gain for each band - from SROM */
   2315 	uint8 rf_cores;                  /* count of RF Cores being reported */
   2316 	uint8 est_Pout[4];                           /* Latest tx power out estimate per RF
   2317 							  * chain without adjustment
   2318 							  */
   2319 	uint8 est_Pout_cck;                          /* Latest CCK tx power out estimate */
   2320 	uint8 user_limit[WL_TX_POWER_RATES_LEGACY];  /* User limit */
   2321 	uint8 reg_limit[WL_TX_POWER_RATES_LEGACY];   /* Regulatory power limit */
   2322 	uint8 board_limit[WL_TX_POWER_RATES_LEGACY]; /* Max power board can support (SROM) */
   2323 	uint8 target[WL_TX_POWER_RATES_LEGACY];      /* Latest target power */
   2324 } tx_power_legacy2_t;
   2325 
   2326 /* TX Power index defines */
   2327 #define WL_NUM_RATES_CCK			4 /* 1, 2, 5.5, 11 Mbps */
   2328 #define WL_NUM_RATES_OFDM			8 /* 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
   2329 #define WL_NUM_RATES_MCS_1STREAM	8 /* MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
   2330 #define WL_NUM_RATES_EXTRA_VHT		2 /* Additional VHT 11AC rates */
   2331 #define WL_NUM_RATES_VHT			10
   2332 #define WL_NUM_RATES_MCS32			1
   2333 
   2334 #define WLC_NUM_RATES_CCK       WL_NUM_RATES_CCK
   2335 #define WLC_NUM_RATES_OFDM      WL_NUM_RATES_OFDM
   2336 #define WLC_NUM_RATES_MCS_1_STREAM  WL_NUM_RATES_MCS_1STREAM
   2337 #define WLC_NUM_RATES_MCS_2_STREAM  WL_NUM_RATES_MCS_1STREAM
   2338 #define WLC_NUM_RATES_MCS32     WL_NUM_RATES_MCS32
   2339 #define WL_TX_POWER_CCK_NUM     WL_NUM_RATES_CCK
   2340 #define WL_TX_POWER_OFDM_NUM        WL_NUM_RATES_OFDM
   2341 #define WL_TX_POWER_MCS_1_STREAM_NUM    WL_NUM_RATES_MCS_1STREAM
   2342 #define WL_TX_POWER_MCS_2_STREAM_NUM    WL_NUM_RATES_MCS_1STREAM
   2343 #define WL_TX_POWER_MCS_32_NUM      WL_NUM_RATES_MCS32
   2344 
   2345 #define WL_NUM_2x2_ELEMENTS		4
   2346 #define WL_NUM_3x3_ELEMENTS		6
   2347 
   2348 typedef struct txppr {
   2349 	/* start of 20MHz tx power limits */
   2350 	int8 b20_1x1dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
   2351 	int8 b20_1x1ofdm[WL_NUM_RATES_OFDM];		/* Legacy OFDM transmission */
   2352 	int8 b20_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];		/* SISO MCS 0-7 */
   2353 
   2354 	int8 b20_1x2dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
   2355 	int8 b20_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2356 	int8 b20_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
   2357 	int8 b20_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2358 	int8 b20_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
   2359 
   2360 	int8 b20_1x3dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
   2361 	int8 b20_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2362 	int8 b20_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
   2363 	int8 b20_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2364 	int8 b20_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
   2365 	int8 b20_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
   2366 
   2367 	int8 b20_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
   2368 	int8 b20_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
   2369 	int8 b20_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
   2370 	int8 b20_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
   2371 	int8 b20_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
   2372 	int8 b20_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
   2373 	int8 b20_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
   2374 	int8 b20_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
   2375 
   2376 	/* start of 40MHz tx power limits */
   2377 	int8 b40_dummy1x1dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2378 	int8 b40_1x1ofdm[WL_NUM_RATES_OFDM];		/* Legacy OFDM transmission */
   2379 	int8 b40_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];		/* SISO MCS 0-7 */
   2380 
   2381 	int8 b40_dummy1x2dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2382 	int8 b40_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2383 	int8 b40_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
   2384 	int8 b40_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2385 	int8 b40_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
   2386 
   2387 	int8 b40_dummy1x3dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2388 	int8 b40_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2389 	int8 b40_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
   2390 	int8 b40_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2391 	int8 b40_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
   2392 	int8 b40_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
   2393 
   2394 	int8 b40_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
   2395 	int8 b40_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
   2396 	int8 b40_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
   2397 	int8 b40_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
   2398 	int8 b40_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
   2399 	int8 b40_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
   2400 	int8 b40_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
   2401 	int8 b40_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
   2402 
   2403 	/* start of 20in40MHz tx power limits */
   2404 	int8 b20in40_1x1dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2405 	int8 b20in40_1x1ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM transmission */
   2406 	int8 b20in40_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];	/* SISO MCS 0-7 */
   2407 
   2408 	int8 b20in40_1x2dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
   2409 	int8 b20in40_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2410 	int8 b20in40_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
   2411 	int8 b20in40_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2412 	int8 b20in40_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
   2413 
   2414 	int8 b20in40_1x3dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
   2415 	int8 b20in40_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* 20 in 40 MHz Legacy OFDM CDD */
   2416 	int8 b20in40_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
   2417 	int8 b20in40_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2418 	int8 b20in40_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
   2419 	int8 b20in40_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
   2420 
   2421 	int8 b20in40_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
   2422 	int8 b20in40_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
   2423 	int8 b20in40_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
   2424 	int8 b20in40_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
   2425 	int8 b20in40_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
   2426 	int8 b20in40_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
   2427 	int8 b20in40_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
   2428 	int8 b20in40_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
   2429 
   2430 	/* start of 80MHz tx power limits */
   2431 	int8 b80_dummy1x1dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
   2432 	int8 b80_1x1ofdm[WL_NUM_RATES_OFDM];			/* Legacy OFDM transmission */
   2433 	int8 b80_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];	/* SISO MCS 0-7 */
   2434 
   2435 	int8 b80_dummy1x2dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2436 	int8 b80_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2437 	int8 b80_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
   2438 	int8 b80_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2439 	int8 b80_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
   2440 
   2441 	int8 b80_dummy1x3dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2442 	int8 b80_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2443 	int8 b80_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
   2444 	int8 b80_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2445 	int8 b80_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
   2446 	int8 b80_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
   2447 
   2448 	int8 b80_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
   2449 	int8 b80_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
   2450 	int8 b80_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
   2451 	int8 b80_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
   2452 	int8 b80_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
   2453 	int8 b80_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
   2454 	int8 b80_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
   2455 	int8 b80_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
   2456 
   2457 	/* start of 20in80MHz tx power limits */
   2458 	int8 b20in80_1x1dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2459 	int8 b20in80_1x1ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM transmission */
   2460 	int8 b20in80_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];	/* SISO MCS 0-7 */
   2461 
   2462 	int8 b20in80_1x2dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
   2463 	int8 b20in80_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2464 	int8 b20in80_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
   2465 	int8 b20in80_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2466 	int8 b20in80_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
   2467 
   2468 	int8 b20in80_1x3dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
   2469 	int8 b20in80_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2470 	int8 b20in80_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
   2471 	int8 b20in80_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2472 	int8 b20in80_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
   2473 	int8 b20in80_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
   2474 
   2475 	int8 b20in80_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
   2476 	int8 b20in80_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
   2477 	int8 b20in80_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
   2478 	int8 b20in80_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
   2479 	int8 b20in80_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
   2480 	int8 b20in80_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
   2481 	int8 b20in80_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
   2482 	int8 b20in80_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
   2483 
   2484 	/* start of 40in80MHz tx power limits */
   2485 	int8 b40in80_dummy1x1dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2486 	int8 b40in80_1x1ofdm[WL_NUM_RATES_OFDM];		/* Legacy OFDM transmission */
   2487 	int8 b40in80_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];	/* SISO MCS 0-7 */
   2488 
   2489 	int8 b40in80_dummy1x2dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2490 	int8 b40in80_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
   2491 	int8 b40in80_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
   2492 	int8 b40in80_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2493 	int8 b40in80_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
   2494 
   2495 	int8 b40in80_dummy1x3dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
   2496 	int8 b40in80_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* MHz Legacy OFDM CDD */
   2497 	int8 b40in80_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
   2498 	int8 b40in80_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
   2499 	int8 b40in80_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
   2500 	int8 b40in80_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
   2501 
   2502 	int8 b40in80_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
   2503 	int8 b40in80_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
   2504 	int8 b40in80_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
   2505 	int8 b40in80_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
   2506 	int8 b40in80_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
   2507 	int8 b40in80_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
   2508 	int8 b40in80_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
   2509 	int8 b40in80_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
   2510 
   2511 	int8 mcs32; /* C_CHECK - THIS NEEDS TO BE REMOVED THROUGHOUT THE CODE */
   2512 } txppr_t;
   2513 
   2514 /* 20MHz */
   2515 #define WL_TX_POWER_CCK_FIRST					OFFSETOF(txppr_t, b20_1x1dsss)
   2516 #define WL_TX_POWER_OFDM20_FIRST				OFFSETOF(txppr_t, b20_1x1ofdm)
   2517 #define WL_TX_POWER_MCS20_SISO_FIRST			OFFSETOF(txppr_t, b20_1x1mcs0)
   2518 #define WL_TX_POWER_20_S1x1_FIRST				OFFSETOF(txppr_t, b20_1x1mcs0)
   2519 
   2520 #define WL_TX_POWER_CCK_CDD_S1x2_FIRST			OFFSETOF(txppr_t, b20_1x2dsss)
   2521 #define WL_TX_POWER_OFDM20_CDD_FIRST			OFFSETOF(txppr_t, b20_1x2cdd_ofdm)
   2522 #define WL_TX_POWER_MCS20_CDD_FIRST				OFFSETOF(txppr_t, b20_1x2cdd_mcs0)
   2523 #define WL_TX_POWER_20_S1x2_FIRST				OFFSETOF(txppr_t, b20_1x2cdd_mcs0)
   2524 #define WL_TX_POWER_MCS20_STBC_FIRST			OFFSETOF(txppr_t, b20_2x2stbc_mcs0)
   2525 #define WL_TX_POWER_MCS20_SDM_FIRST				OFFSETOF(txppr_t, b20_2x2sdm_mcs8)
   2526 #define WL_TX_POWER_20_S2x2_FIRST				OFFSETOF(txppr_t, b20_2x2sdm_mcs8)
   2527 
   2528 #define WL_TX_POWER_CCK_CDD_S1x3_FIRST			OFFSETOF(txppr_t, b20_1x3dsss)
   2529 #define WL_TX_POWER_OFDM20_CDD_S1x3_FIRST		OFFSETOF(txppr_t, b20_1x3cdd_ofdm)
   2530 #define WL_TX_POWER_20_S1x3_FIRST				OFFSETOF(txppr_t, b20_1x3cdd_mcs0)
   2531 #define WL_TX_POWER_20_STBC_S2x3_FIRST			OFFSETOF(txppr_t, b20_2x3stbc_mcs0)
   2532 #define WL_TX_POWER_20_S2x3_FIRST				OFFSETOF(txppr_t, b20_2x3sdm_mcs8)
   2533 #define WL_TX_POWER_20_S3x3_FIRST				OFFSETOF(txppr_t, b20_3x3sdm_mcs16)
   2534 
   2535 #define WL_TX_POWER_20_S1X1_VHT					OFFSETOF(txppr_t, b20_1x1vht)
   2536 #define WL_TX_POWER_20_S1X2_CDD_VHT				OFFSETOF(txppr_t, b20_1x2cdd_vht)
   2537 #define WL_TX_POWER_20_S2X2_STBC_VHT			OFFSETOF(txppr_t, b20_2x2stbc_vht)
   2538 #define WL_TX_POWER_20_S2X2_VHT					OFFSETOF(txppr_t, b20_2x2sdm_vht)
   2539 #define WL_TX_POWER_20_S1X3_CDD_VHT				OFFSETOF(txppr_t, b20_1x3cdd_vht)
   2540 #define WL_TX_POWER_20_S2X3_STBC_VHT			OFFSETOF(txppr_t, b20_2x3stbc_vht)
   2541 #define WL_TX_POWER_20_S2X3_VHT					OFFSETOF(txppr_t, b20_2x3sdm_vht)
   2542 #define WL_TX_POWER_20_S3X3_VHT					OFFSETOF(txppr_t, b20_3x3sdm_vht)
   2543 
   2544 /* 40MHz */
   2545 #define WL_TX_POWER_40_DUMMY_CCK_FIRST			OFFSETOF(txppr_t, b40_dummy1x1dsss)
   2546 #define WL_TX_POWER_OFDM40_FIRST				OFFSETOF(txppr_t, b40_1x1ofdm)
   2547 #define WL_TX_POWER_MCS40_SISO_FIRST			OFFSETOF(txppr_t, b40_1x1mcs0)
   2548 #define WL_TX_POWER_40_S1x1_FIRST				OFFSETOF(txppr_t, b40_1x1mcs0)
   2549 
   2550 #define WL_TX_POWER_40_DUMMY_CCK_CDD_S1x2_FIRST	OFFSETOF(txppr_t, b40_dummy1x2dsss)
   2551 #define WL_TX_POWER_OFDM40_CDD_FIRST			OFFSETOF(txppr_t, b40_1x2cdd_ofdm)
   2552 #define WL_TX_POWER_MCS40_CDD_FIRST				OFFSETOF(txppr_t, b40_1x2cdd_mcs0)
   2553 #define WL_TX_POWER_40_S1x2_FIRST				OFFSETOF(txppr_t, b40_1x2cdd_mcs0)
   2554 #define WL_TX_POWER_MCS40_STBC_FIRST			OFFSETOF(txppr_t, b40_2x2stbc_mcs0)
   2555 #define WL_TX_POWER_MCS40_SDM_FIRST				OFFSETOF(txppr_t, b40_2x2sdm_mcs8)
   2556 #define WL_TX_POWER_40_S2x2_FIRST				OFFSETOF(txppr_t, b40_2x2sdm_mcs8)
   2557 
   2558 #define WL_TX_POWER_40_DUMMY_CCK_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b40_dummy1x3dsss)
   2559 #define WL_TX_POWER_OFDM40_CDD_S1x3_FIRST		OFFSETOF(txppr_t, b40_1x3cdd_ofdm)
   2560 #define WL_TX_POWER_40_S1x3_FIRST				OFFSETOF(txppr_t, b40_1x3cdd_mcs0)
   2561 #define WL_TX_POWER_40_STBC_S2x3_FIRST			OFFSETOF(txppr_t, b40_2x3stbc_mcs0)
   2562 #define WL_TX_POWER_40_S2x3_FIRST				OFFSETOF(txppr_t, b40_2x3sdm_mcs8)
   2563 #define WL_TX_POWER_40_S3x3_FIRST				OFFSETOF(txppr_t, b40_3x3sdm_mcs16)
   2564 
   2565 #define WL_TX_POWER_40_S1X1_VHT					OFFSETOF(txppr_t, b40_1x1vht)
   2566 #define WL_TX_POWER_40_S1X2_CDD_VHT				OFFSETOF(txppr_t, b40_1x2cdd_vht)
   2567 #define WL_TX_POWER_40_S2X2_STBC_VHT			OFFSETOF(txppr_t, b40_2x2stbc_vht)
   2568 #define WL_TX_POWER_40_S2X2_VHT					OFFSETOF(txppr_t, b40_2x2sdm_vht)
   2569 #define WL_TX_POWER_40_S1X3_CDD_VHT				OFFSETOF(txppr_t, b40_1x3cdd_vht)
   2570 #define WL_TX_POWER_40_S2X3_STBC_VHT			OFFSETOF(txppr_t, b40_2x3stbc_vht)
   2571 #define WL_TX_POWER_40_S2X3_VHT					OFFSETOF(txppr_t, b40_2x3sdm_vht)
   2572 #define WL_TX_POWER_40_S3X3_VHT					OFFSETOF(txppr_t, b40_3x3sdm_vht)
   2573 
   2574 /* 20 in 40MHz */
   2575 #define WL_TX_POWER_20UL_CCK_FIRST				OFFSETOF(txppr_t, b20in40_1x1dsss)
   2576 #define WL_TX_POWER_20UL_OFDM_FIRST				OFFSETOF(txppr_t, b20in40_1x1ofdm)
   2577 #define WL_TX_POWER_20UL_S1x1_FIRST				OFFSETOF(txppr_t, b20in40_1x1mcs0)
   2578 
   2579 #define WL_TX_POWER_CCK_20U_CDD_S1x2_FIRST	OFFSETOF(txppr_t, b20in40_1x2dsss)
   2580 #define WL_TX_POWER_20UL_OFDM_CDD_FIRST		OFFSETOF(txppr_t, b20in40_1x2cdd_ofdm)
   2581 #define WL_TX_POWER_20UL_S1x2_FIRST			OFFSETOF(txppr_t, b20in40_1x2cdd_mcs0)
   2582 #define WL_TX_POWER_20UL_STBC_S2x2_FIRST	OFFSETOF(txppr_t, b20in40_2x2stbc_mcs0)
   2583 #define WL_TX_POWER_20UL_S2x2_FIRST			OFFSETOF(txppr_t, b20in40_2x2sdm_mcs8)
   2584 
   2585 #define WL_TX_POWER_CCK_20U_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b20in40_1x3dsss)
   2586 #define WL_TX_POWER_20UL_OFDM_CDD_S1x3_FIRST OFFSETOF(txppr_t, b20in40_1x3cdd_ofdm)
   2587 #define WL_TX_POWER_20UL_S1x3_FIRST			OFFSETOF(txppr_t, b20in40_1x3cdd_mcs0)
   2588 #define WL_TX_POWER_20UL_STBC_S2x3_FIRST	OFFSETOF(txppr_t, b20in40_2x3stbc_mcs0)
   2589 #define WL_TX_POWER_20UL_S2x3_FIRST			OFFSETOF(txppr_t, b20in40_2x3sdm_mcs8)
   2590 #define WL_TX_POWER_20UL_S3x3_FIRST			OFFSETOF(txppr_t, b20in40_3x3sdm_mcs16)
   2591 
   2592 #define WL_TX_POWER_20UL_S1X1_VHT			OFFSETOF(txppr_t, b20in40_1x1vht)
   2593 #define WL_TX_POWER_20UL_S1X2_CDD_VHT		OFFSETOF(txppr_t, b20in40_1x2cdd_vht)
   2594 #define WL_TX_POWER_20UL_S2X2_STBC_VHT		OFFSETOF(txppr_t, b20in40_2x2stbc_vht)
   2595 #define WL_TX_POWER_20UL_S2X2_VHT			OFFSETOF(txppr_t, b20in40_2x2sdm_vht)
   2596 #define WL_TX_POWER_20UL_S1X3_CDD_VHT		OFFSETOF(txppr_t, b20in40_1x3cdd_vht)
   2597 #define WL_TX_POWER_20UL_S2X3_STBC_VHT		OFFSETOF(txppr_t, b20in40_2x3stbc_vht)
   2598 #define