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 */
54typedef 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
62typedef struct {
63	uint32 num;
64	chanspec_t list[1];
65} chanspec_list_t;
66
67#define ACTION_FRAME_SIZE 1800
68
69typedef 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
78typedef struct ssid_info
79{
80	uint8		ssid_len;	/* the length of SSID */
81	uint8		ssid[32];	/* SSID string */
82} ssid_info_t;
83
84typedef 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
95typedef 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
114typedef 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 */
147typedef 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 */
189typedef 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
237typedef 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
251typedef 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 */
264enum {
265	DL_TYPE_UCODE = 1,
266	DL_TYPE_CLM = 2
267};
268
269/* ucode type values */
270enum {
271	UCODE_FW,
272	INIT_VALS,
273	BS_INIT_VALS
274};
275
276struct wl_dload_data {
277	uint16 flag;
278	uint16 dload_type;
279	uint32 len;
280	uint32 crc;
281	uint8  data[1];
282};
283typedef struct wl_dload_data wl_dload_data_t;
284
285struct 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};
292typedef struct wl_ucode_info wl_ucode_info_t;
293
294struct 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};
302typedef struct wl_clm_dload_info wl_clm_dload_info_t;
303
304#endif /* LINUX_POSTMOGRIFY_REMOVAL */
305
306typedef 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
314typedef 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
319typedef BWL_PRE_PACKED_STRUCT struct wnm_url {
320	uint8   len;
321	uint8   data[1];
322} BWL_POST_PACKED_STRUCT wnm_url_t;
323
324typedef 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
332typedef 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
340typedef 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
367typedef 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 */
415typedef 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
426typedef 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
450typedef 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
459typedef 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 */
470typedef 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
479typedef 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 */
487typedef 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
492typedef 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 */
500typedef 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 */
508typedef 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 */
522typedef 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 */
526typedef 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 */
530typedef 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 */
541typedef 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 */
556typedef 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
653typedef 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
682typedef 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
691typedef 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 */
703enum 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 */
717typedef 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
734typedef 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
749typedef 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
757typedef 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
776typedef 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
786typedef 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
795typedef 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
809typedef 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
814typedef 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
822typedef 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
884typedef 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 */
911typedef 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
958typedef struct _pmkid {
959	struct ether_addr	BSSID;
960	uint8			PMKID[WPA2_PMKID_LEN];
961} pmkid_t;
962
963typedef struct _pmkid_list {
964	uint32	npmkid;
965	pmkid_t	pmkid[1];
966} pmkid_list_t;
967
968typedef struct _pmkid_cand {
969	struct ether_addr	BSSID;
970	uint8			preauth;
971} pmkid_cand_t;
972
973typedef 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
979typedef 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
991typedef 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 */
999typedef 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] */
1006typedef 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 */
1018typedef 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
1033typedef 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 */
1041struct 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
1049typedef 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
1053typedef 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
1062typedef 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 */
1091typedef 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
1099typedef 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 */
1149typedef 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 */
1155typedef struct {
1156	uint32 code;
1157	scb_val_t ioctl_args;
1158} authops_t;
1159
1160/* channel encoding */
1161typedef 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 */
1168struct 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 */
1175typedef 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 */
1193typedef 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
1199typedef 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
1207typedef 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 */
1216typedef 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 */
1223typedef 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 */
1245typedef 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 */
1265typedef 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
1288typedef 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 */
1294typedef 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
1305typedef 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 */
1730typedef 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 */
1773typedef 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
1783typedef 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
1981typedef 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 */
2017typedef 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
2052typedef 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 */
2067enum {
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 */
2074enum {
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 */
2081enum {
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 */
2091enum {
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 */
2097enum {
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};
2102typedef 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
2109typedef 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
2116typedef 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 */
2125typedef 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
2139typedef 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 */
2153typedef 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 */
2172typedef 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
2207typedef 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 */
2249typedef 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 */
2273typedef 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
2286typedef 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
2308typedef 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
2348typedef 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 WL_TX_POWER_20UL_S2X3_VHT			OFFSETOF(txppr_t, b20in40_2x3sdm_vht)
2599#define WL_TX_POWER_20UL_S3X3_VHT			OFFSETOF(txppr_t, b20in40_3x3sdm_vht)
2600
2601/* 80MHz */
2602#define WL_TX_POWER_80_DUMMY_CCK_FIRST		OFFSETOF(txppr_t, b80_dummy1x1dsss)
2603#define WL_TX_POWER_OFDM80_FIRST			OFFSETOF(txppr_t, b80_1x1ofdm)
2604#define WL_TX_POWER_MCS80_SISO_FIRST		OFFSETOF(txppr_t, b80_1x1mcs0)
2605#define WL_TX_POWER_80_S1x1_FIRST			OFFSETOF(txppr_t, b80_1x1mcs0)
2606
2607#define WL_TX_POWER_80_DUMMY_CCK_CDD_S1x2_FIRST	OFFSETOF(txppr_t, b80_dummy1x2dsss)
2608#define WL_TX_POWER_OFDM80_CDD_FIRST			OFFSETOF(txppr_t, b80_1x2cdd_ofdm)
2609#define WL_TX_POWER_MCS80_CDD_FIRST				OFFSETOF(txppr_t, b80_1x2cdd_mcs0)
2610#define WL_TX_POWER_80_S1x2_FIRST				OFFSETOF(txppr_t, b80_1x2cdd_mcs0)
2611#define WL_TX_POWER_MCS80_STBC_FIRST			OFFSETOF(txppr_t, b80_2x2stbc_mcs0)
2612#define WL_TX_POWER_MCS80_SDM_FIRST				OFFSETOF(txppr_t, b80_2x2sdm_mcs8)
2613#define WL_TX_POWER_80_S2x2_FIRST				OFFSETOF(txppr_t, b80_2x2sdm_mcs8)
2614
2615#define WL_TX_POWER_80_DUMMY_CCK_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b80_dummy1x3dsss)
2616#define WL_TX_POWER_OFDM80_CDD_S1x3_FIRST		OFFSETOF(txppr_t, b80_1x3cdd_ofdm)
2617#define WL_TX_POWER_80_S1x3_FIRST				OFFSETOF(txppr_t, b80_1x3cdd_mcs0)
2618#define WL_TX_POWER_80_STBC_S2x3_FIRST			OFFSETOF(txppr_t, b80_2x3stbc_mcs0)
2619#define WL_TX_POWER_80_S2x3_FIRST				OFFSETOF(txppr_t, b80_2x3sdm_mcs8)
2620#define WL_TX_POWER_80_S3x3_FIRST				OFFSETOF(txppr_t, b80_3x3sdm_mcs16)
2621
2622#define WL_TX_POWER_80_S1X1_VHT					OFFSETOF(txppr_t, b80_1x1vht)
2623#define WL_TX_POWER_80_S1X2_CDD_VHT				OFFSETOF(txppr_t, b80_1x2cdd_vht)
2624#define WL_TX_POWER_80_S2X2_STBC_VHT			OFFSETOF(txppr_t, b80_2x2stbc_vht)
2625#define WL_TX_POWER_80_S2X2_VHT					OFFSETOF(txppr_t, b80_2x2sdm_vht)
2626#define WL_TX_POWER_80_S1X3_CDD_VHT				OFFSETOF(txppr_t, b80_1x3cdd_vht)
2627#define WL_TX_POWER_80_S2X3_STBC_VHT			OFFSETOF(txppr_t, b80_2x3stbc_vht)
2628#define WL_TX_POWER_80_S2X3_VHT					OFFSETOF(txppr_t, b80_2x3sdm_vht)
2629#define WL_TX_POWER_80_S3X3_VHT					OFFSETOF(txppr_t, b80_3x3sdm_vht)
2630
2631/* 20 in 80MHz */
2632#define WL_TX_POWER_20UUL_CCK_FIRST				OFFSETOF(txppr_t, b20in80_1x1dsss)
2633#define WL_TX_POWER_20UUL_OFDM_FIRST			OFFSETOF(txppr_t, b20in80_1x1ofdm)
2634#define WL_TX_POWER_20UUL_S1x1_FIRST			OFFSETOF(txppr_t, b20in80_1x1mcs0)
2635
2636#define WL_TX_POWER_CCK_20UU_CDD_S1x2_FIRST		OFFSETOF(txppr_t, b20in80_1x2dsss)
2637#define WL_TX_POWER_20UUL_OFDM_CDD_FIRST		OFFSETOF(txppr_t, b20in80_1x2cdd_ofdm)
2638#define WL_TX_POWER_20UUL_S1x2_FIRST			OFFSETOF(txppr_t, b20in80_1x2cdd_mcs0)
2639#define WL_TX_POWER_20UUL_STBC_S2x2_FIRST		OFFSETOF(txppr_t, b20in80_2x2stbc_mcs0)
2640#define WL_TX_POWER_20UUL_S2x2_FIRST			OFFSETOF(txppr_t, b20in80_2x2sdm_mcs8)
2641
2642#define WL_TX_POWER_CCK_20UU_CDD_S1x3_FIRST		OFFSETOF(txppr_t, b20in80_1x3dsss)
2643#define WL_TX_POWER_20UUL_OFDM_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b20in80_1x3cdd_ofdm)
2644#define WL_TX_POWER_20UUL_S1x3_FIRST			OFFSETOF(txppr_t, b20in80_1x3cdd_mcs0)
2645#define WL_TX_POWER_20UUL_STBC_S2x3_FIRST		OFFSETOF(txppr_t, b20in80_2x3stbc_mcs0)
2646#define WL_TX_POWER_20UUL_S2x3_FIRST			OFFSETOF(txppr_t, b20in80_2x3sdm_mcs8)
2647#define WL_TX_POWER_20UUL_S3x3_FIRST			OFFSETOF(txppr_t, b20in80_3x3sdm_mcs16)
2648
2649#define WL_TX_POWER_20UUL_S1X1_VHT			OFFSETOF(txppr_t, b20in80_1x1vht)
2650#define WL_TX_POWER_20UUL_S1X2_CDD_VHT		OFFSETOF(txppr_t, b20in80_1x2cdd_vht)
2651#define WL_TX_POWER_20UUL_S2X2_STBC_VHT		OFFSETOF(txppr_t, b20in80_2x2stbc_vht)
2652#define WL_TX_POWER_20UUL_S2X2_VHT			OFFSETOF(txppr_t, b20in80_2x2sdm_vht)
2653#define WL_TX_POWER_20UUL_S1X3_CDD_VHT		OFFSETOF(txppr_t, b20in80_1x3cdd_vht)
2654#define WL_TX_POWER_20UUL_S2X3_STBC_VHT		OFFSETOF(txppr_t, b20in80_2x3stbc_vht)
2655#define WL_TX_POWER_20UUL_S2X3_VHT			OFFSETOF(txppr_t, b20in80_2x3sdm_vht)
2656#define WL_TX_POWER_20UUL_S3X3_VHT			OFFSETOF(txppr_t, b20in80_3x3sdm_vht)
2657
2658/* 40 in 80MHz */
2659#define WL_TX_POWER_40UUL_DUMMY_CCK_FIRST		OFFSETOF(txppr_t, b40in80_dummy1x1dsss)
2660#define WL_TX_POWER_40UUL_OFDM_FIRST			OFFSETOF(txppr_t, b40in80_1x1ofdm)
2661#define WL_TX_POWER_40UUL_S1x1_FIRST			OFFSETOF(txppr_t, b40in80_1x1mcs0)
2662
2663#define WL_TX_POWER_CCK_40UU_DUMMY_CDD_S1x2_FIRST OFFSETOF(txppr_t, b40in80_dummy1x2dsss)
2664#define WL_TX_POWER_40UUL_OFDM_CDD_FIRST		OFFSETOF(txppr_t, b40in80_1x2cdd_ofdm)
2665#define WL_TX_POWER_40UUL_S1x2_FIRST			OFFSETOF(txppr_t, b40in80_1x2cdd_mcs0)
2666#define WL_TX_POWER_40UUL_STBC_S2x2_FIRST		OFFSETOF(txppr_t, b40in80_2x2stbc_mcs0)
2667#define WL_TX_POWER_40UUL_S2x2_FIRST			OFFSETOF(txppr_t, b40in80_2x2sdm_mcs8)
2668
2669#define WL_TX_POWER_CCK_40UU_DUMMY_CDD_S1x3_FIRST OFFSETOF(txppr_t, b40in80_dummy1x3dsss)
2670#define WL_TX_POWER_40UUL_OFDM_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b40in80_1x3cdd_ofdm)
2671#define WL_TX_POWER_40UUL_S1x3_FIRST			OFFSETOF(txppr_t, b40in80_1x3cdd_mcs0)
2672#define WL_TX_POWER_40UUL_STBC_S2x3_FIRST		OFFSETOF(txppr_t, b40in80_2x3stbc_mcs0)
2673#define WL_TX_POWER_40UUL_S2x3_FIRST			OFFSETOF(txppr_t, b40in80_2x3sdm_mcs8)
2674#define WL_TX_POWER_40UUL_S3x3_FIRST			OFFSETOF(txppr_t, b40in80_3x3sdm_mcs16)
2675
2676#define WL_TX_POWER_40UUL_S1X1_VHT			OFFSETOF(txppr_t, b40in80_1x1vht)
2677#define WL_TX_POWER_40UUL_S1X2_CDD_VHT		OFFSETOF(txppr_t, b40in80_1x2cdd_vht)
2678#define WL_TX_POWER_40UUL_S2X2_STBC_VHT		OFFSETOF(txppr_t, b40in80_2x2stbc_vht)
2679#define WL_TX_POWER_40UUL_S2X2_VHT			OFFSETOF(txppr_t, b40in80_2x2sdm_vht)
2680#define WL_TX_POWER_40UUL_S1X3_CDD_VHT		OFFSETOF(txppr_t, b40in80_1x3cdd_vht)
2681#define WL_TX_POWER_40UUL_S2X3_STBC_VHT		OFFSETOF(txppr_t, b40in80_2x3stbc_vht)
2682#define WL_TX_POWER_40UUL_S2X3_VHT			OFFSETOF(txppr_t, b40in80_2x3sdm_vht)
2683#define WL_TX_POWER_40UUL_S3X3_VHT			OFFSETOF(txppr_t, b40in80_3x3sdm_vht)
2684
2685#define WL_TX_POWER_MCS_32			OFFSETOF(txppr_t, mcs32) /* C_CHECK remove later */
2686
2687#define WL_TX_POWER_RATES			sizeof(struct txppr)
2688
2689/* sslpnphy specifics */
2690#define WL_TX_POWER_MCS20_SISO_FIRST_SSN	WL_TX_POWER_MCS20_SISO_FIRST
2691#define WL_TX_POWER_MCS40_SISO_FIRST_SSN	WL_TX_POWER_MCS40_SISO_FIRST
2692
2693typedef struct {
2694	uint16 ver;				/* version of this struct */
2695	uint16 len;				/* length in bytes of this structure */
2696	uint32 flags;
2697	chanspec_t chanspec;			/* txpwr report for this channel */
2698	chanspec_t local_chanspec;		/* channel on which we are associated */
2699	uint32 buflen;				/* ppr buffer length */
2700	uint8      pprbuf[1];			/* Latest target power buffer */
2701} wl_txppr_t;
2702
2703#define WL_TXPPR_VERSION	0
2704#define WL_TXPPR_LENGTH	(sizeof(wl_txppr_t))
2705#define TX_POWER_T_VERSION	44
2706
2707/* Defines used with channel_bandwidth for curpower */
2708#define WL_BW_20MHZ 		0
2709#define WL_BW_40MHZ 		1
2710#define WL_BW_80MHZ 		2
2711#define WL_BW_160MHZ 		3
2712
2713/* tx_power_t.flags bits */
2714/* use for defined PPR_API */
2715#define WL_TX_POWER_F_ENABLED	1
2716#define WL_TX_POWER_F_HW		2
2717#define WL_TX_POWER_F_MIMO		4
2718#define WL_TX_POWER_F_SISO		8
2719#define WL_TX_POWER_F_HT		0x10
2720#define WL_TX_POWER_F_VHT		0x20
2721
2722typedef struct {
2723	uint32 flags;
2724	chanspec_t chanspec;			/* txpwr report for this channel */
2725	chanspec_t local_chanspec;		/* channel on which we are associated */
2726	uint8 local_max;			/* local max according to the AP */
2727	uint8 local_constraint;			/* local constraint according to the AP */
2728	int8  antgain[2];			/* Ant gain for each band - from SROM */
2729	uint8 rf_cores;				/* count of RF Cores being reported */
2730	uint8 est_Pout[4];			/* Latest tx power out estimate per RF chain */
2731	uint8 est_Pout_act[4]; /* Latest tx power out estimate per RF chain w/o adjustment */
2732	uint8 est_Pout_cck;			/* Latest CCK tx power out estimate */
2733	uint8 tx_power_max[4];		/* Maximum target power among all rates */
2734	uint tx_power_max_rate_ind[4];		/* Index of the rate with the max target power */
2735	uint8 user_limit[WL_TX_POWER_RATES];	/* User limit */
2736	int8 board_limit[WL_TX_POWER_RATES];	/* Max power board can support (SROM) */
2737	int8 target[WL_TX_POWER_RATES];			/* Latest target power */
2738	int8 clm_limits[WL_NUMRATES];		/* regulatory limits - 20, 40 or 80MHz */
2739	int8 clm_limits_subchan1[WL_NUMRATES];	/* regulatory limits - 20in40 or 40in80 */
2740	int8 clm_limits_subchan2[WL_NUMRATES];	/* regulatory limits - 20in80MHz */
2741	int8 sar;					/* SAR limit for display by wl executable */
2742	int8 channel_bandwidth;		/* 20, 40 or 80 MHz bandwidth? */
2743	uint8 version;				/* Version of the data format wlu <--> driver */
2744	uint8 display_core;			/* Displayed curpower core */
2745	int8 target_offsets[4];		/* Target power offsets for current rate per core */
2746	uint32 last_tx_ratespec;	/* Ratespec for last transmition */
2747	int8 SARLIMIT[MAX_STREAMS_SUPPORTED];
2748} tx_power_t;
2749
2750typedef struct tx_inst_power {
2751	uint8 txpwr_est_Pout[2];			/* Latest estimate for 2.4 and 5 Ghz */
2752	uint8 txpwr_est_Pout_gofdm;			/* Pwr estimate for 2.4 OFDM */
2753} tx_inst_power_t;
2754
2755
2756typedef struct {
2757	uint32 flags;
2758	chanspec_t chanspec;			/* txpwr report for this channel */
2759	chanspec_t local_chanspec;		/* channel on which we are associated */
2760	uint8 local_max;			/* local max according to the AP */
2761	uint8 local_constraint;			/* local constraint according to the AP */
2762	int8  antgain[2];			/* Ant gain for each band - from SROM */
2763	uint8 rf_cores;				/* count of RF Cores being reported */
2764	uint8 est_Pout[4];			/* Latest tx power out estimate per RF chain */
2765	uint8 est_Pout_act[4];                  /* Latest tx power out estimate per RF chain
2766						 * without adjustment
2767						 */
2768	uint8 est_Pout_cck;			/* Latest CCK tx power out estimate */
2769	uint8 tx_power_max[4];                  /* Maximum target power among all rates */
2770	uint tx_power_max_rate_ind[4];         /* Index of the rate with the max target power */
2771	txppr_t user_limit;			/* User limit */
2772	txppr_t reg_limit;			/* Regulatory power limit */
2773	txppr_t board_limit;			/* Max power board can support (SROM) */
2774	txppr_t target;				/* Latest target power */
2775} wl_txpwr_t;
2776
2777#define WL_NUM_TXCHAIN_MAX	4
2778typedef struct wl_txchain_pwr_offsets {
2779	int8 offset[WL_NUM_TXCHAIN_MAX];	/* quarter dBm signed offset for each chain */
2780} wl_txchain_pwr_offsets_t;
2781
2782/* 802.11h measurement types */
2783#define WLC_MEASURE_TPC			1
2784#define WLC_MEASURE_CHANNEL_BASIC	2
2785#define WLC_MEASURE_CHANNEL_CCA		3
2786#define WLC_MEASURE_CHANNEL_RPI		4
2787
2788/* regulatory enforcement levels */
2789#define SPECT_MNGMT_OFF			0		/* both 11h and 11d disabled */
2790#define SPECT_MNGMT_LOOSE_11H		1		/* allow non-11h APs in scan lists */
2791#define SPECT_MNGMT_STRICT_11H		2		/* prune out non-11h APs from scan list */
2792#define SPECT_MNGMT_STRICT_11D		3		/* switch to 802.11D mode */
2793/* SPECT_MNGMT_LOOSE_11H_D - same as SPECT_MNGMT_LOOSE with the exception that Country IE
2794 * adoption is done regardless of capability spectrum_management
2795 */
2796#define SPECT_MNGMT_LOOSE_11H_D		4		/* operation defined above */
2797
2798#define WL_CHAN_VALID_HW	(1 << 0)	/* valid with current HW */
2799#define WL_CHAN_VALID_SW	(1 << 1)	/* valid with current country setting */
2800#define WL_CHAN_BAND_5G		(1 << 2)	/* 5GHz-band channel */
2801#define WL_CHAN_RADAR		(1 << 3)	/* radar sensitive  channel */
2802#define WL_CHAN_INACTIVE	(1 << 4)	/* temporarily inactive due to radar */
2803#define WL_CHAN_PASSIVE		(1 << 5)	/* channel is in passive mode */
2804#define WL_CHAN_RESTRICTED	(1 << 6)	/* restricted use channel */
2805
2806/* BTC mode used by "btc_mode" iovar */
2807#define	WL_BTC_DISABLE		0	/* disable BT coexistence */
2808#define WL_BTC_FULLTDM      1	/* full TDM COEX */
2809#define WL_BTC_ENABLE       1	/* full TDM COEX to maintain backward compatiblity */
2810#define WL_BTC_PREMPT      2    /* full TDM COEX with preemption */
2811#define WL_BTC_LITE        3	/* light weight coex for large isolation platform */
2812#define WL_BTC_PARALLEL		4   /* BT and WLAN run in parallel with separate antenna  */
2813#define WL_BTC_HYBRID		5   /* hybrid coex, only ack is allowed to transmit in BT slot */
2814#define WL_BTC_DEFAULT		8	/* set the default mode for the device */
2815#define WL_INF_BTC_DISABLE      0
2816#define WL_INF_BTC_ENABLE       1
2817#define WL_INF_BTC_AUTO         3
2818
2819/* BTC wire used by "btc_wire" iovar */
2820#define	WL_BTC_DEFWIRE		0	/* use default wire setting */
2821#define WL_BTC_2WIRE		2	/* use 2-wire BTC */
2822#define WL_BTC_3WIRE		3	/* use 3-wire BTC */
2823#define WL_BTC_4WIRE		4	/* use 4-wire BTC */
2824
2825/* BTC flags: BTC configuration that can be set by host */
2826#define WL_BTC_FLAG_PREMPT               (1 << 0)
2827#define WL_BTC_FLAG_BT_DEF               (1 << 1)
2828#define WL_BTC_FLAG_ACTIVE_PROT          (1 << 2)
2829#define WL_BTC_FLAG_SIM_RSP              (1 << 3)
2830#define WL_BTC_FLAG_PS_PROTECT           (1 << 4)
2831#define WL_BTC_FLAG_SIM_TX_LP	         (1 << 5)
2832#define WL_BTC_FLAG_ECI                  (1 << 6)
2833#define WL_BTC_FLAG_LIGHT                (1 << 7)
2834#define WL_BTC_FLAG_PARALLEL             (1 << 8)
2835
2836/* Message levels */
2837#define WL_ERROR_VAL		0x00000001
2838#define WL_TRACE_VAL		0x00000002
2839#define WL_PRHDRS_VAL		0x00000004
2840#define WL_PRPKT_VAL		0x00000008
2841#define WL_INFORM_VAL		0x00000010
2842#define WL_TMP_VAL		0x00000020
2843#define WL_OID_VAL		0x00000040
2844#define WL_RATE_VAL		0x00000080
2845#define WL_ASSOC_VAL		0x00000100
2846#define WL_PRUSR_VAL		0x00000200
2847#define WL_PS_VAL		0x00000400
2848#define WL_TXPWR_VAL		0x00000800	/* retired in TOT on 6/10/2009 */
2849#define WL_PORT_VAL		0x00001000
2850#define WL_DUAL_VAL		0x00002000
2851#define WL_WSEC_VAL		0x00004000
2852#define WL_WSEC_DUMP_VAL	0x00008000
2853#define WL_LOG_VAL		0x00010000
2854#define WL_NRSSI_VAL		0x00020000	/* retired in TOT on 6/10/2009 */
2855#define WL_LOFT_VAL		0x00040000	/* retired in TOT on 6/10/2009 */
2856#define WL_REGULATORY_VAL	0x00080000
2857#define WL_PHYCAL_VAL		0x00100000	/* retired in TOT on 6/10/2009 */
2858#define WL_RADAR_VAL		0x00200000	/* retired in TOT on 6/10/2009 */
2859#define WL_MPC_VAL		0x00400000
2860#define WL_APSTA_VAL		0x00800000
2861#define WL_DFS_VAL		0x01000000
2862#define WL_BA_VAL		0x02000000	/* retired in TOT on 6/14/2010 */
2863#define WL_ACI_VAL		0x04000000
2864#define WL_MBSS_VAL		0x04000000
2865#define WL_CAC_VAL		0x08000000
2866#define WL_AMSDU_VAL		0x10000000
2867#define WL_AMPDU_VAL		0x20000000
2868#define WL_FFPLD_VAL		0x40000000
2869
2870/* wl_msg_level is full. For new bits take the next one and AND with
2871 * wl_msg_level2 in wl_dbg.h
2872 */
2873#define WL_DPT_VAL 		0x00000001
2874#define WL_SCAN_VAL		0x00000002
2875#define WL_WOWL_VAL		0x00000004
2876#define WL_COEX_VAL		0x00000008
2877#define WL_RTDC_VAL		0x00000010
2878#define WL_PROTO_VAL		0x00000020
2879#define WL_BTA_VAL		0x00000040
2880#define WL_CHANINT_VAL		0x00000080
2881#define WL_THERMAL_VAL		0x00000100	/* retired in TOT on 6/10/2009 */
2882#define WL_P2P_VAL		0x00000200
2883#define WL_ITFR_VAL		0x00000400
2884#define WL_MCHAN_VAL		0x00000800
2885#define WL_TDLS_VAL		0x00001000
2886#define WL_MCNX_VAL		0x00002000
2887#define WL_PROT_VAL		0x00004000
2888#define WL_PSTA_VAL		0x00008000
2889#define WL_TBTT_VAL		0x00010000
2890#define WL_NIC_VAL		0x00020000
2891#define WL_PWRSEL_VAL		0x00040000
2892#define WL_TRF_MGMT_VAL		0x00080000
2893#define WL_L2FILTER_VAL		0x00100000
2894#define WL_TSO_VAL		0x00200000
2895#define WL_MQ_VAL		0x00400000
2896/* These 3 levels are currently not used in trunk but in Aardvark and Phoenix2 with != values */
2897#define WL_LPC_VAL	        0x00800000
2898#define WL_TXBF_VAL		0x01000000
2899#define WL_P2PO_VAL		0x02000000
2900/* This level is synchronized with other branches */
2901#define WL_WNM_VAL		0x04000000
2902/* This level is currently not used in trunk but used in Phoenix2 */
2903#define WL_SRSCAN_VAL	0x08000000
2904
2905/* use top-bit for WL_TIME_STAMP_VAL because this is a modifier
2906 * rather than a message-type of its own
2907 */
2908#define WL_TIMESTAMP_VAL        0x80000000
2909
2910/* max # of leds supported by GPIO (gpio pin# == led index#) */
2911#define	WL_LED_NUMGPIO		32	/* gpio 0-31 */
2912
2913/* led per-pin behaviors */
2914#define	WL_LED_OFF		0		/* always off */
2915#define	WL_LED_ON		1		/* always on */
2916#define	WL_LED_ACTIVITY		2		/* activity */
2917#define	WL_LED_RADIO		3		/* radio enabled */
2918#define	WL_LED_ARADIO		4		/* 5  Ghz radio enabled */
2919#define	WL_LED_BRADIO		5		/* 2.4Ghz radio enabled */
2920#define	WL_LED_BGMODE		6		/* on if gmode, off if bmode */
2921#define	WL_LED_WI1		7
2922#define	WL_LED_WI2		8
2923#define	WL_LED_WI3		9
2924#define	WL_LED_ASSOC		10		/* associated state indicator */
2925#define	WL_LED_INACTIVE		11		/* null behavior (clears default behavior) */
2926#define	WL_LED_ASSOCACT		12		/* on when associated; blink fast for activity */
2927#define WL_LED_WI4		13
2928#define WL_LED_WI5		14
2929#define	WL_LED_BLINKSLOW	15		/* blink slow */
2930#define	WL_LED_BLINKMED		16		/* blink med */
2931#define	WL_LED_BLINKFAST	17		/* blink fast */
2932#define	WL_LED_BLINKCUSTOM	18		/* blink custom */
2933#define	WL_LED_BLINKPERIODIC	19		/* blink periodic (custom 1000ms / off 400ms) */
2934#define WL_LED_ASSOC_WITH_SEC 	20		/* when connected with security */
2935						/* keep on for 300 sec */
2936#define WL_LED_START_OFF 	21		/* off upon boot, could be turned on later */
2937#define WL_LED_W6		22		/* off upon boot, could be turned on later */
2938#define WL_LED_WI7		23		/* off upon boot, could be turned on later */
2939#define	WL_LED_NUMBEHAVIOR	24
2940
2941/* led behavior numeric value format */
2942#define	WL_LED_BEH_MASK		0x7f		/* behavior mask */
2943#define	WL_LED_AL_MASK		0x80		/* activelow (polarity) bit */
2944
2945/* maximum channels returned by the get valid channels iovar */
2946#define WL_NUMCHANNELS		64
2947
2948/* max number of chanspecs (used by the iovar to calc. buf space) */
2949#define WL_NUMCHANSPECS 110
2950
2951/* WDS link local endpoint WPA role */
2952#define WL_WDS_WPA_ROLE_AUTH	0	/* authenticator */
2953#define WL_WDS_WPA_ROLE_SUP	1	/* supplicant */
2954#define WL_WDS_WPA_ROLE_AUTO	255	/* auto, based on mac addr value */
2955
2956/* number of bytes needed to define a 128-bit mask for MAC event reporting */
2957#define WL_EVENTING_MASK_LEN	16
2958
2959/*
2960 * Join preference iovar value is an array of tuples. Each tuple has a one-byte type,
2961 * a one-byte length, and a variable length value.  RSSI type tuple must be present
2962 * in the array.
2963 *
2964 * Types are defined in "join preference types" section.
2965 *
2966 * Length is the value size in octets. It is reserved for WL_JOIN_PREF_WPA type tuple
2967 * and must be set to zero.
2968 *
2969 * Values are defined below.
2970 *
2971 * 1. RSSI - 2 octets
2972 * offset 0: reserved
2973 * offset 1: reserved
2974 *
2975 * 2. WPA - 2 + 12 * n octets (n is # tuples defined below)
2976 * offset 0: reserved
2977 * offset 1: # of tuples
2978 * offset 2: tuple 1
2979 * offset 14: tuple 2
2980 * ...
2981 * offset 2 + 12 * (n - 1) octets: tuple n
2982 *
2983 * struct wpa_cfg_tuple {
2984 *   uint8 akm[DOT11_OUI_LEN+1];     akm suite
2985 *   uint8 ucipher[DOT11_OUI_LEN+1]; unicast cipher suite
2986 *   uint8 mcipher[DOT11_OUI_LEN+1]; multicast cipher suite
2987 * };
2988 *
2989 * multicast cipher suite can be specified as a specific cipher suite or WL_WPA_ACP_MCS_ANY.
2990 *
2991 * 3. BAND - 2 octets
2992 * offset 0: reserved
2993 * offset 1: see "band preference" and "band types"
2994 *
2995 * 4. BAND RSSI - 2 octets
2996 * offset 0: band types
2997 * offset 1: +ve RSSI boost value in dB
2998 */
2999
3000/* join preference types */
3001#define WL_JOIN_PREF_RSSI	1	/* by RSSI */
3002#define WL_JOIN_PREF_WPA	2	/* by akm and ciphers */
3003#define WL_JOIN_PREF_BAND	3	/* by 802.11 band */
3004#define WL_JOIN_PREF_RSSI_DELTA	4	/* by 802.11 band only if RSSI delta condition matches */
3005#define WL_JOIN_PREF_TRANS_PREF	5	/* defined by requesting AP */
3006
3007/* band preference */
3008#define WLJP_BAND_ASSOC_PREF	255	/* use what WLC_SET_ASSOC_PREFER ioctl specifies */
3009
3010/* any multicast cipher suite */
3011#define WL_WPA_ACP_MCS_ANY	"\x00\x00\x00\x00"
3012
3013struct tsinfo_arg {
3014	uint8 octets[3];
3015};
3016#endif /* LINUX_POSTMOGRIFY_REMOVAL */
3017
3018#define	NFIFO			6	/* # tx/rx fifopairs */
3019
3020#define	WL_CNT_T_VERSION	8	/* current version of wl_cnt_t struct */
3021
3022typedef struct {
3023	uint16	version;	/* see definition of WL_CNT_T_VERSION */
3024	uint16	length;		/* length of entire structure */
3025
3026	/* transmit stat counters */
3027	uint32	txframe;	/* tx data frames */
3028	uint32	txbyte;		/* tx data bytes */
3029	uint32	txretrans;	/* tx mac retransmits */
3030	uint32	txerror;	/* tx data errors (derived: sum of others) */
3031	uint32	txctl;		/* tx management frames */
3032	uint32	txprshort;	/* tx short preamble frames */
3033	uint32	txserr;		/* tx status errors */
3034	uint32	txnobuf;	/* tx out of buffers errors */
3035	uint32	txnoassoc;	/* tx discard because we're not associated */
3036	uint32	txrunt;		/* tx runt frames */
3037	uint32	txchit;		/* tx header cache hit (fastpath) */
3038	uint32	txcmiss;	/* tx header cache miss (slowpath) */
3039
3040	/* transmit chip error counters */
3041	uint32	txuflo;		/* tx fifo underflows */
3042	uint32	txphyerr;	/* tx phy errors (indicated in tx status) */
3043	uint32	txphycrs;
3044
3045	/* receive stat counters */
3046	uint32	rxframe;	/* rx data frames */
3047	uint32	rxbyte;		/* rx data bytes */
3048	uint32	rxerror;	/* rx data errors (derived: sum of others) */
3049	uint32	rxctl;		/* rx management frames */
3050	uint32	rxnobuf;	/* rx out of buffers errors */
3051	uint32	rxnondata;	/* rx non data frames in the data channel errors */
3052	uint32	rxbadds;	/* rx bad DS errors */
3053	uint32	rxbadcm;	/* rx bad control or management frames */
3054	uint32	rxfragerr;	/* rx fragmentation errors */
3055	uint32	rxrunt;		/* rx runt frames */
3056	uint32	rxgiant;	/* rx giant frames */
3057	uint32	rxnoscb;	/* rx no scb error */
3058	uint32	rxbadproto;	/* rx invalid frames */
3059	uint32	rxbadsrcmac;	/* rx frames with Invalid Src Mac */
3060	uint32	rxbadda;	/* rx frames tossed for invalid da */
3061	uint32	rxfilter;	/* rx frames filtered out */
3062
3063	/* receive chip error counters */
3064	uint32	rxoflo;		/* rx fifo overflow errors */
3065	uint32	rxuflo[NFIFO];	/* rx dma descriptor underflow errors */
3066
3067	uint32	d11cnt_txrts_off;	/* d11cnt txrts value when reset d11cnt */
3068	uint32	d11cnt_rxcrc_off;	/* d11cnt rxcrc value when reset d11cnt */
3069	uint32	d11cnt_txnocts_off;	/* d11cnt txnocts value when reset d11cnt */
3070
3071	/* misc counters */
3072	uint32	dmade;		/* tx/rx dma descriptor errors */
3073	uint32	dmada;		/* tx/rx dma data errors */
3074	uint32	dmape;		/* tx/rx dma descriptor protocol errors */
3075	uint32	reset;		/* reset count */
3076	uint32	tbtt;		/* cnts the TBTT int's */
3077	uint32	txdmawar;
3078	uint32	pkt_callback_reg_fail;	/* callbacks register failure */
3079
3080	/* MAC counters: 32-bit version of d11.h's macstat_t */
3081	uint32	txallfrm;	/* total number of frames sent, incl. Data, ACK, RTS, CTS,
3082				 * Control Management (includes retransmissions)
3083				 */
3084	uint32	txrtsfrm;	/* number of RTS sent out by the MAC */
3085	uint32	txctsfrm;	/* number of CTS sent out by the MAC */
3086	uint32	txackfrm;	/* number of ACK frames sent out */
3087	uint32	txdnlfrm;	/* Not used */
3088	uint32	txbcnfrm;	/* beacons transmitted */
3089	uint32	txfunfl[8];	/* per-fifo tx underflows */
3090	uint32	txtplunfl;	/* Template underflows (mac was too slow to transmit ACK/CTS
3091				 * or BCN)
3092				 */
3093	uint32	txphyerror;	/* Transmit phy error, type of error is reported in tx-status for
3094				 * driver enqueued frames
3095				 */
3096	uint32	rxfrmtoolong;	/* Received frame longer than legal limit (2346 bytes) */
3097	uint32	rxfrmtooshrt;	/* Received frame did not contain enough bytes for its frame type */
3098	uint32	rxinvmachdr;	/* Either the protocol version != 0 or frame type not
3099				 * data/control/management
3100				 */
3101	uint32	rxbadfcs;	/* number of frames for which the CRC check failed in the MAC */
3102	uint32	rxbadplcp;	/* parity check of the PLCP header failed */
3103	uint32	rxcrsglitch;	/* PHY was able to correlate the preamble but not the header */
3104	uint32	rxstrt;		/* Number of received frames with a good PLCP
3105				 * (i.e. passing parity check)
3106				 */
3107	uint32	rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
3108	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
3109	uint32	rxcfrmucast;	/* number of received CNTRL frames with good FCS and matching RA */
3110	uint32	rxrtsucast;	/* number of unicast RTS addressed to the MAC (good FCS) */
3111	uint32	rxctsucast;	/* number of unicast CTS addressed to the MAC (good FCS) */
3112	uint32	rxackucast;	/* number of ucast ACKS received (good FCS) */
3113	uint32	rxdfrmocast;	/* number of received DATA frames (good FCS and not matching RA) */
3114	uint32	rxmfrmocast;	/* number of received MGMT frames (good FCS and not matching RA) */
3115	uint32	rxcfrmocast;	/* number of received CNTRL frame (good FCS and not matching RA) */
3116	uint32	rxrtsocast;	/* number of received RTS not addressed to the MAC */
3117	uint32	rxctsocast;	/* number of received CTS not addressed to the MAC */
3118	uint32	rxdfrmmcast;	/* number of RX Data multicast frames received by the MAC */
3119	uint32	rxmfrmmcast;	/* number of RX Management multicast frames received by the MAC */
3120	uint32	rxcfrmmcast;	/* number of RX Control multicast frames received by the MAC
3121				 * (unlikely to see these)
3122				 */
3123	uint32	rxbeaconmbss;	/* beacons received from member of BSS */
3124	uint32	rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
3125				  * other BSS (WDS FRAME)
3126				  */
3127	uint32	rxbeaconobss;	/* beacons received from other BSS */
3128	uint32	rxrsptmout;	/* Number of response timeouts for transmitted frames
3129				 * expecting a response
3130				 */
3131	uint32	bcntxcancl;	/* transmit beacons canceled due to receipt of beacon (IBSS) */
3132	uint32	rxf0ovfl;	/* Number of receive fifo 0 overflows */
3133	uint32	rxf1ovfl;	/* Number of receive fifo 1 overflows (obsolete) */
3134	uint32	rxf2ovfl;	/* Number of receive fifo 2 overflows (obsolete) */
3135	uint32	txsfovfl;	/* Number of transmit status fifo overflows (obsolete) */
3136	uint32	pmqovfl;	/* Number of PMQ overflows */
3137	uint32	rxcgprqfrm;	/* Number of received Probe requests that made it into
3138				 * the PRQ fifo
3139				 */
3140	uint32	rxcgprsqovfl;	/* Rx Probe Request Que overflow in the AP */
3141	uint32	txcgprsfail;	/* Tx Probe Response Fail. AP sent probe response but did
3142				 * not get ACK
3143				 */
3144	uint32	txcgprssuc;	/* Tx Probe Response Success (ACK was received) */
3145	uint32	prs_timeout;	/* Number of probe requests that were dropped from the PRQ
3146				 * fifo because a probe response could not be sent out within
3147				 * the time limit defined in M_PRS_MAXTIME
3148				 */
3149	uint32	rxnack;		/* obsolete */
3150	uint32	frmscons;	/* obsolete */
3151	uint32	txnack;		/* obsolete */
3152	uint32	txglitch_nack;	/* obsolete */
3153	uint32	txburst;	/* obsolete */
3154
3155	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
3156	uint32	txfrag;		/* dot11TransmittedFragmentCount */
3157	uint32	txmulti;	/* dot11MulticastTransmittedFrameCount */
3158	uint32	txfail;		/* dot11FailedCount */
3159	uint32	txretry;	/* dot11RetryCount */
3160	uint32	txretrie;	/* dot11MultipleRetryCount */
3161	uint32	rxdup;		/* dot11FrameduplicateCount */
3162	uint32	txrts;		/* dot11RTSSuccessCount */
3163	uint32	txnocts;	/* dot11RTSFailureCount */
3164	uint32	txnoack;	/* dot11ACKFailureCount */
3165	uint32	rxfrag;		/* dot11ReceivedFragmentCount */
3166	uint32	rxmulti;	/* dot11MulticastReceivedFrameCount */
3167	uint32	rxcrc;		/* dot11FCSErrorCount */
3168	uint32	txfrmsnt;	/* dot11TransmittedFrameCount (bogus MIB?) */
3169	uint32	rxundec;	/* dot11WEPUndecryptableCount */
3170
3171	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3172	uint32	tkipmicfaill;	/* TKIPLocalMICFailures */
3173	uint32	tkipcntrmsr;	/* TKIPCounterMeasuresInvoked */
3174	uint32	tkipreplay;	/* TKIPReplays */
3175	uint32	ccmpfmterr;	/* CCMPFormatErrors */
3176	uint32	ccmpreplay;	/* CCMPReplays */
3177	uint32	ccmpundec;	/* CCMPDecryptErrors */
3178	uint32	fourwayfail;	/* FourWayHandshakeFailures */
3179	uint32	wepundec;	/* dot11WEPUndecryptableCount */
3180	uint32	wepicverr;	/* dot11WEPICVErrorCount */
3181	uint32	decsuccess;	/* DecryptSuccessCount */
3182	uint32	tkipicverr;	/* TKIPICVErrorCount */
3183	uint32	wepexcluded;	/* dot11WEPExcludedCount */
3184
3185	uint32	txchanrej;	/* Tx frames suppressed due to channel rejection */
3186	uint32	psmwds;		/* Count PSM watchdogs */
3187	uint32	phywatchdog;	/* Count Phy watchdogs (triggered by ucode) */
3188
3189	/* MBSS counters, AP only */
3190	uint32	prq_entries_handled;	/* PRQ entries read in */
3191	uint32	prq_undirected_entries;	/*    which were bcast bss & ssid */
3192	uint32	prq_bad_entries;	/*    which could not be translated to info */
3193	uint32	atim_suppress_count;	/* TX suppressions on ATIM fifo */
3194	uint32	bcn_template_not_ready;	/* Template marked in use on send bcn ... */
3195	uint32	bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
3196	uint32	late_tbtt_dpc;	/* TBTT DPC did not happen in time */
3197
3198	/* per-rate receive stat counters */
3199	uint32  rx1mbps;	/* packets rx at 1Mbps */
3200	uint32  rx2mbps;	/* packets rx at 2Mbps */
3201	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
3202	uint32  rx6mbps;	/* packets rx at 6Mbps */
3203	uint32  rx9mbps;	/* packets rx at 9Mbps */
3204	uint32  rx11mbps;	/* packets rx at 11Mbps */
3205	uint32  rx12mbps;	/* packets rx at 12Mbps */
3206	uint32  rx18mbps;	/* packets rx at 18Mbps */
3207	uint32  rx24mbps;	/* packets rx at 24Mbps */
3208	uint32  rx36mbps;	/* packets rx at 36Mbps */
3209	uint32  rx48mbps;	/* packets rx at 48Mbps */
3210	uint32  rx54mbps;	/* packets rx at 54Mbps */
3211	uint32  rx108mbps; 	/* packets rx at 108mbps */
3212	uint32  rx162mbps;	/* packets rx at 162mbps */
3213	uint32  rx216mbps;	/* packets rx at 216 mbps */
3214	uint32  rx270mbps;	/* packets rx at 270 mbps */
3215	uint32  rx324mbps;	/* packets rx at 324 mbps */
3216	uint32  rx378mbps;	/* packets rx at 378 mbps */
3217	uint32  rx432mbps;	/* packets rx at 432 mbps */
3218	uint32  rx486mbps;	/* packets rx at 486 mbps */
3219	uint32  rx540mbps;	/* packets rx at 540 mbps */
3220
3221	/* pkteng rx frame stats */
3222	uint32	pktengrxducast; /* unicast frames rxed by the pkteng code */
3223	uint32	pktengrxdmcast; /* multicast frames rxed by the pkteng code */
3224
3225	uint32	rfdisable;	/* count of radio disables */
3226	uint32	bphy_rxcrsglitch;	/* PHY count of bphy glitches */
3227
3228	uint32	txexptime;	/* Tx frames suppressed due to timer expiration */
3229
3230	uint32	txmpdu_sgi;	/* count for sgi transmit */
3231	uint32	rxmpdu_sgi;	/* count for sgi received */
3232	uint32	txmpdu_stbc;	/* count for stbc transmit */
3233	uint32	rxmpdu_stbc;	/* count for stbc received */
3234
3235	uint32	rxundec_mcst;	/* dot11WEPUndecryptableCount */
3236
3237	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3238	uint32	tkipmicfaill_mcst;	/* TKIPLocalMICFailures */
3239	uint32	tkipcntrmsr_mcst;	/* TKIPCounterMeasuresInvoked */
3240	uint32	tkipreplay_mcst;	/* TKIPReplays */
3241	uint32	ccmpfmterr_mcst;	/* CCMPFormatErrors */
3242	uint32	ccmpreplay_mcst;	/* CCMPReplays */
3243	uint32	ccmpundec_mcst;	/* CCMPDecryptErrors */
3244	uint32	fourwayfail_mcst;	/* FourWayHandshakeFailures */
3245	uint32	wepundec_mcst;	/* dot11WEPUndecryptableCount */
3246	uint32	wepicverr_mcst;	/* dot11WEPICVErrorCount */
3247	uint32	decsuccess_mcst;	/* DecryptSuccessCount */
3248	uint32	tkipicverr_mcst;	/* TKIPICVErrorCount */
3249	uint32	wepexcluded_mcst;	/* dot11WEPExcludedCount */
3250
3251	uint32	dma_hang;	/* count for dma hang */
3252	uint32	reinit;		/* count for reinit */
3253
3254	uint32  pstatxucast;	/* count of ucast frames xmitted on all psta assoc */
3255	uint32  pstatxnoassoc;	/* count of txnoassoc frames xmitted on all psta assoc */
3256	uint32  pstarxucast;	/* count of ucast frames received on all psta assoc */
3257	uint32  pstarxbcmc;	/* count of bcmc frames received on all psta */
3258	uint32  pstatxbcmc;	/* count of bcmc frames transmitted on all psta */
3259
3260	uint32  cso_passthrough; /* hw cso required but passthrough */
3261	uint32	chained;	/* number of frames chained */
3262	uint32	chainedsz1;	/* number of chain size 1 frames */
3263	uint32	unchained;	/* number of frames not chained */
3264	uint32	maxchainsz;	/* max chain size so far */
3265	uint32	currchainsz;	/* current chain size */
3266	uint32 	cso_normal;	/* hw cso hdr for normal process */
3267} wl_cnt_t;
3268
3269#ifndef LINUX_POSTMOGRIFY_REMOVAL
3270typedef struct {
3271	uint16  version;    /* see definition of WL_CNT_T_VERSION */
3272	uint16  length;     /* length of entire structure */
3273
3274	/* transmit stat counters */
3275	uint32  txframe;    /* tx data frames */
3276	uint32  txbyte;     /* tx data bytes */
3277	uint32  txretrans;  /* tx mac retransmits */
3278	uint32  txerror;    /* tx data errors (derived: sum of others) */
3279	uint32  txctl;      /* tx management frames */
3280	uint32  txprshort;  /* tx short preamble frames */
3281	uint32  txserr;     /* tx status errors */
3282	uint32  txnobuf;    /* tx out of buffers errors */
3283	uint32  txnoassoc;  /* tx discard because we're not associated */
3284	uint32  txrunt;     /* tx runt frames */
3285	uint32  txchit;     /* tx header cache hit (fastpath) */
3286	uint32  txcmiss;    /* tx header cache miss (slowpath) */
3287
3288	/* transmit chip error counters */
3289	uint32  txuflo;     /* tx fifo underflows */
3290	uint32  txphyerr;   /* tx phy errors (indicated in tx status) */
3291	uint32  txphycrs;
3292
3293	/* receive stat counters */
3294	uint32  rxframe;    /* rx data frames */
3295	uint32  rxbyte;     /* rx data bytes */
3296	uint32  rxerror;    /* rx data errors (derived: sum of others) */
3297	uint32  rxctl;      /* rx management frames */
3298	uint32  rxnobuf;    /* rx out of buffers errors */
3299	uint32  rxnondata;  /* rx non data frames in the data channel errors */
3300	uint32  rxbadds;    /* rx bad DS errors */
3301	uint32  rxbadcm;    /* rx bad control or management frames */
3302	uint32  rxfragerr;  /* rx fragmentation errors */
3303	uint32  rxrunt;     /* rx runt frames */
3304	uint32  rxgiant;    /* rx giant frames */
3305	uint32  rxnoscb;    /* rx no scb error */
3306	uint32  rxbadproto; /* rx invalid frames */
3307	uint32  rxbadsrcmac;    /* rx frames with Invalid Src Mac */
3308	uint32  rxbadda;    /* rx frames tossed for invalid da */
3309	uint32  rxfilter;   /* rx frames filtered out */
3310
3311	/* receive chip error counters */
3312	uint32  rxoflo;     /* rx fifo overflow errors */
3313	uint32  rxuflo[NFIFO];  /* rx dma descriptor underflow errors */
3314
3315	uint32  d11cnt_txrts_off;   /* d11cnt txrts value when reset d11cnt */
3316	uint32  d11cnt_rxcrc_off;   /* d11cnt rxcrc value when reset d11cnt */
3317	uint32  d11cnt_txnocts_off; /* d11cnt txnocts value when reset d11cnt */
3318
3319	/* misc counters */
3320	uint32  dmade;      /* tx/rx dma descriptor errors */
3321	uint32  dmada;      /* tx/rx dma data errors */
3322	uint32  dmape;      /* tx/rx dma descriptor protocol errors */
3323	uint32  reset;      /* reset count */
3324	uint32  tbtt;       /* cnts the TBTT int's */
3325	uint32  txdmawar;
3326	uint32  pkt_callback_reg_fail;  /* callbacks register failure */
3327
3328	/* MAC counters: 32-bit version of d11.h's macstat_t */
3329	uint32  txallfrm;   /* total number of frames sent, incl. Data, ACK, RTS, CTS,
3330			     * Control Management (includes retransmissions)
3331			     */
3332	uint32  txrtsfrm;   /* number of RTS sent out by the MAC */
3333	uint32  txctsfrm;   /* number of CTS sent out by the MAC */
3334	uint32  txackfrm;   /* number of ACK frames sent out */
3335	uint32  txdnlfrm;   /* Not used */
3336	uint32  txbcnfrm;   /* beacons transmitted */
3337	uint32  txfunfl[8]; /* per-fifo tx underflows */
3338	uint32  txtplunfl;  /* Template underflows (mac was too slow to transmit ACK/CTS
3339			     * or BCN)
3340			     */
3341	uint32  txphyerror; /* Transmit phy error, type of error is reported in tx-status for
3342			     * driver enqueued frames
3343			     */
3344	uint32  rxfrmtoolong;   /* Received frame longer than legal limit (2346 bytes) */
3345	uint32  rxfrmtooshrt;   /* Received frame did not contain enough bytes for its frame type */
3346	uint32  rxinvmachdr;    /* Either the protocol version != 0 or frame type not
3347				 * data/control/management
3348			   */
3349	uint32  rxbadfcs;   /* number of frames for which the CRC check failed in the MAC */
3350	uint32  rxbadplcp;  /* parity check of the PLCP header failed */
3351	uint32  rxcrsglitch;    /* PHY was able to correlate the preamble but not the header */
3352	uint32  rxstrt;     /* Number of received frames with a good PLCP
3353			     * (i.e. passing parity check)
3354			     */
3355	uint32  rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
3356	uint32  rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
3357	uint32  rxcfrmucast;    /* number of received CNTRL frames with good FCS and matching RA */
3358	uint32  rxrtsucast; /* number of unicast RTS addressed to the MAC (good FCS) */
3359	uint32  rxctsucast; /* number of unicast CTS addressed to the MAC (good FCS) */
3360	uint32  rxackucast; /* number of ucast ACKS received (good FCS) */
3361	uint32  rxdfrmocast;    /* number of received DATA frames (good FCS and not matching RA) */
3362	uint32  rxmfrmocast;    /* number of received MGMT frames (good FCS and not matching RA) */
3363	uint32  rxcfrmocast;    /* number of received CNTRL frame (good FCS and not matching RA) */
3364	uint32  rxrtsocast; /* number of received RTS not addressed to the MAC */
3365	uint32  rxctsocast; /* number of received CTS not addressed to the MAC */
3366	uint32  rxdfrmmcast;    /* number of RX Data multicast frames received by the MAC */
3367	uint32  rxmfrmmcast;    /* number of RX Management multicast frames received by the MAC */
3368	uint32  rxcfrmmcast;    /* number of RX Control multicast frames received by the MAC
3369				 * (unlikely to see these)
3370				 */
3371	uint32  rxbeaconmbss;   /* beacons received from member of BSS */
3372	uint32  rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
3373				  * other BSS (WDS FRAME)
3374				  */
3375	uint32  rxbeaconobss;   /* beacons received from other BSS */
3376	uint32  rxrsptmout; /* Number of response timeouts for transmitted frames
3377			     * expecting a response
3378			     */
3379	uint32  bcntxcancl; /* transmit beacons canceled due to receipt of beacon (IBSS) */
3380	uint32  rxf0ovfl;   /* Number of receive fifo 0 overflows */
3381	uint32  rxf1ovfl;   /* Number of receive fifo 1 overflows (obsolete) */
3382	uint32  rxf2ovfl;   /* Number of receive fifo 2 overflows (obsolete) */
3383	uint32  txsfovfl;   /* Number of transmit status fifo overflows (obsolete) */
3384	uint32  pmqovfl;    /* Number of PMQ overflows */
3385	uint32  rxcgprqfrm; /* Number of received Probe requests that made it into
3386			     * the PRQ fifo
3387			     */
3388	uint32  rxcgprsqovfl;   /* Rx Probe Request Que overflow in the AP */
3389	uint32  txcgprsfail;    /* Tx Probe Response Fail. AP sent probe response but did
3390				 * not get ACK
3391				 */
3392	uint32  txcgprssuc; /* Tx Probe Response Success (ACK was received) */
3393	uint32  prs_timeout;    /* Number of probe requests that were dropped from the PRQ
3394				 * fifo because a probe response could not be sent out within
3395				 * the time limit defined in M_PRS_MAXTIME
3396				 */
3397	uint32  rxnack;
3398	uint32  frmscons;
3399	uint32  txnack;
3400	uint32  txglitch_nack;  /* obsolete */
3401	uint32  txburst;    /* obsolete */
3402
3403	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
3404	uint32  txfrag;     /* dot11TransmittedFragmentCount */
3405	uint32  txmulti;    /* dot11MulticastTransmittedFrameCount */
3406	uint32  txfail;     /* dot11FailedCount */
3407	uint32  txretry;    /* dot11RetryCount */
3408	uint32  txretrie;   /* dot11MultipleRetryCount */
3409	uint32  rxdup;      /* dot11FrameduplicateCount */
3410	uint32  txrts;      /* dot11RTSSuccessCount */
3411	uint32  txnocts;    /* dot11RTSFailureCount */
3412	uint32  txnoack;    /* dot11ACKFailureCount */
3413	uint32  rxfrag;     /* dot11ReceivedFragmentCount */
3414	uint32  rxmulti;    /* dot11MulticastReceivedFrameCount */
3415	uint32  rxcrc;      /* dot11FCSErrorCount */
3416	uint32  txfrmsnt;   /* dot11TransmittedFrameCount (bogus MIB?) */
3417	uint32  rxundec;    /* dot11WEPUndecryptableCount */
3418
3419	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3420	uint32  tkipmicfaill;   /* TKIPLocalMICFailures */
3421	uint32  tkipcntrmsr;    /* TKIPCounterMeasuresInvoked */
3422	uint32  tkipreplay; /* TKIPReplays */
3423	uint32  ccmpfmterr; /* CCMPFormatErrors */
3424	uint32  ccmpreplay; /* CCMPReplays */
3425	uint32  ccmpundec;  /* CCMPDecryptErrors */
3426	uint32  fourwayfail;    /* FourWayHandshakeFailures */
3427	uint32  wepundec;   /* dot11WEPUndecryptableCount */
3428	uint32  wepicverr;  /* dot11WEPICVErrorCount */
3429	uint32  decsuccess; /* DecryptSuccessCount */
3430	uint32  tkipicverr; /* TKIPICVErrorCount */
3431	uint32  wepexcluded;    /* dot11WEPExcludedCount */
3432
3433	uint32  rxundec_mcst;   /* dot11WEPUndecryptableCount */
3434
3435	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3436	uint32  tkipmicfaill_mcst;  /* TKIPLocalMICFailures */
3437	uint32  tkipcntrmsr_mcst;   /* TKIPCounterMeasuresInvoked */
3438	uint32  tkipreplay_mcst;    /* TKIPReplays */
3439	uint32  ccmpfmterr_mcst;    /* CCMPFormatErrors */
3440	uint32  ccmpreplay_mcst;    /* CCMPReplays */
3441	uint32  ccmpundec_mcst; /* CCMPDecryptErrors */
3442	uint32  fourwayfail_mcst;   /* FourWayHandshakeFailures */
3443	uint32  wepundec_mcst;  /* dot11WEPUndecryptableCount */
3444	uint32  wepicverr_mcst; /* dot11WEPICVErrorCount */
3445	uint32  decsuccess_mcst;    /* DecryptSuccessCount */
3446	uint32  tkipicverr_mcst;    /* TKIPICVErrorCount */
3447	uint32  wepexcluded_mcst;   /* dot11WEPExcludedCount */
3448
3449	uint32  txchanrej;  /* Tx frames suppressed due to channel rejection */
3450	uint32  txexptime;  /* Tx frames suppressed due to timer expiration */
3451	uint32  psmwds;     /* Count PSM watchdogs */
3452	uint32  phywatchdog;    /* Count Phy watchdogs (triggered by ucode) */
3453
3454	/* MBSS counters, AP only */
3455	uint32  prq_entries_handled;    /* PRQ entries read in */
3456	uint32  prq_undirected_entries; /*    which were bcast bss & ssid */
3457	uint32  prq_bad_entries;    /*    which could not be translated to info */
3458	uint32  atim_suppress_count;    /* TX suppressions on ATIM fifo */
3459	uint32  bcn_template_not_ready; /* Template marked in use on send bcn ... */
3460	uint32  bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
3461	uint32  late_tbtt_dpc;  /* TBTT DPC did not happen in time */
3462
3463	/* per-rate receive stat counters */
3464	uint32  rx1mbps;    /* packets rx at 1Mbps */
3465	uint32  rx2mbps;    /* packets rx at 2Mbps */
3466	uint32  rx5mbps5;   /* packets rx at 5.5Mbps */
3467	uint32  rx6mbps;    /* packets rx at 6Mbps */
3468	uint32  rx9mbps;    /* packets rx at 9Mbps */
3469	uint32  rx11mbps;   /* packets rx at 11Mbps */
3470	uint32  rx12mbps;   /* packets rx at 12Mbps */
3471	uint32  rx18mbps;   /* packets rx at 18Mbps */
3472	uint32  rx24mbps;   /* packets rx at 24Mbps */
3473	uint32  rx36mbps;   /* packets rx at 36Mbps */
3474	uint32  rx48mbps;   /* packets rx at 48Mbps */
3475	uint32  rx54mbps;   /* packets rx at 54Mbps */
3476	uint32  rx108mbps;  /* packets rx at 108mbps */
3477	uint32  rx162mbps;  /* packets rx at 162mbps */
3478	uint32  rx216mbps;  /* packets rx at 216 mbps */
3479	uint32  rx270mbps;  /* packets rx at 270 mbps */
3480	uint32  rx324mbps;  /* packets rx at 324 mbps */
3481	uint32  rx378mbps;  /* packets rx at 378 mbps */
3482	uint32  rx432mbps;  /* packets rx at 432 mbps */
3483	uint32  rx486mbps;  /* packets rx at 486 mbps */
3484	uint32  rx540mbps;  /* packets rx at 540 mbps */
3485
3486	/* pkteng rx frame stats */
3487	uint32  pktengrxducast; /* unicast frames rxed by the pkteng code */
3488	uint32  pktengrxdmcast; /* multicast frames rxed by the pkteng code */
3489
3490	uint32  rfdisable;  /* count of radio disables */
3491	uint32  bphy_rxcrsglitch;   /* PHY count of bphy glitches */
3492
3493	uint32  txmpdu_sgi; /* count for sgi transmit */
3494	uint32  rxmpdu_sgi; /* count for sgi received */
3495	uint32  txmpdu_stbc;    /* count for stbc transmit */
3496	uint32  rxmpdu_stbc;    /* count for stbc received */
3497} wl_cnt_ver_six_t;
3498
3499#define	WL_DELTA_STATS_T_VERSION	1	/* current version of wl_delta_stats_t struct */
3500
3501typedef struct {
3502	uint16 version;     /* see definition of WL_DELTA_STATS_T_VERSION */
3503	uint16 length;      /* length of entire structure */
3504
3505	/* transmit stat counters */
3506	uint32 txframe;     /* tx data frames */
3507	uint32 txbyte;      /* tx data bytes */
3508	uint32 txretrans;   /* tx mac retransmits */
3509	uint32 txfail;      /* tx failures */
3510
3511	/* receive stat counters */
3512	uint32 rxframe;     /* rx data frames */
3513	uint32 rxbyte;      /* rx data bytes */
3514
3515	/* per-rate receive stat counters */
3516	uint32  rx1mbps;	/* packets rx at 1Mbps */
3517	uint32  rx2mbps;	/* packets rx at 2Mbps */
3518	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
3519	uint32  rx6mbps;	/* packets rx at 6Mbps */
3520	uint32  rx9mbps;	/* packets rx at 9Mbps */
3521	uint32  rx11mbps;	/* packets rx at 11Mbps */
3522	uint32  rx12mbps;	/* packets rx at 12Mbps */
3523	uint32  rx18mbps;	/* packets rx at 18Mbps */
3524	uint32  rx24mbps;	/* packets rx at 24Mbps */
3525	uint32  rx36mbps;	/* packets rx at 36Mbps */
3526	uint32  rx48mbps;	/* packets rx at 48Mbps */
3527	uint32  rx54mbps;	/* packets rx at 54Mbps */
3528	uint32  rx108mbps; 	/* packets rx at 108mbps */
3529	uint32  rx162mbps;	/* packets rx at 162mbps */
3530	uint32  rx216mbps;	/* packets rx at 216 mbps */
3531	uint32  rx270mbps;	/* packets rx at 270 mbps */
3532	uint32  rx324mbps;	/* packets rx at 324 mbps */
3533	uint32  rx378mbps;	/* packets rx at 378 mbps */
3534	uint32  rx432mbps;	/* packets rx at 432 mbps */
3535	uint32  rx486mbps;	/* packets rx at 486 mbps */
3536	uint32  rx540mbps;	/* packets rx at 540 mbps */
3537} wl_delta_stats_t;
3538#endif /* LINUX_POSTMOGRIFY_REMOVAL */
3539
3540#define WL_WME_CNT_VERSION	1	/* current version of wl_wme_cnt_t */
3541
3542typedef struct {
3543	uint32 packets;
3544	uint32 bytes;
3545} wl_traffic_stats_t;
3546
3547typedef struct {
3548	uint16	version;	/* see definition of WL_WME_CNT_VERSION */
3549	uint16	length;		/* length of entire structure */
3550
3551	wl_traffic_stats_t tx[AC_COUNT];	/* Packets transmitted */
3552	wl_traffic_stats_t tx_failed[AC_COUNT];	/* Packets dropped or failed to transmit */
3553	wl_traffic_stats_t rx[AC_COUNT];	/* Packets received */
3554	wl_traffic_stats_t rx_failed[AC_COUNT];	/* Packets failed to receive */
3555
3556	wl_traffic_stats_t forward[AC_COUNT];	/* Packets forwarded by AP */
3557
3558	wl_traffic_stats_t tx_expired[AC_COUNT];	/* packets dropped due to lifetime expiry */
3559
3560} wl_wme_cnt_t;
3561
3562#ifndef LINUX_POSTMOGRIFY_REMOVAL
3563struct wl_msglevel2 {
3564	uint32 low;
3565	uint32 high;
3566};
3567
3568typedef struct wl_mkeep_alive_pkt {
3569	uint16	version; /* Version for mkeep_alive */
3570	uint16	length; /* length of fixed parameters in the structure */
3571	uint32	period_msec;
3572	uint16	len_bytes;
3573	uint8	keep_alive_id; /* 0 - 3 for N = 4 */
3574	uint8	data[1];
3575} wl_mkeep_alive_pkt_t;
3576
3577#define WL_MKEEP_ALIVE_VERSION		1
3578#define WL_MKEEP_ALIVE_FIXED_LEN	OFFSETOF(wl_mkeep_alive_pkt_t, data)
3579#define WL_MKEEP_ALIVE_PRECISION	500
3580
3581#ifdef WLBA
3582
3583#define WLC_BA_CNT_VERSION  1   /* current version of wlc_ba_cnt_t */
3584
3585/* block ack related stats */
3586typedef struct wlc_ba_cnt {
3587	uint16  version;    /* WLC_BA_CNT_VERSION */
3588	uint16  length;     /* length of entire structure */
3589
3590	/* transmit stat counters */
3591	uint32 txpdu;       /* pdus sent */
3592	uint32 txsdu;       /* sdus sent */
3593	uint32 txfc;        /* tx side flow controlled packets */
3594	uint32 txfci;       /* tx side flow control initiated */
3595	uint32 txretrans;   /* retransmitted pdus */
3596	uint32 txbatimer;   /* ba resend due to timer */
3597	uint32 txdrop;      /* dropped packets */
3598	uint32 txaddbareq;  /* addba req sent */
3599	uint32 txaddbaresp; /* addba resp sent */
3600	uint32 txdelba;     /* delba sent */
3601	uint32 txba;        /* ba sent */
3602	uint32 txbar;       /* bar sent */
3603	uint32 txpad[4];    /* future */
3604
3605	/* receive side counters */
3606	uint32 rxpdu;       /* pdus recd */
3607	uint32 rxqed;       /* pdus buffered before sending up */
3608	uint32 rxdup;       /* duplicate pdus */
3609	uint32 rxnobuf;     /* pdus discarded due to no buf */
3610	uint32 rxaddbareq;  /* addba req recd */
3611	uint32 rxaddbaresp; /* addba resp recd */
3612	uint32 rxdelba;     /* delba recd */
3613	uint32 rxba;        /* ba recd */
3614	uint32 rxbar;       /* bar recd */
3615	uint32 rxinvba;     /* invalid ba recd */
3616	uint32 rxbaholes;   /* ba recd with holes */
3617	uint32 rxunexp;     /* unexpected packets */
3618	uint32 rxpad[4];    /* future */
3619} wlc_ba_cnt_t;
3620#endif /* WLBA */
3621
3622/* structure for per-tid ampdu control */
3623struct ampdu_tid_control {
3624	uint8 tid;			/* tid */
3625	uint8 enable;			/* enable/disable */
3626};
3627
3628/* structure for identifying ea/tid for sending addba/delba */
3629struct ampdu_ea_tid {
3630	struct ether_addr ea;		/* Station address */
3631	uint8 tid;			/* tid */
3632};
3633/* structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
3634struct ampdu_retry_tid {
3635	uint8 tid;	/* tid */
3636	uint8 retry;	/* retry value */
3637};
3638
3639/* Different discovery modes for dpt */
3640#define	DPT_DISCOVERY_MANUAL	0x01	/* manual discovery mode */
3641#define	DPT_DISCOVERY_AUTO	0x02	/* auto discovery mode */
3642#define	DPT_DISCOVERY_SCAN	0x04	/* scan-based discovery mode */
3643
3644/* different path selection values */
3645#define DPT_PATHSEL_AUTO	0	/* auto mode for path selection */
3646#define DPT_PATHSEL_DIRECT	1	/* always use direct DPT path */
3647#define DPT_PATHSEL_APPATH	2	/* always use AP path */
3648
3649/* different ops for deny list */
3650#define DPT_DENY_LIST_ADD 	1	/* add to dpt deny list */
3651#define DPT_DENY_LIST_REMOVE 	2	/* remove from dpt deny list */
3652
3653/* different ops for manual end point */
3654#define DPT_MANUAL_EP_CREATE	1	/* create manual dpt endpoint */
3655#define DPT_MANUAL_EP_MODIFY	2	/* modify manual dpt endpoint */
3656#define DPT_MANUAL_EP_DELETE	3	/* delete manual dpt endpoint */
3657
3658/* structure for dpt iovars */
3659typedef struct dpt_iovar {
3660	struct ether_addr ea;		/* Station address */
3661	uint8 mode;			/* mode: depends on iovar */
3662	uint32 pad;			/* future */
3663} dpt_iovar_t;
3664
3665/* flags to indicate DPT status */
3666#define	DPT_STATUS_ACTIVE	0x01	/* link active (though may be suspended) */
3667#define	DPT_STATUS_AES		0x02	/* link secured through AES encryption */
3668#define	DPT_STATUS_FAILED	0x04	/* DPT link failed */
3669
3670#define	DPT_FNAME_LEN		48	/* Max length of friendly name */
3671
3672typedef struct dpt_status {
3673	uint8 status;			/* flags to indicate status */
3674	uint8 fnlen;			/* length of friendly name */
3675	uchar name[DPT_FNAME_LEN];	/* friendly name */
3676	uint32 rssi;			/* RSSI of the link */
3677	sta_info_t sta;			/* sta info */
3678} dpt_status_t;
3679
3680/* structure for dpt list */
3681typedef struct dpt_list {
3682	uint32 num;			/* number of entries in struct */
3683	dpt_status_t status[1];		/* per station info */
3684} dpt_list_t;
3685
3686/* structure for dpt friendly name */
3687typedef struct dpt_fname {
3688	uint8 len;			/* length of friendly name */
3689	uchar name[DPT_FNAME_LEN];	/* friendly name */
3690} dpt_fname_t;
3691
3692#define BDD_FNAME_LEN       32  /* Max length of friendly name */
3693typedef struct bdd_fname {
3694	uint8 len;          /* length of friendly name */
3695	uchar name[BDD_FNAME_LEN];  /* friendly name */
3696} bdd_fname_t;
3697
3698/* structure for addts arguments */
3699/* For ioctls that take a list of TSPEC */
3700struct tslist {
3701	int count;			/* number of tspecs */
3702	struct tsinfo_arg tsinfo[1];	/* variable length array of tsinfo */
3703};
3704
3705#ifdef WLTDLS
3706/* different ops for manual end point */
3707#define TDLS_MANUAL_EP_CREATE		1	/* create manual dpt endpoint */
3708#define TDLS_MANUAL_EP_MODIFY		2	/* modify manual dpt endpoint */
3709#define TDLS_MANUAL_EP_DELETE		3	/* delete manual dpt endpoint */
3710#define TDLS_MANUAL_EP_PM		4	/*  put dpt endpoint in PM mode */
3711#define TDLS_MANUAL_EP_WAKE		5	/* wake up dpt endpoint from PM */
3712#define TDLS_MANUAL_EP_DISCOVERY	6	/* discover if endpoint is TDLS capable */
3713#define TDLS_MANUAL_EP_CHSW		7	/* channel switch */
3714#define TDLS_MANUAL_EP_WFD_TPQ	8	/* WiFi-Display Tunneled Probe reQuest */
3715
3716/* structure for tdls iovars */
3717typedef struct tdls_iovar {
3718	struct ether_addr ea;		/* Station address */
3719	uint8 mode;			/* mode: depends on iovar */
3720	chanspec_t chanspec;
3721	uint32 pad;			/* future */
3722} tdls_iovar_t;
3723
3724/* modes */
3725#define TDLS_WFD_IE_TX 			0
3726#define TDLS_WFD_IE_RX 			1
3727#define TDLS_WFD_PROBE_IE_TX	2
3728#define TDLS_WFD_PROBE_IE_RX	3
3729#define TDLS_WFD_IE_SIZE 		512
3730/* structure for tdls wfd ie */
3731typedef struct tdls_wfd_ie_iovar {
3732	struct ether_addr ea;		/* Station address */
3733	uint8 mode;
3734	uint16 length;
3735	uint8 data[TDLS_WFD_IE_SIZE];
3736} tdls_wfd_ie_iovar_t;
3737#endif /* WLTDLS */
3738
3739/* structure for addts/delts arguments */
3740typedef struct tspec_arg {
3741	uint16 version;			/* see definition of TSPEC_ARG_VERSION */
3742	uint16 length;			/* length of entire structure */
3743	uint flag;			/* bit field */
3744	/* TSPEC Arguments */
3745	struct tsinfo_arg tsinfo;	/* TS Info bit field */
3746	uint16 nom_msdu_size;		/* (Nominal or fixed) MSDU Size (bytes) */
3747	uint16 max_msdu_size;		/* Maximum MSDU Size (bytes) */
3748	uint min_srv_interval;		/* Minimum Service Interval (us) */
3749	uint max_srv_interval;		/* Maximum Service Interval (us) */
3750	uint inactivity_interval;	/* Inactivity Interval (us) */
3751	uint suspension_interval;	/* Suspension Interval (us) */
3752	uint srv_start_time;		/* Service Start Time (us) */
3753	uint min_data_rate;		/* Minimum Data Rate (bps) */
3754	uint mean_data_rate;		/* Mean Data Rate (bps) */
3755	uint peak_data_rate;		/* Peak Data Rate (bps) */
3756	uint max_burst_size;		/* Maximum Burst Size (bytes) */
3757	uint delay_bound;		/* Delay Bound (us) */
3758	uint min_phy_rate;		/* Minimum PHY Rate (bps) */
3759	uint16 surplus_bw;		/* Surplus Bandwidth Allowance (range 1.0 to 8.0) */
3760	uint16 medium_time;		/* Medium Time (32 us/s periods) */
3761	uint8 dialog_token;		/* dialog token */
3762} tspec_arg_t;
3763
3764/* tspec arg for desired station */
3765typedef	struct tspec_per_sta_arg {
3766	struct ether_addr ea;
3767	struct tspec_arg ts;
3768} tspec_per_sta_arg_t;
3769
3770/* structure for max bandwidth for each access category */
3771typedef	struct wme_max_bandwidth {
3772	uint32	ac[AC_COUNT];	/* max bandwidth for each access category */
3773} wme_max_bandwidth_t;
3774
3775#define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
3776
3777/* current version of wl_tspec_arg_t struct */
3778#define	TSPEC_ARG_VERSION		2	/* current version of wl_tspec_arg_t struct */
3779#define TSPEC_ARG_LENGTH		55	/* argument length from tsinfo to medium_time */
3780#define TSPEC_DEFAULT_DIALOG_TOKEN	42	/* default dialog token */
3781#define TSPEC_DEFAULT_SBW_FACTOR	0x3000	/* default surplus bw */
3782
3783
3784#define WL_WOWL_KEEPALIVE_MAX_PACKET_SIZE  80
3785#define WLC_WOWL_MAX_KEEPALIVE	2
3786
3787/* define for flag */
3788#define TSPEC_PENDING		0	/* TSPEC pending */
3789#define TSPEC_ACCEPTED		1	/* TSPEC accepted */
3790#define TSPEC_REJECTED		2	/* TSPEC rejected */
3791#define TSPEC_UNKNOWN		3	/* TSPEC unknown */
3792#define TSPEC_STATUS_MASK	7	/* TSPEC status mask */
3793
3794
3795/* Software feature flag defines used by wlfeatureflag */
3796#ifdef WLAFTERBURNER
3797#define WL_SWFL_ABBFL		0x0001 /* Allow Afterburner on systems w/o hardware BFL */
3798#define WL_SWFL_ABENCORE	0x0002 /* Allow AB on non-4318E chips */
3799#endif /* WLAFTERBURNER */
3800#define WL_SWFL_NOHWRADIO	0x0004
3801#define WL_SWFL_FLOWCONTROL	0x0008 /* Enable backpressure to OS stack */
3802#define WL_SWFL_WLBSSSORT	0x0010 /* Per-port supports sorting of BSS */
3803
3804#define WL_LIFETIME_MAX 0xFFFF /* Max value in ms */
3805
3806/* Packet lifetime configuration per ac */
3807typedef struct wl_lifetime {
3808	uint32 ac;	        /* access class */
3809	uint32 lifetime;    /* Packet lifetime value in ms */
3810} wl_lifetime_t;
3811
3812/* Channel Switch Announcement param */
3813typedef struct wl_chan_switch {
3814	uint8 mode;		/* value 0 or 1 */
3815	uint8 count;		/* count # of beacons before switching */
3816	chanspec_t chspec;	/* chanspec */
3817	uint8 reg;		/* regulatory class */
3818} wl_chan_switch_t;
3819
3820/* Roaming trigger definitions for WLC_SET_ROAM_TRIGGER.
3821 *
3822 * (-100 < value < 0)   value is used directly as a roaming trigger in dBm
3823 * (0 <= value) value specifies a logical roaming trigger level from
3824 *                      the list below
3825 *
3826 * WLC_GET_ROAM_TRIGGER always returns roaming trigger value in dBm, never
3827 * the logical roam trigger value.
3828 */
3829#define WLC_ROAM_TRIGGER_DEFAULT	0 /* default roaming trigger */
3830#define WLC_ROAM_TRIGGER_BANDWIDTH	1 /* optimize for bandwidth roaming trigger */
3831#define WLC_ROAM_TRIGGER_DISTANCE	2 /* optimize for distance roaming trigger */
3832#define WLC_ROAM_TRIGGER_AUTO		3 /* auto-detect environment */
3833#define WLC_ROAM_TRIGGER_MAX_VALUE	3 /* max. valid value */
3834
3835#define WLC_ROAM_NEVER_ROAM_TRIGGER	(-100) /* Avoid Roaming by setting a large value */
3836
3837/* Preferred Network Offload (PNO, formerly PFN) defines */
3838#define WPA_AUTH_PFN_ANY	0xffffffff	/* for PFN, match only ssid */
3839
3840enum {
3841	PFN_LIST_ORDER,
3842	PFN_RSSI
3843};
3844
3845enum {
3846	DISABLE,
3847	ENABLE
3848};
3849
3850enum {
3851	OFF_ADAPT,
3852	SMART_ADAPT,
3853	STRICT_ADAPT,
3854	SLOW_ADAPT
3855};
3856
3857#define SORT_CRITERIA_BIT		0
3858#define AUTO_NET_SWITCH_BIT		1
3859#define ENABLE_BKGRD_SCAN_BIT		2
3860#define IMMEDIATE_SCAN_BIT		3
3861#define	AUTO_CONNECT_BIT		4
3862#define	ENABLE_BD_SCAN_BIT		5
3863#define ENABLE_ADAPTSCAN_BIT		6
3864#define IMMEDIATE_EVENT_BIT		8
3865#define SUPPRESS_SSID_BIT		9
3866#define ENABLE_NET_OFFLOAD_BIT		10
3867
3868#define SORT_CRITERIA_MASK		0x0001
3869#define AUTO_NET_SWITCH_MASK		0x0002
3870#define ENABLE_BKGRD_SCAN_MASK		0x0004
3871#define IMMEDIATE_SCAN_MASK		0x0008
3872#define	AUTO_CONNECT_MASK		0x0010
3873
3874#define ENABLE_BD_SCAN_MASK		0x0020
3875#define ENABLE_ADAPTSCAN_MASK	0x00c0
3876#define IMMEDIATE_EVENT_MASK	0x0100
3877#define SUPPRESS_SSID_MASK	0x0200
3878#define ENABLE_NET_OFFLOAD_MASK	0x0400
3879
3880#define PFN_VERSION		2
3881#define PFN_SCANRESULT_VERSION	1
3882#define MAX_PFN_LIST_COUNT	16
3883
3884#define PFN_COMPLETE			1
3885#define PFN_INCOMPLETE			0
3886
3887#define DEFAULT_BESTN			2
3888#define DEFAULT_MSCAN			0
3889#define DEFAULT_REPEAT			10
3890#define DEFAULT_EXP			2
3891
3892/* PFN network info structure */
3893typedef struct wl_pfn_subnet_info {
3894	struct ether_addr BSSID;
3895	uint8	channel; /* channel number only */
3896	uint8	SSID_len;
3897	uint8	SSID[32];
3898} wl_pfn_subnet_info_t;
3899
3900typedef struct wl_pfn_net_info {
3901	wl_pfn_subnet_info_t pfnsubnet;
3902	int16	RSSI; /* receive signal strength (in dBm) */
3903	uint16	timestamp; /* age in seconds */
3904} wl_pfn_net_info_t;
3905
3906typedef struct wl_pfn_scanresults {
3907	uint32 version;
3908	uint32 status;
3909	uint32 count;
3910	wl_pfn_net_info_t netinfo[1];
3911} wl_pfn_scanresults_t;
3912
3913/* PFN data structure */
3914typedef struct wl_pfn_param {
3915	int32 version;			/* PNO parameters version */
3916	int32 scan_freq;		/* Scan frequency */
3917	int32 lost_network_timeout;	/* Timeout in sec. to declare
3918					* discovered network as lost
3919					*/
3920	int16 flags;			/* Bit field to control features
3921					* of PFN such as sort criteria auto
3922					* enable switch and background scan
3923					*/
3924	int16 rssi_margin;		/* Margin to avoid jitter for choosing a
3925					* PFN based on RSSI sort criteria
3926					*/
3927	uint8 bestn;			/* number of best networks in each scan */
3928	uint8 mscan;			/* number of scans recorded */
3929	uint8 repeat;			/* Minimum number of scan intervals
3930					*before scan frequency changes in adaptive scan
3931					*/
3932	uint8 exp;			/* Exponent of 2 for maximum scan interval */
3933	int32 slow_freq;		/* slow scan period */
3934} wl_pfn_param_t;
3935
3936typedef struct wl_pfn_bssid {
3937	struct ether_addr	macaddr;
3938	/* Bit4: suppress_lost, Bit3: suppress_found */
3939	uint16			flags;
3940} wl_pfn_bssid_t;
3941#define WL_PFN_SUPPRESSFOUND_MASK	0x08
3942#define WL_PFN_SUPPRESSLOST_MASK	0x10
3943#define WL_PFN_RSSI_MASK		0xff00
3944#define WL_PFN_RSSI_SHIFT		8
3945
3946typedef struct wl_pfn_cfg {
3947	uint32			reporttype;
3948	int32			channel_num;
3949	uint16			channel_list[WL_NUMCHANNELS];
3950} wl_pfn_cfg_t;
3951#define WL_PFN_REPORT_ALLNET    0
3952#define WL_PFN_REPORT_SSIDNET   1
3953#define WL_PFN_REPORT_BSSIDNET  2
3954
3955typedef struct wl_pfn {
3956	wlc_ssid_t		ssid;		/* ssid name and its length */
3957	int32			flags;		/* bit2: hidden */
3958	int32			infra;		/* BSS Vs IBSS */
3959	int32			auth;		/* Open Vs Closed */
3960	int32			wpa_auth;	/* WPA type */
3961	int32			wsec;		/* wsec value */
3962} wl_pfn_t;
3963#define WL_PFN_HIDDEN_BIT	2
3964#define PNO_SCAN_MAX_FW		508*1000	/* max time scan time in msec */
3965#define PNO_SCAN_MAX_FW_SEC	PNO_SCAN_MAX_FW/1000 /* max time scan time in SEC */
3966#define PNO_SCAN_MIN_FW_SEC	10		/* min time scan time in SEC */
3967#define WL_PFN_HIDDEN_MASK	0x4
3968
3969#endif /* LINUX_POSTMOGRIFY_REMOVAL */
3970
3971/* Service discovery */
3972typedef struct {
3973	uint8	transaction_id;	/* Transaction id */
3974	uint8	protocol;	/* Service protocol type */
3975	uint16	query_len;	/* Length of query */
3976	uint16	response_len;	/* Length of response */
3977	uint8	qrbuf[1];
3978} wl_p2po_qr_t;
3979
3980typedef struct {
3981	uint16			period;			/* extended listen period */
3982	uint16			interval;		/* extended listen interval */
3983} wl_p2po_listen_t;
3984
3985/* ANQP offload */
3986
3987#define ANQPO_MAX_QUERY_SIZE		256
3988typedef struct {
3989	uint16 max_retransmit;		/* -1 use default, max retransmit on no ACK from peer */
3990	uint16 response_timeout;	/* -1 use default, msec to wait for resp after tx packet */
3991	uint16 max_comeback_delay;	/* -1 use default, max comeback delay in resp else fail */
3992	uint16 max_retries;			/* -1 use default, max retries on failure */
3993	uint16 query_len;			/* length of ANQP query */
3994	uint8 query_data[1];		/* ANQP encoded query (max ANQPO_MAX_QUERY_SIZE) */
3995} wl_anqpo_set_t;
3996
3997typedef struct {
3998	uint16 channel;				/* channel of the peer */
3999	struct ether_addr addr;		/* addr of the peer */
4000} wl_anqpo_peer_t;
4001
4002#define ANQPO_MAX_PEER_LIST			64
4003typedef struct {
4004	uint16 count;				/* number of peers in list */
4005	wl_anqpo_peer_t peer[1];	/* max ANQPO_MAX_PEER_LIST */
4006} wl_anqpo_peer_list_t;
4007
4008#define ANQPO_MAX_IGNORE_SSID		64
4009typedef struct {
4010	bool is_clear;				/* set to clear list (not used on GET) */
4011	uint16 count;				/* number of SSID in list */
4012	wlc_ssid_t ssid[1];			/* max ANQPO_MAX_IGNORE_SSID */
4013} wl_anqpo_ignore_ssid_list_t;
4014
4015#define ANQPO_MAX_IGNORE_BSSID		64
4016typedef struct {
4017	bool is_clear;				/* set to clear list (not used on GET) */
4018	uint16 count;				/* number of addr in list */
4019	struct ether_addr bssid[1];	/* max ANQPO_MAX_IGNORE_BSSID */
4020} wl_anqpo_ignore_bssid_list_t;
4021
4022/* TCP Checksum Offload defines */
4023#define TOE_TX_CSUM_OL		0x00000001
4024#define TOE_RX_CSUM_OL		0x00000002
4025
4026#ifndef LINUX_POSTMOGRIFY_REMOVAL
4027/* TCP Checksum Offload error injection for testing */
4028#define TOE_ERRTEST_TX_CSUM	0x00000001
4029#define TOE_ERRTEST_RX_CSUM	0x00000002
4030#define TOE_ERRTEST_RX_CSUM2	0x00000004
4031
4032struct toe_ol_stats_t {
4033	/* Num of tx packets that don't need to be checksummed */
4034	uint32 tx_summed;
4035
4036	/* Num of tx packets where checksum is filled by offload engine */
4037	uint32 tx_iph_fill;
4038	uint32 tx_tcp_fill;
4039	uint32 tx_udp_fill;
4040	uint32 tx_icmp_fill;
4041
4042	/*  Num of rx packets where toe finds out if checksum is good or bad */
4043	uint32 rx_iph_good;
4044	uint32 rx_iph_bad;
4045	uint32 rx_tcp_good;
4046	uint32 rx_tcp_bad;
4047	uint32 rx_udp_good;
4048	uint32 rx_udp_bad;
4049	uint32 rx_icmp_good;
4050	uint32 rx_icmp_bad;
4051
4052	/* Num of tx packets in which csum error is injected */
4053	uint32 tx_tcp_errinj;
4054	uint32 tx_udp_errinj;
4055	uint32 tx_icmp_errinj;
4056
4057	/* Num of rx packets in which csum error is injected */
4058	uint32 rx_tcp_errinj;
4059	uint32 rx_udp_errinj;
4060	uint32 rx_icmp_errinj;
4061};
4062
4063/* ARP Offload feature flags for arp_ol iovar */
4064#define ARP_OL_AGENT		0x00000001
4065#define ARP_OL_SNOOP		0x00000002
4066#define ARP_OL_HOST_AUTO_REPLY	0x00000004
4067#define ARP_OL_PEER_AUTO_REPLY	0x00000008
4068
4069/* ARP Offload error injection */
4070#define ARP_ERRTEST_REPLY_PEER	0x1
4071#define ARP_ERRTEST_REPLY_HOST	0x2
4072
4073#define ARP_MULTIHOMING_MAX	8	/* Maximum local host IP addresses */
4074#define ND_MULTIHOMING_MAX	10	/* Maximum local host IP addresses */
4075
4076/* Arp offload statistic counts */
4077struct arp_ol_stats_t {
4078	uint32  host_ip_entries;	/* Host IP table addresses (more than one if multihomed) */
4079	uint32  host_ip_overflow;	/* Host IP table additions skipped due to overflow */
4080
4081	uint32  arp_table_entries;	/* ARP table entries */
4082	uint32  arp_table_overflow;	/* ARP table additions skipped due to overflow */
4083
4084	uint32  host_request;		/* ARP requests from host */
4085	uint32  host_reply;		/* ARP replies from host */
4086	uint32  host_service;		/* ARP requests from host serviced by ARP Agent */
4087
4088	uint32  peer_request;		/* ARP requests received from network */
4089	uint32  peer_request_drop;	/* ARP requests from network that were dropped */
4090	uint32  peer_reply;		/* ARP replies received from network */
4091	uint32  peer_reply_drop;	/* ARP replies from network that were dropped */
4092	uint32  peer_service;		/* ARP request from host serviced by ARP Agent */
4093};
4094
4095/* NS offload statistic counts */
4096struct nd_ol_stats_t {
4097	uint32  host_ip_entries;    /* Host IP table addresses (more than one if multihomed) */
4098	uint32  host_ip_overflow;   /* Host IP table additions skipped due to overflow */
4099	uint32  peer_request;       /* NS requests received from network */
4100	uint32  peer_request_drop;  /* NS requests from network that were dropped */
4101	uint32  peer_reply_drop;    /* NA replies from network that were dropped */
4102	uint32  peer_service;       /* NS request from host serviced by firmware */
4103};
4104
4105/*
4106 * Keep-alive packet offloading.
4107 */
4108
4109/* NAT keep-alive packets format: specifies the re-transmission period, the packet
4110 * length, and packet contents.
4111 */
4112typedef struct wl_keep_alive_pkt {
4113	uint32	period_msec;	/* Retransmission period (0 to disable packet re-transmits) */
4114	uint16	len_bytes;	/* Size of packet to transmit (0 to disable packet re-transmits) */
4115	uint8	data[1];	/* Variable length packet to transmit.  Contents should include
4116				 * entire ethernet packet (enet header, IP header, UDP header,
4117				 * and UDP payload) in network byte order.
4118				 */
4119} wl_keep_alive_pkt_t;
4120
4121#define WL_KEEP_ALIVE_FIXED_LEN		OFFSETOF(wl_keep_alive_pkt_t, data)
4122
4123/*
4124 * Dongle pattern matching filter.
4125 */
4126
4127/* Packet filter types. Currently, only pattern matching is supported. */
4128typedef enum wl_pkt_filter_type {
4129	WL_PKT_FILTER_TYPE_PATTERN_MATCH	/* Pattern matching filter */
4130} wl_pkt_filter_type_t;
4131
4132#define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
4133
4134/* Pattern matching filter. Specifies an offset within received packets to
4135 * start matching, the pattern to match, the size of the pattern, and a bitmask
4136 * that indicates which bits within the pattern should be matched.
4137 */
4138typedef struct wl_pkt_filter_pattern {
4139	uint32	offset;		/* Offset within received packet to start pattern matching.
4140				 * Offset '0' is the first byte of the ethernet header.
4141				 */
4142	uint32	size_bytes;	/* Size of the pattern.  Bitmask must be the same size. */
4143	uint8   mask_and_pattern[1]; /* Variable length mask and pattern data.  mask starts
4144				      * at offset 0.  Pattern immediately follows mask.
4145				      */
4146} wl_pkt_filter_pattern_t;
4147
4148/* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
4149typedef struct wl_pkt_filter {
4150	uint32	id;		/* Unique filter id, specified by app. */
4151	uint32	type;		/* Filter type (WL_PKT_FILTER_TYPE_xxx). */
4152	uint32	negate_match;	/* Negate the result of filter matches */
4153	union {			/* Filter definitions */
4154		wl_pkt_filter_pattern_t pattern;	/* Pattern matching filter */
4155	} u;
4156} wl_pkt_filter_t;
4157
4158#define WL_PKT_FILTER_FIXED_LEN		  OFFSETOF(wl_pkt_filter_t, u)
4159#define WL_PKT_FILTER_PATTERN_FIXED_LEN	  OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
4160
4161/* IOVAR "pkt_filter_enable" parameter. */
4162typedef struct wl_pkt_filter_enable {
4163	uint32	id;		/* Unique filter id */
4164	uint32	enable;		/* Enable/disable bool */
4165} wl_pkt_filter_enable_t;
4166
4167/* IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
4168typedef struct wl_pkt_filter_list {
4169	uint32	num;		/* Number of installed packet filters */
4170	wl_pkt_filter_t	filter[1];	/* Variable array of packet filters. */
4171} wl_pkt_filter_list_t;
4172
4173#define WL_PKT_FILTER_LIST_FIXED_LEN	  OFFSETOF(wl_pkt_filter_list_t, filter)
4174
4175/* IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
4176typedef struct wl_pkt_filter_stats {
4177	uint32	num_pkts_matched;	/* # filter matches for specified filter id */
4178	uint32	num_pkts_forwarded;	/* # packets fwded from dongle to host for all filters */
4179	uint32	num_pkts_discarded;	/* # packets discarded by dongle for all filters */
4180} wl_pkt_filter_stats_t;
4181
4182#define RSN_KCK_LENGTH 16
4183#define RSN_KEK_LENGTH 16
4184#define RSN_REPLAY_LEN 8
4185typedef struct _gtkrefresh {
4186	uchar	KCK[RSN_KCK_LENGTH];
4187	uchar	KEK[RSN_KEK_LENGTH];
4188	uchar	ReplayCounter[RSN_REPLAY_LEN];
4189} gtk_keyinfo_t, *pgtk_keyinfo_t;
4190
4191/* Sequential Commands ioctl */
4192typedef struct wl_seq_cmd_ioctl {
4193	uint32 cmd;		/* common ioctl definition */
4194	uint32 len;		/* length of user buffer */
4195} wl_seq_cmd_ioctl_t;
4196
4197#define WL_SEQ_CMD_ALIGN_BYTES	4
4198
4199/* These are the set of get IOCTLs that should be allowed when using
4200 * IOCTL sequence commands. These are issued implicitly by wl.exe each time
4201 * it is invoked. We never want to buffer these, or else wl.exe will stop working.
4202 */
4203#define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
4204	(((cmd) == WLC_GET_MAGIC)		|| \
4205	 ((cmd) == WLC_GET_VERSION)		|| \
4206	 ((cmd) == WLC_GET_AP)			|| \
4207	 ((cmd) == WLC_GET_INSTANCE))
4208
4209/*
4210 * Packet engine interface
4211 */
4212
4213#define WL_PKTENG_PER_TX_START			0x01
4214#define WL_PKTENG_PER_TX_STOP			0x02
4215#define WL_PKTENG_PER_RX_START			0x04
4216#define WL_PKTENG_PER_RX_WITH_ACK_START 	0x05
4217#define WL_PKTENG_PER_TX_WITH_ACK_START 	0x06
4218#define WL_PKTENG_PER_RX_STOP			0x08
4219#define WL_PKTENG_PER_MASK			0xff
4220
4221#define WL_PKTENG_SYNCHRONOUS			0x100	/* synchronous flag */
4222
4223#define WL_PKTENG_MAXPKTSZ			16384	/* max pktsz limit for pkteng */
4224
4225typedef struct wl_pkteng {
4226	uint32 flags;
4227	uint32 delay;			/* Inter-packet delay */
4228	uint32 nframes;			/* Number of frames */
4229	uint32 length;			/* Packet length */
4230	uint8  seqno;			/* Enable/disable sequence no. */
4231	struct ether_addr dest;		/* Destination address */
4232	struct ether_addr src;		/* Source address */
4233} wl_pkteng_t;
4234
4235#define NUM_80211b_RATES	4
4236#define NUM_80211ag_RATES	8
4237#define NUM_80211n_RATES	32
4238#define NUM_80211_RATES		(NUM_80211b_RATES+NUM_80211ag_RATES+NUM_80211n_RATES)
4239typedef struct wl_pkteng_stats {
4240	uint32 lostfrmcnt;		/* RX PER test: no of frames lost (skip seqno) */
4241	int32 rssi;			/* RSSI */
4242	int32 snr;			/* signal to noise ratio */
4243	uint16 rxpktcnt[NUM_80211_RATES+1];
4244	uint8 rssi_qdb; /* qdB portion of the computed rssi */
4245} wl_pkteng_stats_t;
4246
4247
4248#define WL_WOWL_MAGIC       (1 << 0)    /* Wakeup on Magic packet */
4249#define WL_WOWL_NET         (1 << 1)    /* Wakeup on Netpattern */
4250#define WL_WOWL_DIS         (1 << 2)    /* Wakeup on loss-of-link due to Disassoc/Deauth */
4251#define WL_WOWL_RETR        (1 << 3)    /* Wakeup on retrograde TSF */
4252#define WL_WOWL_BCN         (1 << 4)    /* Wakeup on loss of beacon */
4253#define WL_WOWL_TST         (1 << 5)    /* Wakeup after test */
4254#define WL_WOWL_M1          (1 << 6)    /* Wakeup after PTK refresh */
4255#define WL_WOWL_EAPID       (1 << 7)    /* Wakeup after receipt of EAP-Identity Req */
4256#define WL_WOWL_PME_GPIO    (1 << 8)    /* Wakeind via PME(0) or GPIO(1) */
4257#define WL_WOWL_NEEDTKIP1   (1 << 9)    /* need tkip phase 1 key to be updated by the driver */
4258#define WL_WOWL_GTK_FAILURE (1 << 10)   /* enable wakeup if GTK fails */
4259#define WL_WOWL_EXTMAGPAT   (1 << 11)   /* support extended magic packets */
4260#define WL_WOWL_ARPOFFLOAD  (1 << 12)   /* support ARP/NS/keepalive offloading */
4261#define WL_WOWL_WPA2        (1 << 13)   /* read protocol version for EAPOL frames */
4262#define WL_WOWL_KEYROT      (1 << 14)   /* If the bit is set, use key rotaton */
4263#define WL_WOWL_BCAST       (1 << 15)   /* If the bit is set, frm received was bcast frame */
4264
4265#define MAGIC_PKT_MINLEN 102    /* Magic pkt min length is 6 * 0xFF + 16 * ETHER_ADDR_LEN */
4266
4267#define WOWL_PATTEN_TYPE_ARP	(1 << 0)	/* ARP offload Pattern */
4268#define WOWL_PATTEN_TYPE_NA	(1 << 1)	/* NA offload Pattern */
4269
4270typedef struct {
4271	uint32 masksize;		/* Size of the mask in #of bytes */
4272	uint32 offset;			/* Offset to start looking for the packet in # of bytes */
4273	uint32 patternoffset;		/* Offset of start of pattern in the structure */
4274	uint32 patternsize;		/* Size of the pattern itself in #of bytes */
4275	uint32 id;			/* id */
4276	uint32 reasonsize;		/* Size of the wakeup reason code */
4277	uint32 flags;			/* Flags to tell the pattern type and other properties */
4278	/* Mask follows the structure above */
4279	/* Pattern follows the mask is at 'patternoffset' from the start */
4280} wl_wowl_pattern_t;
4281
4282typedef struct {
4283	uint			count;
4284	wl_wowl_pattern_t	pattern[1];
4285} wl_wowl_pattern_list_t;
4286
4287typedef struct {
4288	uint8	pci_wakeind;	/* Whether PCI PMECSR PMEStatus bit was set */
4289	uint16	ucode_wakeind;	/* What wakeup-event indication was set by ucode */
4290} wl_wowl_wakeind_t;
4291
4292
4293/* per AC rate control related data structure */
4294typedef struct wl_txrate_class {
4295	uint8		init_rate;
4296	uint8		min_rate;
4297	uint8		max_rate;
4298} wl_txrate_class_t;
4299
4300
4301
4302/* Overlap BSS Scan parameters default, minimum, maximum */
4303#define WLC_OBSS_SCAN_PASSIVE_DWELL_DEFAULT		20	/* unit TU */
4304#define WLC_OBSS_SCAN_PASSIVE_DWELL_MIN			5	/* unit TU */
4305#define WLC_OBSS_SCAN_PASSIVE_DWELL_MAX			1000	/* unit TU */
4306#define WLC_OBSS_SCAN_ACTIVE_DWELL_DEFAULT		10	/* unit TU */
4307#define WLC_OBSS_SCAN_ACTIVE_DWELL_MIN			10	/* unit TU */
4308#define WLC_OBSS_SCAN_ACTIVE_DWELL_MAX			1000	/* unit TU */
4309#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_DEFAULT	300	/* unit Sec */
4310#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MIN		10	/* unit Sec */
4311#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MAX		900	/* unit Sec */
4312#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_DEFAULT	5
4313#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MIN	5
4314#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MAX	100
4315#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_DEFAULT	200	/* unit TU */
4316#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MIN	200	/* unit TU */
4317#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MAX	10000	/* unit TU */
4318#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_DEFAULT	20	/* unit TU */
4319#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MIN	20	/* unit TU */
4320#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MAX	10000	/* unit TU */
4321#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_DEFAULT	25	/* unit percent */
4322#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MIN		0	/* unit percent */
4323#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MAX		100	/* unit percent */
4324
4325/* structure for Overlap BSS scan arguments */
4326typedef struct wl_obss_scan_arg {
4327	int16	passive_dwell;
4328	int16	active_dwell;
4329	int16	bss_widthscan_interval;
4330	int16	passive_total;
4331	int16	active_total;
4332	int16	chanwidth_transition_delay;
4333	int16	activity_threshold;
4334} wl_obss_scan_arg_t;
4335
4336#define WL_OBSS_SCAN_PARAM_LEN	sizeof(wl_obss_scan_arg_t)
4337#define WL_MIN_NUM_OBSS_SCAN_ARG 7	/* minimum number of arguments required for OBSS Scan */
4338
4339#define WL_COEX_INFO_MASK		0x07
4340#define WL_COEX_INFO_REQ		0x01
4341#define	WL_COEX_40MHZ_INTOLERANT	0x02
4342#define	WL_COEX_WIDTH20			0x04
4343
4344#define	WLC_RSSI_INVALID	 0	/* invalid RSSI value */
4345
4346#define MAX_RSSI_LEVELS 8
4347
4348/* RSSI event notification configuration. */
4349typedef struct wl_rssi_event {
4350	uint32 rate_limit_msec;		/* # of events posted to application will be limited to
4351					 * one per specified period (0 to disable rate limit).
4352					 */
4353	uint8 num_rssi_levels;		/* Number of entries in rssi_levels[] below */
4354	int8 rssi_levels[MAX_RSSI_LEVELS];	/* Variable number of RSSI levels. An event
4355						 * will be posted each time the RSSI of received
4356						 * beacons/packets crosses a level.
4357						 */
4358} wl_rssi_event_t;
4359
4360typedef struct wl_action_obss_coex_req {
4361	uint8 info;
4362	uint8 num;
4363	uint8 ch_list[1];
4364} wl_action_obss_coex_req_t;
4365
4366
4367/* IOVar parameter block for small MAC address array with type indicator */
4368#define WL_IOV_MAC_PARAM_LEN  4
4369
4370#define WL_IOV_PKTQ_LOG_PRECS 16
4371
4372typedef struct {
4373	uint32 num_addrs;
4374	char   addr_type[WL_IOV_MAC_PARAM_LEN];
4375	struct ether_addr ea[WL_IOV_MAC_PARAM_LEN];
4376} wl_iov_mac_params_t;
4377
4378
4379/* Parameter block for PKTQ_LOG statistics */
4380typedef struct {
4381	uint32 requested;      /* packets requested to be stored */
4382	uint32 stored;         /* packets stored */
4383	uint32 saved;          /* packets saved,
4384	                          because a lowest priority queue has given away one packet
4385	                       */
4386	uint32 selfsaved;      /* packets saved,
4387	                          because an older packet from the same queue has been dropped
4388	                       */
4389	uint32 full_dropped;   /* packets dropped,
4390	                          because pktq is full with higher precedence packets
4391	                       */
4392	uint32 dropped;        /* packets dropped because pktq per that precedence is full */
4393	uint32 sacrificed;     /* packets dropped,
4394	                          in order to save one from a queue of a highest priority
4395	                       */
4396	uint32 busy;           /* packets droped because of hardware/transmission error */
4397	uint32 retry;          /* packets re-sent because they were not received */
4398	uint32 ps_retry;       /* packets retried again prior to moving power save mode */
4399	uint32 retry_drop;     /* packets finally dropped after retry limit */
4400	uint32 max_avail;      /* the high-water mark of the queue capacity for packets -
4401	                          goes to zero as queue fills
4402	                       */
4403	uint32 max_used;       /* the high-water mark of the queue utilisation for packets -
4404	                          increases with use ('inverse' of max_avail)
4405	                       */
4406	uint32 queue_capacity; /* the maximum capacity of the queue */
4407} pktq_log_counters_v01_t;
4408
4409typedef struct {
4410	uint32 requested;      /* packets requested to be stored */
4411	uint32 stored;         /* packets stored */
4412	uint32 saved;          /* packets saved,
4413	                          because a lowest priority queue has given away one packet
4414	                       */
4415	uint32 selfsaved;      /* packets saved,
4416	                          because an older packet from the same queue has been dropped
4417	                       */
4418	uint32 full_dropped;   /* packets dropped,
4419	                          because pktq is full with higher precedence packets
4420	                       */
4421	uint32 dropped;        /* packets dropped because pktq per that precedence is full */
4422	uint32 sacrificed;     /* packets dropped,
4423	                          in order to save one from a queue of a highest priority
4424	                       */
4425	uint32 busy;           /* packets droped because of hardware/transmission error */
4426	uint32 retry;          /* packets re-sent because they were not received */
4427	uint32 ps_retry;       /* packets retried again prior to moving power save mode */
4428	uint32 retry_drop;     /* packets finally dropped after retry limit */
4429	uint32 max_avail;      /* the high-water mark of the queue capacity for packets -
4430	                          goes to zero as queue fills
4431	                       */
4432	uint32 max_used;       /* the high-water mark of the queue utilisation for packets -
4433	                          increases with use ('inverse' of max_avail)
4434	                       */
4435	uint32 queue_capacity; /* the maximum capacity of the queue */
4436	uint32 rtsfail;        /* count of rts attempts that failed to receive cts */
4437	uint32 acked;          /* count of packets sent (acked) successfully */
4438} pktq_log_counters_v02_t;
4439
4440#define sacrified sacrificed
4441
4442typedef struct {
4443	uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
4444	pktq_log_counters_v01_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
4445	char                 headings[1];
4446} pktq_log_format_v01_t;
4447
4448typedef struct {
4449	uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
4450	pktq_log_counters_v02_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
4451	uint32               throughput[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
4452	uint32               time_delta;
4453	char                 headings[1];
4454} pktq_log_format_v02_t;
4455
4456
4457typedef struct {
4458	uint32               version;
4459	wl_iov_mac_params_t  params;
4460	union {
4461		pktq_log_format_v01_t v01;
4462		pktq_log_format_v02_t v02;
4463	} pktq_log;
4464} wl_iov_pktq_log_t;
4465
4466
4467/* **** EXTLOG **** */
4468#define EXTLOG_CUR_VER		0x0100
4469
4470#define MAX_ARGSTR_LEN		18 /* At least big enough for storing ETHER_ADDR_STR_LEN */
4471
4472/* log modules (bitmap) */
4473#define LOG_MODULE_COMMON	0x0001
4474#define LOG_MODULE_ASSOC	0x0002
4475#define LOG_MODULE_EVENT	0x0004
4476#define LOG_MODULE_MAX		3			/* Update when adding module */
4477
4478/* log levels */
4479#define WL_LOG_LEVEL_DISABLE	0
4480#define WL_LOG_LEVEL_ERR	1
4481#define WL_LOG_LEVEL_WARN	2
4482#define WL_LOG_LEVEL_INFO	3
4483#define WL_LOG_LEVEL_MAX	WL_LOG_LEVEL_INFO	/* Update when adding level */
4484
4485/* flag */
4486#define LOG_FLAG_EVENT		1
4487
4488/* log arg_type */
4489#define LOG_ARGTYPE_NULL	0
4490#define LOG_ARGTYPE_STR		1	/* %s */
4491#define LOG_ARGTYPE_INT		2	/* %d */
4492#define LOG_ARGTYPE_INT_STR	3	/* %d...%s */
4493#define LOG_ARGTYPE_STR_INT	4	/* %s...%d */
4494
4495typedef struct wlc_extlog_cfg {
4496	int max_number;
4497	uint16 module;	/* bitmap */
4498	uint8 level;
4499	uint8 flag;
4500	uint16 version;
4501} wlc_extlog_cfg_t;
4502
4503typedef struct log_record {
4504	uint32 time;
4505	uint16 module;
4506	uint16 id;
4507	uint8 level;
4508	uint8 sub_unit;
4509	uint8 seq_num;
4510	int32 arg;
4511	char str[MAX_ARGSTR_LEN];
4512} log_record_t;
4513
4514typedef struct wlc_extlog_req {
4515	uint32 from_last;
4516	uint32 num;
4517} wlc_extlog_req_t;
4518
4519typedef struct wlc_extlog_results {
4520	uint16 version;
4521	uint16 record_len;
4522	uint32 num;
4523	log_record_t logs[1];
4524} wlc_extlog_results_t;
4525
4526typedef struct log_idstr {
4527	uint16	id;
4528	uint16	flag;
4529	uint8	arg_type;
4530	const char	*fmt_str;
4531} log_idstr_t;
4532
4533#define FMTSTRF_USER		1
4534
4535/* flat ID definitions
4536 * New definitions HAVE TO BE ADDED at the end of the table. Otherwise, it will
4537 * affect backward compatibility with pre-existing apps
4538 */
4539typedef enum {
4540	FMTSTR_DRIVER_UP_ID = 0,
4541	FMTSTR_DRIVER_DOWN_ID = 1,
4542	FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
4543	FMTSTR_NO_PROGRESS_ID = 3,
4544	FMTSTR_RFDISABLE_ID = 4,
4545	FMTSTR_REG_PRINT_ID = 5,
4546	FMTSTR_EXPTIME_ID = 6,
4547	FMTSTR_JOIN_START_ID = 7,
4548	FMTSTR_JOIN_COMPLETE_ID = 8,
4549	FMTSTR_NO_NETWORKS_ID = 9,
4550	FMTSTR_SECURITY_MISMATCH_ID = 10,
4551	FMTSTR_RATE_MISMATCH_ID = 11,
4552	FMTSTR_AP_PRUNED_ID = 12,
4553	FMTSTR_KEY_INSERTED_ID = 13,
4554	FMTSTR_DEAUTH_ID = 14,
4555	FMTSTR_DISASSOC_ID = 15,
4556	FMTSTR_LINK_UP_ID = 16,
4557	FMTSTR_LINK_DOWN_ID = 17,
4558	FMTSTR_RADIO_HW_OFF_ID = 18,
4559	FMTSTR_RADIO_HW_ON_ID = 19,
4560	FMTSTR_EVENT_DESC_ID = 20,
4561	FMTSTR_PNP_SET_POWER_ID = 21,
4562	FMTSTR_RADIO_SW_OFF_ID = 22,
4563	FMTSTR_RADIO_SW_ON_ID = 23,
4564	FMTSTR_PWD_MISMATCH_ID = 24,
4565	FMTSTR_FATAL_ERROR_ID = 25,
4566	FMTSTR_AUTH_FAIL_ID = 26,
4567	FMTSTR_ASSOC_FAIL_ID = 27,
4568	FMTSTR_IBSS_FAIL_ID = 28,
4569	FMTSTR_EXTAP_FAIL_ID = 29,
4570	FMTSTR_MAX_ID
4571} log_fmtstr_id_t;
4572
4573#ifdef DONGLEOVERLAYS
4574typedef struct {
4575	uint32 flags_idx;	/* lower 8 bits: overlay index; upper 24 bits: flags */
4576	uint32 offset;		/* offset into overlay region to write code */
4577	uint32 len;			/* overlay code len */
4578	/* overlay code follows this struct */
4579} wl_ioctl_overlay_t;
4580
4581#define OVERLAY_IDX_MASK		0x000000ff
4582#define OVERLAY_IDX_SHIFT		0
4583#define OVERLAY_FLAGS_MASK		0xffffff00
4584#define OVERLAY_FLAGS_SHIFT		8
4585/* overlay written to device memory immediately after loading the base image */
4586#define OVERLAY_FLAG_POSTLOAD	0x100
4587/* defer overlay download until the device responds w/WLC_E_OVL_DOWNLOAD event */
4588#define OVERLAY_FLAG_DEFER_DL	0x200
4589/* overlay downloaded prior to the host going to sleep */
4590#define OVERLAY_FLAG_PRESLEEP	0x400
4591
4592#define OVERLAY_DOWNLOAD_CHUNKSIZE	1024
4593#endif /* DONGLEOVERLAYS */
4594
4595#endif /* LINUX_POSTMOGRIFY_REMOVAL */
4596
4597/* no default structure packing */
4598#include <packed_section_end.h>
4599
4600/* require strict packing */
4601#include <packed_section_start.h>
4602
4603#ifndef LINUX_POSTMOGRIFY_REMOVAL
4604
4605/* Structures and constants used for "vndr_ie" IOVar interface */
4606#define VNDR_IE_CMD_LEN		4	/* length of the set command string:
4607					 * "add", "del" (+ NUL)
4608					 */
4609
4610/* 802.11 Mgmt Packet flags */
4611#define VNDR_IE_BEACON_FLAG	0x1
4612#define VNDR_IE_PRBRSP_FLAG	0x2
4613#define VNDR_IE_ASSOCRSP_FLAG	0x4
4614#define VNDR_IE_AUTHRSP_FLAG	0x8
4615#define VNDR_IE_PRBREQ_FLAG	0x10
4616#define VNDR_IE_ASSOCREQ_FLAG	0x20
4617#define VNDR_IE_IWAPID_FLAG	0x40 /* vendor IE in IW advertisement protocol ID field */
4618#define VNDR_IE_CUSTOM_FLAG	0x100 /* allow custom IE id */
4619
4620#if defined(WLP2P)
4621/* P2P Action Frames flags (spec ordered) */
4622#define VNDR_IE_GONREQ_FLAG     0x001000
4623#define VNDR_IE_GONRSP_FLAG     0x002000
4624#define VNDR_IE_GONCFM_FLAG     0x004000
4625#define VNDR_IE_INVREQ_FLAG     0x008000
4626#define VNDR_IE_INVRSP_FLAG     0x010000
4627#define VNDR_IE_DISREQ_FLAG     0x020000
4628#define VNDR_IE_DISRSP_FLAG     0x040000
4629#define VNDR_IE_PRDREQ_FLAG     0x080000
4630#define VNDR_IE_PRDRSP_FLAG     0x100000
4631
4632#define VNDR_IE_P2PAF_SHIFT	12
4633#endif /* WLP2P */
4634
4635#define VNDR_IE_INFO_HDR_LEN	(sizeof(uint32))
4636
4637typedef BWL_PRE_PACKED_STRUCT struct {
4638	uint32 pktflag;			/* bitmask indicating which packet(s) contain this IE */
4639	vndr_ie_t vndr_ie_data;		/* vendor IE data */
4640} BWL_POST_PACKED_STRUCT vndr_ie_info_t;
4641
4642typedef BWL_PRE_PACKED_STRUCT struct {
4643	int iecount;			/* number of entries in the vndr_ie_list[] array */
4644	vndr_ie_info_t vndr_ie_list[1];	/* variable size list of vndr_ie_info_t structs */
4645} BWL_POST_PACKED_STRUCT vndr_ie_buf_t;
4646
4647typedef BWL_PRE_PACKED_STRUCT struct {
4648	char cmd[VNDR_IE_CMD_LEN];	/* vndr_ie IOVar set command : "add", "del" + NUL */
4649	vndr_ie_buf_t vndr_ie_buffer;	/* buffer containing Vendor IE list information */
4650} BWL_POST_PACKED_STRUCT vndr_ie_setbuf_t;
4651
4652/* tag_ID/length/value_buffer tuple */
4653typedef BWL_PRE_PACKED_STRUCT struct {
4654	uint8	id;
4655	uint8	len;
4656	uint8	data[1];
4657} BWL_POST_PACKED_STRUCT tlv_t;
4658
4659typedef BWL_PRE_PACKED_STRUCT struct {
4660	uint32 pktflag;			/* bitmask indicating which packet(s) contain this IE */
4661	tlv_t ie_data;		/* IE data */
4662} BWL_POST_PACKED_STRUCT ie_info_t;
4663
4664typedef BWL_PRE_PACKED_STRUCT struct {
4665	int iecount;			/* number of entries in the ie_list[] array */
4666	ie_info_t ie_list[1];	/* variable size list of ie_info_t structs */
4667} BWL_POST_PACKED_STRUCT ie_buf_t;
4668
4669typedef BWL_PRE_PACKED_STRUCT struct {
4670	char cmd[VNDR_IE_CMD_LEN];	/* ie IOVar set command : "add" + NUL */
4671	ie_buf_t ie_buffer;	/* buffer containing IE list information */
4672} BWL_POST_PACKED_STRUCT ie_setbuf_t;
4673
4674typedef BWL_PRE_PACKED_STRUCT struct {
4675	uint32 pktflag;		/* bitmask indicating which packet(s) contain this IE */
4676	uint8 id;		/* IE type */
4677} BWL_POST_PACKED_STRUCT ie_getbuf_t;
4678
4679/* structures used to define format of wps ie data from probe requests */
4680/* passed up to applications via iovar "prbreq_wpsie" */
4681typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_hdr {
4682	struct ether_addr staAddr;
4683	uint16 ieLen;
4684} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_hdr_t;
4685
4686typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
4687	sta_prbreq_wps_ie_hdr_t hdr;
4688	uint8 ieData[1];
4689} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
4690
4691typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
4692	uint32 totLen;
4693	uint8 ieDataList[1];
4694} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
4695
4696
4697#ifdef WLMEDIA_TXFAILEVENT
4698typedef BWL_PRE_PACKED_STRUCT struct {
4699	char   dest[ETHER_ADDR_LEN]; /* destination MAC */
4700	uint8  prio;            /* Packet Priority */
4701	uint8  flags;           /* Flags           */
4702	uint32 tsf_l;           /* TSF timer low   */
4703	uint32 tsf_h;           /* TSF timer high  */
4704	uint16 rates;           /* Main Rates      */
4705	uint16 txstatus;        /* TX Status       */
4706} BWL_POST_PACKED_STRUCT txfailinfo_t;
4707#endif /* WLMEDIA_TXFAILEVENT */
4708
4709typedef BWL_PRE_PACKED_STRUCT struct {
4710	uint32 flags;
4711	chanspec_t chanspec;			/* txpwr report for this channel */
4712	chanspec_t local_chanspec;		/* channel on which we are associated */
4713	uint8 local_max;			/* local max according to the AP */
4714	uint8 local_constraint;			/* local constraint according to the AP */
4715	int8  antgain[2];			/* Ant gain for each band - from SROM */
4716	uint8 rf_cores;				/* count of RF Cores being reported */
4717	uint8 est_Pout[4];			/* Latest tx power out estimate per RF chain */
4718	uint8 est_Pout_act[4]; /* Latest tx power out estimate per RF chain w/o adjustment */
4719	uint8 est_Pout_cck;			/* Latest CCK tx power out estimate */
4720	uint8 tx_power_max[4];		/* Maximum target power among all rates */
4721	uint tx_power_max_rate_ind[4];		/* Index of the rate with the max target power */
4722	int8 clm_limits[WL_NUMRATES];		/* regulatory limits - 20, 40 or 80MHz */
4723	int8 clm_limits_subchan1[WL_NUMRATES];	/* regulatory limits - 20in40 or 40in80 */
4724	int8 clm_limits_subchan2[WL_NUMRATES];	/* regulatory limits - 20in80MHz */
4725	int8 sar;					/* SAR limit for display by wl executable */
4726	int8 channel_bandwidth;		/* 20, 40 or 80 MHz bandwidth? */
4727	uint8 version;				/* Version of the data format wlu <--> driver */
4728	uint8 display_core;			/* Displayed curpower core */
4729	int8 target_offsets[4];		/* Target power offsets for current rate per core */
4730	uint32 last_tx_ratespec;	/* Ratespec for last transmition */
4731	uint   user_target;		/* user limit */
4732	uint32 board_limit_len;		/* length of board limit buffer */
4733	uint32 target_len;		/* length of target power buffer */
4734	int8 SARLIMIT[MAX_STREAMS_SUPPORTED];
4735	uint8  pprdata[1];		/* ppr serialization buffer */
4736} BWL_POST_PACKED_STRUCT tx_pwr_rpt_t;
4737
4738#endif /* LINUX_POSTMOGRIFY_REMOVAL */
4739
4740/* no strict structure packing */
4741#include <packed_section_end.h>
4742
4743#ifndef LINUX_POSTMOGRIFY_REMOVAL
4744/* Global ASSERT Logging */
4745#define ASSERTLOG_CUR_VER	0x0100
4746#define MAX_ASSRTSTR_LEN	64
4747
4748typedef struct assert_record {
4749	uint32 time;
4750	uint8 seq_num;
4751	char str[MAX_ASSRTSTR_LEN];
4752} assert_record_t;
4753
4754typedef struct assertlog_results {
4755	uint16 version;
4756	uint16 record_len;
4757	uint32 num;
4758	assert_record_t logs[1];
4759} assertlog_results_t;
4760
4761#define LOGRRC_FIX_LEN	8
4762#define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
4763
4764
4765/* channel interference measurement (chanim) related defines */
4766
4767/* chanim mode */
4768#define CHANIM_DISABLE	0	/* disabled */
4769#define CHANIM_DETECT	1	/* detection only */
4770#define CHANIM_EXT		2 	/* external state machine */
4771#define CHANIM_ACT		3	/* full internal state machine, detect + act */
4772#define CHANIM_MODE_MAX 4
4773
4774/* define for apcs reason code */
4775#define APCS_INIT		0
4776#define APCS_IOCTL		1
4777#define APCS_CHANIM		2
4778#define APCS_CSTIMER	3
4779#define APCS_BTA		4
4780#define APCS_TXDLY		5
4781#define APCS_NONACSD	6
4782
4783/* number of ACS record entries */
4784#define CHANIM_ACS_RECORD			10
4785
4786/* CHANIM */
4787#define CCASTATS_TXDUR  0
4788#define CCASTATS_INBSS  1
4789#define CCASTATS_OBSS   2
4790#define CCASTATS_NOCTG  3
4791#define CCASTATS_NOPKT  4
4792#define CCASTATS_DOZE   5
4793#define CCASTATS_TXOP	6
4794#define CCASTATS_GDTXDUR        7
4795#define CCASTATS_BDTXDUR        8
4796#define CCASTATS_MAX    9
4797
4798/* chanim acs record */
4799typedef struct {
4800	bool valid;
4801	uint8 trigger;
4802	chanspec_t selected_chspc;
4803	int8 bgnoise;
4804	uint32 glitch_cnt;
4805	uint8 ccastats;
4806	uint timestamp;
4807} chanim_acs_record_t;
4808
4809typedef struct {
4810	chanim_acs_record_t acs_record[CHANIM_ACS_RECORD];
4811	uint8 count;
4812	uint timestamp;
4813} wl_acs_record_t;
4814
4815typedef struct chanim_stats {
4816	uint32 glitchcnt;               /* normalized as per second count */
4817	uint32 badplcp;                 /* normalized as per second count */
4818	uint8 ccastats[CCASTATS_MAX]; 	/* normalized as 0-255 */
4819	int8 bgnoise;					/* background noise level (in dBm) */
4820	chanspec_t chanspec;
4821	uint32 timestamp;
4822} chanim_stats_t;
4823
4824#define WL_CHANIM_STATS_VERSION 1
4825#define WL_CHANIM_COUNT_ALL	0xff
4826#define WL_CHANIM_COUNT_ONE	0x1
4827
4828typedef struct {
4829	uint32 buflen;
4830	uint32 version;
4831	uint32 count;
4832	chanim_stats_t stats[1];
4833} wl_chanim_stats_t;
4834
4835#define WL_CHANIM_STATS_FIXED_LEN OFFSETOF(wl_chanim_stats_t, stats)
4836
4837/* Noise measurement metrics. */
4838#define NOISE_MEASURE_KNOISE	0x1
4839
4840/* scb probe parameter */
4841typedef struct {
4842	uint32 scb_timeout;
4843	uint32 scb_activity_time;
4844	uint32 scb_max_probe;
4845} wl_scb_probe_t;
4846
4847/* ap tpc modes */
4848#define	AP_TPC_OFF		0
4849#define	AP_TPC_BSS_PWR		1	/* BSS power control */
4850#define AP_TPC_AP_PWR		2	/* AP power control */
4851#define	AP_TPC_AP_BSS_PWR	3	/* Both AP and BSS power control */
4852#define AP_TPC_MAX_LINK_MARGIN	127
4853
4854/* ap tpc modes */
4855#define	AP_TPC_OFF		0
4856#define	AP_TPC_BSS_PWR		1	/* BSS power control */
4857#define AP_TPC_AP_PWR		2	/* AP power control */
4858#define	AP_TPC_AP_BSS_PWR	3	/* Both AP and BSS power control */
4859#define AP_TPC_MAX_LINK_MARGIN	127
4860
4861/* structure/defines for selective mgmt frame (smf) stats support */
4862
4863#define SMFS_VERSION 1
4864/* selected mgmt frame (smf) stats element */
4865typedef struct wl_smfs_elem {
4866	uint32 count;
4867	uint16 code;  /* SC or RC code */
4868} wl_smfs_elem_t;
4869
4870typedef struct wl_smf_stats {
4871	uint32 version;
4872	uint16 length;	/* reserved for future usage */
4873	uint8 type;
4874	uint8 codetype;
4875	uint32 ignored_cnt;
4876	uint32 malformed_cnt;
4877	uint32 count_total; /* count included the interested group */
4878	wl_smfs_elem_t elem[1];
4879} wl_smf_stats_t;
4880
4881#define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);
4882
4883enum {
4884	SMFS_CODETYPE_SC,
4885	SMFS_CODETYPE_RC
4886};
4887
4888/* reuse two number in the sc/rc space */
4889#define	SMFS_CODE_MALFORMED 0xFFFE
4890#define SMFS_CODE_IGNORED 	0xFFFD
4891
4892typedef enum smfs_type {
4893	SMFS_TYPE_AUTH,
4894	SMFS_TYPE_ASSOC,
4895	SMFS_TYPE_REASSOC,
4896	SMFS_TYPE_DISASSOC_TX,
4897	SMFS_TYPE_DISASSOC_RX,
4898	SMFS_TYPE_DEAUTH_TX,
4899	SMFS_TYPE_DEAUTH_RX,
4900	SMFS_TYPE_MAX
4901} smfs_type_t;
4902
4903#ifdef PHYMON
4904
4905#define PHYMON_VERSION 1
4906
4907typedef struct wl_phycal_core_state {
4908	/* Tx IQ/LO calibration coeffs */
4909	int16 tx_iqlocal_a;
4910	int16 tx_iqlocal_b;
4911	int8 tx_iqlocal_ci;
4912	int8 tx_iqlocal_cq;
4913	int8 tx_iqlocal_di;
4914	int8 tx_iqlocal_dq;
4915	int8 tx_iqlocal_ei;
4916	int8 tx_iqlocal_eq;
4917	int8 tx_iqlocal_fi;
4918	int8 tx_iqlocal_fq;
4919
4920	/* Rx IQ calibration coeffs */
4921	int16 rx_iqcal_a;
4922	int16 rx_iqcal_b;
4923
4924	uint8 tx_iqlocal_pwridx; /* Tx Power Index for Tx IQ/LO calibration */
4925	uint32 papd_epsilon_table[64]; /* PAPD epsilon table */
4926	int16 papd_epsilon_offset; /* PAPD epsilon offset */
4927	uint8 curr_tx_pwrindex; /* Tx power index */
4928	int8 idle_tssi; /* Idle TSSI */
4929	int8 est_tx_pwr; /* Estimated Tx Power (dB) */
4930	int8 est_rx_pwr; /* Estimated Rx Power (dB) from RSSI */
4931	uint16 rx_gaininfo; /* Rx gain applied on last Rx pkt */
4932	uint16 init_gaincode; /* initgain required for ACI */
4933	int8 estirr_tx;
4934	int8 estirr_rx;
4935
4936} wl_phycal_core_state_t;
4937
4938typedef struct wl_phycal_state {
4939	int version;
4940	int8 num_phy_cores; /* number of cores */
4941	int8 curr_temperature; /* on-chip temperature sensor reading */
4942	chanspec_t chspec; /* channspec for this state */
4943	bool aci_state; /* ACI state: ON/OFF */
4944	uint16 crsminpower; /* crsminpower required for ACI */
4945	uint16 crsminpowerl; /* crsminpowerl required for ACI */
4946	uint16 crsminpoweru; /* crsminpoweru required for ACI */
4947	wl_phycal_core_state_t phycal_core[1];
4948} wl_phycal_state_t;
4949
4950#define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
4951#endif /* PHYMON */
4952
4953/* discovery state */
4954typedef struct wl_p2p_disc_st {
4955	uint8 state;	/* see state */
4956	chanspec_t chspec;	/* valid in listen state */
4957	uint16 dwell;	/* valid in listen state, in ms */
4958} wl_p2p_disc_st_t;
4959
4960/* state */
4961#define WL_P2P_DISC_ST_SCAN	0
4962#define WL_P2P_DISC_ST_LISTEN	1
4963#define WL_P2P_DISC_ST_SEARCH	2
4964
4965/* scan request */
4966typedef struct wl_p2p_scan {
4967	uint8 type;		/* 'S' for WLC_SCAN, 'E' for "escan" */
4968	uint8 reserved[3];
4969	/* scan or escan parms... */
4970} wl_p2p_scan_t;
4971
4972/* i/f request */
4973typedef struct wl_p2p_if {
4974	struct ether_addr addr;
4975	uint8 type;	/* see i/f type */
4976	chanspec_t chspec;	/* for p2p_ifadd GO */
4977} wl_p2p_if_t;
4978
4979/* i/f type */
4980#define WL_P2P_IF_CLIENT	0
4981#define WL_P2P_IF_GO		1
4982#define WL_P2P_IF_DYNBCN_GO	2
4983#define WL_P2P_IF_DEV		3
4984
4985/* i/f query */
4986typedef struct wl_p2p_ifq {
4987	uint bsscfgidx;
4988	char ifname[BCM_MSG_IFNAME_MAX];
4989} wl_p2p_ifq_t;
4990
4991/* OppPS & CTWindow */
4992typedef struct wl_p2p_ops {
4993	uint8 ops;	/* 0: disable 1: enable */
4994	uint8 ctw;	/* >= 10 */
4995} wl_p2p_ops_t;
4996
4997/* absence and presence request */
4998typedef struct wl_p2p_sched_desc {
4999	uint32 start;
5000	uint32 interval;
5001	uint32 duration;
5002	uint32 count;	/* see count */
5003} wl_p2p_sched_desc_t;
5004
5005/* count */
5006#define WL_P2P_SCHED_RSVD	0
5007#define WL_P2P_SCHED_REPEAT	255	/* anything > 255 will be treated as 255 */
5008
5009typedef struct wl_p2p_sched {
5010	uint8 type;	/* see schedule type */
5011	uint8 action;	/* see schedule action */
5012	uint8 option;	/* see schedule option */
5013	wl_p2p_sched_desc_t desc[1];
5014} wl_p2p_sched_t;
5015#define WL_P2P_SCHED_FIXED_LEN		3
5016
5017/* schedule type */
5018#define WL_P2P_SCHED_TYPE_ABS		0	/* Scheduled Absence */
5019#define WL_P2P_SCHED_TYPE_REQ_ABS	1	/* Requested Absence */
5020
5021/* schedule action during absence periods (for WL_P2P_SCHED_ABS type) */
5022#define WL_P2P_SCHED_ACTION_NONE	0	/* no action */
5023#define WL_P2P_SCHED_ACTION_DOZE	1	/* doze */
5024/* schedule option - WL_P2P_SCHED_TYPE_REQ_ABS */
5025#define WL_P2P_SCHED_ACTION_GOOFF	2	/* turn off GO beacon/prbrsp functions */
5026/* schedule option - WL_P2P_SCHED_TYPE_XXX */
5027#define WL_P2P_SCHED_ACTION_RESET	255	/* reset */
5028
5029/* schedule option - WL_P2P_SCHED_TYPE_ABS */
5030#define WL_P2P_SCHED_OPTION_NORMAL	0	/* normal start/interval/duration/count */
5031#define WL_P2P_SCHED_OPTION_BCNPCT	1	/* percentage of beacon interval */
5032/* schedule option - WL_P2P_SCHED_TYPE_REQ_ABS */
5033#define WL_P2P_SCHED_OPTION_TSFOFS	2	/* normal start/internal/duration/count with
5034						 * start being an offset of the 'current' TSF
5035						 */
5036
5037/* feature flags */
5038#define WL_P2P_FEAT_GO_CSA	(1 << 0)	/* GO moves with the STA using CSA method */
5039#define WL_P2P_FEAT_GO_NOLEGACY	(1 << 1)	/* GO does not probe respond to non-p2p probe
5040						 * requests
5041						 */
5042#define WL_P2P_FEAT_RESTRICT_DEV_RESP (1 << 2)	/* Restrict p2p dev interface from responding */
5043
5044#ifdef WLNIC
5045/* nic_cnx iovar */
5046typedef struct wl_nic_cnx {
5047	uint8 opcode;
5048	struct ether_addr addr;
5049	/* the following are valid for WL_NIC_CNX_CONN */
5050	uint8 SSID_len;
5051	uint8 SSID[32];
5052	struct ether_addr abssid;
5053	uint16 beacon_interval;
5054	uint16 sync_threshold;
5055	uint16 beacon_wait_time;
5056} wl_nic_cnx_t;
5057
5058/* opcode */
5059#define WL_NIC_CNX_ADD	0	/* add NIC connection */
5060#define WL_NIC_CNX_DEL	1	/* delete NIC connection */
5061#define WL_NIC_CNX_IDX	2	/* query NIC connection index */
5062#define WL_NIC_CNX_CONN	3	/* join/create network */
5063#define WL_NIC_CNX_DIS	4	/* disconnect from network */
5064
5065/* nic_cfg iovar */
5066typedef struct wl_nic_cfg {
5067	uint8 version;
5068	uint8 beacon_mode;
5069	uint8 diluted_beacon_period;
5070	uint8 beacon_probability;
5071	uint8 num_awake_window_params;
5072	struct {
5073		uint8 channel_number;
5074		uint8 awake_window_length;
5075		uint8 repeat_EQC;
5076	} awake_window_params[3];
5077	uint8 scan_length;
5078	uint8 scan_interval;
5079	uint8 scan_probability;
5080	uint8 ASID;
5081	uint8 channel_usage_mode;
5082	uint8 CWmin_af;
5083	uint8 NIC_priority;
5084	uint8 NIC_data_ind;
5085	uint8 allowed_wakeup_delay;
5086} wl_nic_cfg_t;
5087
5088/* version */
5089#define WL_NIC_CFG_VER	1
5090
5091/* beacon_mode */
5092#define WL_NIC_BCN_NORM		0
5093#define WL_NIC_BCN_DILUTED	1
5094
5095/* channel_usage_mode */
5096#define WL_NIC_CHAN_STATIC	0
5097#define WL_NIC_CHAN_CYCLE	1
5098
5099/* nic_cfg iovar */
5100typedef struct wl_nic_frm {
5101	uint8 type;
5102	struct ether_addr da;
5103	uint8 body[1];
5104} wl_nic_frm_t;
5105
5106/* type */
5107#define WL_NIC_FRM_ACTION	2
5108
5109/* i/f query */
5110typedef struct wl_nic_ifq {
5111	uint bsscfgidx;
5112	char ifname[BCM_MSG_IFNAME_MAX];
5113} wl_nic_ifq_t;
5114
5115/* data mode */
5116/* nic_dm iovar */
5117typedef struct wl_nic_dm {
5118	uint8 enab;
5119	uint8 rsvd;
5120	/* the following fields are valid when enabling... */
5121	chanspec_t chspec;
5122	uint8 DATA_priority;
5123	uint8 NIC_priority;
5124} wl_nic_dm_t;
5125
5126/* immediate scan request */
5127typedef struct wl_nic_isq {
5128	uint8 scan_length;
5129} wl_nic_isq_t;
5130#endif /* WLNIC */
5131
5132/* RFAWARE def */
5133#define BCM_ACTION_RFAWARE		0x77
5134#define BCM_ACTION_RFAWARE_DCS  0x01
5135
5136/* DCS reason code define */
5137#define BCM_DCS_IOVAR		0x1
5138#define BCM_DCS_UNKNOWN		0xFF
5139
5140typedef struct wl_bcmdcs_data {
5141	uint reason;
5142	chanspec_t chspec;
5143} wl_bcmdcs_data_t;
5144
5145/* n-mode support capability */
5146/* 2x2 includes both 1x1 & 2x2 devices
5147 * reserved #define 2 for future when we want to separate 1x1 & 2x2 and
5148 * control it independently
5149 */
5150#define WL_11N_2x2			1
5151#define WL_11N_3x3			3
5152#define WL_11N_4x4			4
5153
5154/* define 11n feature disable flags */
5155#define WLFEATURE_DISABLE_11N		0x00000001
5156#define WLFEATURE_DISABLE_11N_STBC_TX	0x00000002
5157#define WLFEATURE_DISABLE_11N_STBC_RX	0x00000004
5158#define WLFEATURE_DISABLE_11N_SGI_TX	0x00000008
5159#define WLFEATURE_DISABLE_11N_SGI_RX	0x00000010
5160#define WLFEATURE_DISABLE_11N_AMPDU_TX	0x00000020
5161#define WLFEATURE_DISABLE_11N_AMPDU_RX	0x00000040
5162#define WLFEATURE_DISABLE_11N_GF	0x00000080
5163
5164/* Proxy STA modes */
5165#define PSTA_MODE_DISABLED		0
5166#define PSTA_MODE_PROXY			1
5167#define PSTA_MODE_REPEATER		2
5168
5169
5170/* NAT configuration */
5171typedef struct {
5172	uint32 ipaddr;		/* interface ip address */
5173	uint32 ipaddr_mask;	/* interface ip address mask */
5174	uint32 ipaddr_gateway;	/* gateway ip address */
5175	uint8 mac_gateway[6];	/* gateway mac address */
5176	uint32 ipaddr_dns;	/* DNS server ip address, valid only for public if */
5177	uint8 mac_dns[6];	/* DNS server mac address,  valid only for public if */
5178	uint8 GUID[38];		/* interface GUID */
5179} nat_if_info_t;
5180
5181typedef struct {
5182	uint op;		/* operation code */
5183	bool pub_if;		/* set for public if, clear for private if */
5184	nat_if_info_t if_info;	/* interface info */
5185} nat_cfg_t;
5186
5187/* op code in nat_cfg */
5188#define NAT_OP_ENABLE		1	/* enable NAT on given interface */
5189#define NAT_OP_DISABLE		2	/* disable NAT on given interface */
5190#define NAT_OP_DISABLE_ALL	3	/* disable NAT on all interfaces */
5191
5192/* NAT state */
5193#define NAT_STATE_ENABLED	1	/* NAT is enabled */
5194#define NAT_STATE_DISABLED	2	/* NAT is disabled */
5195
5196typedef struct {
5197	int state;	/* NAT state returned */
5198} nat_state_t;
5199
5200#ifdef PROP_TXSTATUS
5201/* Bit definitions for tlv iovar */
5202/*
5203 * enable RSSI signals:
5204 * WLFC_CTL_TYPE_RSSI
5205 */
5206#define WLFC_FLAGS_RSSI_SIGNALS		0x0001
5207
5208/* enable (if/mac_open, if/mac_close,, mac_add, mac_del) signals:
5209 *
5210 * WLFC_CTL_TYPE_MAC_OPEN
5211 * WLFC_CTL_TYPE_MAC_CLOSE
5212 *
5213 * WLFC_CTL_TYPE_INTERFACE_OPEN
5214 * WLFC_CTL_TYPE_INTERFACE_CLOSE
5215 *
5216 * WLFC_CTL_TYPE_MACDESC_ADD
5217 * WLFC_CTL_TYPE_MACDESC_DEL
5218 *
5219 */
5220#define WLFC_FLAGS_XONXOFF_SIGNALS	0x0002
5221
5222/* enable (status, fifo_credit, mac_credit) signals
5223 * WLFC_CTL_TYPE_MAC_REQUEST_CREDIT
5224 * WLFC_CTL_TYPE_TXSTATUS
5225 * WLFC_CTL_TYPE_FIFO_CREDITBACK
5226 */
5227#define WLFC_FLAGS_CREDIT_STATUS_SIGNALS	0x0004
5228
5229#define WLFC_FLAGS_HOST_PROPTXSTATUS_ACTIVE	0x0008
5230#define WLFC_FLAGS_PSQ_GENERATIONFSM_ENABLE	0x0010
5231#define WLFC_FLAGS_PSQ_ZERO_BUFFER_ENABLE	0x0020
5232#define WLFC_FLAGS_HOST_RXRERODER_ACTIVE	0x0040
5233#endif /* PROP_TXSTATUS */
5234
5235#define BTA_STATE_LOG_SZ	64
5236
5237/* BTAMP Statemachine states */
5238enum {
5239	HCIReset = 1,
5240	HCIReadLocalAMPInfo,
5241	HCIReadLocalAMPASSOC,
5242	HCIWriteRemoteAMPASSOC,
5243	HCICreatePhysicalLink,
5244	HCIAcceptPhysicalLinkRequest,
5245	HCIDisconnectPhysicalLink,
5246	HCICreateLogicalLink,
5247	HCIAcceptLogicalLink,
5248	HCIDisconnectLogicalLink,
5249	HCILogicalLinkCancel,
5250	HCIAmpStateChange,
5251	HCIWriteLogicalLinkAcceptTimeout
5252};
5253
5254typedef struct flush_txfifo {
5255	uint32 txfifobmp;
5256	uint32 hwtxfifoflush;
5257	struct ether_addr ea;
5258} flush_txfifo_t;
5259
5260#define CHANNEL_5G_LOW_START	36	/* 5G low (36..48) CDD enable/disable bit mask */
5261#define CHANNEL_5G_MID_START	52	/* 5G mid (52..64) CDD enable/disable bit mask */
5262#define CHANNEL_5G_HIGH_START	100	/* 5G high (100..140) CDD enable/disable bit mask */
5263#define CHANNEL_5G_UPPER_START	149	/* 5G upper (149..161) CDD enable/disable bit mask */
5264
5265enum {
5266	SPATIAL_MODE_2G_IDX = 0,
5267	SPATIAL_MODE_5G_LOW_IDX,
5268	SPATIAL_MODE_5G_MID_IDX,
5269	SPATIAL_MODE_5G_HIGH_IDX,
5270	SPATIAL_MODE_5G_UPPER_IDX,
5271	SPATIAL_MODE_MAX_IDX
5272};
5273
5274#define WLC_TXCORE_MAX	4	/* max number of txcore supports */
5275#define WLC_SUBBAND_MAX	4	/* max number of sub-band supports */
5276typedef struct {
5277	uint8	band2g[WLC_TXCORE_MAX];
5278	uint8	band5g[WLC_SUBBAND_MAX][WLC_TXCORE_MAX];
5279} sar_limit_t;
5280
5281/* IOVAR "mempool" parameter. Used to retrieve a list of memory pool statistics. */
5282typedef struct wl_mempool_stats {
5283	int	num;		/* Number of memory pools */
5284	bcm_mp_stats_t s[1];	/* Variable array of memory pool stats. */
5285} wl_mempool_stats_t;
5286
5287
5288/* D0 Coalescing */
5289#define IPV4_ARP_FILTER		0x0001
5290#define IPV4_NETBT_FILTER	0x0002
5291#define IPV4_LLMNR_FILTER	0x0004
5292#define IPV4_SSDP_FILTER	0x0008
5293#define IPV4_WSD_FILTER		0x0010
5294#define IPV6_NETBT_FILTER	0x0200
5295#define IPV6_LLMNR_FILTER	0x0400
5296#define IPV6_SSDP_FILTER	0x0800
5297#define IPV6_WSD_FILTER		0x1000
5298
5299/* Network Offload Engine */
5300#define NWOE_OL_ENABLE		0x00000001
5301
5302typedef struct {
5303	uint32 ipaddr;
5304	uint32 ipaddr_netmask;
5305	uint32 ipaddr_gateway;
5306} nwoe_ifconfig_t;
5307
5308/*
5309 * Traffic management structures/defines.
5310 */
5311
5312/* Traffic management bandwidth parameters */
5313#define TRF_MGMT_MAX_PRIORITIES                 3
5314
5315#define TRF_MGMT_FLAG_ADD_DSCP                  0x0001  /* Add DSCP to IP TOS field */
5316#define TRF_MGMT_FLAG_DISABLE_SHAPING           0x0002  /* Don't shape traffic */
5317#define TRF_MGMT_FLAG_MANAGE_LOCAL_TRAFFIC      0x0008  /* Manage traffic over our local subnet */
5318#define TRF_MGMT_FLAG_FILTER_ON_MACADDR         0x0010  /* filter on MAC address */
5319#define TRF_MGMT_FLAG_NO_RX                     0x0020  /* do not apply fiters to rx packets */
5320
5321#define TRF_FILTER_MAC_ADDR              0x0001 /* L2 filter use dst mac address for filtering */
5322#define TRF_FILTER_IP_ADDR               0x0002 /* L3 filter use ip ddress for filtering */
5323#define TRF_FILTER_L4                    0x0004 /* L4 filter use tcp/udp for filtering */
5324#define TRF_FILTER_FAVORED               0x0010 /* Tag the packet FAVORED */
5325
5326/* Traffic management priority classes */
5327typedef enum trf_mgmt_priority_class {
5328	trf_mgmt_priority_low           = 0,        /* Maps to 802.1p BK */
5329	trf_mgmt_priority_medium        = 1,        /* Maps to 802.1p BE */
5330	trf_mgmt_priority_high          = 2,        /* Maps to 802.1p VI */
5331	trf_mgmt_priority_nochange	= 3,	    /* do not update the priority */
5332	trf_mgmt_priority_invalid       = (trf_mgmt_priority_nochange + 1)
5333} trf_mgmt_priority_class_t;
5334
5335/* Traffic management configuration parameters */
5336typedef struct trf_mgmt_config {
5337	uint32  trf_mgmt_enabled;                           /* 0 - disabled, 1 - enabled */
5338	uint32  flags;                                      /* See TRF_MGMT_FLAG_xxx defines */
5339	uint32  host_ip_addr;                               /* My IP address to determine subnet */
5340	uint32  host_subnet_mask;                           /* My subnet mask */
5341	uint32  downlink_bandwidth;                         /* In units of kbps */
5342	uint32  uplink_bandwidth;                           /* In units of kbps */
5343	uint32  min_tx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /* Minimum guaranteed tx bandwidth */
5344	uint32  min_rx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /* Minimum guaranteed rx bandwidth */
5345} trf_mgmt_config_t;
5346
5347/* Traffic management filter */
5348typedef struct trf_mgmt_filter {
5349	struct ether_addr           dst_ether_addr;         /* His L2 address */
5350	uint32                      dst_ip_addr;            /* His IP address */
5351	uint16                      dst_port;               /* His L4 port */
5352	uint16                      src_port;               /* My L4 port */
5353	uint16                      prot;                   /* L4 protocol (only TCP or UDP) */
5354	uint16                      flags;                  /* TBD. For now, this must be zero. */
5355	trf_mgmt_priority_class_t   priority;               /* Priority for filtered packets */
5356} trf_mgmt_filter_t;
5357
5358/* Traffic management filter list (variable length) */
5359typedef struct trf_mgmt_filter_list     {
5360	uint32              num_filters;
5361	trf_mgmt_filter_t   filter[1];
5362} trf_mgmt_filter_list_t;
5363
5364/* Traffic management global info used for all queues */
5365typedef struct trf_mgmt_global_info {
5366	uint32  maximum_bytes_per_second;
5367	uint32  maximum_bytes_per_sampling_period;
5368	uint32  total_bytes_consumed_per_second;
5369	uint32  total_bytes_consumed_per_sampling_period;
5370	uint32  total_unused_bytes_per_sampling_period;
5371} trf_mgmt_global_info_t;
5372
5373/* Traffic management shaping info per priority queue */
5374typedef struct trf_mgmt_shaping_info {
5375	uint32  gauranteed_bandwidth_percentage;
5376	uint32  guaranteed_bytes_per_second;
5377	uint32  guaranteed_bytes_per_sampling_period;
5378	uint32  num_bytes_produced_per_second;
5379	uint32  num_bytes_consumed_per_second;
5380	uint32  num_queued_packets;                         /* Number of packets in queue */
5381	uint32  num_queued_bytes;                           /* Number of bytes in queue */
5382} trf_mgmt_shaping_info_t;
5383
5384/* Traffic management shaping info array */
5385typedef struct trf_mgmt_shaping_info_array {
5386	trf_mgmt_global_info_t   tx_global_shaping_info;
5387	trf_mgmt_shaping_info_t  tx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
5388	trf_mgmt_global_info_t   rx_global_shaping_info;
5389	trf_mgmt_shaping_info_t  rx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
5390} trf_mgmt_shaping_info_array_t;
5391
5392
5393/* Traffic management statistical counters */
5394typedef struct trf_mgmt_stats {
5395	uint32  num_processed_packets;      /* Number of packets processed */
5396	uint32  num_processed_bytes;        /* Number of bytes processed */
5397	uint32  num_discarded_packets;      /* Number of packets discarded from queue */
5398} trf_mgmt_stats_t;
5399
5400/* Traffic management statisics array */
5401typedef struct trf_mgmt_stats_array     {
5402	trf_mgmt_stats_t  tx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
5403	trf_mgmt_stats_t  rx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
5404} trf_mgmt_stats_array_t;
5405
5406typedef struct powersel_params {
5407	/* LPC Params exposed via IOVAR */
5408	int32		tp_ratio_thresh;  /* Throughput ratio threshold */
5409	uint8		rate_stab_thresh; /* Thresh for rate stability based on nupd */
5410	uint8		pwr_stab_thresh; /* Number of successes before power step down */
5411	uint8		pwr_sel_exp_time; /* Time lapse for expiry of database */
5412} powersel_params_t;
5413
5414/* tx pkt delay statistics */
5415#define	SCB_RETRY_SHORT_DEF	7	/* Default Short retry Limit */
5416#define WLPKTDLY_HIST_NBINS	16	/* number of bins used in the Delay histogram */
5417
5418/* structure to store per-AC delay statistics */
5419typedef struct scb_delay_stats {
5420	uint32 txmpdu_lost;	/* number of MPDUs lost */
5421	uint32 txmpdu_cnt[SCB_RETRY_SHORT_DEF]; /* retry times histogram */
5422	uint32 delay_sum[SCB_RETRY_SHORT_DEF]; /* cumulative packet latency */
5423	uint32 delay_min;	/* minimum packet latency observed */
5424	uint32 delay_max;	/* maximum packet latency observed */
5425	uint32 delay_avg;	/* packet latency average */
5426	uint32 delay_hist[WLPKTDLY_HIST_NBINS];	/* delay histogram */
5427} scb_delay_stats_t;
5428
5429/* structure for txdelay event */
5430typedef struct txdelay_event {
5431	uint8	status;
5432	int		rssi;
5433	chanim_stats_t		chanim_stats;
5434	scb_delay_stats_t	delay_stats[AC_COUNT];
5435} txdelay_event_t;
5436
5437/* structure for txdelay parameters */
5438typedef struct txdelay_params {
5439	uint16	ratio;	/* Avg Txdelay Delta */
5440	uint8	cnt;	/* Sample cnt */
5441	uint8	period;	/* Sample period */
5442	uint8	tune;	/* Debug */
5443} txdelay_params_t;
5444
5445#define WL_RELMCAST_MAX_CLIENT 			32
5446#define WL_RELMCAST_FLAG_INBLACKLIST	1
5447#define WL_RELMCAST_FLAG_ACTIVEACKER	2
5448#define WL_RELMCAST_FLAG_RELMCAST		4
5449
5450#define WL_RELMCAST_VER					1
5451
5452typedef struct wl_relmcast_client {
5453	uint8 flag;
5454	int16 rssi;
5455	struct ether_addr addr;
5456} wl_relmcast_client_t;
5457
5458typedef struct wl_relmcast_st {
5459	uint8 ver;
5460	uint8 num;
5461	wl_relmcast_client_t clients[WL_RELMCAST_MAX_CLIENT];
5462} wl_relmcast_status_t;
5463
5464#endif /* LINUX_POSTMOGRIFY_REMOVAL */
5465
5466/* fbt_cap: FBT assoc / reassoc modes. */
5467#define WLC_FBT_CAP_DRV_4WAY_AND_REASSOC  1 /* Driver 4-way handshake & reassoc (WLFBT). */
5468
5469typedef struct bcnreq {
5470	uint8 bcn_mode;
5471	int dur;
5472	int channel;
5473	struct ether_addr da;
5474	uint16 random_int;
5475	wlc_ssid_t ssid;
5476	uint16 reps;
5477} bcnreq_t;
5478
5479typedef struct rrmreq {
5480	struct ether_addr da;
5481	uint8 reg;
5482	uint8 chan;
5483	uint16 random_int;
5484	uint16 dur;
5485	uint16 reps;
5486} rrmreq_t;
5487
5488typedef struct framereq {
5489	struct ether_addr da;
5490	uint8 reg;
5491	uint8 chan;
5492	uint16 random_int;
5493	uint16 dur;
5494	struct ether_addr ta;
5495	uint16 reps;
5496} framereq_t;
5497
5498typedef struct statreq {
5499	struct ether_addr da;
5500	struct ether_addr peer;
5501	uint16 random_int;
5502	uint16 dur;
5503	uint8 group_id;
5504	uint16 reps;
5505} statreq_t;
5506
5507typedef struct wl_el_set_params_s {
5508	uint8 set;	/* Set number */
5509	uint32 size;	/* Size to make/expand */
5510} wl_el_set_params_t;
5511
5512typedef struct wl_el_tag_params_s {
5513	uint16 tag;
5514	uint8 set;
5515	uint8 flags;
5516} wl_el_tag_params_t;
5517
5518#endif /* _wlioctl_h_ */
5519