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) 2013, Broadcom Corporation. All Rights Reserved.
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 * $Id: wlioctl.h 433276 2013-10-31 03:26:49Z $
22 */
23
24#ifndef _wlioctl_h_
25#define	_wlioctl_h_
26
27#include <typedefs.h>
28#include <proto/ethernet.h>
29#include <proto/bcmeth.h>
30#include <proto/bcmip.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
42#ifdef __NetBSD__
43/* NetBSD 2.0 does not have SIOCDEVPRIVATE. */
44#define SIOCDEVPRIVATE	_IOWR('i', 139, struct ifreq)
45#endif
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#ifndef OLYMPIC_RWL
58	char            intf_name[INTF_NAME_SIZ];
59#endif
60} rem_ioctl_t;
61#define REMOTE_SIZE	sizeof(rem_ioctl_t)
62#ifdef EFI
63#define BCMWL_IOCTL_GUID \
64	{0xB4910A35, 0x88C5, 0x4328, { 0x90, 0x08, 0x9F, 0xB2, 0x00, 0x00, 0x0, 0x0 } }
65#endif /* EFI */
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 IE, VHT_CAP_MCS_MAP_*) */
214	uint16		vht_txmcsmap;	/* VHT tx mcs map (802.11ac IE, 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#define WL_BSS_FLAGS_HS20			0x08    /* hotspot 2.0 capable */
232#define WL_BSS_FLAGS_DWDS 0x80 /* BSS is DWDS Capable, for NTGR CSP689942 */
233#ifdef NTGR_VNDR_IE
234#define WL_BSS_FLAGS_NTGR_SMESH 0x40
235#endif
236
237/* bssinfo flag for nbss_cap */
238#define VHT_BI_SGI_80MHZ			0x00000100
239#define VHT_BI_80MHZ			    0x00000200
240#define VHT_BI_160MHZ			    0x00000400
241#define VHT_BI_8080MHZ			    0x00000800
242
243#ifndef LINUX_POSTMOGRIFY_REMOVAL
244
245typedef struct wl_bsscfg {
246	uint32	wsec;
247	uint32	WPA_auth;
248	uint32	wsec_index;
249	uint32	associated;
250	uint32	BSS;
251	uint32	phytest_on;
252	struct ether_addr	prev_BSSID;
253	struct ether_addr	BSSID;
254} wl_bsscfg_t;
255
256typedef struct wl_bss_config {
257	uint32	atim_window;
258	uint32	beacon_period;
259	uint32	chanspec;
260} wl_bss_config_t;
261
262#define WL_BSS_USER_RADAR_CHAN_SELECT	0x1	/* User application will randomply select
263						 * radar channel.
264						 */
265
266#define DLOAD_HANDLER_VER			1	/* Downloader version */
267#define DLOAD_FLAG_VER_MASK		0xf000	/* Downloader version mask */
268#define DLOAD_FLAG_VER_SHIFT	12	/* Downloader version shift */
269
270#define DL_CRC_NOT_INUSE 			0x0001
271
272/* generic download types & flags */
273enum {
274	DL_TYPE_UCODE = 1,
275	DL_TYPE_CLM = 2
276};
277
278/* ucode type values */
279enum {
280	UCODE_FW,
281	INIT_VALS,
282	BS_INIT_VALS
283};
284
285struct wl_dload_data {
286	uint16 flag;
287	uint16 dload_type;
288	uint32 len;
289	uint32 crc;
290	uint8  data[1];
291};
292typedef struct wl_dload_data wl_dload_data_t;
293
294struct wl_ucode_info {
295	uint32 ucode_type;
296	uint32 num_chunks;
297	uint32 chunk_len;
298	uint32 chunk_num;
299	uint8  data_chunk[1];
300};
301typedef struct wl_ucode_info wl_ucode_info_t;
302
303struct wl_clm_dload_info {
304	uint32 ds_id;
305	uint32 clm_total_len;
306	uint32 num_chunks;
307	uint32 chunk_len;
308	uint32 chunk_offset;
309	uint8  data_chunk[1];
310};
311typedef struct wl_clm_dload_info wl_clm_dload_info_t;
312
313#endif /* LINUX_POSTMOGRIFY_REMOVAL */
314
315typedef struct wlc_ssid {
316	uint32		SSID_len;
317	uchar		SSID[32];
318} wlc_ssid_t;
319
320#ifndef LINUX_POSTMOGRIFY_REMOVAL
321
322#define MAX_PREFERRED_AP_NUM     5
323typedef struct wlc_fastssidinfo {
324	uint32				SSID_channel[MAX_PREFERRED_AP_NUM];
325	wlc_ssid_t		SSID_info[MAX_PREFERRED_AP_NUM];
326} wlc_fastssidinfo_t;
327
328typedef BWL_PRE_PACKED_STRUCT struct wnm_url {
329	uint8   len;
330	uint8   data[1];
331} BWL_POST_PACKED_STRUCT wnm_url_t;
332
333typedef struct chan_scandata {
334	uint8		txpower;
335	uint8		pad;
336	chanspec_t	channel;	/* Channel num, bw, ctrl_sb and band */
337	uint32		channel_mintime;
338	uint32		channel_maxtime;
339} chan_scandata_t;
340
341typedef enum wl_scan_type {
342	EXTDSCAN_FOREGROUND_SCAN,
343	EXTDSCAN_BACKGROUND_SCAN,
344	EXTDSCAN_FORCEDBACKGROUND_SCAN
345} wl_scan_type_t;
346
347#define WLC_EXTDSCAN_MAX_SSID		5
348
349typedef struct wl_extdscan_params {
350	int8 		nprobes;		/* 0, passive, otherwise active */
351	int8    	split_scan;		/* split scan */
352	int8		band;			/* band */
353	int8		pad;
354	wlc_ssid_t 	ssid[WLC_EXTDSCAN_MAX_SSID]; /* ssid list */
355	uint32		tx_rate;		/* in 500ksec units */
356	wl_scan_type_t	scan_type;		/* enum */
357	int32 		channel_num;
358	chan_scandata_t channel_list[1];	/* list of chandata structs */
359} wl_extdscan_params_t;
360
361#define WL_EXTDSCAN_PARAMS_FIXED_SIZE 	(sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
362
363#define WL_BSSTYPE_INFRA 1
364#define WL_BSSTYPE_INDEP 0
365#define WL_BSSTYPE_ANY   2
366
367/* Bitmask for scan_type */
368#define WL_SCANFLAGS_PASSIVE	0x01	/* force passive scan */
369#define WL_SCANFLAGS_RESERVED	0x02	/* Reserved */
370#define WL_SCANFLAGS_PROHIBITED	0x04	/* allow scanning prohibited channels */
371#define WL_SCANFLAGS_OFFCHAN	0x08	/* allow scanning/reporting off-channel APs */
372#define WL_SCANFLAGS_HOTSPOT	0x10	/* automatic ANQP to hotspot APs */
373
374#define WL_SCAN_PARAMS_SSID_MAX 	10
375
376typedef struct wl_scan_params {
377	wlc_ssid_t ssid;		/* default: {0, ""} */
378	struct ether_addr bssid;	/* default: bcast */
379	int8 bss_type;			/* default: any,
380					 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
381					 */
382	uint8 scan_type;		/* flags, 0 use default */
383	int32 nprobes;			/* -1 use default, number of probes per channel */
384	int32 active_time;		/* -1 use default, dwell time per channel for
385					 * active scanning
386					 */
387	int32 passive_time;		/* -1 use default, dwell time per channel
388					 * for passive scanning
389					 */
390	int32 home_time;		/* -1 use default, dwell time for the home channel
391					 * between channel scans
392					 */
393	int32 channel_num;		/* count of channels and ssids that follow
394					 *
395					 * low half is count of channels in channel_list, 0
396					 * means default (use all available channels)
397					 *
398					 * high half is entries in wlc_ssid_t array that
399					 * follows channel_list, aligned for int32 (4 bytes)
400					 * meaning an odd channel count implies a 2-byte pad
401					 * between end of channel_list and first ssid
402					 *
403					 * if ssid count is zero, single ssid in the fixed
404					 * parameter portion is assumed, otherwise ssid in
405					 * the fixed portion is ignored
406					 */
407	uint16 channel_list[1];		/* list of chanspecs */
408} wl_scan_params_t;
409
410/* size of wl_scan_params not including variable length array */
411#define WL_SCAN_PARAMS_FIXED_SIZE 64
412
413/* masks for channel and ssid count */
414#define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff
415#define WL_SCAN_PARAMS_NSSID_SHIFT 16
416
417#define WL_SCAN_ACTION_START      1
418#define WL_SCAN_ACTION_CONTINUE   2
419#define WL_SCAN_ACTION_ABORT      3
420
421#define ISCAN_REQ_VERSION 1
422
423/* incremental scan struct */
424typedef struct wl_iscan_params {
425	uint32 version;
426	uint16 action;
427	uint16 scan_duration;
428	wl_scan_params_t params;
429} wl_iscan_params_t;
430
431/* 3 fields + size of wl_scan_params, not including variable length array */
432#define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
433#endif /* LINUX_POSTMOGRIFY_REMOVAL */
434
435typedef struct wl_scan_results {
436	uint32 buflen;
437	uint32 version;
438	uint32 count;
439	wl_bss_info_t bss_info[1];
440} wl_scan_results_t;
441
442#ifndef LINUX_POSTMOGRIFY_REMOVAL
443/* size of wl_scan_results not including variable length array */
444#define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
445
446/* wl_iscan_results status values */
447#define WL_SCAN_RESULTS_SUCCESS	0
448#define WL_SCAN_RESULTS_PARTIAL	1
449#define WL_SCAN_RESULTS_PENDING	2
450#define WL_SCAN_RESULTS_ABORTED	3
451#define WL_SCAN_RESULTS_NO_MEM  4
452
453/* Used in EXT_STA */
454#define DNGL_RXCTXT_SIZE	45
455
456#if defined(SIMPLE_ISCAN)
457#define ISCAN_RETRY_CNT   5
458#define ISCAN_STATE_IDLE   0
459#define ISCAN_STATE_SCANING 1
460#define ISCAN_STATE_PENDING 2
461
462/* the buf lengh can be WLC_IOCTL_MAXLEN (8K) to reduce iteration */
463#define WLC_IW_ISCAN_MAXLEN   2048
464typedef struct iscan_buf {
465	struct iscan_buf * next;
466	char   iscan_buf[WLC_IW_ISCAN_MAXLEN];
467} iscan_buf_t;
468#endif /* SIMPLE_ISCAN */
469
470#define ESCAN_REQ_VERSION 1
471
472typedef struct wl_escan_params {
473	uint32 version;
474	uint16 action;
475	uint16 sync_id;
476	wl_scan_params_t params;
477} wl_escan_params_t;
478
479#define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
480
481typedef struct wl_escan_result {
482	uint32 buflen;
483	uint32 version;
484	uint16 sync_id;
485	uint16 bss_count;
486	wl_bss_info_t bss_info[1];
487} wl_escan_result_t;
488
489#define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
490
491/* incremental scan results struct */
492typedef struct wl_iscan_results {
493	uint32 status;
494	wl_scan_results_t results;
495} wl_iscan_results_t;
496
497/* size of wl_iscan_results not including variable length array */
498#define WL_ISCAN_RESULTS_FIXED_SIZE \
499	(WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
500
501#define SCANOL_ENABLED			(1 << 0)
502#define SCANOL_BCAST_SSID		(1 << 1)
503#define SCANOL_NOTIFY_BCAST_SSID	(1 << 2)
504#define SCANOL_RESULTS_PER_CYCLE	(1 << 3)
505#define SCANOL_PARAMS_VERSION	1
506
507/* scan times in milliseconds */
508#define SCANOL_HOME_TIME		45	/* for home channel processing */
509#define SCANOL_ASSOC_TIME		20	/* dwell on a channel while associated */
510#define SCANOL_UNASSOC_TIME		40	/* dwell on a channel while unassociated */
511#define SCANOL_PASSIVE_TIME		110	/* listen on a channelfor passive scan */
512#define SCANOL_AWAY_LIMIT		100	/* max time to be away from home channel */
513#define SCANOL_IDLE_REST_TIME		40
514#define SCANOL_IDLE_REST_MULTIPLIER	0
515#define SCANOL_ACTIVE_REST_TIME		20
516#define SCANOL_ACTIVE_REST_MULTIPLIER	0
517#define SCANOL_CYCLE_IDLE_REST_TIME	300000	/* Idle Rest Time between Scan Cycle (msec) */
518#define SCANOL_CYCLE_IDLE_REST_MULTIPLIER	0	/* Idle Rest Time Multiplier */
519#define SCANOL_CYCLE_ACTIVE_REST_TIME	200
520#define SCANOL_CYCLE_ACTIVE_REST_MULTIPLIER	0
521#define SCANOL_MAX_REST_TIME		3600000	/* max rest time between scan cycle (msec) */
522#define SCANOL_CYCLE_DEFAULT		0	/* default for Max Scan Cycle, 0 = forever */
523#define SCANOL_CYCLE_MAX		864000	/* Max Scan Cycle */
524						/* 10 sec/scan cycle => 100 days */
525#define SCANOL_NPROBES			2	/* for Active scan; send n probes on each channel */
526#define SCANOL_NPROBES_MAX		5	/* for Active scan; send n probes on each channel */
527#define SCANOL_SCAN_START_DLY		10	/* delay start of offload scan (sec) */
528#define SCANOL_SCAN_START_DLY_MAX	240	/* delay start of offload scan (sec) */
529#define SCANOL_MULTIPLIER_MAX		10	/* Max Multiplier */
530#define SCANOL_UNASSOC_TIME_MAX		100	/* max dwell on a channel while unassociated */
531#define SCANOL_PASSIVE_TIME_MAX		500	/* max listen on a channel for passive scan */
532#define SCANOL_SSID_MAX			16	/* max supported preferred SSID */
533
534typedef struct scanol_params {
535	uint32 version;
536	uint32 flags;	/* offload scanning flags */
537	int32 active_time;	/* -1 use default, dwell time per channel for active scanning */
538	int32 passive_time;	/* -1 use default, dwell time per channel for passive scanning */
539	int32 idle_rest_time;	/* -1 use default, time idle between scan cycle */
540	int32 idle_rest_time_multiplier;
541	int32 active_rest_time;
542	int32 active_rest_time_multiplier;
543	int32 scan_cycle_idle_rest_time;
544	int32 scan_cycle_idle_rest_multiplier;
545	int32 scan_cycle_active_rest_time;
546	int32 scan_cycle_active_rest_multiplier;
547	int32 max_rest_time;
548	int32 max_scan_cycles;
549	int32 nprobes;		/* -1 use default, number of probes per channel */
550	int32 scan_start_delay;
551	uint32 nchannels;
552	uint32 ssid_count;
553	wlc_ssid_t ssidlist[1];
554} scanol_params_t;
555
556typedef struct wl_probe_params {
557	wlc_ssid_t ssid;
558	struct ether_addr bssid;
559	struct ether_addr mac;
560} wl_probe_params_t;
561#endif /* LINUX_POSTMOGRIFY_REMOVAL */
562
563#define WL_MAXRATES_IN_SET		16	/* max # of rates in a rateset */
564typedef struct wl_rateset {
565	uint32	count;			/* # rates in this set */
566	uint8	rates[WL_MAXRATES_IN_SET];	/* rates in 500kbps units w/hi bit set if basic */
567	uint8	htphy_membership;	/* HT PHY Membership */
568	uint8	mcs[MCSSET_LEN];	/* supported mcs index bit map */
569	uint16  vht_mcsmap;		/* supported vht mcs nss bit map */
570} wl_rateset_t;
571
572typedef struct wl_rateset_args {
573	uint32	count;			/* # rates in this set */
574	uint8	rates[WL_MAXRATES_IN_SET];	/* rates in 500kbps units w/hi bit set if basic */
575	uint8   mcs[MCSSET_LEN];        /* supported mcs index bit map */
576	uint16 vht_mcs[VHT_CAP_MCS_MAP_NSS_MAX]; /* supported mcs index bit map per nss */
577} wl_rateset_args_t;
578
579#define TXBF_RATE_MCS_ALL		4
580#define TXBF_RATE_VHT_ALL		4
581#define TXBF_RATE_OFDM_ALL		8
582
583typedef struct wl_txbf_rateset {
584	uint8	txbf_rate_mcs[TXBF_RATE_MCS_ALL];	/* one for each stream */
585	uint8	txbf_rate_mcs_bcm[TXBF_RATE_MCS_ALL];	/* one for each stream */
586	uint16	txbf_rate_vht[TXBF_RATE_VHT_ALL];	/* one for each stream */
587	uint16	txbf_rate_vht_bcm[TXBF_RATE_VHT_ALL];	/* one for each stream */
588	uint8	txbf_rate_ofdm[TXBF_RATE_OFDM_ALL];	/* bitmap of ofdm rates that enables txbf */
589	uint8	txbf_rate_ofdm_bcm[TXBF_RATE_OFDM_ALL]; /* bitmap of ofdm rates that enables txbf */
590	uint8	txbf_rate_ofdm_cnt;
591	uint8	txbf_rate_ofdm_cnt_bcm;
592} wl_txbf_rateset_t;
593
594#define OFDM_RATE_MASK			0x0000007f
595typedef uint8 ofdm_rates_t;
596
597/* uint32 list */
598typedef struct wl_uint32_list {
599	/* in - # of elements, out - # of entries */
600	uint32 count;
601	/* variable length uint32 list */
602	uint32 element[1];
603} wl_uint32_list_t;
604
605/* used for association with a specific BSSID and chanspec list */
606typedef struct wl_assoc_params {
607	struct ether_addr bssid;	/* 00:00:00:00:00:00: broadcast scan */
608	uint16 bssid_cnt;               /* 0: just use chanspec_num,
609					* otherwise count of chanspecs in chanspec_list
610					* AND paired bssids following chanspec_list
611					*/
612	int32 chanspec_num;		/* 0: all available channels,
613					* otherwise count of chanspecs in chanspec_list
614					*/
615	chanspec_t chanspec_list[1];	/* list of chanspecs */
616} wl_assoc_params_t;
617#define WL_ASSOC_PARAMS_FIXED_SIZE 	OFFSETOF(wl_assoc_params_t, chanspec_list)
618
619/* used for reassociation/roam to a specific BSSID and channel */
620typedef wl_assoc_params_t wl_reassoc_params_t;
621#define WL_REASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
622
623/* used for association to a specific BSSID and channel */
624typedef wl_assoc_params_t wl_join_assoc_params_t;
625#define WL_JOIN_ASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
626
627/* used for join with or without a specific bssid and channel list */
628typedef struct wl_join_params {
629	wlc_ssid_t ssid;
630	wl_assoc_params_t params;	/* optional field, but it must include the fixed portion
631					 * of the wl_assoc_params_t struct when it does present.
632					 */
633} wl_join_params_t;
634
635#ifndef  LINUX_POSTMOGRIFY_REMOVAL
636#define WL_JOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_join_params_t, params) + \
637					 WL_ASSOC_PARAMS_FIXED_SIZE)
638/* scan params for extended join */
639typedef struct wl_join_scan_params {
640	uint8 scan_type;		/* 0 use default, active or passive scan */
641	int32 nprobes;			/* -1 use default, number of probes per channel */
642	int32 active_time;		/* -1 use default, dwell time per channel for
643					 * active scanning
644					 */
645	int32 passive_time;		/* -1 use default, dwell time per channel
646					 * for passive scanning
647					 */
648	int32 home_time;		/* -1 use default, dwell time for the home channel
649					 * between channel scans
650					 */
651} wl_join_scan_params_t;
652
653/* extended join params */
654typedef struct wl_extjoin_params {
655	wlc_ssid_t ssid;		/* {0, ""}: wildcard scan */
656	wl_join_scan_params_t scan;
657	wl_join_assoc_params_t assoc;	/* optional field, but it must include the fixed portion
658					 * of the wl_join_assoc_params_t struct when it does
659					 * present.
660					 */
661} wl_extjoin_params_t;
662#define WL_EXTJOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_extjoin_params_t, assoc) + \
663					 WL_JOIN_ASSOC_PARAMS_FIXED_SIZE)
664
665/* All builds use the new 11ac ratespec/chanspec */
666#undef  D11AC_IOTYPES
667#define D11AC_IOTYPES
668
669#ifndef D11AC_IOTYPES
670
671/* defines used by the nrate iovar */
672#define NRATE_MCS_INUSE	0x00000080	/* MSC in use,indicates b0-6 holds an mcs */
673#define NRATE_RATE_MASK 0x0000007f	/* rate/mcs value */
674#define NRATE_STF_MASK	0x0000ff00	/* stf mode mask: siso, cdd, stbc, sdm */
675#define NRATE_STF_SHIFT	8			/* stf mode shift */
676#define NRATE_OVERRIDE	0x80000000	/* bit indicates override both rate & mode */
677#define NRATE_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicate to override mcs only */
678#define NRATE_SGI_MASK  0x00800000      /* sgi mode */
679#define NRATE_SGI_SHIFT 23              /* sgi mode */
680#define NRATE_LDPC_CODING 0x00400000    /* bit indicates adv coding in use */
681#define NRATE_LDPC_SHIFT 22             /* ldpc shift */
682
683#define NRATE_STF_SISO	0		/* stf mode SISO */
684#define NRATE_STF_CDD	1		/* stf mode CDD */
685#define NRATE_STF_STBC	2		/* stf mode STBC */
686#define NRATE_STF_SDM	3		/* stf mode SDM */
687
688#else /* D11AC_IOTYPES */
689
690/* WL_RSPEC defines for rate information */
691#define WL_RSPEC_RATE_MASK      0x000000FF      /* rate or HT MCS value */
692#define WL_RSPEC_VHT_MCS_MASK   0x0000000F      /* VHT MCS value */
693#define WL_RSPEC_VHT_NSS_MASK   0x000000F0      /* VHT Nss value */
694#define WL_RSPEC_VHT_NSS_SHIFT  4               /* VHT Nss value shift */
695#define WL_RSPEC_TXEXP_MASK     0x00000300
696#define WL_RSPEC_TXEXP_SHIFT    8
697#define WL_RSPEC_BW_MASK        0x00070000      /* bandwidth mask */
698#define WL_RSPEC_BW_SHIFT       16              /* bandwidth shift */
699#define WL_RSPEC_STBC           0x00100000      /* STBC encoding, Nsts = 2 x Nss */
700#define WL_RSPEC_TXBF           0x00200000      /* bit indicates TXBF mode */
701#define WL_RSPEC_LDPC           0x00400000      /* bit indicates adv coding in use */
702#define WL_RSPEC_SGI            0x00800000      /* Short GI mode */
703#define WL_RSPEC_ENCODING_MASK  0x03000000      /* Encoding of Rate/MCS field */
704#define WL_RSPEC_OVERRIDE_RATE  0x40000000      /* bit indicate to override mcs only */
705#define WL_RSPEC_OVERRIDE_MODE  0x80000000      /* bit indicates override both rate & mode */
706
707/* WL_RSPEC_ENCODING field defs */
708#define WL_RSPEC_ENCODE_RATE    0x00000000      /* Legacy rate is stored in RSPEC_RATE_MASK */
709#define WL_RSPEC_ENCODE_HT      0x01000000      /* HT MCS is stored in RSPEC_RATE_MASK */
710#define WL_RSPEC_ENCODE_VHT     0x02000000      /* VHT MCS and Nss is stored in RSPEC_RATE_MASK */
711
712/* WL_RSPEC_BW field defs */
713#define WL_RSPEC_BW_UNSPECIFIED 0
714#define WL_RSPEC_BW_20MHZ       0x00010000
715#define WL_RSPEC_BW_40MHZ       0x00020000
716#define WL_RSPEC_BW_80MHZ       0x00030000
717#define WL_RSPEC_BW_160MHZ      0x00040000
718
719/* Legacy defines for the nrate iovar */
720#define OLD_NRATE_MCS_INUSE         0x00000080 /* MSC in use,indicates b0-6 holds an mcs */
721#define OLD_NRATE_RATE_MASK         0x0000007f /* rate/mcs value */
722#define OLD_NRATE_STF_MASK          0x0000ff00 /* stf mode mask: siso, cdd, stbc, sdm */
723#define OLD_NRATE_STF_SHIFT         8          /* stf mode shift */
724#define OLD_NRATE_OVERRIDE          0x80000000 /* bit indicates override both rate & mode */
725#define OLD_NRATE_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicate to override mcs only */
726#define OLD_NRATE_SGI               0x00800000 /* sgi mode */
727#define OLD_NRATE_LDPC_CODING       0x00400000 /* bit indicates adv coding in use */
728
729#define OLD_NRATE_STF_SISO	0		/* stf mode SISO */
730#define OLD_NRATE_STF_CDD	1		/* stf mode CDD */
731#define OLD_NRATE_STF_STBC	2		/* stf mode STBC */
732#define OLD_NRATE_STF_SDM	3		/* stf mode SDM */
733
734#endif /* D11AC_IOTYPES */
735
736#define ANTENNA_NUM_1	1		/* total number of antennas to be used */
737#define ANTENNA_NUM_2	2
738#define ANTENNA_NUM_3	3
739#define ANTENNA_NUM_4	4
740
741#define ANT_SELCFG_AUTO		0x80	/* bit indicates antenna sel AUTO */
742#define ANT_SELCFG_MASK		0x33	/* antenna configuration mask */
743#define ANT_SELCFG_MAX		4	/* max number of antenna configurations */
744#define ANT_SELCFG_TX_UNICAST	0	/* unicast tx antenna configuration */
745#define ANT_SELCFG_RX_UNICAST	1	/* unicast rx antenna configuration */
746#define ANT_SELCFG_TX_DEF	2	/* default tx antenna configuration */
747#define ANT_SELCFG_RX_DEF	3	/* default rx antenna configuration */
748
749#define MAX_STREAMS_SUPPORTED	4	/* max number of streams supported */
750
751typedef struct {
752	uint8 ant_config[ANT_SELCFG_MAX];	/* antenna configuration */
753	uint8 num_antcfg;	/* number of available antenna configurations */
754} wlc_antselcfg_t;
755
756#define HIGHEST_SINGLE_STREAM_MCS	7 /* MCS values greater than this enable multiple streams */
757
758#define MAX_CCA_CHANNELS 38	/* Max number of 20 Mhz wide channels */
759#define MAX_CCA_SECS     60	/* CCA keeps this many seconds history */
760
761#define IBSS_MED        15	/* Mediom in-bss congestion percentage */
762#define IBSS_HI         25	/* Hi in-bss congestion percentage */
763#define OBSS_MED        12
764#define OBSS_HI         25
765#define INTERFER_MED    5
766#define INTERFER_HI     10
767
768#define  CCA_FLAG_2G_ONLY		0x01	/* Return a channel from 2.4 Ghz band */
769#define  CCA_FLAG_5G_ONLY		0x02	/* Return a channel from 2.4 Ghz band */
770#define  CCA_FLAG_IGNORE_DURATION	0x04	/* Ignore dwell time for each channel */
771#define  CCA_FLAGS_PREFER_1_6_11	0x10
772#define  CCA_FLAG_IGNORE_INTERFER 	0x20 /* do not exlude channel based on interfer level */
773
774#define CCA_ERRNO_BAND 		1	/* After filtering for band pref, no choices left */
775#define CCA_ERRNO_DURATION	2	/* After filtering for duration, no choices left */
776#define CCA_ERRNO_PREF_CHAN	3	/* After filtering for chan pref, no choices left */
777#define CCA_ERRNO_INTERFER	4	/* After filtering for interference, no choices left */
778#define CCA_ERRNO_TOO_FEW	5	/* Only 1 channel was input */
779
780typedef struct {
781	uint32 duration;	/* millisecs spent sampling this channel */
782	uint32 congest_ibss;	/* millisecs in our bss (presumably this traffic will */
783				/*  move if cur bss moves channels) */
784	uint32 congest_obss;	/* traffic not in our bss */
785	uint32 interference;	/* millisecs detecting a non 802.11 interferer. */
786	uint32 timestamp;	/* second timestamp */
787} cca_congest_t;
788
789typedef struct {
790	chanspec_t chanspec;	/* Which channel? */
791	uint8 num_secs;		/* How many secs worth of data */
792	cca_congest_t  secs[1];	/* Data */
793} cca_congest_channel_req_t;
794
795/* interference source detection and identification mode */
796#define ITFR_MODE_DISABLE	0	/* disable feature */
797#define ITFR_MODE_MANUAL_ENABLE	1	/* enable manual detection */
798#define ITFR_MODE_AUTO_ENABLE	2	/* enable auto detection */
799
800/* interference sources */
801enum interference_source {
802	ITFR_NONE = 0,		/* interference */
803	ITFR_PHONE,		/* wireless phone */
804	ITFR_VIDEO_CAMERA,	/* wireless video camera */
805	ITFR_MICROWAVE_OVEN,	/* microwave oven */
806	ITFR_BABY_MONITOR,	/* wireless baby monitor */
807	ITFR_BLUETOOTH,		/* bluetooth */
808	ITFR_VIDEO_CAMERA_OR_BABY_MONITOR,	/* wireless camera or baby monitor */
809	ITFR_BLUETOOTH_OR_BABY_MONITOR,	/* bluetooth or baby monitor */
810	ITFR_VIDEO_CAMERA_OR_PHONE,	/* video camera or phone */
811	ITFR_UNIDENTIFIED	/* interference from unidentified source */
812};
813
814/* structure for interference source report */
815typedef struct {
816	uint32 flags;	/* flags.  bit definitions below */
817	uint32 source;	/* last detected interference source */
818	uint32 timestamp;	/* second timestamp on interferenced flag change */
819} interference_source_rep_t;
820
821/* bit definitions for flags in interference source report */
822#define ITFR_INTERFERENCED	1	/* interference detected */
823#define ITFR_HOME_CHANNEL	2	/* home channel has interference */
824#define ITFR_NOISY_ENVIRONMENT	4	/* noisy environemnt so feature stopped */
825
826#endif /* LINUX_POSTMOGRIFY_REMOVAL */
827
828#define WLC_CNTRY_BUF_SZ	4		/* Country string is 3 bytes + NUL */
829
830#ifndef LINUX_POSTMOGRIFY_REMOVAL
831
832typedef struct wl_country {
833	char country_abbrev[WLC_CNTRY_BUF_SZ];	/* nul-terminated country code used in
834						 * the Country IE
835						 */
836	int32 rev;				/* revision specifier for ccode
837						 * on set, -1 indicates unspecified.
838						 * on get, rev >= 0
839						 */
840	char ccode[WLC_CNTRY_BUF_SZ];		/* nul-terminated built-in country code.
841						 * variable length, but fixed size in
842						 * struct allows simple allocation for
843						 * expected country strings <= 3 chars.
844						 */
845} wl_country_t;
846
847typedef struct wl_channels_in_country {
848	uint32 buflen;
849	uint32 band;
850	char country_abbrev[WLC_CNTRY_BUF_SZ];
851	uint32 count;
852	uint32 channel[1];
853} wl_channels_in_country_t;
854
855typedef struct wl_country_list {
856	uint32 buflen;
857	uint32 band_set;
858	uint32 band;
859	uint32 count;
860	char country_abbrev[1];
861} wl_country_list_t;
862
863#define WL_NUM_RPI_BINS		8
864#define WL_RM_TYPE_BASIC	1
865#define WL_RM_TYPE_CCA		2
866#define WL_RM_TYPE_RPI		3
867
868#define WL_RM_FLAG_PARALLEL	(1<<0)
869
870#define WL_RM_FLAG_LATE		(1<<1)
871#define WL_RM_FLAG_INCAPABLE	(1<<2)
872#define WL_RM_FLAG_REFUSED	(1<<3)
873
874typedef struct wl_rm_req_elt {
875	int8	type;
876	int8	flags;
877	chanspec_t	chanspec;
878	uint32	token;		/* token for this measurement */
879	uint32	tsf_h;		/* TSF high 32-bits of Measurement start time */
880	uint32	tsf_l;		/* TSF low 32-bits */
881	uint32	dur;		/* TUs */
882} wl_rm_req_elt_t;
883
884typedef struct wl_rm_req {
885	uint32	token;		/* overall measurement set token */
886	uint32	count;		/* number of measurement requests */
887	void	*cb;		/* completion callback function: may be NULL */
888	void	*cb_arg;	/* arg to completion callback function */
889	wl_rm_req_elt_t	req[1];	/* variable length block of requests */
890} wl_rm_req_t;
891#define WL_RM_REQ_FIXED_LEN	OFFSETOF(wl_rm_req_t, req)
892
893typedef struct wl_rm_rep_elt {
894	int8	type;
895	int8	flags;
896	chanspec_t	chanspec;
897	uint32	token;		/* token for this measurement */
898	uint32	tsf_h;		/* TSF high 32-bits of Measurement start time */
899	uint32	tsf_l;		/* TSF low 32-bits */
900	uint32	dur;		/* TUs */
901	uint32	len;		/* byte length of data block */
902	uint8	data[1];	/* variable length data block */
903} wl_rm_rep_elt_t;
904#define WL_RM_REP_ELT_FIXED_LEN	24	/* length excluding data block */
905
906#define WL_RPI_REP_BIN_NUM 8
907typedef struct wl_rm_rpi_rep {
908	uint8	rpi[WL_RPI_REP_BIN_NUM];
909	int8	rpi_max[WL_RPI_REP_BIN_NUM];
910} wl_rm_rpi_rep_t;
911
912typedef struct wl_rm_rep {
913	uint32	token;		/* overall measurement set token */
914	uint32	len;		/* length of measurement report block */
915	wl_rm_rep_elt_t	rep[1];	/* variable length block of reports */
916} wl_rm_rep_t;
917#define WL_RM_REP_FIXED_LEN	8
918
919
920#if defined(BCMSUP_PSK)
921typedef enum sup_auth_status {
922	/* Basic supplicant authentication states */
923	WLC_SUP_DISCONNECTED = 0,
924	WLC_SUP_CONNECTING,
925	WLC_SUP_IDREQUIRED,
926	WLC_SUP_AUTHENTICATING,
927	WLC_SUP_AUTHENTICATED,
928	WLC_SUP_KEYXCHANGE,
929	WLC_SUP_KEYED,
930	WLC_SUP_TIMEOUT,
931	WLC_SUP_LAST_BASIC_STATE,
932
933	/* Extended supplicant authentication states */
934	/* Waiting to receive handshake msg M1 */
935	WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
936	/* Preparing to send handshake msg M2 */
937	WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
938	/* Waiting to receive handshake msg M3 */
939	WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
940	WLC_SUP_KEYXCHANGE_PREP_M4,	/* Preparing to send handshake msg M4 */
941	WLC_SUP_KEYXCHANGE_WAIT_G1,	/* Waiting to receive handshake msg G1 */
942	WLC_SUP_KEYXCHANGE_PREP_G2	/* Preparing to send handshake msg G2 */
943} sup_auth_status_t;
944#endif
945#endif /* LINUX_POSTMOGRIFY_REMOVAL */
946
947/* Enumerate crypto algorithms */
948#define	CRYPTO_ALGO_OFF			0
949#define	CRYPTO_ALGO_WEP1		1
950#define	CRYPTO_ALGO_TKIP		2
951#define	CRYPTO_ALGO_WEP128		3
952#define CRYPTO_ALGO_AES_CCM		4
953#define CRYPTO_ALGO_AES_OCB_MSDU	5
954#define CRYPTO_ALGO_AES_OCB_MPDU	6
955#define CRYPTO_ALGO_NALG		7
956#define CRYPTO_ALGO_PMK			12	/* for 802.1x supp to set PMK before 4-way */
957#define CRYPTO_ALGO_BIP			13  /* 802.11w BIP (aes cmac) */
958
959#define WSEC_GEN_MIC_ERROR	0x0001
960#define WSEC_GEN_REPLAY		0x0002
961#define WSEC_GEN_ICV_ERROR	0x0004
962#define WSEC_GEN_MFP_ACT_ERROR	0x0008
963#define WSEC_GEN_MFP_DISASSOC_ERROR	0x0010
964#define WSEC_GEN_MFP_DEAUTH_ERROR	0x0020
965
966#define WL_SOFT_KEY	(1 << 0)	/* Indicates this key is using soft encrypt */
967#define WL_PRIMARY_KEY	(1 << 1)	/* Indicates this key is the primary (ie tx) key */
968#define WL_KF_RES_4	(1 << 4)	/* Reserved for backward compat */
969#define WL_KF_RES_5	(1 << 5)	/* Reserved for backward compat */
970#define WL_IBSS_PEER_GROUP_KEY	(1 << 6)	/* Indicates a group key for a IBSS PEER */
971
972typedef struct wl_wsec_key {
973	uint32		index;		/* key index */
974	uint32		len;		/* key length */
975	uint8		data[DOT11_MAX_KEY_SIZE];	/* key data */
976	uint32		pad_1[18];
977	uint32		algo;		/* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
978	uint32		flags;		/* misc flags */
979	uint32		pad_2[2];
980	int		pad_3;
981	int		iv_initialized;	/* has IV been initialized already? */
982	int		pad_4;
983	/* Rx IV */
984	struct {
985		uint32	hi;		/* upper 32 bits of IV */
986		uint16	lo;		/* lower 16 bits of IV */
987	} rxiv;
988	uint32		pad_5[2];
989	struct ether_addr ea;		/* per station */
990} wl_wsec_key_t;
991
992#define WSEC_MIN_PSK_LEN	8
993#define WSEC_MAX_PSK_LEN	64
994
995/* Flag for key material needing passhash'ing */
996#define WSEC_PASSPHRASE		(1<<0)
997
998/* receptacle for WLC_SET_WSEC_PMK parameter */
999typedef struct {
1000	ushort	key_len;		/* octets in key material */
1001	ushort	flags;			/* key handling qualification */
1002	uint8	key[WSEC_MAX_PSK_LEN];	/* PMK material */
1003} wsec_pmk_t;
1004
1005/* wireless security bitvec */
1006#define WEP_ENABLED		0x0001
1007#define TKIP_ENABLED		0x0002
1008#define AES_ENABLED		0x0004
1009#define WSEC_SWFLAG		0x0008
1010#define SES_OW_ENABLED		0x0040	/* to go into transition mode without setting wep */
1011
1012/* wsec macros for operating on the above definitions */
1013#define WSEC_WEP_ENABLED(wsec)	((wsec) & WEP_ENABLED)
1014#define WSEC_TKIP_ENABLED(wsec)	((wsec) & TKIP_ENABLED)
1015#define WSEC_AES_ENABLED(wsec)	((wsec) & AES_ENABLED)
1016
1017#define WSEC_ENABLED(wsec)	((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
1018#define WSEC_SES_OW_ENABLED(wsec)	((wsec) & SES_OW_ENABLED)
1019
1020#define MFP_CAPABLE		0x0200
1021#define MFP_REQUIRED	0x0400
1022#define MFP_SHA256		0x0800 /* a special configuration for STA for WIFI test tool */
1023
1024/* WPA authentication mode bitvec */
1025#define WPA_AUTH_DISABLED	0x0000	/* Legacy (i.e., non-WPA) */
1026#define WPA_AUTH_NONE		0x0001	/* none (IBSS) */
1027#define WPA_AUTH_UNSPECIFIED	0x0002	/* over 802.1x */
1028#define WPA_AUTH_PSK		0x0004	/* Pre-shared key */
1029/* #define WPA_AUTH_8021X 0x0020 */	/* 802.1x, reserved */
1030#define WPA2_AUTH_UNSPECIFIED	0x0040	/* over 802.1x */
1031#define WPA2_AUTH_PSK		0x0080	/* Pre-shared key */
1032#define BRCM_AUTH_PSK           0x0100  /* BRCM specific PSK */
1033#define BRCM_AUTH_DPT		0x0200	/* DPT PSK without group keys */
1034#define WPA2_AUTH_MFP           0x1000  /* MFP (11w) in contrast to CCX */
1035#define WPA2_AUTH_TPK		0x2000 	/* TDLS Peer Key */
1036#define WPA2_AUTH_FT		0x4000 	/* Fast Transition. */
1037#define WPA_AUTH_PFN_ANY	0xffffffff	/* for PFN, match only ssid */
1038
1039/* pmkid */
1040#define	MAXPMKID		16
1041
1042typedef struct _pmkid {
1043	struct ether_addr	BSSID;
1044	uint8			PMKID[WPA2_PMKID_LEN];
1045} pmkid_t;
1046
1047typedef struct _pmkid_list {
1048	uint32	npmkid;
1049	pmkid_t	pmkid[1];
1050} pmkid_list_t;
1051
1052typedef struct _pmkid_cand {
1053	struct ether_addr	BSSID;
1054	uint8			preauth;
1055} pmkid_cand_t;
1056
1057typedef struct _pmkid_cand_list {
1058	uint32	npmkid_cand;
1059	pmkid_cand_t	pmkid_cand[1];
1060} pmkid_cand_list_t;
1061
1062#ifndef LINUX_POSTMOGRIFY_REMOVAL
1063typedef struct wl_assoc_info {
1064	uint32		req_len;
1065	uint32		resp_len;
1066	uint32		flags;
1067	struct dot11_assoc_req req;
1068	struct ether_addr reassoc_bssid; /* used in reassoc's */
1069	struct dot11_assoc_resp resp;
1070} wl_assoc_info_t;
1071
1072/* flags */
1073#define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */
1074
1075typedef struct wl_led_info {
1076	uint32      index;      /* led index */
1077	uint32      behavior;
1078	uint8       activehi;
1079} wl_led_info_t;
1080
1081
1082/* srom read/write struct passed through ioctl */
1083typedef struct {
1084	uint	byteoff;	/* byte offset */
1085	uint	nbytes;		/* number of bytes */
1086	uint16	buf[1];
1087} srom_rw_t;
1088
1089/* similar cis (srom or otp) struct [iovar: may not be aligned] */
1090typedef struct {
1091	uint32	source;		/* cis source */
1092	uint32	byteoff;	/* byte offset */
1093	uint32	nbytes;		/* number of bytes */
1094	/* data follows here */
1095} cis_rw_t;
1096
1097#define WLC_CIS_DEFAULT	0	/* built-in default */
1098#define WLC_CIS_SROM	1	/* source is sprom */
1099#define WLC_CIS_OTP	2	/* source is otp */
1100
1101/* R_REG and W_REG struct passed through ioctl */
1102typedef struct {
1103	uint32	byteoff;	/* byte offset of the field in d11regs_t */
1104	uint32	val;		/* read/write value of the field */
1105	uint32	size;		/* sizeof the field */
1106	uint	band;		/* band (optional) */
1107} rw_reg_t;
1108
1109/* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */
1110/* PCL - Power Control Loop */
1111/* current gain setting is replaced by user input */
1112#define WL_ATTEN_APP_INPUT_PCL_OFF	0	/* turn off PCL, apply supplied input */
1113#define WL_ATTEN_PCL_ON			1	/* turn on PCL */
1114/* current gain setting is maintained */
1115#define WL_ATTEN_PCL_OFF		2	/* turn off PCL. */
1116
1117typedef struct {
1118	uint16	auto_ctrl;	/* WL_ATTEN_XX */
1119	uint16	bb;		/* Baseband attenuation */
1120	uint16	radio;		/* Radio attenuation */
1121	uint16	txctl1;		/* Radio TX_CTL1 value */
1122} atten_t;
1123
1124/* Per-AC retry parameters */
1125struct wme_tx_params_s {
1126	uint8  short_retry;
1127	uint8  short_fallback;
1128	uint8  long_retry;
1129	uint8  long_fallback;
1130	uint16 max_rate;  /* In units of 512 Kbps */
1131};
1132
1133typedef struct wme_tx_params_s wme_tx_params_t;
1134
1135#define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
1136
1137/* defines used by poweridx iovar - it controls power in a-band */
1138/* current gain setting is maintained */
1139#define WL_PWRIDX_PCL_OFF	-2	/* turn off PCL.  */
1140#define WL_PWRIDX_PCL_ON	-1	/* turn on PCL */
1141#define WL_PWRIDX_LOWER_LIMIT	-2	/* lower limit */
1142#define WL_PWRIDX_UPPER_LIMIT	63	/* upper limit */
1143/* value >= 0 causes
1144 *	- input to be set to that value
1145 *	- PCL to be off
1146 */
1147
1148/* Used to get specific link/ac parameters */
1149typedef struct {
1150	int ac;
1151	uint8 val;
1152	struct ether_addr ea;
1153} link_val_t;
1154
1155#define BCM_MAC_STATUS_INDICATION	(0x40010200L)
1156
1157
1158#define WL_STA_ANT_MAX		4		/* max possible rx antennas */
1159
1160typedef struct {
1161	uint16			ver;		/* version of this struct */
1162	uint16			len;		/* length in bytes of this structure */
1163	uint16			cap;		/* sta's advertised capabilities */
1164	uint32			flags;		/* flags defined below */
1165	uint32			idle;		/* time since data pkt rx'd from sta */
1166	struct ether_addr	ea;		/* Station address */
1167	wl_rateset_t		rateset;	/* rateset in use */
1168	uint32			in;		/* seconds elapsed since associated */
1169	uint32			listen_interval_inms; /* Min Listen interval in ms for this STA */
1170	uint32			tx_pkts;	/* # of packets transmitted */
1171	uint32			tx_failures;	/* # of packets failed */
1172	uint32			rx_ucast_pkts;	/* # of unicast packets received */
1173	uint32			rx_mcast_pkts;	/* # of multicast packets received */
1174	uint32			tx_rate;	/* Rate of last successful tx frame */
1175	uint32			rx_rate;	/* Rate of last successful rx frame */
1176	uint32			rx_decrypt_succeeds;	/* # of packet decrypted successfully */
1177	uint32			rx_decrypt_failures;	/* # of packet decrypted unsuccessfully */
1178	uint32			tx_tot_pkts;	/* # of tx pkts (ucast + mcast) */
1179	uint32 			rx_tot_pkts;	/* # of data packets recvd (uni + mcast) */
1180	uint32			tx_mcast_pkts;	/* # of mcast pkts txed */
1181	uint64			tx_tot_bytes;	/* data bytes txed (ucast + mcast) */
1182	uint64			rx_tot_bytes;	/* data bytes recvd (ucast + mcast) */
1183	uint64			tx_ucast_bytes;	/* data bytes txed (ucast) */
1184	uint64			tx_mcast_bytes;	/* # data bytes txed (mcast) */
1185	uint64			rx_ucast_bytes;	/* data bytes recvd (ucast) */
1186	uint64			rx_mcast_bytes;	/* data bytes recvd (mcast) */
1187	int8			rssi[WL_STA_ANT_MAX];	/* average rssi per antenna of data frames */
1188	int8			nf[WL_STA_ANT_MAX];	/* per antenna noise floor */
1189	uint16			aid;		/* association ID */
1190	uint16			ht_capabilities;	/* advertised ht caps */
1191	uint16			vht_flags;		/* converted vht flags */
1192	uint32			tx_pkts_retried;		/* # of frames where a retry was necessary */
1193	uint32			tx_pkts_retry_exhausted;/* # of frames where a retry was exhausted */
1194	int8			rx_lastpkt_rssi[WL_STA_ANT_MAX];/* Per antenna RSSI of last received data frame */
1195} sta_info_t;
1196
1197#define WL_OLD_STAINFO_SIZE	OFFSETOF(sta_info_t, tx_tot_pkts)
1198
1199#define WL_STA_VER		4
1200
1201#define WL_STA_AID(a)		((a) &~ 0xc000)
1202
1203/* Flags for sta_info_t indicating properties of STA */
1204#define WL_STA_BRCM		0x00000001	/* Running a Broadcom driver */
1205#define WL_STA_WME		0x00000002	/* WMM association */
1206#define WL_STA_NONERP		0x00000004	/* No ERP */
1207#define WL_STA_AUTHE		0x00000008	/* Authenticated */
1208#define WL_STA_ASSOC		0x00000010	/* Associated */
1209#define WL_STA_AUTHO		0x00000020	/* Authorized */
1210#define WL_STA_WDS		0x00000040	/* Wireless Distribution System */
1211#define WL_STA_WDS_LINKUP	0x00000080	/* WDS traffic/probes flowing properly */
1212#define WL_STA_PS		0x00000100	/* STA is in power save mode from AP's viewpoint */
1213#define WL_STA_APSD_BE		0x00000200	/* APSD delv/trigger for AC_BE is default enabled */
1214#define WL_STA_APSD_BK		0x00000400	/* APSD delv/trigger for AC_BK is default enabled */
1215#define WL_STA_APSD_VI		0x00000800	/* APSD delv/trigger for AC_VI is default enabled */
1216#define WL_STA_APSD_VO		0x00001000	/* APSD delv/trigger for AC_VO is default enabled */
1217#define WL_STA_N_CAP		0x00002000	/* STA 802.11n capable */
1218#define WL_STA_SCBSTATS		0x00004000	/* Per STA debug stats */
1219#define WL_STA_AMPDU_CAP	0x00008000	/* STA AMPDU capable */
1220#define WL_STA_AMSDU_CAP	0x00010000	/* STA AMSDU capable */
1221#define WL_STA_MIMO_PS		0x00020000	/* mimo ps mode is enabled */
1222#define WL_STA_MIMO_RTS		0x00040000	/* send rts in mimo ps mode */
1223#define WL_STA_RIFS_CAP		0x00080000	/* rifs enabled */
1224#define WL_STA_VHT_CAP		0x00100000	/* STA VHT(11ac) capable */
1225#define WL_STA_DWDS			0x08000000
1226#ifdef NTGR_VNDR_IE
1227#define WL_STA_NTGR_SMESH	0x04000000
1228#endif
1229#define WL_STA_BW_20MHZ		0x10000000
1230#define WL_STA_BW_40MHZ		0x20000000
1231#define WL_STA_BW_80MHZ		0x40000000
1232#define WL_STA_BW_160MHZ	0x80000000
1233
1234#define WL_WDS_LINKUP		WL_STA_WDS_LINKUP	/* deprecated */
1235#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1236
1237#define	WLC_NUMRATES	16	/* max # of rates in a rateset */
1238
1239typedef struct wlc_rateset {
1240	uint	count;			/* number of rates in rates[] */
1241	uint8	rates[WLC_NUMRATES];	/* rates in 500kbps units w/hi bit set if basic */
1242	uint8	htphy_membership;	/* HT PHY Membership */
1243	uint8	mcs[MCSSET_LEN];	/* supported mcs index bit map */
1244	uint16  vht_mcsmap;		/* supported vht mcs nss bit map */
1245} wlc_rateset_t;
1246
1247#ifndef LINUX_POSTMOGRIFY_REMOVAL
1248/* STA HT cap fields */
1249#define WL_STA_CAP_LDPC_CODING		0x0001	/* Support for rx of LDPC coded pkts */
1250#define WL_STA_CAP_40MHZ		0x0002  /* FALSE:20Mhz, TRUE:20/40MHZ supported */
1251#define WL_STA_CAP_MIMO_PS_MASK		0x000C  /* Mimo PS mask */
1252#define WL_STA_CAP_MIMO_PS_SHIFT	0x0002	/* Mimo PS shift */
1253#define WL_STA_CAP_MIMO_PS_OFF		0x0003	/* Mimo PS, no restriction */
1254#define WL_STA_CAP_MIMO_PS_RTS		0x0001	/* Mimo PS, send RTS/CTS around MIMO frames */
1255#define WL_STA_CAP_MIMO_PS_ON		0x0000	/* Mimo PS, MIMO disallowed */
1256#define WL_STA_CAP_GF			0x0010	/* Greenfield preamble support */
1257#define WL_STA_CAP_SHORT_GI_20		0x0020	/* 20MHZ short guard interval support */
1258#define WL_STA_CAP_SHORT_GI_40		0x0040	/* 40Mhz short guard interval support */
1259#define WL_STA_CAP_TX_STBC		0x0080	/* Tx STBC support */
1260#define WL_STA_CAP_RX_STBC_MASK		0x0300	/* Rx STBC mask */
1261#define WL_STA_CAP_RX_STBC_SHIFT	8	/* Rx STBC shift */
1262#define WL_STA_CAP_DELAYED_BA		0x0400	/* delayed BA support */
1263#define WL_STA_CAP_MAX_AMSDU		0x0800	/* Max AMSDU size in bytes , 0=3839, 1=7935 */
1264#define WL_STA_CAP_DSSS_CCK		0x1000	/* DSSS/CCK supported by the BSS */
1265#define WL_STA_CAP_PSMP			0x2000	/* Power Save Multi Poll support */
1266#define WL_STA_CAP_40MHZ_INTOLERANT 	0x4000	/* 40MHz Intolerant */
1267#define WL_STA_CAP_LSIG_TXOP		0x8000	/* L-SIG TXOP protection support */
1268
1269#define WL_STA_CAP_RX_STBC_NO		0x0	/* no rx STBC support */
1270#define WL_STA_CAP_RX_STBC_ONE_STREAM	0x1	/* rx STBC support of 1 spatial stream */
1271#define WL_STA_CAP_RX_STBC_TWO_STREAM	0x2	/* rx STBC support of 1-2 spatial streams */
1272#define WL_STA_CAP_RX_STBC_THREE_STREAM	0x3	/* rx STBC support of 1-3 spatial streams */
1273
1274/* scb vht flags */
1275#define WL_STA_VHT_LDPCCAP	0x0001
1276#define WL_STA_SGI80       	0x0002
1277#define WL_STA_SGI160		0x0004
1278#define WL_STA_VHT_TX_STBCCAP	0x0008
1279#define WL_STA_VHT_RX_STBCCAP	0x0010
1280#define WL_STA_SU_BEAMFORMER	0x0020
1281#define WL_STA_SU_BEAMFORMEE	0x0040
1282#define WL_STA_MU_BEAMFORMER	0x0080
1283#define WL_STA_MU_BEAMFORMEE	0x0100
1284#define WL_STA_VHT_TXOP_PS	0x0200
1285#define WL_STA_HTC_VHT_CAP	0x0400
1286
1287/* Values for TX Filter override mode */
1288#define WLC_TXFILTER_OVERRIDE_DISABLED  0
1289#define WLC_TXFILTER_OVERRIDE_ENABLED   1
1290
1291#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1292
1293/* Used to get specific STA parameters */
1294typedef struct {
1295	uint32	val;
1296	struct ether_addr ea;
1297} scb_val_t;
1298
1299typedef struct {
1300	uint32 code;
1301	scb_val_t ioctl_args;
1302} authops_t;
1303
1304/* channel encoding */
1305typedef struct channel_info {
1306	int hw_channel;
1307	int target_channel;
1308	int scan_channel;
1309} channel_info_t;
1310
1311/* For ioctls that take a list of MAC addresses */
1312struct maclist {
1313	uint count;			/* number of MAC addresses */
1314	struct ether_addr ea[1];	/* variable length array of MAC addresses */
1315};
1316
1317#ifndef LINUX_POSTMOGRIFY_REMOVAL
1318/* get pkt count struct passed through ioctl */
1319typedef struct get_pktcnt {
1320	uint rx_good_pkt;
1321	uint rx_bad_pkt;
1322	uint tx_good_pkt;
1323	uint tx_bad_pkt;
1324	uint rx_ocast_good_pkt; /* unicast packets destined for others */
1325} get_pktcnt_t;
1326
1327/* NINTENDO2 */
1328#define LQ_IDX_MIN              0
1329#define LQ_IDX_MAX              1
1330#define LQ_IDX_AVG              2
1331#define LQ_IDX_SUM              2
1332#define LQ_IDX_LAST             3
1333#define LQ_STOP_MONITOR         0
1334#define LQ_START_MONITOR        1
1335
1336/* Get averages RSSI, Rx PHY rate and SNR values */
1337typedef struct {
1338	int rssi[LQ_IDX_LAST];  /* Array to keep min, max, avg rssi */
1339	int snr[LQ_IDX_LAST];   /* Array to keep min, max, avg snr */
1340	int isvalid;            /* Flag indicating whether above data is valid */
1341} wl_lq_t; /* Link Quality */
1342
1343typedef enum wl_wakeup_reason_type {
1344	LCD_ON = 1,
1345	LCD_OFF,
1346	DRC1_WAKE,
1347	DRC2_WAKE,
1348	REASON_LAST
1349} wl_wr_type_t;
1350
1351typedef struct {
1352/* Unique filter id */
1353	uint32	id;
1354
1355/* stores the reason for the last wake up */
1356	uint8	reason;
1357} wl_wr_t;
1358
1359/* Get MAC specific rate histogram command */
1360typedef struct {
1361	struct	ether_addr ea;	/* MAC Address */
1362	uint8	ac_cat;	/* Access Category */
1363	uint8	num_pkts;	/* Number of packet entries to be averaged */
1364} wl_mac_ratehisto_cmd_t;	/* MAC Specific Rate Histogram command */
1365
1366/* Get MAC rate histogram response */
1367typedef struct {
1368	uint32	rate[DOT11_RATE_MAX + 1];	/* Rates */
1369	uint32	mcs[WL_RATESET_SZ_HT_MCS * WL_TX_CHAINS_MAX];	/* MCS counts */
1370	uint32	vht[WL_RATESET_SZ_VHT_MCS][WL_TX_CHAINS_MAX];	/* VHT counts */
1371	uint32	tsf_timer[2][2];	/* Start and End time for 8bytes value */
1372} wl_mac_ratehisto_res_t;	/* MAC Specific Rate Histogram Response */
1373
1374/* Values for TX Filter override mode */
1375#define WLC_TXFILTER_OVERRIDE_DISABLED  0
1376#define WLC_TXFILTER_OVERRIDE_ENABLED   1
1377
1378#define WL_IOCTL_ACTION_GET				0x0
1379#define WL_IOCTL_ACTION_SET				0x1
1380#define WL_IOCTL_ACTION_OVL_IDX_MASK	0x1e
1381#define WL_IOCTL_ACTION_OVL_RSV			0x20
1382#define WL_IOCTL_ACTION_OVL				0x40
1383#define WL_IOCTL_ACTION_MASK			0x7e
1384#define WL_IOCTL_ACTION_OVL_SHIFT		1
1385
1386#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1387
1388/* Linux network driver ioctl encoding */
1389typedef struct wl_ioctl {
1390	uint cmd;	/* common ioctl definition */
1391	void *buf;	/* pointer to user buffer */
1392	uint len;	/* length of user buffer */
1393	uint8 set;		/* 1=set IOCTL; 0=query IOCTL */
1394	uint used;	/* bytes read or written (optional) */
1395	uint needed;	/* bytes needed (optional) */
1396} wl_ioctl_t;
1397
1398#ifndef LINUX_POSTMOGRIFY_REMOVAL
1399
1400/* reference to wl_ioctl_t struct used by usermode driver */
1401#define ioctl_subtype	set		/* subtype param */
1402#define ioctl_pid	used		/* pid param */
1403#define ioctl_status	needed		/* status param */
1404
1405/*
1406 * Structure for passing hardware and software
1407 * revision info up from the driver.
1408 */
1409typedef struct wlc_rev_info {
1410	uint		vendorid;	/* PCI vendor id */
1411	uint		deviceid;	/* device id of chip */
1412	uint		radiorev;	/* radio revision */
1413	uint		chiprev;	/* chip revision */
1414	uint		corerev;	/* core revision */
1415	uint		boardid;	/* board identifier (usu. PCI sub-device id) */
1416	uint		boardvendor;	/* board vendor (usu. PCI sub-vendor id) */
1417	uint		boardrev;	/* board revision */
1418	uint		driverrev;	/* driver version */
1419	uint		ucoderev;	/* microcode version */
1420	uint		bus;		/* bus type */
1421	uint		chipnum;	/* chip number */
1422	uint		phytype;	/* phy type */
1423	uint		phyrev;		/* phy revision */
1424	uint		anarev;		/* anacore rev */
1425	uint		chippkg;	/* chip package info */
1426	uint		nvramrev;	/* nvram revision number */
1427} wlc_rev_info_t;
1428
1429#define WL_REV_INFO_LEGACY_LENGTH	48
1430
1431#define WL_BRAND_MAX 10
1432typedef struct wl_instance_info {
1433	uint instance;
1434	char brand[WL_BRAND_MAX];
1435} wl_instance_info_t;
1436
1437/* structure to change size of tx fifo */
1438typedef struct wl_txfifo_sz {
1439	uint16	magic;
1440	uint16	fifo;
1441	uint16	size;
1442} wl_txfifo_sz_t;
1443/* magic pattern used for mismatch driver and wl */
1444#define WL_TXFIFO_SZ_MAGIC	0xa5a5
1445
1446/* Transfer info about an IOVar from the driver */
1447/* Max supported IOV name size in bytes, + 1 for nul termination */
1448#define WLC_IOV_NAME_LEN 30
1449typedef struct wlc_iov_trx_s {
1450	uint8 module;
1451	uint8 type;
1452	char name[WLC_IOV_NAME_LEN];
1453} wlc_iov_trx_t;
1454
1455/* check this magic number */
1456#define WLC_IOCTL_MAGIC		0x14e46c77
1457
1458/* bump this number if you change the ioctl interface */
1459#ifdef D11AC_IOTYPES
1460#define WLC_IOCTL_VERSION	2
1461#define WLC_IOCTL_VERSION_LEGACY_IOTYPES	1
1462#else
1463#define WLC_IOCTL_VERSION	1
1464#endif /* D11AC_IOTYPES */
1465#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1466
1467#define	WLC_IOCTL_MAXLEN		8192	/* max length ioctl buffer required */
1468#define	WLC_IOCTL_SMLEN			256	/* "small" length ioctl buffer required */
1469#define WLC_IOCTL_MEDLEN		1536    /* "med" length ioctl buffer required */
1470#ifdef WLC_HIGH_ONLY
1471#define WLC_SAMPLECOLLECT_MAXLEN	1024	/* limit sample size for bmac  */
1472#define WLC_SAMPLECOLLECT_MAXLEN_LCN40  1024
1473#else
1474#if defined(LCNCONF) || defined(LCN40CONF)
1475#define WLC_SAMPLECOLLECT_MAXLEN	8192	/* Max Sample Collect buffer */
1476#else
1477#define WLC_SAMPLECOLLECT_MAXLEN	10240	/* Max Sample Collect buffer for two cores */
1478#endif
1479#define WLC_SAMPLECOLLECT_MAXLEN_LCN40  8192
1480#endif /* WLC_HIGH_ONLY */
1481
1482/* common ioctl definitions */
1483#define WLC_GET_MAGIC				0
1484#define WLC_GET_VERSION				1
1485#define WLC_UP					2
1486#define WLC_DOWN				3
1487#define WLC_DUMP				6
1488#define WLC_GET_MSGLEVEL			7
1489#define WLC_SET_MSGLEVEL			8
1490#define WLC_GET_PROMISC				9
1491#define WLC_SET_PROMISC				10
1492/* #define WLC_OVERLAY_IOCTL			11 */ /* not supported */
1493#define WLC_GET_RATE				12
1494#define WLC_GET_MAX_RATE			13
1495#define WLC_GET_INSTANCE			14
1496/* #define WLC_GET_FRAG				15 */ /* no longer supported */
1497/* #define WLC_SET_FRAG				16 */ /* no longer supported */
1498/* #define WLC_GET_RTS				17 */ /* no longer supported */
1499/* #define WLC_SET_RTS				18 */ /* no longer supported */
1500#define WLC_GET_INFRA				19
1501#define WLC_SET_INFRA				20
1502#define WLC_GET_AUTH				21
1503#define WLC_SET_AUTH				22
1504#define WLC_GET_BSSID				23
1505#define WLC_SET_BSSID				24
1506#define WLC_GET_SSID				25
1507#define WLC_SET_SSID				26
1508#define WLC_RESTART				27
1509#define WLC_TERMINATED             		28
1510#define WLC_GET_CHANNEL				29
1511#define WLC_SET_CHANNEL				30
1512#define WLC_GET_SRL				31
1513#define WLC_SET_SRL				32
1514#define WLC_GET_LRL				33
1515#define WLC_SET_LRL				34
1516#define WLC_GET_PLCPHDR				35
1517#define WLC_SET_PLCPHDR				36
1518#define WLC_GET_RADIO				37
1519#define WLC_SET_RADIO				38
1520#define WLC_GET_PHYTYPE				39
1521#define WLC_GET_FIXRATE				42
1522#define WLC_SET_FIXRATE				43
1523/* #define WLC_GET_WEP				42 */ /* no longer supported */
1524/* #define WLC_SET_WEP				43 */ /* no longer supported */
1525#define WLC_GET_KEY				44
1526#define WLC_SET_KEY				45
1527#define WLC_GET_REGULATORY			46
1528#define WLC_SET_REGULATORY			47
1529#define WLC_SCAN				50
1530#define WLC_SCAN_RESULTS			51
1531#define WLC_DISASSOC				52
1532#define WLC_REASSOC				53
1533#define WLC_GET_ROAM_TRIGGER			54
1534#define WLC_SET_ROAM_TRIGGER			55
1535#define WLC_GET_TXANT				61
1536#define WLC_SET_TXANT				62
1537#define WLC_GET_ANTDIV				63
1538#define WLC_SET_ANTDIV				64
1539/* #define WLC_GET_TXPWR			65 */ /* no longer supported */
1540/* #define WLC_SET_TXPWR			66 */ /* no longer supported */
1541#define WLC_GET_CLOSED				67
1542#define WLC_SET_CLOSED				68
1543#define WLC_GET_MACLIST				69
1544#define WLC_SET_MACLIST				70
1545#define WLC_GET_RATESET				71
1546#define WLC_SET_RATESET				72
1547/* #define WLC_GET_LOCALE			73 */ /* no longer supported */
1548#define WLC_LONGTRAIN				74
1549#define WLC_GET_BCNPRD				75
1550#define WLC_SET_BCNPRD				76
1551#define WLC_GET_DTIMPRD				77
1552#define WLC_SET_DTIMPRD				78
1553#define WLC_GET_SROM				79
1554#define WLC_SET_SROM				80
1555#define WLC_GET_WEP_RESTRICT			81
1556#define WLC_SET_WEP_RESTRICT			82
1557#define WLC_GET_COUNTRY				83
1558#define WLC_SET_COUNTRY				84
1559#define WLC_GET_REVINFO				98
1560#define WLC_GET_MACMODE				105
1561#define WLC_SET_MACMODE				106
1562#define WLC_GET_GMODE				109
1563#define WLC_SET_GMODE				110
1564#define WLC_GET_CURR_RATESET			114	/* current rateset */
1565#define WLC_GET_SCANSUPPRESS			115
1566#define WLC_SET_SCANSUPPRESS			116
1567#define WLC_GET_AP				117
1568#define WLC_SET_AP				118
1569#define WLC_GET_EAP_RESTRICT			119
1570#define WLC_SET_EAP_RESTRICT			120
1571#define WLC_GET_WDSLIST				123
1572#define WLC_SET_WDSLIST				124
1573#define WLC_GET_RSSI				127
1574#define WLC_GET_WSEC				133
1575#define WLC_SET_WSEC				134
1576#define WLC_GET_BSS_INFO			136
1577#define WLC_GET_LAZYWDS				138
1578#define WLC_SET_LAZYWDS				139
1579#define WLC_GET_BANDLIST			140
1580
1581#ifndef LINUX_POSTMOGRIFY_REMOVAL
1582#define WLC_GET_BAND				141
1583#define WLC_SET_BAND				142
1584#define WLC_SCB_DEAUTHENTICATE			143
1585#define WLC_GET_SHORTSLOT			144
1586#define WLC_GET_SHORTSLOT_OVERRIDE		145
1587#define WLC_SET_SHORTSLOT_OVERRIDE		146
1588#define WLC_GET_SHORTSLOT_RESTRICT		147
1589#define WLC_SET_SHORTSLOT_RESTRICT		148
1590#define WLC_GET_GMODE_PROTECTION		149
1591#define WLC_GET_GMODE_PROTECTION_OVERRIDE	150
1592#define WLC_SET_GMODE_PROTECTION_OVERRIDE	151
1593#define WLC_UPGRADE				152
1594/* #define WLC_GET_MRATE			153 */ /* no longer supported */
1595/* #define WLC_SET_MRATE			154 */ /* no longer supported */
1596#define WLC_GET_ASSOCLIST			159
1597#define WLC_GET_CLK				160
1598#define WLC_SET_CLK				161
1599#define WLC_GET_UP				162
1600#define WLC_OUT					163
1601#define WLC_GET_WPA_AUTH			164
1602#define WLC_SET_WPA_AUTH			165
1603#define WLC_GET_PROTECTION_CONTROL		178
1604#define WLC_SET_PROTECTION_CONTROL		179
1605#endif /* LINUX_POSTMOGRIFY_REMOVAL  */
1606#define WLC_GET_PHYLIST				180
1607#ifndef LINUX_POSTMOGRIFY_REMOVAL
1608#define WLC_GET_KEY_SEQ				183
1609#define WLC_GET_SCAN_CHANNEL_TIME		184
1610#define WLC_SET_SCAN_CHANNEL_TIME		185
1611/* #define WLC_GET_GMODE_PROTECTION_CTS		198 */ /* no longer supported */
1612/* #define WLC_SET_GMODE_PROTECTION_CTS		199 */ /* no longer supported */
1613#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1614#define WLC_SCB_DEAUTHENTICATE_FOR_REASON	201
1615#ifndef LINUX_POSTMOGRIFY_REMOVAL
1616#define WLC_GET_PIOMODE				203
1617#define WLC_SET_PIOMODE				204
1618#define WLC_SET_LED				209
1619#define WLC_GET_LED				210
1620#define WLC_GET_CHANNEL_SEL			215
1621#define WLC_START_CHANNEL_SEL			216
1622#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1623#define WLC_GET_VALID_CHANNELS			217
1624#define WLC_GET_FAKEFRAG			218
1625#define WLC_SET_FAKEFRAG			219
1626#define WLC_GET_WET				230
1627#define WLC_SET_WET				231
1628#define WLC_GET_KEY_PRIMARY			235
1629#define WLC_SET_KEY_PRIMARY			236
1630
1631#ifndef LINUX_POSTMOGRIFY_REMOVAL
1632
1633#define WLC_GET_RADAR				242
1634#define WLC_SET_RADAR				243
1635#define WLC_SET_SPECT_MANAGMENT			244
1636#define WLC_GET_SPECT_MANAGMENT			245
1637#define WLC_WDS_GET_REMOTE_HWADDR		246	/* handled in wl_linux.c/wl_vx.c */
1638#define WLC_SET_CS_SCAN_TIMER			248
1639#define WLC_GET_CS_SCAN_TIMER			249
1640#define WLC_KEEPALIVE			253
1641#define WLC_SEND_PWR_CONSTRAINT			254
1642#define WLC_CURRENT_PWR				256
1643#define WLC_GET_CHANNELS_IN_COUNTRY		260
1644#define WLC_GET_COUNTRY_LIST			261
1645#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1646#define WLC_GET_VAR				262	/* get value of named variable */
1647#define WLC_SET_VAR				263	/* set named variable to value */
1648#ifndef LINUX_POSTMOGRIFY_REMOVAL
1649#define WLC_NVRAM_GET				264	/* deprecated */
1650#define WLC_NVRAM_SET				265
1651#define WLC_SET_WSEC_PMK			268
1652#define WLC_GET_AUTH_MODE			269
1653#define WLC_SET_AUTH_MODE			270
1654#define WLC_NDCONFIG_ITEM			273	/* currently handled in wl_oid.c */
1655#define WLC_NVOTPW				274
1656#define WLC_OTPW				275
1657#define WLC_IOV_BLOCK_GET			276
1658#define WLC_IOV_MODULES_GET			277
1659#define WLC_SOFT_RESET				278
1660#define WLC_GET_ALLOW_MODE			279
1661#define WLC_SET_ALLOW_MODE			280
1662#define WLC_GET_DESIRED_BSSID			281
1663#define WLC_SET_DESIRED_BSSID			282
1664#define	WLC_DISASSOC_MYAP			283
1665#define WLC_GET_NBANDS				284	/* for Dongle EXT_STA support */
1666#define WLC_GET_BANDSTATES			285	/* for Dongle EXT_STA support */
1667#define WLC_GET_WLC_BSS_INFO			286	/* for Dongle EXT_STA support */
1668#define WLC_GET_ASSOC_INFO			287	/* for Dongle EXT_STA support */
1669#define WLC_GET_OID_PHY				288	/* for Dongle EXT_STA support */
1670#define WLC_SET_OID_PHY				289	/* for Dongle EXT_STA support */
1671#define WLC_SET_ASSOC_TIME			290	/* for Dongle EXT_STA support */
1672#define WLC_GET_DESIRED_SSID			291	/* for Dongle EXT_STA support */
1673#define WLC_GET_CHANSPEC			292	/* for Dongle EXT_STA support */
1674#define WLC_GET_ASSOC_STATE			293	/* for Dongle EXT_STA support */
1675#define WLC_SET_PHY_STATE			294	/* for Dongle EXT_STA support */
1676#define WLC_GET_SCAN_PENDING			295	/* for Dongle EXT_STA support */
1677#define WLC_GET_SCANREQ_PENDING			296	/* for Dongle EXT_STA support */
1678#define WLC_GET_PREV_ROAM_REASON		297	/* for Dongle EXT_STA support */
1679#define WLC_SET_PREV_ROAM_REASON		298	/* for Dongle EXT_STA support */
1680#define WLC_GET_BANDSTATES_PI			299	/* for Dongle EXT_STA support */
1681#define WLC_GET_PHY_STATE			300	/* for Dongle EXT_STA support */
1682#define WLC_GET_BSS_WPA_RSN			301	/* for Dongle EXT_STA support */
1683#define WLC_GET_BSS_WPA2_RSN			302	/* for Dongle EXT_STA support */
1684#define WLC_GET_BSS_BCN_TS			303	/* for Dongle EXT_STA support */
1685#define WLC_GET_INT_DISASSOC			304	/* for Dongle EXT_STA support */
1686#define WLC_SET_NUM_PEERS			305     /* for Dongle EXT_STA support */
1687#define WLC_GET_NUM_BSS				306	/* for Dongle EXT_STA support */
1688#define WLC_PHY_SAMPLE_COLLECT			307	/* phy sample collect mode */
1689/* #define WLC_UM_PRIV				308 */	/* Deprecated: usermode driver */
1690#define WLC_GET_CMD				309
1691/* #define WLC_LAST				310 */	/* Never used - can be reused */
1692#define WLC_SET_INTERFERENCE_OVERRIDE_MODE	311	/* set inter mode override */
1693#define WLC_GET_INTERFERENCE_OVERRIDE_MODE	312	/* get inter mode override */
1694/* #define WLC_GET_WAI_RESTRICT			313 */	/* for WAPI, deprecated use iovar instead */
1695/* #define WLC_SET_WAI_RESTRICT			314 */	/* for WAPI, deprecated use iovar instead */
1696/* #define WLC_SET_WAI_REKEY			315 */	/* for WAPI, deprecated use iovar instead */
1697#define WLC_SET_NAT_CONFIG			316	/* for configuring NAT filter driver */
1698#define WLC_GET_NAT_STATE			317
1699#define WLC_GET_TXBF_RATESET			318
1700#define WLC_SET_TXBF_RATESET			319
1701#define WLC_SCAN_CQ				320
1702#define WLC_GET_RSSI_QDB			321 /* qdB portion of the RSSI */
1703
1704#define WLC_LAST				322
1705
1706#ifndef EPICTRL_COOKIE
1707#define EPICTRL_COOKIE		0xABADCEDE
1708#endif
1709
1710/* vx wlc ioctl's offset */
1711#define CMN_IOCTL_OFF 0x180
1712
1713/*
1714 * custom OID support
1715 *
1716 * 0xFF - implementation specific OID
1717 * 0xE4 - first byte of Broadcom PCI vendor ID
1718 * 0x14 - second byte of Broadcom PCI vendor ID
1719 * 0xXX - the custom OID number
1720 */
1721
1722/* begin 0x1f values beyond the start of the ET driver range. */
1723#define WL_OID_BASE		0xFFE41420
1724
1725/* NDIS overrides */
1726#define OID_WL_GETINSTANCE	(WL_OID_BASE + WLC_GET_INSTANCE)
1727#define OID_WL_NDCONFIG_ITEM	(WL_OID_BASE + WLC_NDCONFIG_ITEM)
1728
1729/* EXT_STA Dongle suuport */
1730#define OID_STA_CHANSPEC	(WL_OID_BASE + WLC_GET_CHANSPEC)
1731#define OID_STA_NBANDS		(WL_OID_BASE + WLC_GET_NBANDS)
1732#define OID_STA_GET_PHY		(WL_OID_BASE + WLC_GET_OID_PHY)
1733#define OID_STA_SET_PHY		(WL_OID_BASE + WLC_SET_OID_PHY)
1734#define OID_STA_ASSOC_TIME	(WL_OID_BASE + WLC_SET_ASSOC_TIME)
1735#define OID_STA_DESIRED_SSID	(WL_OID_BASE + WLC_GET_DESIRED_SSID)
1736#define OID_STA_SET_PHY_STATE	(WL_OID_BASE + WLC_SET_PHY_STATE)
1737#define OID_STA_SCAN_PENDING	(WL_OID_BASE + WLC_GET_SCAN_PENDING)
1738#define OID_STA_SCANREQ_PENDING (WL_OID_BASE + WLC_GET_SCANREQ_PENDING)
1739#define OID_STA_GET_ROAM_REASON (WL_OID_BASE + WLC_GET_PREV_ROAM_REASON)
1740#define OID_STA_SET_ROAM_REASON (WL_OID_BASE + WLC_SET_PREV_ROAM_REASON)
1741#define OID_STA_GET_PHY_STATE	(WL_OID_BASE + WLC_GET_PHY_STATE)
1742#define OID_STA_INT_DISASSOC	(WL_OID_BASE + WLC_GET_INT_DISASSOC)
1743#define OID_STA_SET_NUM_PEERS	(WL_OID_BASE + WLC_SET_NUM_PEERS)
1744#define OID_STA_GET_NUM_BSS	(WL_OID_BASE + WLC_GET_NUM_BSS)
1745
1746/* NAT filter driver support */
1747#define OID_NAT_SET_CONFIG	(WL_OID_BASE + WLC_SET_NAT_CONFIG)
1748#define OID_NAT_GET_STATE	(WL_OID_BASE + WLC_GET_NAT_STATE)
1749
1750#define WL_DECRYPT_STATUS_SUCCESS	1
1751#define WL_DECRYPT_STATUS_FAILURE	2
1752#define WL_DECRYPT_STATUS_UNKNOWN	3
1753
1754/* allows user-mode app to poll the status of USB image upgrade */
1755#define WLC_UPGRADE_SUCCESS			0
1756#define WLC_UPGRADE_PENDING			1
1757
1758#ifdef CONFIG_USBRNDIS_RETAIL
1759/* struct passed in for WLC_NDCONFIG_ITEM */
1760typedef struct {
1761	char *name;
1762	void *param;
1763} ndconfig_item_t;
1764#endif
1765
1766
1767/* WLC_GET_AUTH, WLC_SET_AUTH values */
1768#define WL_AUTH_OPEN_SYSTEM		0	/* d11 open authentication */
1769#define WL_AUTH_SHARED_KEY		1	/* d11 shared authentication */
1770#define WL_AUTH_OPEN_SHARED     	2   /* try open, then shared if open failed w/rc 13 */
1771#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1772
1773/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
1774#define WL_RADIO_SW_DISABLE		(1<<0)
1775#define WL_RADIO_HW_DISABLE		(1<<1)
1776#define WL_RADIO_MPC_DISABLE		(1<<2)
1777#define WL_RADIO_COUNTRY_DISABLE	(1<<3)	/* some countries don't support any channel */
1778
1779#define	WL_SPURAVOID_OFF	0
1780#define	WL_SPURAVOID_ON1	1
1781#define	WL_SPURAVOID_ON2	2
1782
1783
1784/* Override bit for WLC_SET_TXPWR.  if set, ignore other level limits */
1785#define WL_TXPWR_OVERRIDE	(1U<<31)
1786#define WL_TXPWR_NEG   (1U<<30)
1787
1788#ifndef LINUX_POSTMOGRIFY_REMOVAL
1789#define WL_PHY_PAVARS_LEN	32	/* Phy type, Band range, chain, a1[0], b0[0], b1[0] ... */
1790
1791
1792
1793typedef struct wl_po {
1794	uint16	phy_type;	/* Phy type */
1795	uint16	band;
1796	uint16	cckpo;
1797	uint32	ofdmpo;
1798	uint16	mcspo[8];
1799} wl_po_t;
1800
1801#define WL_NUM_RPCALVARS 5	/* number of rpcal vars */
1802
1803typedef struct wl_rpcal {
1804	uint16 value;
1805	uint16 update;
1806} wl_rpcal_t;
1807
1808/* a large TX Power as an init value to factor out of MIN() calculations,
1809 * keep low enough to fit in an int8, units are .25 dBm
1810 */
1811#define WLC_TXPWR_MAX		(127)	/* ~32 dBm = 1,500 mW */
1812
1813/* "diag" iovar argument and error code */
1814#define WL_DIAG_INTERRUPT			1	/* d11 loopback interrupt test */
1815#define WL_DIAG_MEMORY				3	/* d11 memory test */
1816#define WL_DIAG_LED				4	/* LED test */
1817#define WL_DIAG_REG				5	/* d11/phy register test */
1818#define WL_DIAG_SROM				6	/* srom read/crc test */
1819#define WL_DIAG_DMA				7	/* DMA test */
1820
1821#define WL_DIAGERR_SUCCESS			0
1822#define WL_DIAGERR_FAIL_TO_RUN			1	/* unable to run requested diag */
1823#define WL_DIAGERR_NOT_SUPPORTED		2	/* diag requested is not supported */
1824#define WL_DIAGERR_INTERRUPT_FAIL		3	/* loopback interrupt test failed */
1825#define WL_DIAGERR_LOOPBACK_FAIL		4	/* loopback data test failed */
1826#define WL_DIAGERR_SROM_FAIL			5	/* srom read failed */
1827#define WL_DIAGERR_SROM_BADCRC			6	/* srom crc failed */
1828#define WL_DIAGERR_REG_FAIL			7	/* d11/phy register test failed */
1829#define WL_DIAGERR_MEMORY_FAIL			8	/* d11 memory test failed */
1830#define WL_DIAGERR_NOMEM			9	/* diag test failed due to no memory */
1831#define WL_DIAGERR_DMA_FAIL			10	/* DMA test failed */
1832
1833#define WL_DIAGERR_MEMORY_TIMEOUT		11	/* d11 memory test didn't finish in time */
1834#define WL_DIAGERR_MEMORY_BADPATTERN		12	/* d11 memory test result in bad pattern */
1835
1836/* band types */
1837#define	WLC_BAND_AUTO		0	/* auto-select */
1838#define	WLC_BAND_5G		1	/* 5 Ghz */
1839#define	WLC_BAND_2G		2	/* 2.4 Ghz */
1840#define	WLC_BAND_ALL		3	/* all bands */
1841
1842/* band range returned by band_range iovar */
1843#define WL_CHAN_FREQ_RANGE_2G      0
1844#define WL_CHAN_FREQ_RANGE_5GL     1
1845#define WL_CHAN_FREQ_RANGE_5GM     2
1846#define WL_CHAN_FREQ_RANGE_5GH     3
1847
1848#define WL_CHAN_FREQ_RANGE_5GLL_5BAND    4
1849#define WL_CHAN_FREQ_RANGE_5GLH_5BAND    5
1850#define WL_CHAN_FREQ_RANGE_5GML_5BAND    6
1851#define WL_CHAN_FREQ_RANGE_5GMH_5BAND    7
1852#define WL_CHAN_FREQ_RANGE_5GH_5BAND     8
1853
1854#define WL_CHAN_FREQ_RANGE_5G_BAND0     1
1855#define WL_CHAN_FREQ_RANGE_5G_BAND1     2
1856#define WL_CHAN_FREQ_RANGE_5G_BAND2     3
1857#define WL_CHAN_FREQ_RANGE_5G_BAND3     4
1858
1859#define WL_CHAN_FREQ_RANGE_5G_4BAND    	5
1860#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1861
1862/* phy types (returned by WLC_GET_PHYTPE) */
1863#define	WLC_PHY_TYPE_A		0
1864#define	WLC_PHY_TYPE_B		1
1865#define	WLC_PHY_TYPE_G		2
1866#define	WLC_PHY_TYPE_N		4
1867#define	WLC_PHY_TYPE_LP		5
1868#define	WLC_PHY_TYPE_SSN	6
1869#define	WLC_PHY_TYPE_HT		7
1870#define	WLC_PHY_TYPE_LCN	8
1871#define	WLC_PHY_TYPE_LCN40	10
1872#define WLC_PHY_TYPE_AC		11
1873#define	WLC_PHY_TYPE_NULL	0xf
1874
1875/* Values for PM */
1876#define PM_OFF	0
1877#define PM_MAX	1
1878#define PM_FAST 2
1879#define PM_FORCE_OFF 3 		/* use this bit to force PM off even bt is active */
1880
1881#ifndef LINUX_POSTMOGRIFY_REMOVAL
1882/* MAC list modes */
1883#define WLC_MACMODE_DISABLED	0	/* MAC list disabled */
1884#define WLC_MACMODE_DENY	1	/* Deny specified (i.e. allow unspecified) */
1885#define WLC_MACMODE_ALLOW	2	/* Allow specified (i.e. deny unspecified) */
1886
1887/*
1888 *
1889 */
1890#define GMODE_LEGACY_B		0
1891#define GMODE_AUTO		1
1892#define GMODE_ONLY		2
1893#define GMODE_B_DEFERRED	3
1894#define GMODE_PERFORMANCE	4
1895#define GMODE_LRS		5
1896#define GMODE_MAX		6
1897
1898/* values for PLCPHdr_override */
1899#define WLC_PLCP_AUTO	-1
1900#define WLC_PLCP_SHORT	0
1901#define WLC_PLCP_LONG	1
1902
1903/* values for g_protection_override and n_protection_override */
1904#define WLC_PROTECTION_AUTO		-1
1905#define WLC_PROTECTION_OFF		0
1906#define WLC_PROTECTION_ON		1
1907#define WLC_PROTECTION_MMHDR_ONLY	2
1908#define WLC_PROTECTION_CTS_ONLY		3
1909
1910/* values for g_protection_control and n_protection_control */
1911#define WLC_PROTECTION_CTL_OFF		0
1912#define WLC_PROTECTION_CTL_LOCAL	1
1913#define WLC_PROTECTION_CTL_OVERLAP	2
1914
1915/* values for n_protection */
1916#define WLC_N_PROTECTION_OFF		0
1917#define WLC_N_PROTECTION_OPTIONAL	1
1918#define WLC_N_PROTECTION_20IN40		2
1919#define WLC_N_PROTECTION_MIXEDMODE	3
1920
1921/* values for n_preamble_type */
1922#define WLC_N_PREAMBLE_MIXEDMODE	0
1923#define WLC_N_PREAMBLE_GF		1
1924#define WLC_N_PREAMBLE_GF_BRCM          2
1925
1926/* values for band specific 40MHz capabilities (deprecated) */
1927#define WLC_N_BW_20ALL			0
1928#define WLC_N_BW_40ALL			1
1929#define WLC_N_BW_20IN2G_40IN5G		2
1930
1931#define WLC_BW_20MHZ_BIT		(1<<0)
1932#define WLC_BW_40MHZ_BIT		(1<<1)
1933#define WLC_BW_80MHZ_BIT		(1<<2)
1934
1935/* Bandwidth capabilities */
1936#define WLC_BW_CAP_20MHZ		(WLC_BW_20MHZ_BIT)
1937#define WLC_BW_CAP_40MHZ		(WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
1938#define WLC_BW_CAP_80MHZ		(WLC_BW_80MHZ_BIT|WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
1939#define WLC_BW_CAP_UNRESTRICTED		0xFF
1940
1941#define WL_BW_CAP_20MHZ(bw_cap)	(((bw_cap) & WLC_BW_20MHZ_BIT) ? TRUE : FALSE)
1942#define WL_BW_CAP_40MHZ(bw_cap)	(((bw_cap) & WLC_BW_40MHZ_BIT) ? TRUE : FALSE)
1943#define WL_BW_CAP_80MHZ(bw_cap)	(((bw_cap) & WLC_BW_80MHZ_BIT) ? TRUE : FALSE)
1944
1945/* values to force tx/rx chain */
1946#define WLC_N_TXRX_CHAIN0		0
1947#define WLC_N_TXRX_CHAIN1		1
1948
1949/* bitflags for SGI support (sgi_rx iovar) */
1950#define WLC_N_SGI_20			0x01
1951#define WLC_N_SGI_40			0x02
1952#define WLC_VHT_SGI_80			0x04
1953
1954/* when sgi_tx==WLC_SGI_ALL, bypass rate selection, enable sgi for all mcs */
1955#define WLC_SGI_ALL				0x02
1956
1957#define LISTEN_INTERVAL			10
1958#define	INTERFERE_OVRRIDE_OFF	-1	/* interference override off */
1959
1960/* interfernece mode bit-masks (ACPHY) */
1961#define ACPHY_ACI_GLITCHBASED_DESENSE 1   /* bit 0 */
1962#define ACPHY_ACI_HWACI_PKTGAINLMT 2      /* bit 1 */
1963#define ACPHY_ACI_W2NB_PKTGAINLMT 4       /* bit 2 */
1964#define ACPHY_ACI_MAX_MODE 7
1965
1966typedef struct wl_aci_args {
1967	int enter_aci_thresh; /* Trigger level to start detecting ACI */
1968	int exit_aci_thresh; /* Trigger level to exit ACI mode */
1969	int usec_spin; /* microsecs to delay between rssi samples */
1970	int glitch_delay; /* interval between ACI scans when glitch count is consistently high */
1971	uint16 nphy_adcpwr_enter_thresh;	/* ADC power to enter ACI mitigation mode */
1972	uint16 nphy_adcpwr_exit_thresh;	/* ADC power to exit ACI mitigation mode */
1973	uint16 nphy_repeat_ctr;		/* Number of tries per channel to compute power */
1974	uint16 nphy_num_samples;	/* Number of samples to compute power on one channel */
1975	uint16 nphy_undetect_window_sz;	/* num of undetects to exit ACI Mitigation mode */
1976	uint16 nphy_b_energy_lo_aci;	/* low ACI power energy threshold for bphy */
1977	uint16 nphy_b_energy_md_aci;	/* mid ACI power energy threshold for bphy */
1978	uint16 nphy_b_energy_hi_aci;	/* high ACI power energy threshold for bphy */
1979	uint16 nphy_noise_noassoc_glitch_th_up; /* wl interference 4 */
1980	uint16 nphy_noise_noassoc_glitch_th_dn;
1981	uint16 nphy_noise_assoc_glitch_th_up;
1982	uint16 nphy_noise_assoc_glitch_th_dn;
1983	uint16 nphy_noise_assoc_aci_glitch_th_up;
1984	uint16 nphy_noise_assoc_aci_glitch_th_dn;
1985	uint16 nphy_noise_assoc_enter_th;
1986	uint16 nphy_noise_noassoc_enter_th;
1987	uint16 nphy_noise_assoc_rx_glitch_badplcp_enter_th;
1988	uint16 nphy_noise_noassoc_crsidx_incr;
1989	uint16 nphy_noise_assoc_crsidx_incr;
1990	uint16 nphy_noise_crsidx_decr;
1991} wl_aci_args_t;
1992
1993#define TRIGGER_NOW				0
1994#define TRIGGER_CRS				0x01
1995#define TRIGGER_CRSDEASSERT			0x02
1996#define TRIGGER_GOODFCS				0x04
1997#define TRIGGER_BADFCS				0x08
1998#define TRIGGER_BADPLCP				0x10
1999#define TRIGGER_CRSGLITCH			0x20
2000#define WL_ACI_ARGS_LEGACY_LENGTH	16	/* bytes of pre NPHY aci args */
2001#define	WL_SAMPLECOLLECT_T_VERSION	2	/* version of wl_samplecollect_args_t struct */
2002typedef struct wl_samplecollect_args {
2003	/* version 0 fields */
2004	uint8 coll_us;
2005	int cores;
2006	/* add'l version 1 fields */
2007	uint16 version;     /* see definition of WL_SAMPLECOLLECT_T_VERSION */
2008	uint16 length;      /* length of entire structure */
2009	int8 trigger;
2010	uint16 timeout;
2011	uint16 mode;
2012	uint32 pre_dur;
2013	uint32 post_dur;
2014	uint8 gpio_sel;
2015	bool downsamp;
2016	bool be_deaf;
2017	bool agc;		/* loop from init gain and going down */
2018	bool filter;		/* override high pass corners to lowest */
2019	/* add'l version 2 fields */
2020	uint8 trigger_state;
2021	uint8 module_sel1;
2022	uint8 module_sel2;
2023	uint16 nsamps;
2024	int bitStart;
2025	uint32 gpioCapMask;
2026} wl_samplecollect_args_t;
2027
2028#define	WL_SAMPLEDATA_HEADER_TYPE	1
2029#define WL_SAMPLEDATA_HEADER_SIZE	80	/* sample collect header size (bytes) */
2030#define	WL_SAMPLEDATA_TYPE		2
2031#define	WL_SAMPLEDATA_SEQ		0xff	/* sequence # */
2032#define	WL_SAMPLEDATA_MORE_DATA		0x100	/* more data mask */
2033#define	WL_SAMPLEDATA_T_VERSION		1	/* version of wl_samplecollect_args_t struct */
2034/* version for unpacked sample data, int16 {(I,Q),Core(0..N)} */
2035#define	WL_SAMPLEDATA_T_VERSION_SPEC_AN 2
2036
2037typedef struct wl_sampledata {
2038	uint16 version;	/* structure version */
2039	uint16 size;	/* size of structure */
2040	uint16 tag;	/* Header/Data */
2041	uint16 length;	/* data length */
2042	uint32 flag;	/* bit def */
2043} wl_sampledata_t;
2044
2045/* wl_radar_args_t */
2046typedef struct {
2047	int npulses; 	/* required number of pulses at n * t_int */
2048	int ncontig; 	/* required number of pulses at t_int */
2049	int min_pw; 	/* minimum pulse width (20 MHz clocks) */
2050	int max_pw; 	/* maximum pulse width (20 MHz clocks) */
2051	uint16 thresh0;	/* Radar detection, thresh 0 */
2052	uint16 thresh1;	/* Radar detection, thresh 1 */
2053	uint16 blank;	/* Radar detection, blank control */
2054	uint16 fmdemodcfg;	/* Radar detection, fmdemod config */
2055	int npulses_lp;  /* Radar detection, minimum long pulses */
2056	int min_pw_lp; /* Minimum pulsewidth for long pulses */
2057	int max_pw_lp; /* Maximum pulsewidth for long pulses */
2058	int min_fm_lp; /* Minimum fm for long pulses */
2059	int max_span_lp;  /* Maximum deltat for long pulses */
2060	int min_deltat; /* Minimum spacing between pulses */
2061	int max_deltat; /* Maximum spacing between pulses */
2062	uint16 autocorr;	/* Radar detection, autocorr on or off */
2063	uint16 st_level_time;	/* Radar detection, start_timing level */
2064	uint16 t2_min; /* minimum clocks needed to remain in state 2 */
2065	uint32 version; /* version */
2066	uint32 fra_pulse_err;	/* sample error margin for detecting French radar pulsed */
2067	int npulses_fra;  /* Radar detection, minimum French pulses set */
2068	int npulses_stg2;  /* Radar detection, minimum staggered-2 pulses set */
2069	int npulses_stg3;  /* Radar detection, minimum staggered-3 pulses set */
2070	uint16 percal_mask;	/* defines which period cal is masked from radar detection */
2071	int quant;	/* quantization resolution to pulse positions */
2072	uint32 min_burst_intv_lp;	/* minimum burst to burst interval for bin3 radar */
2073	uint32 max_burst_intv_lp;	/* maximum burst to burst interval for bin3 radar */
2074	int nskip_rst_lp;	/* number of skipped pulses before resetting lp buffer */
2075	int max_pw_tol;	/* maximum tollerance allowed in detected pulse width for radar detection */
2076	uint16 feature_mask; /* 16-bit mask to specify enabled features */
2077} wl_radar_args_t;
2078
2079#define WL_RADAR_ARGS_VERSION 2
2080
2081typedef struct {
2082	uint32 version; /* version */
2083	uint16 thresh0_20_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 20MHz */
2084	uint16 thresh1_20_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
2085	uint16 thresh0_40_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
2086	uint16 thresh1_40_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
2087	uint16 thresh0_80_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 80MHz */
2088	uint16 thresh1_80_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 80MHz */
2089	uint16 thresh0_20_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
2090	uint16 thresh1_20_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
2091	uint16 thresh0_40_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
2092	uint16 thresh1_40_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
2093	uint16 thresh0_80_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 80MHz */
2094	uint16 thresh1_80_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 80MHz */
2095} wl_radar_thr_t;
2096
2097#define WL_RADAR_THR_VERSION	2
2098#define WL_THRESHOLD_LO_BAND	70	/* range from 5250MHz - 5350MHz */
2099
2100/* radar iovar SET defines */
2101#define WL_RADAR_DETECTOR_OFF		0	/* radar detector off */
2102#define WL_RADAR_DETECTOR_ON		1	/* radar detector on */
2103#define WL_RADAR_SIMULATED		2	/* force radar detector to declare
2104						 * detection once
2105						 */
2106#define WL_RSSI_ANT_VERSION	1	/* current version of wl_rssi_ant_t */
2107#define WL_ANT_RX_MAX		2	/* max 2 receive antennas */
2108#define WL_ANT_HT_RX_MAX	3	/* max 3 receive antennas/cores */
2109#define WL_ANT_IDX_1		0	/* antenna index 1 */
2110#define WL_ANT_IDX_2		1	/* antenna index 2 */
2111
2112#ifndef WL_RSSI_ANT_MAX
2113#define WL_RSSI_ANT_MAX		4	/* max possible rx antennas */
2114#elif WL_RSSI_ANT_MAX != 4
2115#error "WL_RSSI_ANT_MAX does not match"
2116#endif
2117
2118/* RSSI per antenna */
2119typedef struct {
2120	uint32	version;		/* version field */
2121	uint32	count;			/* number of valid antenna rssi */
2122	int8 rssi_ant[WL_RSSI_ANT_MAX];	/* rssi per antenna */
2123} wl_rssi_ant_t;
2124
2125/* dfs_status iovar-related defines */
2126
2127/* cac - channel availability check,
2128 * ism - in-service monitoring
2129 * csa - channel switching announcement
2130 */
2131
2132/* cac state values */
2133#define WL_DFS_CACSTATE_IDLE		0	/* state for operating in non-radar channel */
2134#define	WL_DFS_CACSTATE_PREISM_CAC	1	/* CAC in progress */
2135#define WL_DFS_CACSTATE_ISM		2	/* ISM in progress */
2136#define WL_DFS_CACSTATE_CSA		3	/* csa */
2137#define WL_DFS_CACSTATE_POSTISM_CAC	4	/* ISM CAC */
2138#define WL_DFS_CACSTATE_PREISM_OOC	5	/* PREISM OOC */
2139#define WL_DFS_CACSTATE_POSTISM_OOC	6	/* POSTISM OOC */
2140#define WL_DFS_CACSTATES		7	/* this many states exist */
2141
2142/* data structure used in 'dfs_status' wl interface, which is used to query dfs status */
2143typedef struct {
2144	uint state;		/* noted by WL_DFS_CACSTATE_XX. */
2145	uint duration;		/* time spent in ms in state. */
2146	/* as dfs enters ISM state, it removes the operational channel from quiet channel
2147	 * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
2148	 */
2149	chanspec_t chanspec_cleared;
2150	/* chanspec cleared used to be a uint, add another to uint16 to maintain size */
2151	uint16 pad;
2152} wl_dfs_status_t;
2153
2154/* data structure used in 'radar_status' wl interface, which is use to query radar det status */
2155typedef struct {
2156	bool detected;
2157	int count;
2158	bool pretended;
2159	uint32 radartype;
2160	uint32 timenow;
2161	uint32 timefromL;
2162	int lp_csect_single;
2163	int detected_pulse_index;
2164	int nconsecq_pulses;
2165	chanspec_t ch;
2166	int pw[10];
2167	int intv[10];
2168	int fm[10];
2169} wl_radar_status_t;
2170
2171
2172#define NUM_PWRCTRL_RATES 12
2173
2174typedef struct {
2175	uint8 txpwr_band_max[NUM_PWRCTRL_RATES];	/* User set target */
2176	uint8 txpwr_limit[NUM_PWRCTRL_RATES];		/* reg and local power limit */
2177	uint8 txpwr_local_max;				/* local max according to the AP */
2178	uint8 txpwr_local_constraint;			/* local constraint according to the AP */
2179	uint8 txpwr_chan_reg_max;			/* Regulatory max for this channel */
2180	uint8 txpwr_target[2][NUM_PWRCTRL_RATES];	/* Latest target for 2.4 and 5 Ghz */
2181	uint8 txpwr_est_Pout[2];			/* Latest estimate for 2.4 and 5 Ghz */
2182	uint8 txpwr_opo[NUM_PWRCTRL_RATES];		/* On G phy, OFDM power offset */
2183	uint8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];	/* Max CCK power for this band (SROM) */
2184	uint8 txpwr_bphy_ofdm_max;			/* Max OFDM power for this band (SROM) */
2185	uint8 txpwr_aphy_max[NUM_PWRCTRL_RATES];	/* Max power for A band (SROM) */
2186	int8  txpwr_antgain[2];				/* Ant gain for each band - from SROM */
2187	uint8 txpwr_est_Pout_gofdm;			/* Pwr estimate for 2.4 OFDM */
2188} tx_power_legacy_t;
2189
2190#define WL_TX_POWER_RATES_LEGACY    45
2191#define WL_TX_POWER_MCS20_FIRST         12
2192#define WL_TX_POWER_MCS20_NUM           16
2193#define WL_TX_POWER_MCS40_FIRST         28
2194#define WL_TX_POWER_MCS40_NUM           17
2195
2196typedef struct {
2197	uint32 flags;
2198	chanspec_t chanspec;                 /* txpwr report for this channel */
2199	chanspec_t local_chanspec;           /* channel on which we are associated */
2200	uint8 local_max;                 /* local max according to the AP */
2201	uint8 local_constraint;              /* local constraint according to the AP */
2202	int8  antgain[2];                /* Ant gain for each band - from SROM */
2203	uint8 rf_cores;                  /* count of RF Cores being reported */
2204	uint8 est_Pout[4];                           /* Latest tx power out estimate per RF
2205							  * chain without adjustment
2206							  */
2207	uint8 est_Pout_cck;                          /* Latest CCK tx power out estimate */
2208	uint8 user_limit[WL_TX_POWER_RATES_LEGACY];  /* User limit */
2209	uint8 reg_limit[WL_TX_POWER_RATES_LEGACY];   /* Regulatory power limit */
2210	uint8 board_limit[WL_TX_POWER_RATES_LEGACY]; /* Max power board can support (SROM) */
2211	uint8 target[WL_TX_POWER_RATES_LEGACY];      /* Latest target power */
2212} tx_power_legacy2_t;
2213
2214/* TX Power index defines */
2215#define WL_NUM_RATES_CCK			4 /* 1, 2, 5.5, 11 Mbps */
2216#define WL_NUM_RATES_OFDM			8 /* 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
2217#define WL_NUM_RATES_MCS_1STREAM	8 /* MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
2218#define WL_NUM_RATES_EXTRA_VHT		2 /* Additional VHT 11AC rates */
2219#define WL_NUM_RATES_VHT			10
2220#define WL_NUM_RATES_MCS32			1
2221
2222#define WLC_NUM_RATES_CCK       WL_NUM_RATES_CCK
2223#define WLC_NUM_RATES_OFDM      WL_NUM_RATES_OFDM
2224#define WLC_NUM_RATES_MCS_1_STREAM  WL_NUM_RATES_MCS_1STREAM
2225#define WLC_NUM_RATES_MCS_2_STREAM  WL_NUM_RATES_MCS_1STREAM
2226#define WLC_NUM_RATES_MCS32     WL_NUM_RATES_MCS32
2227#define WL_TX_POWER_CCK_NUM     WL_NUM_RATES_CCK
2228#define WL_TX_POWER_OFDM_NUM        WL_NUM_RATES_OFDM
2229#define WL_TX_POWER_MCS_1_STREAM_NUM    WL_NUM_RATES_MCS_1STREAM
2230#define WL_TX_POWER_MCS_2_STREAM_NUM    WL_NUM_RATES_MCS_1STREAM
2231#define WL_TX_POWER_MCS_32_NUM      WL_NUM_RATES_MCS32
2232
2233#define WL_NUM_2x2_ELEMENTS		4
2234#define WL_NUM_3x3_ELEMENTS		6
2235
2236typedef struct {
2237	uint16 ver;				/* version of this struct */
2238	uint16 len;				/* length in bytes of this structure */
2239	uint32 flags;
2240	chanspec_t chanspec;			/* txpwr report for this channel */
2241	chanspec_t local_chanspec;		/* channel on which we are associated */
2242	uint32     buflen;			/* ppr buffer length */
2243	uint8      pprbuf[1];			/* Latest target power buffer */
2244} wl_txppr_t;
2245
2246#define WL_TXPPR_VERSION	1
2247#define WL_TXPPR_LENGTH	(sizeof(wl_txppr_t))
2248#define TX_POWER_T_VERSION	44
2249
2250/* Defines used with channel_bandwidth for curpower */
2251#define WL_BW_20MHZ 		0
2252#define WL_BW_40MHZ 		1
2253#define WL_BW_80MHZ 		2
2254#define WL_BW_160MHZ 		3
2255
2256/* tx_power_t.flags bits */
2257#define WL_TX_POWER_F_ENABLED	1
2258#define WL_TX_POWER_F_HW		2
2259#define WL_TX_POWER_F_MIMO		4
2260#define WL_TX_POWER_F_SISO		8
2261#define WL_TX_POWER_F_HT		0x10
2262#define WL_TX_POWER_F_VHT		0x20
2263#define WL_TX_POWER_F_OPENLOOP		0x40
2264
2265typedef struct tx_inst_power {
2266	uint8 txpwr_est_Pout[2];			/* Latest estimate for 2.4 and 5 Ghz */
2267	uint8 txpwr_est_Pout_gofdm;			/* Pwr estimate for 2.4 OFDM */
2268} tx_inst_power_t;
2269
2270#define WL_NUM_TXCHAIN_MAX	4
2271typedef struct wl_txchain_pwr_offsets {
2272	int8 offset[WL_NUM_TXCHAIN_MAX];	/* quarter dBm signed offset for each chain */
2273} wl_txchain_pwr_offsets_t;
2274
2275
2276/* regulatory enforcement levels */
2277#define SPECT_MNGMT_OFF			0		/* both 11h and 11d disabled */
2278#define SPECT_MNGMT_LOOSE_11H		1		/* allow non-11h APs in scan lists */
2279#define SPECT_MNGMT_STRICT_11H		2		/* prune out non-11h APs from scan list */
2280#define SPECT_MNGMT_STRICT_11D		3		/* switch to 802.11D mode */
2281/* SPECT_MNGMT_LOOSE_11H_D - same as SPECT_MNGMT_LOOSE with the exception that Country IE
2282 * adoption is done regardless of capability spectrum_management
2283 */
2284#define SPECT_MNGMT_LOOSE_11H_D		4		/* operation defined above */
2285
2286#define WL_CHAN_VALID_HW	(1 << 0)	/* valid with current HW */
2287#define WL_CHAN_VALID_SW	(1 << 1)	/* valid with current country setting */
2288#define WL_CHAN_BAND_5G		(1 << 2)	/* 5GHz-band channel */
2289#define WL_CHAN_RADAR		(1 << 3)	/* radar sensitive  channel */
2290#define WL_CHAN_INACTIVE	(1 << 4)	/* temporarily inactive due to radar */
2291#define WL_CHAN_PASSIVE		(1 << 5)	/* channel is in passive mode */
2292#define WL_CHAN_RESTRICTED	(1 << 6)	/* restricted use channel */
2293
2294/* BTC mode used by "btc_mode" iovar */
2295#define	WL_BTC_DISABLE		0	/* disable BT coexistence */
2296#define WL_BTC_FULLTDM      1	/* full TDM COEX */
2297#define WL_BTC_ENABLE       1	/* full TDM COEX to maintain backward compatiblity */
2298#define WL_BTC_PREMPT      2    /* full TDM COEX with preemption */
2299#define WL_BTC_LITE        3	/* light weight coex for large isolation platform */
2300#define WL_BTC_PARALLEL		4   /* BT and WLAN run in parallel with separate antenna  */
2301#define WL_BTC_HYBRID		5   /* hybrid coex, only ack is allowed to transmit in BT slot */
2302#define WL_BTC_DEFAULT		8	/* set the default mode for the device */
2303#define WL_INF_BTC_DISABLE      0
2304#define WL_INF_BTC_ENABLE       1
2305#define WL_INF_BTC_AUTO         3
2306
2307/* BTC wire used by "btc_wire" iovar */
2308#define	WL_BTC_DEFWIRE		0	/* use default wire setting */
2309#define WL_BTC_2WIRE		2	/* use 2-wire BTC */
2310#define WL_BTC_3WIRE		3	/* use 3-wire BTC */
2311#define WL_BTC_4WIRE		4	/* use 4-wire BTC */
2312
2313/* BTC flags: BTC configuration that can be set by host */
2314#define WL_BTC_FLAG_PREMPT               (1 << 0)
2315#define WL_BTC_FLAG_BT_DEF               (1 << 1)
2316#define WL_BTC_FLAG_ACTIVE_PROT          (1 << 2)
2317#define WL_BTC_FLAG_SIM_RSP              (1 << 3)
2318#define WL_BTC_FLAG_PS_PROTECT           (1 << 4)
2319#define WL_BTC_FLAG_SIM_TX_LP	         (1 << 5)
2320#define WL_BTC_FLAG_ECI                  (1 << 6)
2321#define WL_BTC_FLAG_LIGHT                (1 << 7)
2322#define WL_BTC_FLAG_PARALLEL             (1 << 8)
2323
2324#define WL_PORT_VAL		0x00001000
2325#define WL_PHYCAL_VAL		0x00100000	/* retired in TOT on 6/10/2009 */
2326#define WL_MPC_VAL		0x00400000
2327#define WL_APSTA_VAL		0x00800000
2328#define WL_DFS_VAL		0x01000000
2329#define WL_BA_VAL		0x02000000	/* retired in TOT on 6/14/2010 */
2330#define WL_MBSS_VAL		0x04000000
2331#define WL_CAC_VAL		0x08000000
2332#define WL_AMSDU_VAL		0x10000000
2333#define WL_AMPDU_VAL		0x20000000
2334#define WL_FFPLD_VAL		0x40000000
2335
2336/* wl_msg_level is full. For new bits take the next one and AND with
2337 * wl_msg_level2 in wl_dbg.h
2338 */
2339#define WL_DPT_VAL 		0x00000001
2340#define WL_SCAN_VAL		0x00000002
2341#define WL_WOWL_VAL		0x00000004
2342#define WL_COEX_VAL		0x00000008
2343#define WL_RTDC_VAL		0x00000010
2344#define WL_PROTO_VAL		0x00000020
2345#define WL_BTA_VAL		0x00000040
2346#define WL_CHANINT_VAL		0x00000080
2347#define WL_WMF_VAL		0x00000100
2348#define WL_P2P_VAL		0x00000200
2349#define WL_ITFR_VAL		0x00000400
2350#define WL_MCHAN_VAL		0x00000800
2351#define WL_TDLS_VAL		0x00001000
2352#define WL_MCNX_VAL		0x00002000
2353#define WL_PROT_VAL		0x00004000
2354#define WL_PSTA_VAL		0x00008000
2355#define WL_TSO_VAL		0x00010000
2356#define WL_TRF_MGMT_VAL		0x00020000
2357#define WL_LPC_VAL	        0x00040000
2358#define WL_L2FILTER_VAL		0x00080000
2359#define WL_TXBF_VAL		0x00100000
2360#define WL_P2PO_VAL		0x00200000
2361/* Space reserved for conflicting message levels from trunk */
2362#define WL_WNM_VAL		0x04000000
2363#define WL_AWDL_VAL		0x08000000
2364#define WL_PWRSEL_VAL		0x10000000
2365#define WL_NET_DETECT_VAL	0x20000000
2366#define WL_PCIE_VAL		0x40000000
2367/* Enterprise-specific debug trace flags. Each value
2368 * here should have a corresponding entry in wl_emsgs[] in wlu.c.
2369 * No two trace flags may have the same value. */
2370#define WLENT_QOS_VAL         0x1
2371#define WLENT_PROBSUP_VAL     0x2
2372#define WLENT_EVENT_VAL       0x4
2373#define WLENT_80211RAW_VAL    0x8
2374
2375/* use top-bit for WL_TIME_STAMP_VAL because this is a modifier
2376 * rather than a message-type of its own
2377 */
2378#define WL_TIMESTAMP_VAL        0x80000000
2379
2380/* max # of leds supported by GPIO (gpio pin# == led index#) */
2381#define	WL_LED_NUMGPIO		32	/* gpio 0-31 */
2382
2383/* led per-pin behaviors */
2384#define	WL_LED_OFF		0		/* always off */
2385#define	WL_LED_ON		1		/* always on */
2386#define	WL_LED_ACTIVITY		2		/* activity */
2387#define	WL_LED_RADIO		3		/* radio enabled */
2388#define	WL_LED_ARADIO		4		/* 5  Ghz radio enabled */
2389#define	WL_LED_BRADIO		5		/* 2.4Ghz radio enabled */
2390#define	WL_LED_BGMODE		6		/* on if gmode, off if bmode */
2391#define	WL_LED_WI1		7
2392#define	WL_LED_WI2		8
2393#define	WL_LED_WI3		9
2394#define	WL_LED_ASSOC		10		/* associated state indicator */
2395#define	WL_LED_INACTIVE		11		/* null behavior (clears default behavior) */
2396#define	WL_LED_ASSOCACT		12		/* on when associated; blink fast for activity */
2397#define WL_LED_WI4		13
2398#define WL_LED_WI5		14
2399#define	WL_LED_BLINKSLOW	15		/* blink slow */
2400#define	WL_LED_BLINKMED		16		/* blink med */
2401#define	WL_LED_BLINKFAST	17		/* blink fast */
2402#define	WL_LED_BLINKCUSTOM	18		/* blink custom */
2403#define	WL_LED_BLINKPERIODIC	19		/* blink periodic (custom 1000ms / off 400ms) */
2404#define WL_LED_ASSOC_WITH_SEC 	20		/* when connected with security */
2405						/* keep on for 300 sec */
2406#define WL_LED_START_OFF 	21		/* off upon boot, could be turned on later */
2407#define WL_LED_WI6		22
2408#define WL_LED_WI7		23
2409#define WL_LED_WI8		24
2410#define	WL_LED_NUMBEHAVIOR	25
2411
2412/* led behavior numeric value format */
2413#define	WL_LED_BEH_MASK		0x7f		/* behavior mask */
2414#define	WL_LED_AL_MASK		0x80		/* activelow (polarity) bit */
2415
2416#define WL_NUMCHANNELS		64
2417
2418/* max number of chanspecs (used by the iovar to calc. buf space) */
2419#define WL_NUMCHANSPECS 110
2420
2421/* WDS link local endpoint WPA role */
2422#define WL_WDS_WPA_ROLE_AUTH	0	/* authenticator */
2423#define WL_WDS_WPA_ROLE_SUP	1	/* supplicant */
2424#define WL_WDS_WPA_ROLE_AUTO	255	/* auto, based on mac addr value */
2425
2426/* number of bytes needed to define a 128-bit mask for MAC event reporting */
2427#define WL_EVENTING_MASK_LEN	((WLC_E_LAST + 7) / 8)
2428
2429/*
2430 * Join preference iovar value is an array of tuples. Each tuple has a one-byte type,
2431 * a one-byte length, and a variable length value.  RSSI type tuple must be present
2432 * in the array.
2433 *
2434 * Types are defined in "join preference types" section.
2435 *
2436 * Length is the value size in octets. It is reserved for WL_JOIN_PREF_WPA type tuple
2437 * and must be set to zero.
2438 *
2439 * Values are defined below.
2440 *
2441 * 1. RSSI - 2 octets
2442 * offset 0: reserved
2443 * offset 1: reserved
2444 *
2445 * 2. WPA - 2 + 12 * n octets (n is # tuples defined below)
2446 * offset 0: reserved
2447 * offset 1: # of tuples
2448 * offset 2: tuple 1
2449 * offset 14: tuple 2
2450 * ...
2451 * offset 2 + 12 * (n - 1) octets: tuple n
2452 *
2453 * struct wpa_cfg_tuple {
2454 *   uint8 akm[DOT11_OUI_LEN+1];     akm suite
2455 *   uint8 ucipher[DOT11_OUI_LEN+1]; unicast cipher suite
2456 *   uint8 mcipher[DOT11_OUI_LEN+1]; multicast cipher suite
2457 * };
2458 *
2459 * multicast cipher suite can be specified as a specific cipher suite or WL_WPA_ACP_MCS_ANY.
2460 *
2461 * 3. BAND - 2 octets
2462 * offset 0: reserved
2463 * offset 1: see "band preference" and "band types"
2464 *
2465 * 4. BAND RSSI - 2 octets
2466 * offset 0: band types
2467 * offset 1: +ve RSSI boost balue in dB
2468 */
2469
2470/* join preference types */
2471#define WL_JOIN_PREF_RSSI	1	/* by RSSI */
2472#define WL_JOIN_PREF_WPA	2	/* by akm and ciphers */
2473#define WL_JOIN_PREF_BAND	3	/* by 802.11 band */
2474#define WL_JOIN_PREF_RSSI_DELTA	4	/* by 802.11 band only if RSSI delta condition matches */
2475#define WL_JOIN_PREF_TRANS_PREF	5	/* defined by requesting AP */
2476
2477/* band preference */
2478
2479/* any multicast cipher suite */
2480#define WL_WPA_ACP_MCS_ANY	"\x00\x00\x00\x00"
2481
2482struct tsinfo_arg {
2483	uint8 octets[3];
2484};
2485#endif /* LINUX_POSTMOGRIFY_REMOVAL */
2486
2487#define	NFIFO			6	/* # tx/rx fifopairs */
2488
2489#define	WL_CNT_T_VERSION	9	/* current version of wl_cnt_t struct */
2490
2491typedef struct {
2492	uint16	version;	/* see definition of WL_CNT_T_VERSION */
2493	uint16	length;		/* length of entire structure */
2494
2495	/* transmit stat counters */
2496	uint32	txframe;	/* tx data frames */
2497	uint32	txbyte;		/* tx data bytes */
2498	uint32	txretrans;	/* tx mac retransmits */
2499	uint32	txerror;	/* tx data errors (derived: sum of others) */
2500	uint32	txctl;		/* tx management frames */
2501	uint32	txprshort;	/* tx short preamble frames */
2502	uint32	txserr;		/* tx status errors */
2503	uint32	txnobuf;	/* tx out of buffers errors */
2504	uint32	txnoassoc;	/* tx discard because we're not associated */
2505	uint32	txrunt;		/* tx runt frames */
2506	uint32	txchit;		/* tx header cache hit (fastpath) */
2507	uint32	txcmiss;	/* tx header cache miss (slowpath) */
2508
2509	/* transmit chip error counters */
2510	uint32	txuflo;		/* tx fifo underflows */
2511	uint32	txphyerr;	/* tx phy errors (indicated in tx status) */
2512	uint32	txphycrs;
2513
2514	/* receive stat counters */
2515	uint32	rxframe;	/* rx data frames */
2516	uint32	rxbyte;		/* rx data bytes */
2517	uint32	rxerror;	/* rx data errors (derived: sum of others) */
2518	uint32	rxctl;		/* rx management frames */
2519	uint32	rxnobuf;	/* rx out of buffers errors */
2520	uint32	rxnondata;	/* rx non data frames in the data channel errors */
2521	uint32	rxbadds;	/* rx bad DS errors */
2522	uint32	rxbadcm;	/* rx bad control or management frames */
2523	uint32	rxfragerr;	/* rx fragmentation errors */
2524	uint32	rxrunt;		/* rx runt frames */
2525	uint32	rxgiant;	/* rx giant frames */
2526	uint32	rxnoscb;	/* rx no scb error */
2527	uint32	rxbadproto;	/* rx invalid frames */
2528	uint32	rxbadsrcmac;	/* rx frames with Invalid Src Mac */
2529	uint32	rxbadda;	/* rx frames tossed for invalid da */
2530	uint32	rxfilter;	/* rx frames filtered out */
2531
2532	/* receive chip error counters */
2533	uint32	rxoflo;		/* rx fifo overflow errors */
2534	uint32	rxuflo[NFIFO];	/* rx dma descriptor underflow errors */
2535
2536	uint32	d11cnt_txrts_off;	/* d11cnt txrts value when reset d11cnt */
2537	uint32	d11cnt_rxcrc_off;	/* d11cnt rxcrc value when reset d11cnt */
2538	uint32	d11cnt_txnocts_off;	/* d11cnt txnocts value when reset d11cnt */
2539
2540	/* misc counters */
2541	uint32	dmade;		/* tx/rx dma descriptor errors */
2542	uint32	dmada;		/* tx/rx dma data errors */
2543	uint32	dmape;		/* tx/rx dma descriptor protocol errors */
2544	uint32	reset;		/* reset count */
2545	uint32	tbtt;		/* cnts the TBTT int's */
2546	uint32	txdmawar;
2547	uint32	pkt_callback_reg_fail;	/* callbacks register failure */
2548
2549	/* MAC counters: 32-bit version of d11.h's macstat_t */
2550	uint32	txallfrm;	/* total number of frames sent, incl. Data, ACK, RTS, CTS,
2551				 * Control Management (includes retransmissions)
2552				 */
2553	uint32	txrtsfrm;	/* number of RTS sent out by the MAC */
2554	uint32	txctsfrm;	/* number of CTS sent out by the MAC */
2555	uint32	txackfrm;	/* number of ACK frames sent out */
2556	uint32	txdnlfrm;	/* Not used */
2557	uint32	txbcnfrm;	/* beacons transmitted */
2558	uint32	txfunfl[6];	/* per-fifo tx underflows */
2559	uint32	rxtoolate;	/* receive too late */
2560	uint32  txfbw;		/* transmit at fallback bw (dynamic bw) */
2561	uint32	txtplunfl;	/* Template underflows (mac was too slow to transmit ACK/CTS
2562				 * or BCN)
2563				 */
2564	uint32	txphyerror;	/* Transmit phy error, type of error is reported in tx-status for
2565				 * driver enqueued frames
2566				 */
2567	uint32	rxfrmtoolong;	/* Received frame longer than legal limit (2346 bytes) */
2568	uint32	rxfrmtooshrt;	/* Received frame did not contain enough bytes for its frame type */
2569	uint32	rxinvmachdr;	/* Either the protocol version != 0 or frame type not
2570				 * data/control/management
2571				 */
2572	uint32	rxbadfcs;	/* number of frames for which the CRC check failed in the MAC */
2573	uint32	rxbadplcp;	/* parity check of the PLCP header failed */
2574	uint32	rxcrsglitch;	/* PHY was able to correlate the preamble but not the header */
2575	uint32	rxstrt;		/* Number of received frames with a good PLCP
2576				 * (i.e. passing parity check)
2577				 */
2578	uint32	rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
2579	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
2580	uint32	rxcfrmucast;	/* number of received CNTRL frames with good FCS and matching RA */
2581	uint32	rxrtsucast;	/* number of unicast RTS addressed to the MAC (good FCS) */
2582	uint32	rxctsucast;	/* number of unicast CTS addressed to the MAC (good FCS) */
2583	uint32	rxackucast;	/* number of ucast ACKS received (good FCS) */
2584	uint32	rxdfrmocast;	/* number of received DATA frames (good FCS and not matching RA) */
2585	uint32	rxmfrmocast;	/* number of received MGMT frames (good FCS and not matching RA) */
2586	uint32	rxcfrmocast;	/* number of received CNTRL frame (good FCS and not matching RA) */
2587	uint32	rxrtsocast;	/* number of received RTS not addressed to the MAC */
2588	uint32	rxctsocast;	/* number of received CTS not addressed to the MAC */
2589	uint32	rxdfrmmcast;	/* number of RX Data multicast frames received by the MAC */
2590	uint32	rxmfrmmcast;	/* number of RX Management multicast frames received by the MAC */
2591	uint32	rxcfrmmcast;	/* number of RX Control multicast frames received by the MAC
2592				 * (unlikely to see these)
2593				 */
2594	uint32	rxbeaconmbss;	/* beacons received from member of BSS */
2595	uint32	rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
2596				  * other BSS (WDS FRAME)
2597				  */
2598	uint32	rxbeaconobss;	/* beacons received from other BSS */
2599	uint32	rxrsptmout;	/* Number of response timeouts for transmitted frames
2600				 * expecting a response
2601				 */
2602	uint32	bcntxcancl;	/* transmit beacons canceled due to receipt of beacon (IBSS) */
2603	uint32	rxf0ovfl;	/* Number of receive fifo 0 overflows */
2604	uint32	rxf1ovfl;	/* Number of receive fifo 1 overflows (obsolete) */
2605	uint32	rxf2ovfl;	/* Number of receive fifo 2 overflows (obsolete) */
2606	uint32	txsfovfl;	/* Number of transmit status fifo overflows (obsolete) */
2607	uint32	pmqovfl;	/* Number of PMQ overflows */
2608	uint32	rxcgprqfrm;	/* Number of received Probe requests that made it into
2609				 * the PRQ fifo
2610				 */
2611	uint32	rxcgprsqovfl;	/* Rx Probe Request Que overflow in the AP */
2612	uint32	txcgprsfail;	/* Tx Probe Response Fail. AP sent probe response but did
2613				 * not get ACK
2614				 */
2615	uint32	txcgprssuc;	/* Tx Probe Response Success (ACK was received) */
2616	uint32	prs_timeout;	/* Number of probe requests that were dropped from the PRQ
2617				 * fifo because a probe response could not be sent out within
2618				 * the time limit defined in M_PRS_MAXTIME
2619				 */
2620	uint32	rxnack;		/* obsolete */
2621	uint32	frmscons;	/* obsolete */
2622	uint32  txnack;		/* obsolete */
2623	uint32	rxback;		/* blockack rxcnt */
2624	uint32	txback;		/* blockack txcnt */
2625
2626	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2627	uint32	txfrag;		/* dot11TransmittedFragmentCount */
2628	uint32	txmulti;	/* dot11MulticastTransmittedFrameCount */
2629	uint32	txfail;		/* dot11FailedCount */
2630	uint32	txretry;	/* dot11RetryCount */
2631	uint32	txretrie;	/* dot11MultipleRetryCount */
2632	uint32	rxdup;		/* dot11FrameduplicateCount */
2633	uint32	txrts;		/* dot11RTSSuccessCount */
2634	uint32	txnocts;	/* dot11RTSFailureCount */
2635	uint32	txnoack;	/* dot11ACKFailureCount */
2636	uint32	rxfrag;		/* dot11ReceivedFragmentCount */
2637	uint32	rxmulti;	/* dot11MulticastReceivedFrameCount */
2638	uint32	rxcrc;		/* dot11FCSErrorCount */
2639	uint32	txfrmsnt;	/* dot11TransmittedFrameCount (bogus MIB?) */
2640	uint32	rxundec;	/* dot11WEPUndecryptableCount */
2641
2642	/* WPA2 counters (see rxundec for DecryptFailureCount) */
2643	uint32	tkipmicfaill;	/* TKIPLocalMICFailures */
2644	uint32	tkipcntrmsr;	/* TKIPCounterMeasuresInvoked */
2645	uint32	tkipreplay;	/* TKIPReplays */
2646	uint32	ccmpfmterr;	/* CCMPFormatErrors */
2647	uint32	ccmpreplay;	/* CCMPReplays */
2648	uint32	ccmpundec;	/* CCMPDecryptErrors */
2649	uint32	fourwayfail;	/* FourWayHandshakeFailures */
2650	uint32	wepundec;	/* dot11WEPUndecryptableCount */
2651	uint32	wepicverr;	/* dot11WEPICVErrorCount */
2652	uint32	decsuccess;	/* DecryptSuccessCount */
2653	uint32	tkipicverr;	/* TKIPICVErrorCount */
2654	uint32	wepexcluded;	/* dot11WEPExcludedCount */
2655
2656	uint32	txchanrej;	/* Tx frames suppressed due to channel rejection */
2657	uint32	psmwds;		/* Count PSM watchdogs */
2658	uint32	phywatchdog;	/* Count Phy watchdogs (triggered by ucode) */
2659
2660	/* MBSS counters, AP only */
2661	uint32	prq_entries_handled;	/* PRQ entries read in */
2662	uint32	prq_undirected_entries;	/*    which were bcast bss & ssid */
2663	uint32	prq_bad_entries;	/*    which could not be translated to info */
2664	uint32	atim_suppress_count;	/* TX suppressions on ATIM fifo */
2665	uint32	bcn_template_not_ready;	/* Template marked in use on send bcn ... */
2666	uint32	bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
2667	uint32	late_tbtt_dpc;	/* TBTT DPC did not happen in time */
2668
2669	/* per-rate receive stat counters */
2670	uint32  rx1mbps;	/* packets rx at 1Mbps */
2671	uint32  rx2mbps;	/* packets rx at 2Mbps */
2672	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
2673	uint32  rx6mbps;	/* packets rx at 6Mbps */
2674	uint32  rx9mbps;	/* packets rx at 9Mbps */
2675	uint32  rx11mbps;	/* packets rx at 11Mbps */
2676	uint32  rx12mbps;	/* packets rx at 12Mbps */
2677	uint32  rx18mbps;	/* packets rx at 18Mbps */
2678	uint32  rx24mbps;	/* packets rx at 24Mbps */
2679	uint32  rx36mbps;	/* packets rx at 36Mbps */
2680	uint32  rx48mbps;	/* packets rx at 48Mbps */
2681	uint32  rx54mbps;	/* packets rx at 54Mbps */
2682	uint32  rx108mbps; 	/* packets rx at 108mbps */
2683	uint32  rx162mbps;	/* packets rx at 162mbps */
2684	uint32  rx216mbps;	/* packets rx at 216 mbps */
2685	uint32  rx270mbps;	/* packets rx at 270 mbps */
2686	uint32  rx324mbps;	/* packets rx at 324 mbps */
2687	uint32  rx378mbps;	/* packets rx at 378 mbps */
2688	uint32  rx432mbps;	/* packets rx at 432 mbps */
2689	uint32  rx486mbps;	/* packets rx at 486 mbps */
2690	uint32  rx540mbps;	/* packets rx at 540 mbps */
2691
2692	/* pkteng rx frame stats */
2693	uint32	pktengrxducast; /* unicast frames rxed by the pkteng code */
2694	uint32	pktengrxdmcast; /* multicast frames rxed by the pkteng code */
2695
2696	uint32	rfdisable;	/* count of radio disables */
2697	uint32	bphy_rxcrsglitch;	/* PHY count of bphy glitches */
2698	uint32  bphy_badplcp;
2699
2700	uint32	txexptime;	/* Tx frames suppressed due to timer expiration */
2701
2702	uint32	txmpdu_sgi;	/* count for sgi transmit */
2703	uint32	rxmpdu_sgi;	/* count for sgi received */
2704	uint32	txmpdu_stbc;	/* count for stbc transmit */
2705	uint32	rxmpdu_stbc;	/* count for stbc received */
2706
2707	uint32	rxundec_mcst;	/* dot11WEPUndecryptableCount */
2708
2709	/* WPA2 counters (see rxundec for DecryptFailureCount) */
2710	uint32	tkipmicfaill_mcst;	/* TKIPLocalMICFailures */
2711	uint32	tkipcntrmsr_mcst;	/* TKIPCounterMeasuresInvoked */
2712	uint32	tkipreplay_mcst;	/* TKIPReplays */
2713	uint32	ccmpfmterr_mcst;	/* CCMPFormatErrors */
2714	uint32	ccmpreplay_mcst;	/* CCMPReplays */
2715	uint32	ccmpundec_mcst;	/* CCMPDecryptErrors */
2716	uint32	fourwayfail_mcst;	/* FourWayHandshakeFailures */
2717	uint32	wepundec_mcst;	/* dot11WEPUndecryptableCount */
2718	uint32	wepicverr_mcst;	/* dot11WEPICVErrorCount */
2719	uint32	decsuccess_mcst;	/* DecryptSuccessCount */
2720	uint32	tkipicverr_mcst;	/* TKIPICVErrorCount */
2721	uint32	wepexcluded_mcst;	/* dot11WEPExcludedCount */
2722
2723	uint32	dma_hang;	/* count for dma hang */
2724	uint32	reinit;		/* count for reinit */
2725
2726	uint32  pstatxucast;	/* count of ucast frames xmitted on all psta assoc */
2727	uint32  pstatxnoassoc;	/* count of txnoassoc frames xmitted on all psta assoc */
2728	uint32  pstarxucast;	/* count of ucast frames received on all psta assoc */
2729	uint32  pstarxbcmc;	/* count of bcmc frames received on all psta */
2730	uint32  pstatxbcmc;	/* count of bcmc frames transmitted on all psta */
2731
2732	uint32  cso_passthrough; /* hw cso required but passthrough */
2733	uint32 	cso_normal;	/* hw cso hdr for normal process */
2734	uint32	chained;	/* number of frames chained */
2735	uint32	chainedsz1;	/* number of chain size 1 frames */
2736	uint32	unchained;	/* number of frames not chained */
2737	uint32	maxchainsz;	/* max chain size so far */
2738	uint32	currchainsz;	/* current chain size */
2739	uint32	rxdrop20s;	/* drop secondary cnt */
2740	uint32	pciereset;	/* Secondary Bus Reset issued by driver */
2741	uint32	cfgrestore;	/* configspace restore by driver */
2742} wl_cnt_t;
2743
2744#ifndef LINUX_POSTMOGRIFY_REMOVAL
2745typedef struct {
2746	uint16  version;    /* see definition of WL_CNT_T_VERSION */
2747	uint16  length;     /* length of entire structure */
2748
2749	/* transmit stat counters */
2750	uint32  txframe;    /* tx data frames */
2751	uint32  txbyte;     /* tx data bytes */
2752	uint32  txretrans;  /* tx mac retransmits */
2753	uint32  txerror;    /* tx data errors (derived: sum of others) */
2754	uint32  txctl;      /* tx management frames */
2755	uint32  txprshort;  /* tx short preamble frames */
2756	uint32  txserr;     /* tx status errors */
2757	uint32  txnobuf;    /* tx out of buffers errors */
2758	uint32  txnoassoc;  /* tx discard because we're not associated */
2759	uint32  txrunt;     /* tx runt frames */
2760	uint32  txchit;     /* tx header cache hit (fastpath) */
2761	uint32  txcmiss;    /* tx header cache miss (slowpath) */
2762
2763	/* transmit chip error counters */
2764	uint32  txuflo;     /* tx fifo underflows */
2765	uint32  txphyerr;   /* tx phy errors (indicated in tx status) */
2766	uint32  txphycrs;
2767
2768	/* receive stat counters */
2769	uint32  rxframe;    /* rx data frames */
2770	uint32  rxbyte;     /* rx data bytes */
2771	uint32  rxerror;    /* rx data errors (derived: sum of others) */
2772	uint32  rxctl;      /* rx management frames */
2773	uint32  rxnobuf;    /* rx out of buffers errors */
2774	uint32  rxnondata;  /* rx non data frames in the data channel errors */
2775	uint32  rxbadds;    /* rx bad DS errors */
2776	uint32  rxbadcm;    /* rx bad control or management frames */
2777	uint32  rxfragerr;  /* rx fragmentation errors */
2778	uint32  rxrunt;     /* rx runt frames */
2779	uint32  rxgiant;    /* rx giant frames */
2780	uint32  rxnoscb;    /* rx no scb error */
2781	uint32  rxbadproto; /* rx invalid frames */
2782	uint32  rxbadsrcmac;    /* rx frames with Invalid Src Mac */
2783	uint32  rxbadda;    /* rx frames tossed for invalid da */
2784	uint32  rxfilter;   /* rx frames filtered out */
2785
2786	/* receive chip error counters */
2787	uint32  rxoflo;     /* rx fifo overflow errors */
2788	uint32  rxuflo[NFIFO];  /* rx dma descriptor underflow errors */
2789
2790	uint32  d11cnt_txrts_off;   /* d11cnt txrts value when reset d11cnt */
2791	uint32  d11cnt_rxcrc_off;   /* d11cnt rxcrc value when reset d11cnt */
2792	uint32  d11cnt_txnocts_off; /* d11cnt txnocts value when reset d11cnt */
2793
2794	/* misc counters */
2795	uint32  dmade;      /* tx/rx dma descriptor errors */
2796	uint32  dmada;      /* tx/rx dma data errors */
2797	uint32  dmape;      /* tx/rx dma descriptor protocol errors */
2798	uint32  reset;      /* reset count */
2799	uint32  tbtt;       /* cnts the TBTT int's */
2800	uint32  txdmawar;
2801	uint32  pkt_callback_reg_fail;  /* callbacks register failure */
2802
2803	/* MAC counters: 32-bit version of d11.h's macstat_t */
2804	uint32  txallfrm;   /* total number of frames sent, incl. Data, ACK, RTS, CTS,
2805			     * Control Management (includes retransmissions)
2806			     */
2807	uint32  txrtsfrm;   /* number of RTS sent out by the MAC */
2808	uint32  txctsfrm;   /* number of CTS sent out by the MAC */
2809	uint32  txackfrm;   /* number of ACK frames sent out */
2810	uint32  txdnlfrm;   /* Not used */
2811	uint32  txbcnfrm;   /* beacons transmitted */
2812	uint32  txfunfl[6]; /* per-fifo tx underflows */
2813	uint32	rxtoolate;	/* receive too late */
2814	uint32  txfbw;	    /* transmit at fallback bw (dynamic bw) */
2815	uint32  txtplunfl;  /* Template underflows (mac was too slow to transmit ACK/CTS
2816			     * or BCN)
2817			     */
2818	uint32  txphyerror; /* Transmit phy error, type of error is reported in tx-status for
2819			     * driver enqueued frames
2820			     */
2821	uint32  rxfrmtoolong;   /* Received frame longer than legal limit (2346 bytes) */
2822	uint32  rxfrmtooshrt;   /* Received frame did not contain enough bytes for its frame type */
2823	uint32  rxinvmachdr;    /* Either the protocol version != 0 or frame type not
2824				 * data/control/management
2825			   */
2826	uint32  rxbadfcs;   /* number of frames for which the CRC check failed in the MAC */
2827	uint32  rxbadplcp;  /* parity check of the PLCP header failed */
2828	uint32  rxcrsglitch;    /* PHY was able to correlate the preamble but not the header */
2829	uint32  rxstrt;     /* Number of received frames with a good PLCP
2830			     * (i.e. passing parity check)
2831			     */
2832	uint32  rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
2833	uint32  rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
2834	uint32  rxcfrmucast;    /* number of received CNTRL frames with good FCS and matching RA */
2835	uint32  rxrtsucast; /* number of unicast RTS addressed to the MAC (good FCS) */
2836	uint32  rxctsucast; /* number of unicast CTS addressed to the MAC (good FCS) */
2837	uint32  rxackucast; /* number of ucast ACKS received (good FCS) */
2838	uint32  rxdfrmocast;    /* number of received DATA frames (good FCS and not matching RA) */
2839	uint32  rxmfrmocast;    /* number of received MGMT frames (good FCS and not matching RA) */
2840	uint32  rxcfrmocast;    /* number of received CNTRL frame (good FCS and not matching RA) */
2841	uint32  rxrtsocast; /* number of received RTS not addressed to the MAC */
2842	uint32  rxctsocast; /* number of received CTS not addressed to the MAC */
2843	uint32  rxdfrmmcast;    /* number of RX Data multicast frames received by the MAC */
2844	uint32  rxmfrmmcast;    /* number of RX Management multicast frames received by the MAC */
2845	uint32  rxcfrmmcast;    /* number of RX Control multicast frames received by the MAC
2846				 * (unlikely to see these)
2847				 */
2848	uint32  rxbeaconmbss;   /* beacons received from member of BSS */
2849	uint32  rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
2850				  * other BSS (WDS FRAME)
2851				  */
2852	uint32  rxbeaconobss;   /* beacons received from other BSS */
2853	uint32  rxrsptmout; /* Number of response timeouts for transmitted frames
2854			     * expecting a response
2855			     */
2856	uint32  bcntxcancl; /* transmit beacons canceled due to receipt of beacon (IBSS) */
2857	uint32  rxf0ovfl;   /* Number of receive fifo 0 overflows */
2858	uint32  rxf1ovfl;   /* Number of receive fifo 1 overflows (obsolete) */
2859	uint32  rxf2ovfl;   /* Number of receive fifo 2 overflows (obsolete) */
2860	uint32  txsfovfl;   /* Number of transmit status fifo overflows (obsolete) */
2861	uint32  pmqovfl;    /* Number of PMQ overflows */
2862	uint32  rxcgprqfrm; /* Number of received Probe requests that made it into
2863			     * the PRQ fifo
2864			     */
2865	uint32  rxcgprsqovfl;   /* Rx Probe Request Que overflow in the AP */
2866	uint32  txcgprsfail;    /* Tx Probe Response Fail. AP sent probe response but did
2867				 * not get ACK
2868				 */
2869	uint32  txcgprssuc; /* Tx Probe Response Success (ACK was received) */
2870	uint32  prs_timeout;    /* Number of probe requests that were dropped from the PRQ
2871				 * fifo because a probe response could not be sent out within
2872				 * the time limit defined in M_PRS_MAXTIME
2873				 */
2874	uint32  rxnack;
2875	uint32  frmscons;
2876	uint32  txnack;		/* obsolete */
2877	uint32	rxback;		/* blockack rxcnt */
2878	uint32	txback;		/* blockack txcnt */
2879
2880	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2881	uint32  txfrag;     /* dot11TransmittedFragmentCount */
2882	uint32  txmulti;    /* dot11MulticastTransmittedFrameCount */
2883	uint32  txfail;     /* dot11FailedCount */
2884	uint32  txretry;    /* dot11RetryCount */
2885	uint32  txretrie;   /* dot11MultipleRetryCount */
2886	uint32  rxdup;      /* dot11FrameduplicateCount */
2887	uint32  txrts;      /* dot11RTSSuccessCount */
2888	uint32  txnocts;    /* dot11RTSFailureCount */
2889	uint32  txnoack;    /* dot11ACKFailureCount */
2890	uint32  rxfrag;     /* dot11ReceivedFragmentCount */
2891	uint32  rxmulti;    /* dot11MulticastReceivedFrameCount */
2892	uint32  rxcrc;      /* dot11FCSErrorCount */
2893	uint32  txfrmsnt;   /* dot11TransmittedFrameCount (bogus MIB?) */
2894	uint32  rxundec;    /* dot11WEPUndecryptableCount */
2895
2896	/* WPA2 counters (see rxundec for DecryptFailureCount) */
2897	uint32  tkipmicfaill;   /* TKIPLocalMICFailures */
2898	uint32  tkipcntrmsr;    /* TKIPCounterMeasuresInvoked */
2899	uint32  tkipreplay; /* TKIPReplays */
2900	uint32  ccmpfmterr; /* CCMPFormatErrors */
2901	uint32  ccmpreplay; /* CCMPReplays */
2902	uint32  ccmpundec;  /* CCMPDecryptErrors */
2903	uint32  fourwayfail;    /* FourWayHandshakeFailures */
2904	uint32  wepundec;   /* dot11WEPUndecryptableCount */
2905	uint32  wepicverr;  /* dot11WEPICVErrorCount */
2906	uint32  decsuccess; /* DecryptSuccessCount */
2907	uint32  tkipicverr; /* TKIPICVErrorCount */
2908	uint32  wepexcluded;    /* dot11WEPExcludedCount */
2909
2910	uint32  rxundec_mcst;   /* dot11WEPUndecryptableCount */
2911
2912	/* WPA2 counters (see rxundec for DecryptFailureCount) */
2913	uint32  tkipmicfaill_mcst;  /* TKIPLocalMICFailures */
2914	uint32  tkipcntrmsr_mcst;   /* TKIPCounterMeasuresInvoked */
2915	uint32  tkipreplay_mcst;    /* TKIPReplays */
2916	uint32  ccmpfmterr_mcst;    /* CCMPFormatErrors */
2917	uint32  ccmpreplay_mcst;    /* CCMPReplays */
2918	uint32  ccmpundec_mcst; /* CCMPDecryptErrors */
2919	uint32  fourwayfail_mcst;   /* FourWayHandshakeFailures */
2920	uint32  wepundec_mcst;  /* dot11WEPUndecryptableCount */
2921	uint32  wepicverr_mcst; /* dot11WEPICVErrorCount */
2922	uint32  decsuccess_mcst;    /* DecryptSuccessCount */
2923	uint32  tkipicverr_mcst;    /* TKIPICVErrorCount */
2924	uint32  wepexcluded_mcst;   /* dot11WEPExcludedCount */
2925
2926	uint32  txchanrej;  /* Tx frames suppressed due to channel rejection */
2927	uint32  txexptime;  /* Tx frames suppressed due to timer expiration */
2928	uint32  psmwds;     /* Count PSM watchdogs */
2929	uint32  phywatchdog;    /* Count Phy watchdogs (triggered by ucode) */
2930
2931	/* MBSS counters, AP only */
2932	uint32  prq_entries_handled;    /* PRQ entries read in */
2933	uint32  prq_undirected_entries; /*    which were bcast bss & ssid */
2934	uint32  prq_bad_entries;    /*    which could not be translated to info */
2935	uint32  atim_suppress_count;    /* TX suppressions on ATIM fifo */
2936	uint32  bcn_template_not_ready; /* Template marked in use on send bcn ... */
2937	uint32  bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
2938	uint32  late_tbtt_dpc;  /* TBTT DPC did not happen in time */
2939
2940	/* per-rate receive stat counters */
2941	uint32  rx1mbps;    /* packets rx at 1Mbps */
2942	uint32  rx2mbps;    /* packets rx at 2Mbps */
2943	uint32  rx5mbps5;   /* packets rx at 5.5Mbps */
2944	uint32  rx6mbps;    /* packets rx at 6Mbps */
2945	uint32  rx9mbps;    /* packets rx at 9Mbps */
2946	uint32  rx11mbps;   /* packets rx at 11Mbps */
2947	uint32  rx12mbps;   /* packets rx at 12Mbps */
2948	uint32  rx18mbps;   /* packets rx at 18Mbps */
2949	uint32  rx24mbps;   /* packets rx at 24Mbps */
2950	uint32  rx36mbps;   /* packets rx at 36Mbps */
2951	uint32  rx48mbps;   /* packets rx at 48Mbps */
2952	uint32  rx54mbps;   /* packets rx at 54Mbps */
2953	uint32  rx108mbps;  /* packets rx at 108mbps */
2954	uint32  rx162mbps;  /* packets rx at 162mbps */
2955	uint32  rx216mbps;  /* packets rx at 216 mbps */
2956	uint32  rx270mbps;  /* packets rx at 270 mbps */
2957	uint32  rx324mbps;  /* packets rx at 324 mbps */
2958	uint32  rx378mbps;  /* packets rx at 378 mbps */
2959	uint32  rx432mbps;  /* packets rx at 432 mbps */
2960	uint32  rx486mbps;  /* packets rx at 486 mbps */
2961	uint32  rx540mbps;  /* packets rx at 540 mbps */
2962
2963	/* pkteng rx frame stats */
2964	uint32  pktengrxducast; /* unicast frames rxed by the pkteng code */
2965	uint32  pktengrxdmcast; /* multicast frames rxed by the pkteng code */
2966
2967	uint32  rfdisable;  /* count of radio disables */
2968	uint32  bphy_rxcrsglitch;   /* PHY count of bphy glitches */
2969	uint32  bphy_badplcp;
2970
2971	uint32  txmpdu_sgi; /* count for sgi transmit */
2972	uint32  rxmpdu_sgi; /* count for sgi received */
2973	uint32  txmpdu_stbc;    /* count for stbc transmit */
2974	uint32  rxmpdu_stbc;    /* count for stbc received */
2975
2976	uint32	rxdrop20s;	/* drop secondary cnt */
2977
2978} wl_cnt_ver_six_t;
2979
2980#define	WL_DELTA_STATS_T_VERSION	2	/* current version of wl_delta_stats_t struct */
2981
2982typedef struct {
2983	uint16 version;     /* see definition of WL_DELTA_STATS_T_VERSION */
2984	uint16 length;      /* length of entire structure */
2985
2986	/* transmit stat counters */
2987	uint32 txframe;     /* tx data frames */
2988	uint32 txbyte;      /* tx data bytes */
2989	uint32 txretrans;   /* tx mac retransmits */
2990	uint32 txfail;      /* tx failures */
2991
2992	/* receive stat counters */
2993	uint32 rxframe;     /* rx data frames */
2994	uint32 rxbyte;      /* rx data bytes */
2995
2996	/* per-rate receive stat counters */
2997	uint32  rx1mbps;	/* packets rx at 1Mbps */
2998	uint32  rx2mbps;	/* packets rx at 2Mbps */
2999	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
3000	uint32  rx6mbps;	/* packets rx at 6Mbps */
3001	uint32  rx9mbps;	/* packets rx at 9Mbps */
3002	uint32  rx11mbps;	/* packets rx at 11Mbps */
3003	uint32  rx12mbps;	/* packets rx at 12Mbps */
3004	uint32  rx18mbps;	/* packets rx at 18Mbps */
3005	uint32  rx24mbps;	/* packets rx at 24Mbps */
3006	uint32  rx36mbps;	/* packets rx at 36Mbps */
3007	uint32  rx48mbps;	/* packets rx at 48Mbps */
3008	uint32  rx54mbps;	/* packets rx at 54Mbps */
3009	uint32  rx108mbps; 	/* packets rx at 108mbps */
3010	uint32  rx162mbps;	/* packets rx at 162mbps */
3011	uint32  rx216mbps;	/* packets rx at 216 mbps */
3012	uint32  rx270mbps;	/* packets rx at 270 mbps */
3013	uint32  rx324mbps;	/* packets rx at 324 mbps */
3014	uint32  rx378mbps;	/* packets rx at 378 mbps */
3015	uint32  rx432mbps;	/* packets rx at 432 mbps */
3016	uint32  rx486mbps;	/* packets rx at 486 mbps */
3017	uint32  rx540mbps;	/* packets rx at 540 mbps */
3018
3019	/* phy stats */
3020	uint32 rxbadplcp;
3021	uint32 rxcrsglitch;
3022	uint32 bphy_rxcrsglitch;
3023	uint32 bphy_badplcp;
3024
3025} wl_delta_stats_t;
3026#endif /* LINUX_POSTMOGRIFY_REMOVAL */
3027
3028#define WL_WME_CNT_VERSION	1	/* current version of wl_wme_cnt_t */
3029
3030typedef struct {
3031	uint32 packets;
3032	uint32 bytes;
3033} wl_traffic_stats_t;
3034
3035typedef struct {
3036	uint16	version;	/* see definition of WL_WME_CNT_VERSION */
3037	uint16	length;		/* length of entire structure */
3038
3039	wl_traffic_stats_t tx[AC_COUNT];	/* Packets transmitted */
3040	wl_traffic_stats_t tx_failed[AC_COUNT];	/* Packets dropped or failed to transmit */
3041	wl_traffic_stats_t rx[AC_COUNT];	/* Packets received */
3042	wl_traffic_stats_t rx_failed[AC_COUNT];	/* Packets failed to receive */
3043
3044	wl_traffic_stats_t forward[AC_COUNT];	/* Packets forwarded by AP */
3045
3046	wl_traffic_stats_t tx_expired[AC_COUNT];	/* packets dropped due to lifetime expiry */
3047
3048} wl_wme_cnt_t;
3049
3050#ifndef LINUX_POSTMOGRIFY_REMOVAL
3051struct wl_msglevel2 {
3052	uint32 low;
3053	uint32 high;
3054};
3055
3056typedef struct wl_mkeep_alive_pkt {
3057	uint16	version; /* Version for mkeep_alive */
3058	uint16	length; /* length of fixed parameters in the structure */
3059	uint32	period_msec;
3060	uint16	len_bytes;
3061	uint8	keep_alive_id; /* 0 - 3 for N = 4 */
3062	uint8	data[1];
3063} wl_mkeep_alive_pkt_t;
3064
3065#define WL_MKEEP_ALIVE_VERSION		1
3066#define WL_MKEEP_ALIVE_FIXED_LEN	OFFSETOF(wl_mkeep_alive_pkt_t, data)
3067#define WL_MKEEP_ALIVE_PRECISION	500
3068
3069/* TCP Keep-Alive conn struct */
3070typedef struct wl_mtcpkeep_alive_conn_pkt {
3071	struct ether_addr saddr;		/* src mac address */
3072	struct ether_addr daddr;		/* dst mac address */
3073	struct ipv4_addr sipaddr;		/* source IP addr */
3074	struct ipv4_addr dipaddr;		/* dest IP addr */
3075	uint16 sport;				/* src port */
3076	uint16 dport;				/* dest port */
3077	uint32 seq;				/* seq number */
3078	uint32 ack;				/* ACK number */
3079	uint16 tcpwin;				/* TCP window */
3080} wl_mtcpkeep_alive_conn_pkt_t;
3081
3082/* TCP Keep-Alive interval struct */
3083typedef struct wl_mtcpkeep_alive_timers_pkt {
3084	uint16 interval;		/* interval timer */
3085	uint16 retry_interval;		/* retry_interval timer */
3086	uint16 retry_count;		/* retry_count */
3087} wl_mtcpkeep_alive_timers_pkt_t;
3088
3089#ifndef ETHER_MAX_DATA
3090#define ETHER_MAX_DATA	1500
3091#endif /* ETHER_MAX_DATA */
3092
3093typedef struct wake_info {
3094	uint32 wake_reason;
3095	uint32 wake_info_len;		/* size of packet */
3096	uchar  packet[1];
3097} wake_info_t;
3098
3099typedef struct wake_pkt {
3100	uint32 wake_pkt_len;		/* size of packet */
3101	uchar  packet[1];
3102} wake_pkt_t;
3103
3104
3105#define WL_MTCPKEEP_ALIVE_VERSION		1
3106
3107#ifdef WLBA
3108
3109#define WLC_BA_CNT_VERSION  1   /* current version of wlc_ba_cnt_t */
3110
3111/* block ack related stats */
3112typedef struct wlc_ba_cnt {
3113	uint16  version;    /* WLC_BA_CNT_VERSION */
3114	uint16  length;     /* length of entire structure */
3115
3116	/* transmit stat counters */
3117	uint32 txpdu;       /* pdus sent */
3118	uint32 txsdu;       /* sdus sent */
3119	uint32 txfc;        /* tx side flow controlled packets */
3120	uint32 txfci;       /* tx side flow control initiated */
3121	uint32 txretrans;   /* retransmitted pdus */
3122	uint32 txbatimer;   /* ba resend due to timer */
3123	uint32 txdrop;      /* dropped packets */
3124	uint32 txaddbareq;  /* addba req sent */
3125	uint32 txaddbaresp; /* addba resp sent */
3126	uint32 txdelba;     /* delba sent */
3127	uint32 txba;        /* ba sent */
3128	uint32 txbar;       /* bar sent */
3129	uint32 txpad[4];    /* future */
3130
3131	/* receive side counters */
3132	uint32 rxpdu;       /* pdus recd */
3133	uint32 rxqed;       /* pdus buffered before sending up */
3134	uint32 rxdup;       /* duplicate pdus */
3135	uint32 rxnobuf;     /* pdus discarded due to no buf */
3136	uint32 rxaddbareq;  /* addba req recd */
3137	uint32 rxaddbaresp; /* addba resp recd */
3138	uint32 rxdelba;     /* delba recd */
3139	uint32 rxba;        /* ba recd */
3140	uint32 rxbar;       /* bar recd */
3141	uint32 rxinvba;     /* invalid ba recd */
3142	uint32 rxbaholes;   /* ba recd with holes */
3143	uint32 rxunexp;     /* unexpected packets */
3144	uint32 rxpad[4];    /* future */
3145} wlc_ba_cnt_t;
3146#endif /* WLBA */
3147
3148/* structure for per-tid ampdu control */
3149struct ampdu_tid_control {
3150	uint8 tid;			/* tid */
3151	uint8 enable;			/* enable/disable */
3152};
3153
3154/* structure for identifying ea/tid for sending addba/delba */
3155struct ampdu_ea_tid {
3156	struct ether_addr ea;		/* Station address */
3157	uint8 tid;			/* tid */
3158};
3159/* structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
3160struct ampdu_retry_tid {
3161	uint8 tid;	/* tid */
3162	uint8 retry;	/* retry value */
3163};
3164
3165/* Different discovery modes for dpt */
3166#define	DPT_DISCOVERY_MANUAL	0x01	/* manual discovery mode */
3167#define	DPT_DISCOVERY_AUTO	0x02	/* auto discovery mode */
3168#define	DPT_DISCOVERY_SCAN	0x04	/* scan-based discovery mode */
3169
3170/* different path selection values */
3171#define DPT_PATHSEL_AUTO	0	/* auto mode for path selection */
3172#define DPT_PATHSEL_DIRECT	1	/* always use direct DPT path */
3173#define DPT_PATHSEL_APPATH	2	/* always use AP path */
3174
3175/* different ops for deny list */
3176#define DPT_DENY_LIST_ADD 	1	/* add to dpt deny list */
3177#define DPT_DENY_LIST_REMOVE 	2	/* remove from dpt deny list */
3178
3179/* different ops for manual end point */
3180#define DPT_MANUAL_EP_CREATE	1	/* create manual dpt endpoint */
3181#define DPT_MANUAL_EP_MODIFY	2	/* modify manual dpt endpoint */
3182#define DPT_MANUAL_EP_DELETE	3	/* delete manual dpt endpoint */
3183
3184/* structure for dpt iovars */
3185typedef struct dpt_iovar {
3186	struct ether_addr ea;		/* Station address */
3187	uint8 mode;			/* mode: depends on iovar */
3188	uint32 pad;			/* future */
3189} dpt_iovar_t;
3190
3191/* flags to indicate DPT status */
3192#define	DPT_STATUS_ACTIVE	0x01	/* link active (though may be suspended) */
3193#define	DPT_STATUS_AES		0x02	/* link secured through AES encryption */
3194#define	DPT_STATUS_FAILED	0x04	/* DPT link failed */
3195
3196#define	DPT_FNAME_LEN		48	/* Max length of friendly name */
3197
3198typedef struct dpt_status {
3199	uint8 status;			/* flags to indicate status */
3200	uint8 fnlen;			/* length of friendly name */
3201	uchar name[DPT_FNAME_LEN];	/* friendly name */
3202	uint32 rssi;			/* RSSI of the link */
3203	sta_info_t sta;			/* sta info */
3204} dpt_status_t;
3205
3206/* structure for dpt list */
3207typedef struct dpt_list {
3208	uint32 num;			/* number of entries in struct */
3209	dpt_status_t status[1];		/* per station info */
3210} dpt_list_t;
3211
3212/* structure for dpt friendly name */
3213typedef struct dpt_fname {
3214	uint8 len;			/* length of friendly name */
3215	uchar name[DPT_FNAME_LEN];	/* friendly name */
3216} dpt_fname_t;
3217
3218#define BDD_FNAME_LEN       32  /* Max length of friendly name */
3219typedef struct bdd_fname {
3220	uint8 len;          /* length of friendly name */
3221	uchar name[BDD_FNAME_LEN];  /* friendly name */
3222} bdd_fname_t;
3223
3224/* structure for addts arguments */
3225/* For ioctls that take a list of TSPEC */
3226struct tslist {
3227	int count;			/* number of tspecs */
3228	struct tsinfo_arg tsinfo[1];	/* variable length array of tsinfo */
3229};
3230
3231#ifdef WLTDLS
3232/* different ops for manual end point */
3233#define TDLS_MANUAL_EP_CREATE	1	/* create manual dpt endpoint */
3234#define TDLS_MANUAL_EP_MODIFY	2	/* modify manual dpt endpoint */
3235#define TDLS_MANUAL_EP_DELETE	3	/* delete manual dpt endpoint */
3236#define TDLS_MANUAL_EP_PM		4	/*  put dpt endpoint in PM mode */
3237#define TDLS_MANUAL_EP_WAKE		5	/* wake up dpt endpoint from PM */
3238#define TDLS_MANUAL_EP_DISCOVERY	6	/* discover if endpoint is TDLS capable */
3239#define TDLS_MANUAL_EP_CHSW		7	/* channel switch */
3240#define TDLS_MANUAL_EP_WFD_TPQ	8	/* WiFi-Display Tunneled Probe reQuest */
3241
3242/* structure for tdls iovars */
3243typedef struct tdls_iovar {
3244	struct ether_addr ea;		/* Station address */
3245	uint8 mode;			/* mode: depends on iovar */
3246	chanspec_t chanspec;
3247	uint32 pad;			/* future */
3248} tdls_iovar_t;
3249
3250/* modes */
3251#define TDLS_WFD_IE_TX 			0
3252#define TDLS_WFD_IE_RX 			1
3253#define TDLS_WFD_PROBE_IE_TX	2
3254#define TDLS_WFD_PROBE_IE_RX	3
3255#define TDLS_WFD_IE_SIZE 		512
3256/* structure for tdls wfd ie */
3257typedef struct tdls_wfd_ie_iovar {
3258	struct ether_addr ea;		/* Station address */
3259	uint8 mode;
3260	uint16 length;
3261	uint8 data[TDLS_WFD_IE_SIZE];
3262} tdls_wfd_ie_iovar_t;
3263#endif /* WLTDLS */
3264
3265/* structure for addts/delts arguments */
3266typedef struct tspec_arg {
3267	uint16 version;			/* see definition of TSPEC_ARG_VERSION */
3268	uint16 length;			/* length of entire structure */
3269	uint flag;			/* bit field */
3270	/* TSPEC Arguments */
3271	struct tsinfo_arg tsinfo;	/* TS Info bit field */
3272	uint16 nom_msdu_size;		/* (Nominal or fixed) MSDU Size (bytes) */
3273	uint16 max_msdu_size;		/* Maximum MSDU Size (bytes) */
3274	uint min_srv_interval;		/* Minimum Service Interval (us) */
3275	uint max_srv_interval;		/* Maximum Service Interval (us) */
3276	uint inactivity_interval;	/* Inactivity Interval (us) */
3277	uint suspension_interval;	/* Suspension Interval (us) */
3278	uint srv_start_time;		/* Service Start Time (us) */
3279	uint min_data_rate;		/* Minimum Data Rate (bps) */
3280	uint mean_data_rate;		/* Mean Data Rate (bps) */
3281	uint peak_data_rate;		/* Peak Data Rate (bps) */
3282	uint max_burst_size;		/* Maximum Burst Size (bytes) */
3283	uint delay_bound;		/* Delay Bound (us) */
3284	uint min_phy_rate;		/* Minimum PHY Rate (bps) */
3285	uint16 surplus_bw;		/* Surplus Bandwidth Allowance (range 1.0 to 8.0) */
3286	uint16 medium_time;		/* Medium Time (32 us/s periods) */
3287	uint8 dialog_token;		/* dialog token */
3288} tspec_arg_t;
3289
3290/* tspec arg for desired station */
3291typedef	struct tspec_per_sta_arg {
3292	struct ether_addr ea;
3293	struct tspec_arg ts;
3294} tspec_per_sta_arg_t;
3295
3296/* structure for max bandwidth for each access category */
3297typedef	struct wme_max_bandwidth {
3298	uint32	ac[AC_COUNT];	/* max bandwidth for each access category */
3299} wme_max_bandwidth_t;
3300
3301#define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
3302
3303/* current version of wl_tspec_arg_t struct */
3304#define	TSPEC_ARG_VERSION		2	/* current version of wl_tspec_arg_t struct */
3305#define TSPEC_ARG_LENGTH		55	/* argument length from tsinfo to medium_time */
3306#define TSPEC_DEFAULT_DIALOG_TOKEN	42	/* default dialog token */
3307#define TSPEC_DEFAULT_SBW_FACTOR	0x3000	/* default surplus bw */
3308
3309
3310#define WL_WOWL_KEEPALIVE_MAX_PACKET_SIZE  80
3311#define WLC_WOWL_MAX_KEEPALIVE	2
3312
3313/* define for flag */
3314#define TSPEC_PENDING		0	/* TSPEC pending */
3315#define TSPEC_ACCEPTED		1	/* TSPEC accepted */
3316#define TSPEC_REJECTED		2	/* TSPEC rejected */
3317#define TSPEC_UNKNOWN		3	/* TSPEC unknown */
3318#define TSPEC_STATUS_MASK	7	/* TSPEC status mask */
3319
3320
3321/* Software feature flag defines used by wlfeatureflag */
3322#ifdef WLAFTERBURNER
3323#define WL_SWFL_ABBFL       0x0001 /* Allow Afterburner on systems w/o hardware BFL */
3324#define WL_SWFL_ABENCORE    0x0002 /* Allow AB on non-4318E chips */
3325#endif /* WLAFTERBURNER */
3326#define WL_SWFL_NOHWRADIO	0x0004
3327#define WL_SWFL_FLOWCONTROL     0x0008 /* Enable backpressure to OS stack */
3328#define WL_SWFL_WLBSSSORT	0x0010 /* Per-port supports sorting of BSS */
3329
3330#define WL_LIFETIME_MAX 0xFFFF /* Max value in ms */
3331
3332/* Packet lifetime configuration per ac */
3333typedef struct wl_lifetime {
3334	uint32 ac;	        /* access class */
3335	uint32 lifetime;    /* Packet lifetime value in ms */
3336} wl_lifetime_t;
3337
3338#define CSA_BROADCAST_ACTION_FRAME	0	/* csa broadcast action frame */
3339#define CSA_UNICAST_ACTION_FRAME	  1 /* csa unicast action frame */
3340
3341/* Channel Switch Announcement param */
3342typedef struct wl_chan_switch {
3343	uint8 mode;		/* value 0 or 1 */
3344	uint8 count;		/* count # of beacons before switching */
3345	chanspec_t chspec;	/* chanspec */
3346	uint8 reg;		/* regulatory class */
3347	uint8 frame_type;		/* csa frame type, unicast or broadcast */
3348} wl_chan_switch_t;
3349
3350/* Roaming trigger definitions for WLC_SET_ROAM_TRIGGER.
3351 *
3352 * (-100 < value < 0)   value is used directly as a roaming trigger in dBm
3353 * (0 <= value) value specifies a logical roaming trigger level from
3354 *                      the list below
3355 *
3356 * WLC_GET_ROAM_TRIGGER always returns roaming trigger value in dBm, never
3357 * the logical roam trigger value.
3358 */
3359#define WLC_ROAM_TRIGGER_DEFAULT	0 /* default roaming trigger */
3360#define WLC_ROAM_TRIGGER_BANDWIDTH	1 /* optimize for bandwidth roaming trigger */
3361#define WLC_ROAM_TRIGGER_DISTANCE	2 /* optimize for distance roaming trigger */
3362#define WLC_ROAM_TRIGGER_AUTO		3 /* auto-detect environment */
3363#define WLC_ROAM_TRIGGER_MAX_VALUE	3 /* max. valid value */
3364
3365#define WLC_ROAM_NEVER_ROAM_TRIGGER	(-100) /* Avoid Roaming by setting a large value */
3366
3367/* Preferred Network Offload (PNO, formerly PFN) defines */
3368#define WPA_AUTH_PFN_ANY	0xffffffff	/* for PFN, match only ssid */
3369
3370enum {
3371	PFN_LIST_ORDER,
3372	PFN_RSSI
3373};
3374
3375enum {
3376	DISABLE,
3377	ENABLE
3378};
3379
3380enum {
3381	OFF_ADAPT,
3382	SMART_ADAPT,
3383	STRICT_ADAPT,
3384	SLOW_ADAPT
3385};
3386
3387#define SORT_CRITERIA_BIT		0
3388#define AUTO_NET_SWITCH_BIT		1
3389#define ENABLE_BKGRD_SCAN_BIT	2
3390#define IMMEDIATE_SCAN_BIT		3
3391#define	AUTO_CONNECT_BIT		4
3392#define	ENABLE_BD_SCAN_BIT		5
3393#define ENABLE_ADAPTSCAN_BIT	6
3394#define IMMEDIATE_EVENT_BIT		8
3395#define SUPPRESS_SSID_BIT		9
3396#define ENABLE_NET_OFFLOAD_BIT		10
3397
3398#define SORT_CRITERIA_MASK		0x0001
3399#define AUTO_NET_SWITCH_MASK	0x0002
3400#define ENABLE_BKGRD_SCAN_MASK	0x0004
3401#define IMMEDIATE_SCAN_MASK		0x0008
3402#define	AUTO_CONNECT_MASK		0x0010
3403
3404#define ENABLE_BD_SCAN_MASK		0x0020
3405#define ENABLE_ADAPTSCAN_MASK	0x00c0
3406#define IMMEDIATE_EVENT_MASK	0x0100
3407#define SUPPRESS_SSID_MASK	0x0200
3408#define ENABLE_NET_OFFLOAD_MASK	0x0400
3409
3410#define PFN_VERSION				2
3411#define PFN_SCANRESULT_VERSION	1
3412#define MAX_PFN_LIST_COUNT	16
3413
3414#define PFN_COMPLETE			1
3415#define PFN_INCOMPLETE			0
3416
3417#define DEFAULT_BESTN			2
3418#define DEFAULT_MSCAN			0
3419#define DEFAULT_REPEAT			10
3420#define DEFAULT_EXP				2
3421
3422/* PFN network info structure */
3423typedef struct wl_pfn_subnet_info {
3424	struct ether_addr BSSID;
3425	uint8	channel; /* channel number only */
3426	uint8	SSID_len;
3427	uint8	SSID[32];
3428} wl_pfn_subnet_info_t;
3429
3430typedef struct wl_pfn_net_info {
3431	wl_pfn_subnet_info_t pfnsubnet;
3432	int16	RSSI; /* receive signal strength (in dBm) */
3433	uint16	timestamp; /* age in seconds */
3434} wl_pfn_net_info_t;
3435
3436typedef struct wl_pfn_scanresults {
3437	uint32 version;
3438	uint32 status;
3439	uint32 count;
3440	wl_pfn_net_info_t netinfo[1];
3441} wl_pfn_scanresults_t;
3442
3443/* PFN data structure */
3444typedef struct wl_pfn_param {
3445	int32 version;			/* PNO parameters version */
3446	int32 scan_freq;		/* Scan frequency */
3447	int32 lost_network_timeout;	/* Timeout in sec. to declare
3448								* discovered network as lost
3449								*/
3450	int16 flags;			/* Bit field to control features
3451							* of PFN such as sort criteria auto
3452							* enable switch and background scan
3453							*/
3454	int16 rssi_margin;		/* Margin to avoid jitter for choosing a
3455							* PFN based on RSSI sort criteria
3456							*/
3457	uint8 bestn; /* number of best networks in each scan */
3458	uint8 mscan; /* number of scans recorded */
3459	uint8 repeat; /* Minimum number of scan intervals
3460				     *before scan frequency changes in adaptive scan
3461				     */
3462	uint8 exp; /* Exponent of 2 for maximum scan interval */
3463#if !defined(WLC_PATCH) || !defined(BCM43362A2)
3464	int32 slow_freq; /* slow scan period */
3465#endif /* !WLC_PATCH || !BCM43362A2 */
3466} wl_pfn_param_t;
3467
3468typedef struct wl_pfn_bssid {
3469	struct ether_addr  macaddr;
3470	/* Bit4: suppress_lost, Bit3: suppress_found */
3471	uint16             flags;
3472} wl_pfn_bssid_t;
3473#define WL_PFN_SUPPRESSFOUND_MASK	0x08
3474#define WL_PFN_SUPPRESSLOST_MASK	0x10
3475#define WL_PFN_RSSI_MASK			0xff00
3476#define WL_PFN_RSSI_SHIFT			8
3477
3478typedef struct wl_pfn_cfg {
3479	uint32				reporttype;
3480	int32				channel_num;
3481	uint16				channel_list[WL_NUMCHANNELS];
3482} wl_pfn_cfg_t;
3483#define WL_PFN_REPORT_ALLNET    0
3484#define WL_PFN_REPORT_SSIDNET   1
3485#define WL_PFN_REPORT_BSSIDNET  2
3486
3487typedef struct wl_pfn {
3488	wlc_ssid_t		ssid;			/* ssid name and its length */
3489	int32			flags;			/* bit2: hidden */
3490	int32			infra;			/* BSS Vs IBSS */
3491	int32			auth;			/* Open Vs Closed */
3492	int32			wpa_auth;		/* WPA type */
3493	int32			wsec;			/* wsec value */
3494} wl_pfn_t;
3495
3496typedef struct wl_pfn_list {
3497	uint32		version;
3498	uint32		enabled;
3499	uint32		count;
3500	wl_pfn_t	pfn[1];
3501} wl_pfn_list_t;
3502
3503typedef BWL_PRE_PACKED_STRUCT struct pfn_olmsg_params_t {
3504	wlc_ssid_t ssid;
3505	uint32	cipher_type;
3506	uint32	auth_type;
3507	uint8	channels[4];
3508} BWL_POST_PACKED_STRUCT pfn_olmsg_params;
3509
3510#define WL_PFN_HIDDEN_BIT		2
3511#define PNO_SCAN_MAX_FW			508*1000	/* max time scan time in msec */
3512#define PNO_SCAN_MAX_FW_SEC		PNO_SCAN_MAX_FW/1000 /* max time scan time in SEC */
3513#define PNO_SCAN_MIN_FW_SEC		10			/* min time scan time in SEC */
3514#define WL_PFN_HIDDEN_MASK		0x4
3515
3516#endif /* LINUX_POSTMOGRIFY_REMOVAL */
3517
3518/* Service discovery */
3519typedef struct {
3520	uint8	transaction_id;	/* Transaction id */
3521	uint8	protocol;	/* Service protocol type */
3522	uint16	query_len;	/* Length of query */
3523	uint16	response_len;	/* Length of response */
3524	uint8	qrbuf[1];
3525} wl_p2po_qr_t;
3526
3527typedef struct {
3528	uint16			period;			/* extended listen period */
3529	uint16			interval;		/* extended listen interval */
3530} wl_p2po_listen_t;
3531
3532/* ANQP offload */
3533
3534#define ANQPO_MAX_QUERY_SIZE		256
3535typedef struct {
3536	uint16 max_retransmit;		/* ~0 use default, max retransmit on no ACK from peer */
3537	uint16 response_timeout;	/* ~0 use default, msec to wait for resp after tx packet */
3538	uint16 max_comeback_delay;	/* ~0 use default, max comeback delay in resp else fail */
3539	uint16 max_retries;			/* ~0 use default, max retries on failure */
3540	uint16 query_len;			/* length of ANQP query */
3541	uint8 query_data[1];		/* ANQP encoded query (max ANQPO_MAX_QUERY_SIZE) */
3542} wl_anqpo_set_t;
3543
3544typedef struct {
3545	uint16 channel;				/* channel of the peer */
3546	struct ether_addr addr;		/* addr of the peer */
3547} wl_anqpo_peer_t;
3548
3549#define ANQPO_MAX_PEER_LIST			64
3550typedef struct {
3551	uint16 count;				/* number of peers in list */
3552	wl_anqpo_peer_t peer[1];	/* max ANQPO_MAX_PEER_LIST */
3553} wl_anqpo_peer_list_t;
3554
3555#define ANQPO_MAX_IGNORE_SSID		64
3556typedef struct {
3557	bool is_clear;				/* set to clear list (not used on GET) */
3558	uint16 count;				/* number of SSID in list */
3559	wlc_ssid_t ssid[1];			/* max ANQPO_MAX_IGNORE_SSID */
3560} wl_anqpo_ignore_ssid_list_t;
3561
3562#define ANQPO_MAX_IGNORE_BSSID		64
3563typedef struct {
3564	bool is_clear;				/* set to clear list (not used on GET) */
3565	uint16 count;				/* number of addr in list */
3566	struct ether_addr bssid[1];	/* max ANQPO_MAX_IGNORE_BSSID */
3567} wl_anqpo_ignore_bssid_list_t;
3568
3569/* TCP Checksum Offload defines */
3570#define TOE_TX_CSUM_OL		0x00000001
3571#define TOE_RX_CSUM_OL		0x00000002
3572
3573#ifndef LINUX_POSTMOGRIFY_REMOVAL
3574/* TCP Checksum Offload error injection for testing */
3575#define TOE_ERRTEST_TX_CSUM	0x00000001
3576#define TOE_ERRTEST_RX_CSUM	0x00000002
3577#define TOE_ERRTEST_RX_CSUM2	0x00000004
3578
3579struct toe_ol_stats_t {
3580	/* Num of tx packets that don't need to be checksummed */
3581	uint32 tx_summed;
3582
3583	/* Num of tx packets where checksum is filled by offload engine */
3584	uint32 tx_iph_fill;
3585	uint32 tx_tcp_fill;
3586	uint32 tx_udp_fill;
3587	uint32 tx_icmp_fill;
3588
3589	/*  Num of rx packets where toe finds out if checksum is good or bad */
3590	uint32 rx_iph_good;
3591	uint32 rx_iph_bad;
3592	uint32 rx_tcp_good;
3593	uint32 rx_tcp_bad;
3594	uint32 rx_udp_good;
3595	uint32 rx_udp_bad;
3596	uint32 rx_icmp_good;
3597	uint32 rx_icmp_bad;
3598
3599	/* Num of tx packets in which csum error is injected */
3600	uint32 tx_tcp_errinj;
3601	uint32 tx_udp_errinj;
3602	uint32 tx_icmp_errinj;
3603
3604	/* Num of rx packets in which csum error is injected */
3605	uint32 rx_tcp_errinj;
3606	uint32 rx_udp_errinj;
3607	uint32 rx_icmp_errinj;
3608};
3609
3610/* ARP Offload feature flags for arp_ol iovar */
3611#define ARP_OL_AGENT		0x00000001
3612#define ARP_OL_SNOOP		0x00000002
3613#define ARP_OL_HOST_AUTO_REPLY	0x00000004
3614#define ARP_OL_PEER_AUTO_REPLY	0x00000008
3615
3616/* ARP Offload error injection */
3617#define ARP_ERRTEST_REPLY_PEER	0x1
3618#define ARP_ERRTEST_REPLY_HOST	0x2
3619
3620#define ARP_MULTIHOMING_MAX	8	/* Maximum local host IP addresses */
3621#define ND_MULTIHOMING_MAX 10	/* Maximum local host IP addresses */
3622
3623/* Arp offload statistic counts */
3624struct arp_ol_stats_t {
3625	uint32  host_ip_entries;	/* Host IP table addresses (more than one if multihomed) */
3626	uint32  host_ip_overflow;	/* Host IP table additions skipped due to overflow */
3627
3628	uint32  arp_table_entries;	/* ARP table entries */
3629	uint32  arp_table_overflow;	/* ARP table additions skipped due to overflow */
3630
3631	uint32  host_request;		/* ARP requests from host */
3632	uint32  host_reply;		/* ARP replies from host */
3633	uint32  host_service;		/* ARP requests from host serviced by ARP Agent */
3634
3635	uint32  peer_request;		/* ARP requests received from network */
3636	uint32  peer_request_drop;	/* ARP requests from network that were dropped */
3637	uint32  peer_reply;		/* ARP replies received from network */
3638	uint32  peer_reply_drop;	/* ARP replies from network that were dropped */
3639	uint32  peer_service;		/* ARP request from host serviced by ARP Agent */
3640};
3641
3642/* NS offload statistic counts */
3643struct nd_ol_stats_t {
3644	uint32  host_ip_entries;    /* Host IP table addresses (more than one if multihomed) */
3645	uint32  host_ip_overflow;   /* Host IP table additions skipped due to overflow */
3646	uint32  peer_request;       /* NS requests received from network */
3647	uint32  peer_request_drop;  /* NS requests from network that were dropped */
3648	uint32  peer_reply_drop;    /* NA replies from network that were dropped */
3649	uint32  peer_service;       /* NS request from host serviced by firmware */
3650};
3651
3652/*
3653 * Keep-alive packet offloading.
3654 */
3655
3656/* NAT keep-alive packets format: specifies the re-transmission period, the packet
3657 * length, and packet contents.
3658 */
3659typedef struct wl_keep_alive_pkt {
3660	uint32	period_msec;	/* Retransmission period (0 to disable packet re-transmits) */
3661	uint16	len_bytes;	/* Size of packet to transmit (0 for null packet) */
3662	uint8	data[1];	/* Variable length packet to transmit.  Contents should include
3663				 * entire ethernet packet (enet header, IP header, UDP header,
3664				 * and UDP payload) in network byte order.
3665				 */
3666} wl_keep_alive_pkt_t;
3667
3668#define WL_KEEP_ALIVE_FIXED_LEN		OFFSETOF(wl_keep_alive_pkt_t, data)
3669
3670typedef struct awdl_config_params {
3671	uint32	version;
3672	uint8	awdl_chan;		/* awdl channel */
3673	uint8	guard_time;		/* Guard Time */
3674	uint16	aw_period;		/* AW interval period */
3675	uint16  aw_cmn_length;		/* Radio on Time AW */
3676	uint16	action_frame_period;	/* awdl action frame period */
3677	uint16  awdl_pktlifetime;	/* max packet life time in msec for awdl action frames  */
3678	uint16  awdl_maxnomaster;	/* max master missing time */
3679	uint16  awdl_extcount;		/* Max extended period count for traffic  */
3680	uint16	aw_ext_length;		/* AW ext period */
3681	uint16	awdl_nmode;	        /* Operation mode of awdl interface; * 0 - Legacy mode
3682					 * 1 - 11n rate only   * 2 - 11n + ampdu rx/tx
3683					 */
3684	struct ether_addr ea;		/* destination bcast/mcast  address to which action frame
3685					 * need to be sent
3686					 */
3687} awdl_config_params_t;
3688
3689typedef struct wl_awdl_action_frame {
3690	uint16	len_bytes;
3691	uint8	awdl_action_frame_data[1];
3692} wl_awdl_action_frame_t;
3693
3694#define WL_AWDL_ACTION_FRAME_FIXED_LEN		OFFSETOF(wl_awdl_action_frame_t, awdl_sync_frame)
3695
3696typedef struct awdl_peer_node {
3697	uint32	type_state;		/* Master, slave , etc.. */
3698	uint16	aw_counter;		/* avail window counter */
3699	int8	rssi;			/* rssi last af was received at */
3700	int8	last_rssi;		/* rssi in the last AF */
3701	uint16	tx_counter;
3702	uint16	tx_delay;		/* ts_hw - ts_fw */
3703	uint16	period_tu;
3704	uint16	aw_period;
3705	uint16	aw_cmn_length;
3706	uint16	aw_ext_length;
3707	uint32	self_metrics;		/* Election Metric */
3708	uint32	top_master_metrics;	/* Top Master Metric */
3709	struct ether_addr 	addr;
3710	struct ether_addr 	top_master;
3711	uint8	dist_top;		/* Distance from Top */
3712} awdl_peer_node_t;
3713
3714typedef struct awdl_peer_table {
3715	uint16  version;
3716	uint16	len;
3717	uint8 peer_nodes[1];
3718} awdl_peer_table_t;
3719
3720typedef struct awdl_af_hdr {
3721	struct ether_addr dst_mac;
3722	uint8 action_hdr[4]; /* Category + OUI[3] */
3723} awdl_af_hdr_t;
3724
3725typedef struct awdl_oui {
3726	uint8 oui[3];	/* default: 0x00 0x17 0xf2 */
3727	uint8 oui_type; /* AWDL: 0x08 */
3728} awdl_oui_t;
3729
3730typedef BWL_PRE_PACKED_STRUCT struct awdl_hdr {
3731	uint8 	type; 		/* 0x08 AWDL */
3732	uint8	version;
3733	uint8 	sub_type; 	/* Sub type */
3734	uint8	rsvd; 		/* Reserved */
3735	uint32	phy_timestamp;	/* PHY Tx time */
3736	uint32	fw_timestamp;	/* Target Tx time */
3737} BWL_POST_PACKED_STRUCT awdl_hdr_t;
3738
3739/* AWDL AF flags for awdl_oob_af iovar */
3740#define AWDL_OOB_AF_FILL_TSF_PARAMS			0x00000001
3741#define AWDL_OOB_AF_FILL_SYNC_PARAMS		0x00000002
3742#define AWDL_OOB_AF_FILL_ELECT_PARAMS		0x00000004
3743#define AWDL_OOB_AF_PARAMS_SIZE 38
3744
3745typedef BWL_PRE_PACKED_STRUCT struct awdl_oob_af_params {
3746	struct ether_addr bssid;
3747	struct ether_addr dst_mac;
3748	uint32 channel;
3749	uint32 dwell_time;
3750	uint32 flags;
3751	uint32 pkt_lifetime;
3752	uint32 tx_rate;
3753	uint32 max_retries; /* for unicast frames only */
3754	uint16 payload_len;
3755	uint8  payload[1]; /* complete AF payload */
3756} BWL_POST_PACKED_STRUCT awdl_oob_af_params_t;
3757
3758typedef BWL_PRE_PACKED_STRUCT struct awdl_sync_params {
3759	uint8	type;			/* Type */
3760	uint16	param_len;		/* sync param length */
3761	uint8	tx_chan;		/* tx channel */
3762	uint16	tx_counter;		/* tx down counter */
3763	uint8	master_chan;		/* master home channel */
3764	uint8	guard_time;		/* Gaurd Time */
3765	uint16	aw_period;		/* AW period */
3766	uint16	action_frame_period;	/* awdl action frame period */
3767	uint16	awdl_flags;		/* AWDL Flags */
3768	uint16	aw_ext_length;		/* AW extention len */
3769	uint16	aw_cmn_length;		/* AW common len */
3770	uint16	aw_remaining;		/* Remaining AW length */
3771	uint8	min_ext;		/* Minimum Extention count */
3772	uint8	max_ext_multi;		/* Max multicast Extention count */
3773	uint8	max_ext_uni;		/* Max unicast Extention count */
3774	uint8	max_ext_af;		/* Max af Extention count */
3775	struct ether_addr current_master;	/* Current Master mac addr */
3776	uint8	presence_mode;		/* Presence mode */
3777	uint8	reserved;
3778	uint16	aw_counter;		/* AW seq# */
3779	uint16	ap_bcn_alignment_delta;	/* AP Beacon alignment delta  */
3780} BWL_POST_PACKED_STRUCT awdl_sync_params_t;
3781
3782typedef BWL_PRE_PACKED_STRUCT struct awdl_channel_sequence {
3783	uint8	aw_seq_len;		/* AW seq length */
3784	uint8	aw_seq_enc;		/* AW seq encoding */
3785	uint8	aw_seq_duplicate_cnt;	/* AW seq dupilcate count */
3786	uint8	seq_step_cnt;		/* Seq spet count */
3787	uint16	seq_fill_chan;		/* channel to fill in; 0xffff repeat current channel */
3788	uint8	chan_sequence[1];	/* Variable list of channel Sequence */
3789} BWL_POST_PACKED_STRUCT awdl_channel_sequence_t;
3790#define WL_AWDL_CHAN_SEQ_FIXED_LEN   OFFSETOF(awdl_channel_sequence_t, chan_sequence)
3791
3792typedef BWL_PRE_PACKED_STRUCT struct awdl_election_info {
3793	uint8	election_flags;	/* Election Flags */
3794	uint16	election_ID;	/* Election ID */
3795	uint32	self_metrics;
3796} BWL_POST_PACKED_STRUCT awdl_election_info_t;
3797
3798typedef BWL_PRE_PACKED_STRUCT struct awdl_election_tree_info {
3799	uint8	election_flags;	/* Election Flags */
3800	uint16	election_ID;	/* Election ID */
3801	uint32	self_metrics;
3802	int8 master_sync_rssi_thld;
3803	int8 slave_sync_rssi_thld;
3804	int8 edge_sync_rssi_thld;
3805	int8 close_range_rssi_thld;
3806	int8 mid_range_rssi_thld;
3807	uint8 max_higher_masters_close_range;
3808	uint8 max_higher_masters_mid_range;
3809	uint8 max_tree_depth;
3810	/* read only */
3811	struct ether_addr top_master;	/* top Master mac addr */
3812	uint32 top_master_self_metric;
3813	uint8  current_tree_depth;
3814} BWL_POST_PACKED_STRUCT awdl_election_tree_info_t;
3815
3816typedef BWL_PRE_PACKED_STRUCT struct awdl_election_params_tlv {
3817	uint8	type;			/* Type */
3818	uint16	param_len;		/* Election param length */
3819	uint8	election_flags;	/* Election Flags */
3820	uint16	election_ID;	/* Election ID */
3821	uint8	dist_top;	/* Distance from Top */
3822	uint8	rsvd;		/* Reserved */
3823	struct ether_addr top_master;	/* Top Master mac addr */
3824	uint32	top_master_metrics;
3825	uint32	self_metrics;
3826	uint8	pad[2];		/* Padding  */
3827} BWL_POST_PACKED_STRUCT awdl_election_params_tlv_t;
3828
3829typedef struct awdl_payload {
3830	uint32	len;		/* Payload length */
3831	uint8	payload[1];	/* Payload */
3832} awdl_payload_t;
3833
3834typedef struct awdl_long_payload {
3835	uint8   long_psf_period;      /* transmit every long_psf_perios AWs */
3836	uint8   long_psf_tx_offset;   /* delay from aw_start */
3837	uint16	len;		          /* Payload length */
3838	uint8	payload[1];           /* Payload */
3839} BWL_POST_PACKED_STRUCT awdl_long_payload_t;
3840
3841typedef BWL_PRE_PACKED_STRUCT struct awdl_opmode {
3842	uint8	mode;		/* 0 - Auto; 1 - Fixed */
3843	uint8	role;		/* 0 - slave; 1 - non-elect master; 2 - master */
3844	uint16	bcast_tu; /* Bcasting period(TU) for non-elect master */
3845	struct ether_addr master; /* Address of master to sync to */
3846	uint16	cur_bcast_tu;	/* Current Bcasting Period(TU) */
3847} BWL_PRE_PACKED_STRUCT awdl_opmode_t;
3848
3849typedef BWL_PRE_PACKED_STRUCT struct awdl_extcount {
3850	uint8	minExt;			/* Min extension count */
3851	uint8	maxExtMulti;	/* Max extension count for mcast packets */
3852	uint8	maxExtUni;		/* Max extension count for unicast packets */
3853	uint8	maxAfExt;			/* Max extension count */
3854} BWL_PRE_PACKED_STRUCT awdl_extcount_t;
3855
3856#define AWDL_OPMODE_AUTO	0
3857#define AWDL_OPMODE_FIXED	1
3858
3859/* peer add/del operation */
3860typedef struct awdl_peer_op {
3861	uint8 version;
3862	uint8 opcode;	/* see opcode definition */
3863	struct ether_addr addr;
3864	uint8 mode;
3865} awdl_peer_op_t;
3866
3867/* peer op table */
3868typedef struct awdl_peer_op_tbl {
3869	uint16	len;		/* length */
3870	uint8	tbl[1];	/* Peer table */
3871} awdl_peer_op_tbl_t;
3872
3873typedef BWL_PRE_PACKED_STRUCT struct awdl_peer_op_node {
3874	struct ether_addr addr;
3875	uint32 flags;	/* Flags to indicate various states */
3876} BWL_POST_PACKED_STRUCT awdl_peer_op_node_t;
3877
3878#define AWDL_PEER_OP_CUR_VER	0
3879
3880/* AWDL related statistics */
3881typedef BWL_PRE_PACKED_STRUCT struct awdl_stats {
3882	uint32	afrx;
3883	uint32	aftx;
3884	uint32	datatx;
3885	uint32	datarx;
3886	uint32	txdrop;
3887	uint32	rxdrop;
3888	uint32	monrx;
3889	uint32	lostmaster;
3890	uint32	misalign;
3891	uint32	aws;
3892	uint32 	aw_dur;
3893	uint32	debug;
3894	uint32  txsupr;
3895	uint32	afrxdrop;
3896	uint32  awdrop;
3897	uint32  noawchansw;
3898	uint32  rx80211;
3899	uint32  peeropdrop;
3900} BWL_POST_PACKED_STRUCT awdl_stats_t;
3901
3902typedef BWL_PRE_PACKED_STRUCT struct awdl_uct_stats {
3903	uint32 aw_proc_in_aw_sched;
3904	uint32 aw_upd_in_pre_aw_proc;
3905	uint32 pre_aw_proc_in_aw_set;
3906	uint32 ignore_pre_aw_proc;
3907	uint32 miss_pre_aw_intr;
3908	uint32 aw_dur_zero;
3909	uint32 aw_sched;
3910	uint32 aw_proc;
3911	uint32 pre_aw_proc;
3912	uint32 not_init;
3913	uint32 null_awdl;
3914} BWL_POST_PACKED_STRUCT awdl_uct_stats_t;
3915
3916/* peer opcode */
3917#define AWDL_PEER_OP_ADD	0
3918#define AWDL_PEER_OP_DEL	1
3919#define AWDL_PEER_OP_INFO	2
3920#define AWDL_PEER_OP_UPD	3
3921
3922typedef struct awdl_pw_opmode {
3923	struct ether_addr top_master;	/* Peer mac addr */
3924	uint8 mode; /* 0 - normal; 1 - fast mode */
3925} awdl_pw_opmode_t;
3926
3927/* i/f request */
3928typedef struct wl_awdl_if {
3929	int32 cfg_idx;
3930	int32 up;
3931	struct ether_addr if_addr;
3932	struct ether_addr bssid;
3933} wl_awdl_if_t;
3934
3935typedef struct _aw_start {
3936	uint8 role;
3937	struct ether_addr 	master;
3938	uint8	aw_seq_num;
3939} aw_start_t;
3940
3941typedef struct _aw_extension_start {
3942	uint8 aw_ext_num;
3943} aw_extension_start_t;
3944
3945typedef struct _awdl_peer_state {
3946	struct ether_addr peer;
3947	uint8	state;
3948} awdl_peer_state_t;
3949#define AWDL_PEER_STATE_OPEN	0
3950#define AWDL_PEER_STATE_CLOSE	1
3951
3952typedef struct _awdl_sync_state_changed {
3953	uint8	new_role;
3954	struct ether_addr master;
3955} awdl_sync_state_changed_t;
3956
3957#define SYNC_ROLE_SLAVE			0
3958#define SYNC_ROLE_NE_MASTER		1	/* Non-election master */
3959#define SYNC_ROLE_MASTER		2
3960
3961typedef struct _awdl_sync_state {
3962	uint8	role;
3963	struct ether_addr master;
3964	uint32 continuous_election_enable;
3965} awdl_sync_state_t;
3966
3967typedef struct _awdl_aw_ap_alignment {
3968	uint32	enabled;
3969	int32	offset;
3970	uint32	align_on_dtim;
3971} awdl_aw_ap_alignment_t;
3972
3973typedef struct _awdl_peer_stats {
3974	uint32 version;
3975	struct ether_addr address;
3976	uint8 clear;
3977	int8 rssi;
3978	int8 avg_rssi;
3979	uint8 txRate;
3980	uint8 rxRate;
3981	uint32 numTx;
3982	uint32 numTxRetries;
3983	uint32 numTxFailures;
3984} awdl_peer_stats_t;
3985
3986#define MAX_NUM_AWDL_KEYS 4
3987typedef struct _awdl_aes_key {
3988	uint32 version;
3989	int32 enable;
3990	struct ether_addr awdl_peer;
3991	uint8 keys[MAX_NUM_AWDL_KEYS][16];
3992} awdl_aes_key_t;
3993
3994/*
3995 * Dongle pattern matching filter.
3996 */
3997/* AOAC wake event flag */
3998#define WAKE_EVENT_NLO_DISCOVERY_BIT 		1
3999#define WAKE_EVENT_AP_ASSOCIATION_LOST_BIT	2
4000#define WAKE_EVENT_GTK_HANDSHAKE_ERROR_BIT 4
4001#define WAKE_EVENT_4WAY_HANDSHAKE_REQUEST_BIT 8
4002
4003#define MAX_NUM_WOL_PATTERN	16 /* LOGO requirements min 16 */
4004#define MAX_WAKE_PACKET_CACHE_BYTES 128 /* Maximum cached wake packet */
4005
4006typedef struct pm_wake_packet {
4007	uint32	status;		/* Is the wake reason a packet (if all the other field's valid) */
4008	uint32	pattern_id;	/* Pattern ID that matched */
4009	uint32	original_packet_size;
4010	uint32	saved_packet_size;
4011	uchar	packet[MAX_WAKE_PACKET_CACHE_BYTES];
4012} pm_wake_packet_t;
4013
4014/* Packet filter operation mode */
4015/* True: 1; False: 0 */
4016#define PKT_FILTER_MODE_FORWARD_ON_MATCH      		1
4017/* Enable and disable pkt_filter as a whole */
4018#define PKT_FILTER_MODE_DISABLE					2
4019/* Cache first matched rx pkt(be queried by host later) */
4020#define PKT_FILTER_MODE_PKT_CACHE_ON_MATCH    		4
4021/* If pkt_filter is enabled and no filter is set, don't forward anything */
4022#define PKT_FILTER_MODE_PKT_FORWARD_OFF_DEFAULT 8
4023
4024/* Packet filter types. Currently, only pattern matching is supported. */
4025typedef enum wl_pkt_filter_type {
4026	WL_PKT_FILTER_TYPE_PATTERN_MATCH=0,	/* Pattern matching filter */
4027	WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH=1, /* Magic packet match */
4028	WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH=2	/* A pattern list (match all to match filter) */
4029} wl_pkt_filter_type_t;
4030
4031#define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
4032
4033/* String mapping for types that may be used by applications or debug */
4034#define WL_PKT_FILTER_TYPE_NAMES \
4035	{ "PATTERN", WL_PKT_FILTER_TYPE_PATTERN_MATCH },       \
4036	{ "MAGIC",   WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH }, \
4037	{ "PATLIST", WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH }
4038
4039/* Pattern matching filter. Specifies an offset within received packets to
4040 * start matching, the pattern to match, the size of the pattern, and a bitmask
4041 * that indicates which bits within the pattern should be matched.
4042 */
4043typedef struct wl_pkt_filter_pattern {
4044	uint32	offset;		/* Offset within received packet to start pattern matching.
4045				 * Offset '0' is the first byte of the ethernet header.
4046				 */
4047	uint32	size_bytes;	/* Size of the pattern.  Bitmask must be the same size. */
4048	uint8   mask_and_pattern[1]; /* Variable length mask and pattern data.  mask starts
4049				      * at offset 0.  Pattern immediately follows mask.
4050				      */
4051} wl_pkt_filter_pattern_t;
4052
4053/* A pattern list is a numerically specified list of modified pattern structures. */
4054typedef struct wl_pkt_filter_pattern_listel {
4055	uint16 rel_offs;	/* Offset to begin match (relative to 'base' below) */
4056	uint16 base_offs;	/* Base for offset (defined below) */
4057	uint16 size_bytes;	/* Size of mask/pattern */
4058	uint16 match_flags;	/* Addition flags controlling the match */
4059	uint8  mask_and_data[1]; /* Variable length mask followed by data, each size_bytes */
4060} wl_pkt_filter_pattern_listel_t;
4061
4062typedef struct wl_pkt_filter_pattern_list {
4063	uint8 list_cnt;		/* Number of elements in the list */
4064	uint8 PAD1[1];		/* Reserved (possible version: reserved) */
4065	uint16 totsize;		/* Total size of this pattern list (includes this struct) */
4066	wl_pkt_filter_pattern_listel_t patterns[1]; /* Variable number of list elements */
4067} wl_pkt_filter_pattern_list_t;
4068
4069/* Base offset values */
4070#define WL_PKT_FILTER_BASE_PKT   0
4071#define WL_PKT_FILTER_BASE_END   1
4072#define WL_PKT_FILTER_BASE_D11_H 2 /* May be removed */
4073#define WL_PKT_FILTER_BASE_D11_D 3 /* May be removed */
4074#define WL_PKT_FILTER_BASE_ETH_H 4
4075#define WL_PKT_FILTER_BASE_ETH_D 5
4076#define WL_PKT_FILTER_BASE_ARP_H 6
4077#define WL_PKT_FILTER_BASE_ARP_D 7 /* May be removed */
4078#define WL_PKT_FILTER_BASE_IP4_H 8
4079#define WL_PKT_FILTER_BASE_IP4_D 9
4080#define WL_PKT_FILTER_BASE_IP6_H 10
4081#define WL_PKT_FILTER_BASE_IP6_D 11
4082#define WL_PKT_FILTER_BASE_TCP_H 12
4083#define WL_PKT_FILTER_BASE_TCP_D 13 /* May be removed */
4084#define WL_PKT_FILTER_BASE_UDP_H 14
4085#define WL_PKT_FILTER_BASE_UDP_D 15
4086#define WL_PKT_FILTER_BASE_IP6_P 16
4087#define WL_PKT_FILTER_BASE_COUNT 17 /* May be removed */
4088
4089/* String mapping for bases that may be used by applications or debug */
4090#define WL_PKT_FILTER_BASE_NAMES \
4091	{ "START", WL_PKT_FILTER_BASE_PKT },   \
4092	{ "END",   WL_PKT_FILTER_BASE_END },   \
4093	{ "ETH_H", WL_PKT_FILTER_BASE_ETH_H }, \
4094	{ "ETH_D", WL_PKT_FILTER_BASE_ETH_D }, \
4095	{ "D11_H", WL_PKT_FILTER_BASE_D11_H }, \
4096	{ "D11_D", WL_PKT_FILTER_BASE_D11_D }, \
4097	{ "ARP_H", WL_PKT_FILTER_BASE_ARP_H }, \
4098	{ "IP4_H", WL_PKT_FILTER_BASE_IP4_H }, \
4099	{ "IP4_D", WL_PKT_FILTER_BASE_IP4_D }, \
4100	{ "IP6_H", WL_PKT_FILTER_BASE_IP6_H }, \
4101	{ "IP6_D", WL_PKT_FILTER_BASE_IP6_D }, \
4102	{ "IP6_P", WL_PKT_FILTER_BASE_IP6_P }, \
4103	{ "TCP_H", WL_PKT_FILTER_BASE_TCP_H }, \
4104	{ "TCP_D", WL_PKT_FILTER_BASE_TCP_D }, \
4105	{ "UDP_H", WL_PKT_FILTER_BASE_UDP_H }, \
4106	{ "UDP_D", WL_PKT_FILTER_BASE_UDP_D }
4107
4108/* Flags for a pattern list element */
4109#define WL_PKT_FILTER_MFLAG_NEG 0x0001
4110
4111/* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
4112typedef struct wl_pkt_filter {
4113	uint32	id;		/* Unique filter id, specified by app. */
4114	uint32	type;		/* Filter type (WL_PKT_FILTER_TYPE_xxx). */
4115	uint32	negate_match;	/* Negate the result of filter matches */
4116	union {			/* Filter definitions */
4117		wl_pkt_filter_pattern_t pattern;	/* Pattern matching filter */
4118		wl_pkt_filter_pattern_list_t patlist; /* List of patterns to match */
4119	} u;
4120} wl_pkt_filter_t;
4121
4122/* IOVAR "tcp_keep_set" parameter. Used to install tcp keep_alive stuff. */
4123typedef struct wl_tcp_keep_set {
4124	uint32	val1;
4125	uint32	val2;
4126} wl_tcp_keep_set_t;
4127
4128#define WL_PKT_FILTER_FIXED_LEN		  OFFSETOF(wl_pkt_filter_t, u)
4129#define WL_PKT_FILTER_PATTERN_FIXED_LEN	  OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
4130#define WL_PKT_FILTER_PATTERN_LIST_FIXED_LEN OFFSETOF(wl_pkt_filter_pattern_list_t, patterns)
4131#define WL_PKT_FILTER_PATTERN_LISTEL_FIXED_LEN	\
4132			OFFSETOF(wl_pkt_filter_pattern_listel_t, mask_and_data)
4133
4134/* IOVAR "pkt_filter_enable" parameter. */
4135typedef struct wl_pkt_filter_enable {
4136	uint32	id;		/* Unique filter id */
4137	uint32	enable;		/* Enable/disable bool */
4138} wl_pkt_filter_enable_t;
4139
4140/* IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
4141typedef struct wl_pkt_filter_list {
4142	uint32	num;		/* Number of installed packet filters */
4143	wl_pkt_filter_t	filter[1];	/* Variable array of packet filters. */
4144} wl_pkt_filter_list_t;
4145
4146#define WL_PKT_FILTER_LIST_FIXED_LEN	  OFFSETOF(wl_pkt_filter_list_t, filter)
4147
4148/* IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
4149typedef struct wl_pkt_filter_stats {
4150	uint32	num_pkts_matched;	/* # filter matches for specified filter id */
4151	uint32	num_pkts_forwarded;	/* # packets fwded from dongle to host for all filters */
4152	uint32	num_pkts_discarded;	/* # packets discarded by dongle for all filters */
4153} wl_pkt_filter_stats_t;
4154
4155/* IOVAR "pkt_filter_ports" parameter.  Configure TCP/UDP port filters. */
4156typedef struct wl_pkt_filter_ports {
4157	uint8 version;		/* Be proper */
4158	uint8 reserved;		/* Be really proper */
4159	uint16 count;		/* Number of ports following */
4160	/* End of fixed data */
4161	uint16 ports[1];	/* Placeholder for ports[<count>] */
4162} wl_pkt_filter_ports_t;
4163
4164#define WL_PKT_FILTER_PORTS_FIXED_LEN	OFFSETOF(wl_pkt_filter_ports_t, ports)
4165
4166#define WL_PKT_FILTER_PORTS_VERSION	0
4167#define WL_PKT_FILTER_PORTS_MAX		128
4168
4169#define RSN_KCK_LENGTH 16
4170#define RSN_KEK_LENGTH 16
4171#define RSN_REPLAY_LEN 8
4172typedef struct _gtkrefresh {
4173	uchar	KCK[RSN_KCK_LENGTH];
4174	uchar	KEK[RSN_KEK_LENGTH];
4175	uchar	ReplayCounter[RSN_REPLAY_LEN];
4176} gtk_keyinfo_t, *pgtk_keyinfo_t;
4177
4178/* Sequential Commands ioctl */
4179typedef struct wl_seq_cmd_ioctl {
4180	uint32 cmd;		/* common ioctl definition */
4181	uint32 len;		/* length of user buffer */
4182} wl_seq_cmd_ioctl_t;
4183
4184#define WL_SEQ_CMD_ALIGN_BYTES	4
4185
4186/* These are the set of get IOCTLs that should be allowed when using
4187 * IOCTL sequence commands. These are issued implicitly by wl.exe each time
4188 * it is invoked. We never want to buffer these, or else wl.exe will stop working.
4189 */
4190#define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
4191	(((cmd) == WLC_GET_MAGIC)		|| \
4192	 ((cmd) == WLC_GET_VERSION)		|| \
4193	 ((cmd) == WLC_GET_AP)			|| \
4194	 ((cmd) == WLC_GET_INSTANCE))
4195
4196/*
4197 * Packet engine interface
4198 */
4199
4200#define WL_PKTENG_PER_TX_START			0x01
4201#define WL_PKTENG_PER_TX_STOP			0x02
4202#define WL_PKTENG_PER_RX_START			0x04
4203#define WL_PKTENG_PER_RX_WITH_ACK_START 	0x05
4204#define WL_PKTENG_PER_TX_WITH_ACK_START 	0x06
4205#define WL_PKTENG_PER_RX_STOP			0x08
4206#define WL_PKTENG_PER_MASK			0xff
4207
4208#define WL_PKTENG_SYNCHRONOUS			0x100	/* synchronous flag */
4209
4210#define WL_PKTENG_MAXPKTSZ				16384	/* max pktsz limit for pkteng */
4211
4212typedef struct wl_pkteng {
4213	uint32 flags;
4214	uint32 delay;			/* Inter-packet delay */
4215	uint32 nframes;			/* Number of frames */
4216	uint32 length;			/* Packet length */
4217	uint8  seqno;			/* Enable/disable sequence no. */
4218	struct ether_addr dest;		/* Destination address */
4219	struct ether_addr src;		/* Source address */
4220} wl_pkteng_t;
4221
4222#define NUM_80211b_RATES	4
4223#define NUM_80211ag_RATES	8
4224#define NUM_80211n_RATES	32
4225#define NUM_80211_RATES		(NUM_80211b_RATES+NUM_80211ag_RATES+NUM_80211n_RATES)
4226typedef struct wl_pkteng_stats {
4227	uint32 lostfrmcnt;		/* RX PER test: no of frames lost (skip seqno) */
4228	int32 rssi;			/* RSSI */
4229	int32 snr;			/* signal to noise ratio */
4230	uint16 rxpktcnt[NUM_80211_RATES+1];
4231	uint8 rssi_qdb; /* qdB portion of the computed rssi */
4232} wl_pkteng_stats_t;
4233
4234typedef struct wl_sslpnphy_papd_debug_data {
4235	uint8 psat_pwr;
4236	uint8 psat_indx;
4237	uint8 final_idx;
4238	uint8 start_idx;
4239	int32 min_phase;
4240	int32 voltage;
4241	int8 temperature;
4242} wl_sslpnphy_papd_debug_data_t;
4243typedef struct wl_sslpnphy_debug_data {
4244	int16 papdcompRe [64];
4245	int16 papdcompIm [64];
4246} wl_sslpnphy_debug_data_t;
4247typedef struct wl_sslpnphy_spbdump_data {
4248	uint16 tbl_length;
4249	int16 spbreal[256];
4250	int16 spbimg[256];
4251} wl_sslpnphy_spbdump_data_t;
4252typedef struct wl_sslpnphy_percal_debug_data {
4253	uint cur_idx;
4254	uint tx_drift;
4255	uint8 prev_cal_idx;
4256	uint percal_ctr;
4257	int nxt_cal_idx;
4258	uint force_1idxcal;
4259	uint onedxacl_req;
4260	int32 last_cal_volt;
4261	int8 last_cal_temp;
4262	uint vbat_ripple;
4263	uint exit_route;
4264	int32 volt_winner;
4265} wl_sslpnphy_percal_debug_data_t;
4266
4267/*
4268 * WOWL capability/override settings
4269 */
4270#define WL_WOWL_MAGIC           (1 << 0)    /* Wakeup on Magic packet */
4271#define WL_WOWL_NET             (1 << 1)    /* Wakeup on Netpattern */
4272#define WL_WOWL_DIS             (1 << 2)    /* Wakeup on loss-of-link due to Disassoc/Deauth */
4273#define WL_WOWL_RETR            (1 << 3)    /* Wakeup on retrograde TSF */
4274#define WL_WOWL_BCN             (1 << 4)    /* Wakeup on loss of beacon */
4275#define WL_WOWL_TST             (1 << 5)    /* Wakeup after test */
4276#define WL_WOWL_M1              (1 << 6)    /* Wakeup after PTK refresh */
4277#define WL_WOWL_EAPID           (1 << 7)    /* Wakeup after receipt of EAP-Identity Req */
4278#define WL_WOWL_PME_GPIO        (1 << 8)    /* Wakeind via PME(0) or GPIO(1) */
4279#define WL_WOWL_NEEDTKIP1       (1 << 9)    /* need tkip phase 1 key to be updated by the driver */
4280#define WL_WOWL_GTK_FAILURE     (1 << 10)   /* enable wakeup if GTK fails */
4281#define WL_WOWL_EXTMAGPAT       (1 << 11)   /* support extended magic packets */
4282#define WL_WOWL_ARPOFFLOAD      (1 << 12)   /* support ARP/NS/keepalive offloading */
4283#define WL_WOWL_WPA2            (1 << 13)   /* read protocol version for EAPOL frames */
4284#define WL_WOWL_KEYROT          (1 << 14)   /* If the bit is set, use key rotaton */
4285#define WL_WOWL_BCAST           (1 << 15)   /* If the bit is set, frm received was bcast frame */
4286#define WL_WOWL_SCANOL          (1 << 16)   /* If the bit is set, scan offload is enabled */
4287#define WL_WOWL_NOT_USED        (1 << 17)   /* Currently unused, use this bit next */
4288#define WL_WOWL_MDNS_CONFLICT   (1 << 18)   /* Wakeup on mDNS Conflict Resolution */
4289#define WL_WOWL_MDNS_SERVICE    (1 << 19)   /* Wakeup on mDNS Service Connect */
4290#define WL_WOWL_TCPKEEP         (1 << 20)   /* tcp keepalive either timed out or got data */
4291#define WL_WOWL_FW_HALT         (1 << 21)   /* Firmware died in wowl mode */
4292#define WL_WOWL_ENAB_HWRADIO    (1 << 22)   /* Enable detection of radio button changes */
4293
4294
4295#define MAGIC_PKT_MINLEN	102    /* Magic pkt min length is 6 * 0xFF + 16 * ETHER_ADDR_LEN */
4296#define MAGIC_PKT_NUM_MAC_ADDRS	16
4297
4298typedef enum {
4299	wowl_pattern_type_bitmap = 0,
4300	wowl_pattern_type_arp,
4301	wowl_pattern_type_na
4302} wowl_pattern_type_t;
4303
4304typedef struct wl_wowl_pattern {
4305	uint32		    masksize;		/* Size of the mask in #of bytes */
4306	uint32		    offset;		/* Pattern byte offset in packet */
4307	uint32		    patternoffset;	/* Offset of start of pattern in the structure */
4308	uint32		    patternsize;	/* Size of the pattern itself in #of bytes */
4309	uint32		    id;			/* id */
4310	uint32		    reasonsize;		/* Size of the wakeup reason code */
4311	wowl_pattern_type_t type;		/* Type of pattern */
4312	/* Mask follows the structure above */
4313	/* Pattern follows the mask is at 'patternoffset' from the start */
4314} wl_wowl_pattern_t;
4315
4316typedef struct wl_wowl_pattern_list {
4317	uint			count;
4318	wl_wowl_pattern_t	pattern[1];
4319} wl_wowl_pattern_list_t;
4320
4321typedef struct wl_wowl_wakeind {
4322	uint8	pci_wakeind;	/* Whether PCI PMECSR PMEStatus bit was set */
4323	uint32	ucode_wakeind;	/* What wakeup-event indication was set by ucode */
4324} wl_wowl_wakeind_t;
4325
4326typedef struct {
4327	uint32		pktlen;		    /* size of packet */
4328	void		*sdu;
4329} tcp_keepalive_wake_pkt_infop_t;
4330
4331/* per AC rate control related data structure */
4332typedef struct wl_txrate_class {
4333	uint8		init_rate;
4334	uint8		min_rate;
4335	uint8		max_rate;
4336} wl_txrate_class_t;
4337
4338
4339#if defined(DSLCPE_DELAY)
4340#define WL_DELAYMODE_DEFER  0   /* defer by scheduler's choice, make this driver default */
4341#define WL_DELAYMODE_FORCE  1   /* force, this is driver default */
4342#define WL_DELAYMODE_AUTO   2   /* defer if no sta associated, force if sta associated */
4343#endif
4344
4345/* Overlap BSS Scan parameters default, minimum, maximum */
4346#define WLC_OBSS_SCAN_PASSIVE_DWELL_DEFAULT		20	/* unit TU */
4347#define WLC_OBSS_SCAN_PASSIVE_DWELL_MIN			5	/* unit TU */
4348#define WLC_OBSS_SCAN_PASSIVE_DWELL_MAX			1000	/* unit TU */
4349#define WLC_OBSS_SCAN_ACTIVE_DWELL_DEFAULT		10	/* unit TU */
4350#define WLC_OBSS_SCAN_ACTIVE_DWELL_MIN			10	/* unit TU */
4351#define WLC_OBSS_SCAN_ACTIVE_DWELL_MAX			1000	/* unit TU */
4352#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_DEFAULT	300	/* unit Sec */
4353#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MIN		10	/* unit Sec */
4354#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MAX		900	/* unit Sec */
4355#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_DEFAULT	5
4356#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MIN	5
4357#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MAX	100
4358#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_DEFAULT	200	/* unit TU */
4359#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MIN	200	/* unit TU */
4360#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MAX	10000	/* unit TU */
4361#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_DEFAULT	20	/* unit TU */
4362#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MIN	20	/* unit TU */
4363#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MAX	10000	/* unit TU */
4364#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_DEFAULT	25	/* unit percent */
4365#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MIN		0	/* unit percent */
4366#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MAX		100	/* unit percent */
4367
4368/* structure for Overlap BSS scan arguments */
4369typedef struct wl_obss_scan_arg {
4370	int16	passive_dwell;
4371	int16	active_dwell;
4372	int16	bss_widthscan_interval;
4373	int16	passive_total;
4374	int16	active_total;
4375	int16	chanwidth_transition_delay;
4376	int16	activity_threshold;
4377} wl_obss_scan_arg_t;
4378
4379#define WL_OBSS_SCAN_PARAM_LEN	sizeof(wl_obss_scan_arg_t)
4380#define WL_MIN_NUM_OBSS_SCAN_ARG 7	/* minimum number of arguments required for OBSS Scan */
4381
4382#define WL_COEX_INFO_MASK		0x07
4383#define WL_COEX_INFO_REQ		0x01
4384#define	WL_COEX_40MHZ_INTOLERANT	0x02
4385#define	WL_COEX_WIDTH20			0x04
4386
4387#define	WLC_RSSI_INVALID	 0	/* invalid RSSI value */
4388
4389#define MAX_RSSI_LEVELS 8
4390
4391/* RSSI event notification configuration. */
4392typedef struct wl_rssi_event {
4393	uint32 rate_limit_msec;		/* # of events posted to application will be limited to
4394					 * one per specified period (0 to disable rate limit).
4395					 */
4396	uint8 num_rssi_levels;		/* Number of entries in rssi_levels[] below */
4397	int8 rssi_levels[MAX_RSSI_LEVELS];	/* Variable number of RSSI levels. An event
4398						 * will be posted each time the RSSI of received
4399						 * beacons/packets crosses a level.
4400						 */
4401} wl_rssi_event_t;
4402
4403typedef struct wl_action_obss_coex_req {
4404	uint8 info;
4405	uint8 num;
4406	uint8 ch_list[1];
4407} wl_action_obss_coex_req_t;
4408
4409
4410/* IOVar parameter block for small MAC address array with type indicator */
4411#define WL_IOV_MAC_PARAM_LEN  4
4412
4413#define WL_IOV_PKTQ_LOG_PRECS 16
4414
4415typedef struct {
4416	uint32 num_addrs;
4417	char   addr_type[WL_IOV_MAC_PARAM_LEN];
4418	struct ether_addr ea[WL_IOV_MAC_PARAM_LEN];
4419} wl_iov_mac_params_t;
4420
4421/* This is extra info that follows wl_iov_mac_params_t */
4422typedef struct {
4423	uint32 addr_info[WL_IOV_MAC_PARAM_LEN];
4424} wl_iov_mac_extra_params_t;
4425
4426/* Combined structure */
4427typedef struct {
4428	wl_iov_mac_params_t params;
4429	wl_iov_mac_extra_params_t extra_params;
4430} wl_iov_mac_full_params_t;
4431
4432/* Parameter block for PKTQ_LOG statistics */
4433typedef struct {
4434	uint32 requested;      /* packets requested to be stored */
4435	uint32 stored;         /* packets stored */
4436	uint32 saved;          /* packets saved,
4437	                          because a lowest priority queue has given away one packet
4438	                       */
4439	uint32 selfsaved;      /* packets saved,
4440	                          because an older packet from the same queue has been dropped
4441	                       */
4442	uint32 full_dropped;   /* packets dropped,
4443	                          because pktq is full with higher precedence packets
4444	                       */
4445	uint32 dropped;        /* packets dropped because pktq per that precedence is full */
4446	uint32 sacrificed;     /* packets dropped,
4447	                          in order to save one from a queue of a highest priority
4448	                       */
4449	uint32 busy;           /* packets droped because of hardware/transmission error */
4450	uint32 retry;          /* packets re-sent because they were not received */
4451	uint32 ps_retry;       /* packets retried again prior to moving power save mode */
4452	uint32 suppress;       /* suppressed packet count */
4453	uint32 retry_drop;     /* packets finally dropped after retry limit */
4454	uint32 max_avail;      /* the high-water mark of the queue capacity for packets -
4455	                          goes to zero as queue fills
4456	                       */
4457	uint32 max_used;       /* the high-water mark of the queue utilisation for packets -
4458	                          increases with use ('inverse' of max_avail)
4459	                       */
4460	uint32 queue_capacity; /* the maximum capacity of the queue */
4461	uint32 rtsfail;        /* count of rts attempts that failed to receive cts */
4462	uint32 acked;          /* count of packets sent (acked) successfully */
4463	uint32 txrate_succ;    /* running total of phy rate of packets sent successfully */
4464	uint32 txrate_main;    /* running total of phy 'main' rate */
4465	uint32 throughput;     /* actual data transferred successfully */
4466	uint32 time_delta;     /* time difference since last pktq_stats */
4467} pktq_log_counters_v04_t;
4468
4469#define sacrified sacrificed
4470
4471typedef struct {
4472	uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
4473	pktq_log_counters_v04_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
4474	uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
4475	uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
4476	char                 headings[1];
4477} pktq_log_format_v04_t;
4478
4479
4480typedef struct {
4481	uint32               version;
4482	wl_iov_mac_params_t  params;
4483	union {
4484		pktq_log_format_v04_t v04;
4485	} pktq_log;
4486} wl_iov_pktq_log_t;
4487
4488
4489/* **** EXTLOG **** */
4490#define EXTLOG_CUR_VER		0x0100
4491
4492#define MAX_ARGSTR_LEN		18 /* At least big enough for storing ETHER_ADDR_STR_LEN */
4493
4494/* log modules (bitmap) */
4495#define LOG_MODULE_COMMON	0x0001
4496#define LOG_MODULE_ASSOC	0x0002
4497#define LOG_MODULE_EVENT	0x0004
4498#define LOG_MODULE_MAX		3			/* Update when adding module */
4499
4500/* log levels */
4501#define WL_LOG_LEVEL_DISABLE	0
4502#define WL_LOG_LEVEL_ERR	1
4503#define WL_LOG_LEVEL_WARN	2
4504#define WL_LOG_LEVEL_INFO	3
4505#define WL_LOG_LEVEL_MAX	WL_LOG_LEVEL_INFO	/* Update when adding level */
4506
4507/* flag */
4508#define LOG_FLAG_EVENT		1
4509
4510/* log arg_type */
4511#define LOG_ARGTYPE_NULL	0
4512#define LOG_ARGTYPE_STR		1	/* %s */
4513#define LOG_ARGTYPE_INT		2	/* %d */
4514#define LOG_ARGTYPE_INT_STR	3	/* %d...%s */
4515#define LOG_ARGTYPE_STR_INT	4	/* %s...%d */
4516
4517typedef struct wlc_extlog_cfg {
4518	int max_number;
4519	uint16 module;	/* bitmap */
4520	uint8 level;
4521	uint8 flag;
4522	uint16 version;
4523} wlc_extlog_cfg_t;
4524
4525typedef struct log_record {
4526	uint32 time;
4527	uint16 module;
4528	uint16 id;
4529	uint8 level;
4530	uint8 sub_unit;
4531	uint8 seq_num;
4532	int32 arg;
4533	char str[MAX_ARGSTR_LEN];
4534} log_record_t;
4535
4536typedef struct wlc_extlog_req {
4537	uint32 from_last;
4538	uint32 num;
4539} wlc_extlog_req_t;
4540
4541typedef struct wlc_extlog_results {
4542	uint16 version;
4543	uint16 record_len;
4544	uint32 num;
4545	log_record_t logs[1];
4546} wlc_extlog_results_t;
4547
4548typedef struct log_idstr {
4549	uint16	id;
4550	uint16	flag;
4551	uint8	arg_type;
4552	const char	*fmt_str;
4553} log_idstr_t;
4554
4555#define FMTSTRF_USER		1
4556
4557/* flat ID definitions
4558 * New definitions HAVE TO BE ADDED at the end of the table. Otherwise, it will
4559 * affect backward compatibility with pre-existing apps
4560 */
4561typedef enum {
4562	FMTSTR_DRIVER_UP_ID = 0,
4563	FMTSTR_DRIVER_DOWN_ID = 1,
4564	FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
4565	FMTSTR_NO_PROGRESS_ID = 3,
4566	FMTSTR_RFDISABLE_ID = 4,
4567	FMTSTR_REG_PRINT_ID = 5,
4568	FMTSTR_EXPTIME_ID = 6,
4569	FMTSTR_JOIN_START_ID = 7,
4570	FMTSTR_JOIN_COMPLETE_ID = 8,
4571	FMTSTR_NO_NETWORKS_ID = 9,
4572	FMTSTR_SECURITY_MISMATCH_ID = 10,
4573	FMTSTR_RATE_MISMATCH_ID = 11,
4574	FMTSTR_AP_PRUNED_ID = 12,
4575	FMTSTR_KEY_INSERTED_ID = 13,
4576	FMTSTR_DEAUTH_ID = 14,
4577	FMTSTR_DISASSOC_ID = 15,
4578	FMTSTR_LINK_UP_ID = 16,
4579	FMTSTR_LINK_DOWN_ID = 17,
4580	FMTSTR_RADIO_HW_OFF_ID = 18,
4581	FMTSTR_RADIO_HW_ON_ID = 19,
4582	FMTSTR_EVENT_DESC_ID = 20,
4583	FMTSTR_PNP_SET_POWER_ID = 21,
4584	FMTSTR_RADIO_SW_OFF_ID = 22,
4585	FMTSTR_RADIO_SW_ON_ID = 23,
4586	FMTSTR_PWD_MISMATCH_ID = 24,
4587	FMTSTR_FATAL_ERROR_ID = 25,
4588	FMTSTR_AUTH_FAIL_ID = 26,
4589	FMTSTR_ASSOC_FAIL_ID = 27,
4590	FMTSTR_IBSS_FAIL_ID = 28,
4591	FMTSTR_EXTAP_FAIL_ID = 29,
4592	FMTSTR_MAX_ID
4593} log_fmtstr_id_t;
4594
4595#ifdef DONGLEOVERLAYS
4596typedef struct {
4597	uint32 flags_idx;	/* lower 8 bits: overlay index; upper 24 bits: flags */
4598	uint32 offset;		/* offset into overlay region to write code */
4599	uint32 len;			/* overlay code len */
4600	/* overlay code follows this struct */
4601} wl_ioctl_overlay_t;
4602
4603#define OVERLAY_IDX_MASK		0x000000ff
4604#define OVERLAY_IDX_SHIFT		0
4605#define OVERLAY_FLAGS_MASK		0xffffff00
4606#define OVERLAY_FLAGS_SHIFT		8
4607/* overlay written to device memory immediately after loading the base image */
4608#define OVERLAY_FLAG_POSTLOAD	0x100
4609/* defer overlay download until the device responds w/WLC_E_OVL_DOWNLOAD event */
4610#define OVERLAY_FLAG_DEFER_DL	0x200
4611/* overlay downloaded prior to the host going to sleep */
4612#define OVERLAY_FLAG_PRESLEEP	0x400
4613
4614#define OVERLAY_DOWNLOAD_CHUNKSIZE	1024
4615#endif /* DONGLEOVERLAYS */
4616
4617#endif /* LINUX_POSTMOGRIFY_REMOVAL */
4618
4619/* 11k Neighbor Report element */
4620typedef struct nbr_element {
4621	uint8 id;
4622	uint8 len;
4623	struct ether_addr bssid;
4624	uint32 bssid_info;
4625	uint8 reg;
4626	uint8 channel;
4627	uint8 phytype;
4628	uint8 pad;
4629} nbr_element_t;
4630
4631/* no default structure packing */
4632#include <packed_section_end.h>
4633
4634/* require strict packing */
4635#include <packed_section_start.h>
4636
4637#ifndef LINUX_POSTMOGRIFY_REMOVAL
4638
4639/* Structures and constants used for "vndr_ie" IOVar interface */
4640#define VNDR_IE_CMD_LEN		4	/* length of the set command string:
4641					 * "add", "del" (+ NUL)
4642					 */
4643
4644/* 802.11 Mgmt Packet flags */
4645#define VNDR_IE_BEACON_FLAG	0x1
4646#define VNDR_IE_PRBRSP_FLAG	0x2
4647#define VNDR_IE_ASSOCRSP_FLAG	0x4
4648#define VNDR_IE_AUTHRSP_FLAG	0x8
4649#define VNDR_IE_PRBREQ_FLAG	0x10
4650#define VNDR_IE_ASSOCREQ_FLAG	0x20
4651#define VNDR_IE_IWAPID_FLAG	0x40 /* vendor IE in IW advertisement protocol ID field */
4652#define VNDR_IE_CUSTOM_FLAG	0x100 /* allow custom IE id */
4653
4654#if defined(WLP2P)
4655/* P2P Action Frames flags (spec ordered) */
4656#define VNDR_IE_GONREQ_FLAG     0x001000
4657#define VNDR_IE_GONRSP_FLAG     0x002000
4658#define VNDR_IE_GONCFM_FLAG     0x004000
4659#define VNDR_IE_INVREQ_FLAG     0x008000
4660#define VNDR_IE_INVRSP_FLAG     0x010000
4661#define VNDR_IE_DISREQ_FLAG     0x020000
4662#define VNDR_IE_DISRSP_FLAG     0x040000
4663#define VNDR_IE_PRDREQ_FLAG     0x080000
4664#define VNDR_IE_PRDRSP_FLAG     0x100000
4665
4666#define VNDR_IE_P2PAF_SHIFT	12
4667#endif /* WLP2P */
4668
4669#define VNDR_IE_INFO_HDR_LEN	(sizeof(uint32))
4670
4671typedef BWL_PRE_PACKED_STRUCT struct {
4672	uint32 pktflag;			/* bitmask indicating which packet(s) contain this IE */
4673	vndr_ie_t vndr_ie_data;		/* vendor IE data */
4674} BWL_POST_PACKED_STRUCT vndr_ie_info_t;
4675
4676typedef BWL_PRE_PACKED_STRUCT struct {
4677	int iecount;			/* number of entries in the vndr_ie_list[] array */
4678	vndr_ie_info_t vndr_ie_list[1];	/* variable size list of vndr_ie_info_t structs */
4679} BWL_POST_PACKED_STRUCT vndr_ie_buf_t;
4680
4681typedef BWL_PRE_PACKED_STRUCT struct {
4682	char cmd[VNDR_IE_CMD_LEN];	/* vndr_ie IOVar set command : "add", "del" + NUL */
4683	vndr_ie_buf_t vndr_ie_buffer;	/* buffer containing Vendor IE list information */
4684} BWL_POST_PACKED_STRUCT vndr_ie_setbuf_t;
4685
4686/* tag_ID/length/value_buffer tuple */
4687typedef BWL_PRE_PACKED_STRUCT struct {
4688	uint8	id;
4689	uint8	len;
4690	uint8	data[1];
4691} BWL_POST_PACKED_STRUCT tlv_t;
4692
4693typedef BWL_PRE_PACKED_STRUCT struct {
4694	uint32 pktflag;			/* bitmask indicating which packet(s) contain this IE */
4695	tlv_t ie_data;		/* IE data */
4696} BWL_POST_PACKED_STRUCT ie_info_t;
4697
4698typedef BWL_PRE_PACKED_STRUCT struct {
4699	int iecount;			/* number of entries in the ie_list[] array */
4700	ie_info_t ie_list[1];	/* variable size list of ie_info_t structs */
4701} BWL_POST_PACKED_STRUCT ie_buf_t;
4702
4703typedef BWL_PRE_PACKED_STRUCT struct {
4704	char cmd[VNDR_IE_CMD_LEN];	/* ie IOVar set command : "add" + NUL */
4705	ie_buf_t ie_buffer;	/* buffer containing IE list information */
4706} BWL_POST_PACKED_STRUCT ie_setbuf_t;
4707
4708typedef BWL_PRE_PACKED_STRUCT struct {
4709	uint32 pktflag;		/* bitmask indicating which packet(s) contain this IE */
4710	uint8 id;		/* IE type */
4711} BWL_POST_PACKED_STRUCT ie_getbuf_t;
4712
4713/* structures used to define format of wps ie data from probe requests */
4714/* passed up to applications via iovar "prbreq_wpsie" */
4715typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_hdr {
4716	struct ether_addr staAddr;
4717	uint16 ieLen;
4718} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_hdr_t;
4719
4720typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
4721	sta_prbreq_wps_ie_hdr_t hdr;
4722	uint8 ieData[1];
4723} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
4724
4725typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
4726	uint32 totLen;
4727	uint8 ieDataList[1];
4728} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
4729
4730
4731#ifdef WLMEDIA_TXFAILEVENT
4732typedef BWL_PRE_PACKED_STRUCT struct {
4733	char   dest[ETHER_ADDR_LEN]; /* destination MAC */
4734	uint8  prio;            /* Packet Priority */
4735	uint8  flags;           /* Flags           */
4736	uint32 tsf_l;           /* TSF timer low   */
4737	uint32 tsf_h;           /* TSF timer high  */
4738	uint16 rates;           /* Main Rates      */
4739	uint16 txstatus;        /* TX Status       */
4740} BWL_POST_PACKED_STRUCT txfailinfo_t;
4741#endif /* WLMEDIA_TXFAILEVENT */
4742
4743typedef BWL_PRE_PACKED_STRUCT struct {
4744	uint32 flags;
4745	chanspec_t chanspec;			/* txpwr report for this channel */
4746	chanspec_t local_chanspec;		/* channel on which we are associated */
4747	uint8 local_max;			/* local max according to the AP */
4748	uint8 local_constraint;			/* local constraint according to the AP */
4749	int8  antgain[2];			/* Ant gain for each band - from SROM */
4750	uint8 rf_cores;				/* count of RF Cores being reported */
4751	uint8 est_Pout[4];			/* Latest tx power out estimate per RF chain */
4752	uint8 est_Pout_act[4]; /* Latest tx power out estimate per RF chain w/o adjustment */
4753	uint8 est_Pout_cck;			/* Latest CCK tx power out estimate */
4754	uint8 tx_power_max[4];		/* Maximum target power among all rates */
4755	uint tx_power_max_rate_ind[4];		/* Index of the rate with the max target power */
4756	int8 clm_limits[WL_NUMRATES];		/* regulatory limits - 20, 40 or 80MHz */
4757	int8 clm_limits_subchan1[WL_NUMRATES];	/* regulatory limits - 20in40 or 40in80 */
4758	int8 clm_limits_subchan2[WL_NUMRATES];	/* regulatory limits - 20in80MHz */
4759	int8 sar;					/* SAR limit for display by wl executable */
4760	int8 channel_bandwidth;		/* 20, 40 or 80 MHz bandwidth? */
4761	uint8 version;				/* Version of the data format wlu <--> driver */
4762	uint8 display_core;			/* Displayed curpower core */
4763	int8 target_offsets[4];		/* Target power offsets for current rate per core */
4764	uint32 last_tx_ratespec;	/* Ratespec for last transmition */
4765	uint   user_target;		/* user limit */
4766	uint32 board_limit_len;		/* length of board limit buffer */
4767	uint32 target_len;		/* length of target power buffer */
4768	int8 SARLIMIT[MAX_STREAMS_SUPPORTED];
4769	uint8  pprdata[1];		/* ppr serialization buffer */
4770} BWL_POST_PACKED_STRUCT tx_pwr_rpt_t;
4771
4772
4773/* fbt_cap: FBT assoc / reassoc modes. */
4774#define WLC_FBT_CAP_DRV_4WAY_AND_REASSOC  1 /* Driver 4-way handshake & reassoc (WLFBT). */
4775
4776#endif /* LINUX_POSTMOGRIFY_REMOVAL */
4777
4778/* no strict structure packing */
4779#include <packed_section_end.h>
4780
4781#ifndef LINUX_POSTMOGRIFY_REMOVAL
4782/* Global ASSERT Logging */
4783#define ASSERTLOG_CUR_VER	0x0100
4784#define MAX_ASSRTSTR_LEN	64
4785
4786typedef struct assert_record {
4787	uint32 time;
4788	uint8 seq_num;
4789	char str[MAX_ASSRTSTR_LEN];
4790} assert_record_t;
4791
4792typedef struct assertlog_results {
4793	uint16 version;
4794	uint16 record_len;
4795	uint32 num;
4796	assert_record_t logs[1];
4797} assertlog_results_t;
4798
4799#define LOGRRC_FIX_LEN	8
4800#define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
4801
4802
4803/* channel interference measurement (chanim) related defines */
4804
4805/* chanim mode */
4806#define CHANIM_DISABLE	0	/* disabled */
4807#define CHANIM_DETECT	1	/* detection only */
4808#define CHANIM_EXT		2 	/* external state machine */
4809#define CHANIM_ACT		3	/* full internal state machine, detect + act */
4810#define CHANIM_MODE_MAX 4
4811
4812/* define for apcs reason code */
4813#define APCS_INIT		0
4814#define APCS_IOCTL		1
4815#define APCS_CHANIM		2
4816#define APCS_CSTIMER		3
4817#define APCS_BTA		4
4818#define APCS_TXDLY		5
4819#define APCS_NONACSD		6
4820#define APCS_DFS_REENTRY	7
4821#define APCS_TXFAIL		8
4822#define APCS_MAX		9
4823
4824/* number of ACS record entries */
4825#define CHANIM_ACS_RECORD			10
4826
4827/* CHANIM */
4828#define CCASTATS_TXDUR  0
4829#define CCASTATS_INBSS  1
4830#define CCASTATS_OBSS   2
4831#define CCASTATS_NOCTG  3
4832#define CCASTATS_NOPKT  4
4833#define CCASTATS_DOZE   5
4834#define CCASTATS_TXOP	6
4835#define CCASTATS_GDTXDUR        7
4836#define CCASTATS_BDTXDUR        8
4837#define CCASTATS_MAX    9
4838
4839/* chanim acs record */
4840typedef struct {
4841	bool valid;
4842	uint8 trigger;
4843	chanspec_t selected_chspc;
4844	int8 bgnoise;
4845	uint32 glitch_cnt;
4846	uint8 ccastats;
4847	uint timestamp;
4848} chanim_acs_record_t;
4849
4850typedef struct {
4851	chanim_acs_record_t acs_record[CHANIM_ACS_RECORD];
4852	uint8 count;
4853	uint timestamp;
4854} wl_acs_record_t;
4855
4856typedef struct chanim_stats {
4857	uint32 glitchcnt;               /* normalized as per second count */
4858	uint32 badplcp;                 /* normalized as per second count */
4859	uint8 ccastats[CCASTATS_MAX];   /* normalized as 0-255 */
4860	int8 bgnoise;					/* background noise level (in dBm) */
4861	chanspec_t chanspec;
4862	uint32 timestamp;
4863	uint32 bphy_glitchcnt;          /* normalized as per second count */
4864	uint32 bphy_badplcp;            /* normalized as per second count */
4865} chanim_stats_t;
4866
4867#define WL_CHANIM_STATS_VERSION 1
4868#define WL_CHANIM_COUNT_ALL	0xff
4869#define WL_CHANIM_COUNT_ONE	0x1
4870
4871typedef struct {
4872	uint32 buflen;
4873	uint32 version;
4874	uint32 count;
4875	chanim_stats_t stats[1];
4876} wl_chanim_stats_t;
4877
4878#define WL_CHANIM_STATS_FIXED_LEN OFFSETOF(wl_chanim_stats_t, stats)
4879
4880/* Noise measurement metrics. */
4881#define NOISE_MEASURE_KNOISE	0x1
4882
4883/* scb probe parameter */
4884typedef struct {
4885	uint32 scb_timeout;
4886	uint32 scb_activity_time;
4887	uint32 scb_max_probe;
4888} wl_scb_probe_t;
4889
4890/* ap tpc modes */
4891#define	AP_TPC_OFF		0
4892#define	AP_TPC_BSS_PWR		1	/* BSS power control */
4893#define AP_TPC_AP_PWR		2	/* AP power control */
4894#define	AP_TPC_AP_BSS_PWR	3	/* Both AP and BSS power control */
4895#define AP_TPC_MAX_LINK_MARGIN	127
4896
4897/* structure/defines for selective mgmt frame (smf) stats support */
4898
4899#define SMFS_VERSION 1
4900/* selected mgmt frame (smf) stats element */
4901typedef struct wl_smfs_elem {
4902	uint32 count;
4903	uint16 code;  /* SC or RC code */
4904} wl_smfs_elem_t;
4905
4906typedef struct wl_smf_stats {
4907	uint32 version;
4908	uint16 length;	/* reserved for future usage */
4909	uint8 type;
4910	uint8 codetype;
4911	uint32 ignored_cnt;
4912	uint32 malformed_cnt;
4913	uint32 count_total; /* count included the interested group */
4914	wl_smfs_elem_t elem[1];
4915} wl_smf_stats_t;
4916
4917#define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);
4918
4919enum {
4920	SMFS_CODETYPE_SC,
4921	SMFS_CODETYPE_RC
4922};
4923
4924/* reuse two number in the sc/rc space */
4925#define	SMFS_CODE_MALFORMED 0xFFFE
4926#define SMFS_CODE_IGNORED 	0xFFFD
4927
4928typedef enum smfs_type {
4929	SMFS_TYPE_AUTH,
4930	SMFS_TYPE_ASSOC,
4931	SMFS_TYPE_REASSOC,
4932	SMFS_TYPE_DISASSOC_TX,
4933	SMFS_TYPE_DISASSOC_RX,
4934	SMFS_TYPE_DEAUTH_TX,
4935	SMFS_TYPE_DEAUTH_RX,
4936	SMFS_TYPE_MAX
4937} smfs_type_t;
4938
4939#ifdef PHYMON
4940
4941#define PHYMON_VERSION 1
4942
4943typedef struct wl_phycal_core_state {
4944	/* Tx IQ/LO calibration coeffs */
4945	int16 tx_iqlocal_a;
4946	int16 tx_iqlocal_b;
4947	int8 tx_iqlocal_ci;
4948	int8 tx_iqlocal_cq;
4949	int8 tx_iqlocal_di;
4950	int8 tx_iqlocal_dq;
4951	int8 tx_iqlocal_ei;
4952	int8 tx_iqlocal_eq;
4953	int8 tx_iqlocal_fi;
4954	int8 tx_iqlocal_fq;
4955
4956	/* Rx IQ calibration coeffs */
4957	int16 rx_iqcal_a;
4958	int16 rx_iqcal_b;
4959
4960	uint8 tx_iqlocal_pwridx; /* Tx Power Index for Tx IQ/LO calibration */
4961	uint32 papd_epsilon_table[64]; /* PAPD epsilon table */
4962	int16 papd_epsilon_offset; /* PAPD epsilon offset */
4963	uint8 curr_tx_pwrindex; /* Tx power index */
4964	int8 idle_tssi; /* Idle TSSI */
4965	int8 est_tx_pwr; /* Estimated Tx Power (dB) */
4966	int8 est_rx_pwr; /* Estimated Rx Power (dB) from RSSI */
4967	uint16 rx_gaininfo; /* Rx gain applied on last Rx pkt */
4968	uint16 init_gaincode; /* initgain required for ACI */
4969	int8 estirr_tx;
4970	int8 estirr_rx;
4971
4972} wl_phycal_core_state_t;
4973
4974typedef struct wl_phycal_state {
4975	int version;
4976	int8 num_phy_cores; /* number of cores */
4977	int8 curr_temperature; /* on-chip temperature sensor reading */
4978	chanspec_t chspec; /* channspec for this state */
4979	bool aci_state; /* ACI state: ON/OFF */
4980	uint16 crsminpower; /* crsminpower required for ACI */
4981	uint16 crsminpowerl; /* crsminpowerl required for ACI */
4982	uint16 crsminpoweru; /* crsminpoweru required for ACI */
4983	wl_phycal_core_state_t phycal_core[1];
4984} wl_phycal_state_t;
4985
4986#define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
4987#endif /* PHYMON */
4988
4989/* discovery state */
4990typedef struct wl_p2p_disc_st {
4991	uint8 state;	/* see state */
4992	chanspec_t chspec;	/* valid in listen state */
4993	uint16 dwell;	/* valid in listen state, in ms */
4994} wl_p2p_disc_st_t;
4995
4996/* state */
4997#define WL_P2P_DISC_ST_SCAN	0
4998#define WL_P2P_DISC_ST_LISTEN	1
4999#define WL_P2P_DISC_ST_SEARCH	2
5000
5001/* scan request */
5002typedef struct wl_p2p_scan {
5003	uint8 type;		/* 'S' for WLC_SCAN, 'E' for "escan" */
5004	uint8 reserved[3];
5005	/* scan or escan parms... */
5006} wl_p2p_scan_t;
5007
5008/* i/f request */
5009typedef struct wl_p2p_if {
5010	struct ether_addr addr;
5011	uint8 type;	/* see i/f type */
5012	chanspec_t chspec;	/* for p2p_ifadd GO */
5013} wl_p2p_if_t;
5014
5015/* i/f type */
5016#define WL_P2P_IF_CLIENT	0
5017#define WL_P2P_IF_GO		1
5018#define WL_P2P_IF_DYNBCN_GO	2
5019#define WL_P2P_IF_DEV		3
5020
5021/* i/f query */
5022typedef struct wl_p2p_ifq {
5023	uint bsscfgidx;
5024	char ifname[BCM_MSG_IFNAME_MAX];
5025} wl_p2p_ifq_t;
5026
5027/* OppPS & CTWindow */
5028typedef struct wl_p2p_ops {
5029	uint8 ops;	/* 0: disable 1: enable */
5030	uint8 ctw;	/* >= 10 */
5031} wl_p2p_ops_t;
5032
5033/* absence and presence request */
5034typedef struct wl_p2p_sched_desc {
5035	uint32 start;
5036	uint32 interval;
5037	uint32 duration;
5038	uint32 count;	/* see count */
5039} wl_p2p_sched_desc_t;
5040
5041/* count */
5042#define WL_P2P_SCHED_RSVD	0
5043#define WL_P2P_SCHED_REPEAT	255	/* anything > 255 will be treated as 255 */
5044
5045typedef struct wl_p2p_sched {
5046	uint8 type;	/* see schedule type */
5047	uint8 action;	/* see schedule action */
5048	uint8 option;	/* see schedule option */
5049	wl_p2p_sched_desc_t desc[1];
5050} wl_p2p_sched_t;
5051#define WL_P2P_SCHED_FIXED_LEN		3
5052
5053/* schedule type */
5054#define WL_P2P_SCHED_TYPE_ABS		0	/* Scheduled Absence */
5055#define WL_P2P_SCHED_TYPE_REQ_ABS	1	/* Requested Absence */
5056
5057/* schedule action during absence periods (for WL_P2P_SCHED_ABS type) */
5058#define WL_P2P_SCHED_ACTION_NONE	0	/* no action */
5059#define WL_P2P_SCHED_ACTION_DOZE	1	/* doze */
5060/* schedule option - WL_P2P_SCHED_TYPE_REQ_ABS */
5061#define WL_P2P_SCHED_ACTION_GOOFF	2	/* turn off GO beacon/prbrsp functions */
5062/* schedule option - WL_P2P_SCHED_TYPE_XXX */
5063#define WL_P2P_SCHED_ACTION_RESET	255	/* reset */
5064
5065/* schedule option - WL_P2P_SCHED_TYPE_ABS */
5066#define WL_P2P_SCHED_OPTION_NORMAL	0	/* normal start/interval/duration/count */
5067#define WL_P2P_SCHED_OPTION_BCNPCT	1	/* percentage of beacon interval */
5068/* schedule option - WL_P2P_SCHED_TYPE_REQ_ABS */
5069#define WL_P2P_SCHED_OPTION_TSFOFS	2	/* normal start/internal/duration/count with
5070						 * start being an offset of the 'current' TSF
5071						 */
5072
5073/* feature flags */
5074#define WL_P2P_FEAT_GO_CSA	(1 << 0)	/* GO moves with the STA using CSA method */
5075#define WL_P2P_FEAT_GO_NOLEGACY	(1 << 1)	/* GO does not probe respond to non-p2p probe
5076						 * requests
5077						 */
5078#define WL_P2P_FEAT_RESTRICT_DEV_RESP (1 << 2)	/* Restrict p2p dev interface from responding */
5079
5080/* RFAWARE def */
5081#define BCM_ACTION_RFAWARE		0x77
5082#define BCM_ACTION_RFAWARE_DCS  0x01
5083
5084/* DCS reason code define */
5085#define BCM_DCS_IOVAR		0x1
5086#define BCM_DCS_UNKNOWN		0xFF
5087
5088typedef struct wl_bcmdcs_data {
5089	uint reason;
5090	chanspec_t chspec;
5091} wl_bcmdcs_data_t;
5092
5093/* n-mode support capability */
5094/* 2x2 includes both 1x1 & 2x2 devices
5095 * reserved #define 2 for future when we want to separate 1x1 & 2x2 and
5096 * control it independently
5097 */
5098#define WL_11N_2x2			1
5099#define WL_11N_3x3			3
5100#define WL_11N_4x4			4
5101
5102/* define 11n feature disable flags */
5103#define WLFEATURE_DISABLE_11N		0x00000001
5104#define WLFEATURE_DISABLE_11N_STBC_TX	0x00000002
5105#define WLFEATURE_DISABLE_11N_STBC_RX	0x00000004
5106#define WLFEATURE_DISABLE_11N_SGI_TX	0x00000008
5107#define WLFEATURE_DISABLE_11N_SGI_RX	0x00000010
5108#define WLFEATURE_DISABLE_11N_AMPDU_TX	0x00000020
5109#define WLFEATURE_DISABLE_11N_AMPDU_RX	0x00000040
5110#define WLFEATURE_DISABLE_11N_GF	0x00000080
5111
5112/* Proxy STA modes */
5113#define PSTA_MODE_DISABLED		0
5114#define PSTA_MODE_PROXY			1
5115#define PSTA_MODE_REPEATER		2
5116
5117
5118/* NAT configuration */
5119typedef struct {
5120	uint32 ipaddr;		/* interface ip address */
5121	uint32 ipaddr_mask;	/* interface ip address mask */
5122	uint32 ipaddr_gateway;	/* gateway ip address */
5123	uint8 mac_gateway[6];	/* gateway mac address */
5124	uint32 ipaddr_dns;	/* DNS server ip address, valid only for public if */
5125	uint8 mac_dns[6];	/* DNS server mac address,  valid only for public if */
5126	uint8 GUID[38];		/* interface GUID */
5127} nat_if_info_t;
5128
5129typedef struct {
5130	uint op;		/* operation code */
5131	bool pub_if;		/* set for public if, clear for private if */
5132	nat_if_info_t if_info;	/* interface info */
5133} nat_cfg_t;
5134
5135/* op code in nat_cfg */
5136#define NAT_OP_ENABLE		1	/* enable NAT on given interface */
5137#define NAT_OP_DISABLE		2	/* disable NAT on given interface */
5138#define NAT_OP_DISABLE_ALL	3	/* disable NAT on all interfaces */
5139
5140/* NAT state */
5141#define NAT_STATE_ENABLED	1	/* NAT is enabled */
5142#define NAT_STATE_DISABLED	2	/* NAT is disabled */
5143
5144typedef struct {
5145	int state;	/* NAT state returned */
5146} nat_state_t;
5147
5148#ifdef PROP_TXSTATUS
5149/* Bit definitions for tlv iovar */
5150/*
5151 * enable RSSI signals:
5152 * WLFC_CTL_TYPE_RSSI
5153 */
5154#define WLFC_FLAGS_RSSI_SIGNALS                         1
5155
5156/* enable (if/mac_open, if/mac_close,, mac_add, mac_del) signals:
5157 *
5158 * WLFC_CTL_TYPE_MAC_OPEN
5159 * WLFC_CTL_TYPE_MAC_CLOSE
5160 *
5161 * WLFC_CTL_TYPE_INTERFACE_OPEN
5162 * WLFC_CTL_TYPE_INTERFACE_CLOSE
5163 *
5164 * WLFC_CTL_TYPE_MACDESC_ADD
5165 * WLFC_CTL_TYPE_MACDESC_DEL
5166 *
5167 */
5168#define WLFC_FLAGS_XONXOFF_SIGNALS                      2
5169
5170/* enable (status, fifo_credit, mac_credit) signals
5171 * WLFC_CTL_TYPE_MAC_REQUEST_CREDIT
5172 * WLFC_CTL_TYPE_TXSTATUS
5173 * WLFC_CTL_TYPE_FIFO_CREDITBACK
5174 */
5175#define WLFC_FLAGS_CREDIT_STATUS_SIGNALS        4
5176
5177#define WLFC_FLAGS_HOST_PROPTXSTATUS_ACTIVE     8
5178#define WLFC_FLAGS_PSQ_GENERATIONFSM_ENABLE     16
5179#define WLFC_FLAGS_PSQ_ZERO_BUFFER_ENABLE	32
5180#endif /* PROP_TXSTATUS */
5181
5182#define BTA_STATE_LOG_SZ	64
5183
5184/* BTAMP Statemachine states */
5185enum {
5186	HCIReset = 1,
5187	HCIReadLocalAMPInfo,
5188	HCIReadLocalAMPASSOC,
5189	HCIWriteRemoteAMPASSOC,
5190	HCICreatePhysicalLink,
5191	HCIAcceptPhysicalLinkRequest,
5192	HCIDisconnectPhysicalLink,
5193	HCICreateLogicalLink,
5194	HCIAcceptLogicalLink,
5195	HCIDisconnectLogicalLink,
5196	HCILogicalLinkCancel,
5197	HCIAmpStateChange,
5198	HCIWriteLogicalLinkAcceptTimeout
5199};
5200
5201typedef struct flush_txfifo {
5202	uint32 txfifobmp;
5203	uint32 hwtxfifoflush;
5204	struct ether_addr ea;
5205} flush_txfifo_t;
5206
5207#define CHANNEL_5G_LOW_START	36	/* 5G low (36..48) CDD enable/disable bit mask */
5208#define CHANNEL_5G_MID_START	52	/* 5G mid (52..64) CDD enable/disable bit mask */
5209#define CHANNEL_5G_HIGH_START	100	/* 5G high (100..140) CDD enable/disable bit mask */
5210#define CHANNEL_5G_UPPER_START	149	/* 5G upper (149..161) CDD enable/disable bit mask */
5211
5212enum {
5213	SPATIAL_MODE_2G_IDX = 0,
5214	SPATIAL_MODE_5G_LOW_IDX,
5215	SPATIAL_MODE_5G_MID_IDX,
5216	SPATIAL_MODE_5G_HIGH_IDX,
5217	SPATIAL_MODE_5G_UPPER_IDX,
5218	SPATIAL_MODE_MAX_IDX
5219};
5220
5221#define WLC_TXCORE_MAX	4	/* max number of txcore supports */
5222#define WLC_SUBBAND_MAX	4	/* max number of sub-band supports */
5223typedef struct {
5224	uint8	band2g[WLC_TXCORE_MAX];
5225	uint8	band5g[WLC_SUBBAND_MAX][WLC_TXCORE_MAX];
5226} sar_limit_t;
5227
5228/* IOVAR "mempool" parameter. Used to retrieve a list of memory pool statistics. */
5229typedef struct wl_mempool_stats {
5230	int	num;		/* Number of memory pools */
5231	bcm_mp_stats_t s[1];	/* Variable array of memory pool stats. */
5232} wl_mempool_stats_t;
5233
5234/* Network Offload Engine */
5235#define NWOE_OL_ENABLE		0x00000001
5236
5237typedef struct {
5238	uint32 ipaddr;
5239	uint32 ipaddr_netmask;
5240	uint32 ipaddr_gateway;
5241} nwoe_ifconfig_t;
5242
5243/*
5244 * Traffic management structures/defines.
5245 */
5246
5247/* Traffic management bandwidth parameters */
5248#define TRF_MGMT_MAX_PRIORITIES                 3
5249
5250#define TRF_MGMT_FLAG_ADD_DSCP                  0x0001  /* Add DSCP to IP TOS field */
5251#define TRF_MGMT_FLAG_DISABLE_SHAPING           0x0002  /* Don't shape traffic */
5252#define TRF_MGMT_FLAG_MANAGE_LOCAL_TRAFFIC      0x0008  /* Manage traffic over our local subnet */
5253#define TRF_MGMT_FLAG_FILTER_ON_MACADDR         0x0010  /* filter on MAC address */
5254#define TRF_MGMT_FLAG_NO_RX                     0x0020  /* do not apply fiters to rx packets */
5255
5256#define TRF_FILTER_MAC_ADDR              0x0001 /* L2 filter use dst mac address for filtering */
5257#define TRF_FILTER_IP_ADDR               0x0002 /* L3 filter use ip ddress for filtering */
5258#define TRF_FILTER_L4                    0x0004 /* L4 filter use tcp/udp for filtering */
5259#define TRF_FILTER_DWM                   0x0008 /* L3 filter use DSCP for filtering */
5260#define TRF_FILTER_FAVORED               0x0010 /* Tag the packet FAVORED */
5261
5262/* Traffic management priority classes */
5263typedef enum trf_mgmt_priority_class {
5264	trf_mgmt_priority_low           = 0,        /* Maps to 802.1p BK */
5265	trf_mgmt_priority_medium        = 1,        /* Maps to 802.1p BE */
5266	trf_mgmt_priority_high          = 2,        /* Maps to 802.1p VI */
5267	trf_mgmt_priority_nochange	= 3,	    /* do not update the priority */
5268	trf_mgmt_priority_invalid       = (trf_mgmt_priority_nochange + 1)
5269} trf_mgmt_priority_class_t;
5270
5271/* Traffic management configuration parameters */
5272typedef struct trf_mgmt_config {
5273	uint32  trf_mgmt_enabled;                           /* 0 - disabled, 1 - enabled */
5274	uint32  flags;                                      /* See TRF_MGMT_FLAG_xxx defines */
5275	uint32  host_ip_addr;                               /* My IP address to determine subnet */
5276	uint32  host_subnet_mask;                           /* My subnet mask */
5277	uint32  downlink_bandwidth;                         /* In units of kbps */
5278	uint32  uplink_bandwidth;                           /* In units of kbps */
5279	uint32  min_tx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /* Minimum guaranteed tx bandwidth */
5280	uint32  min_rx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /* Minimum guaranteed rx bandwidth */
5281} trf_mgmt_config_t;
5282
5283/* Traffic management filter */
5284typedef struct trf_mgmt_filter {
5285	struct ether_addr           dst_ether_addr;         /* His L2 address */
5286	uint32                      dst_ip_addr;            /* His IP address */
5287	uint16                      dst_port;               /* His L4 port */
5288	uint16                      src_port;               /* My L4 port */
5289	uint16                      prot;                   /* L4 protocol (only TCP or UDP) */
5290	uint16                      flags;                  /* TBD. For now, this must be zero. */
5291	trf_mgmt_priority_class_t   priority;               /* Priority for filtered packets */
5292	uint32                      dscp;                   /* DSCP */
5293} trf_mgmt_filter_t;
5294
5295/* Traffic management filter list (variable length) */
5296typedef struct trf_mgmt_filter_list     {
5297	uint32              num_filters;
5298	trf_mgmt_filter_t   filter[1];
5299} trf_mgmt_filter_list_t;
5300
5301/* Traffic management global info used for all queues */
5302typedef struct trf_mgmt_global_info {
5303	uint32  maximum_bytes_per_second;
5304	uint32  maximum_bytes_per_sampling_period;
5305	uint32  total_bytes_consumed_per_second;
5306	uint32  total_bytes_consumed_per_sampling_period;
5307	uint32  total_unused_bytes_per_sampling_period;
5308} trf_mgmt_global_info_t;
5309
5310/* Traffic management shaping info per priority queue */
5311typedef struct trf_mgmt_shaping_info {
5312	uint32  gauranteed_bandwidth_percentage;
5313	uint32  guaranteed_bytes_per_second;
5314	uint32  guaranteed_bytes_per_sampling_period;
5315	uint32  num_bytes_produced_per_second;
5316	uint32  num_bytes_consumed_per_second;
5317	uint32  num_queued_packets;                         /* Number of packets in queue */
5318	uint32  num_queued_bytes;                           /* Number of bytes in queue */
5319} trf_mgmt_shaping_info_t;
5320
5321/* Traffic management shaping info array */
5322typedef struct trf_mgmt_shaping_info_array {
5323	trf_mgmt_global_info_t   tx_global_shaping_info;
5324	trf_mgmt_shaping_info_t  tx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
5325	trf_mgmt_global_info_t   rx_global_shaping_info;
5326	trf_mgmt_shaping_info_t  rx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
5327} trf_mgmt_shaping_info_array_t;
5328
5329
5330/* Traffic management statistical counters */
5331typedef struct trf_mgmt_stats {
5332	uint32  num_processed_packets;      /* Number of packets processed */
5333	uint32  num_processed_bytes;        /* Number of bytes processed */
5334	uint32  num_discarded_packets;      /* Number of packets discarded from queue */
5335} trf_mgmt_stats_t;
5336
5337/* Traffic management statisics array */
5338typedef struct trf_mgmt_stats_array {
5339	trf_mgmt_stats_t  tx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
5340	trf_mgmt_stats_t  rx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
5341} trf_mgmt_stats_array_t;
5342
5343typedef struct lpc_params {
5344	/* LPC Params exposed via IOVAR */
5345	uint8		rate_stab_thresh; /* Thresh for rate stability based on nupd */
5346	uint8		pwr_stab_thresh; /* Number of successes before power step down */
5347	uint8		lpc_exp_time; /* Time lapse for expiry of database */
5348	uint8		pwrup_slow_step; /* Step size for slow step up */
5349	uint8		pwrup_fast_step; /* Step size for fast step up */
5350	uint8		pwrdn_slow_step; /* Step size for slow step down */
5351} lpc_params_t;
5352
5353/* tx pkt delay statistics */
5354#define	SCB_RETRY_SHORT_DEF	7	/* Default Short retry Limit */
5355#define WLPKTDLY_HIST_NBINS	16	/* number of bins used in the Delay histogram */
5356
5357/* structure to store per-AC delay statistics */
5358typedef struct scb_delay_stats {
5359	uint32 txmpdu_lost;	/* number of MPDUs lost */
5360	uint32 txmpdu_cnt[SCB_RETRY_SHORT_DEF]; /* retry times histogram */
5361	uint32 delay_sum[SCB_RETRY_SHORT_DEF]; /* cumulative packet latency */
5362	uint32 delay_min;	/* minimum packet latency observed */
5363	uint32 delay_max;	/* maximum packet latency observed */
5364	uint32 delay_avg;	/* packet latency average */
5365	uint32 delay_hist[WLPKTDLY_HIST_NBINS];	/* delay histogram */
5366} scb_delay_stats_t;
5367
5368/* structure for txdelay event */
5369typedef struct txdelay_event {
5370	uint8	status;
5371	int		rssi;
5372	chanim_stats_t		chanim_stats;
5373	scb_delay_stats_t	delay_stats[AC_COUNT];
5374} txdelay_event_t;
5375
5376/* structure for txdelay parameters */
5377typedef struct txdelay_params {
5378	uint16	ratio;	/* Avg Txdelay Delta */
5379	uint8	cnt;	/* Sample cnt */
5380	uint8	period;	/* Sample period */
5381	uint8	tune;	/* Debug */
5382} txdelay_params_t;
5383
5384/* WNM/NPS subfeatures mask */
5385#define WL_WNM_BSSTRANS		0x00000001
5386#define WL_WNM_PROXYARP		0x00000002
5387#define WL_WNM_MAXIDLE		0x00000004
5388#define WL_WNM_TIMBC		0x00000008
5389#define WL_WNM_TFS		0x00000010
5390#define WL_WNM_SLEEP		0x00000020
5391#define WL_WNM_DMS		0x00000040
5392#define WL_WNM_FMS		0x00000080
5393#define WL_WNM_NOTIF		0x00000100
5394#define WL_WNM_MAX		0x00000200
5395
5396enum {
5397	WNM_SERVICE_DMS = 1,
5398	WNM_SERVICE_FMS = 2,
5399	WNM_SERVICE_TFS = 3
5400};
5401
5402/* Definitions for WNM/NPS TCLAS */
5403typedef struct wl_tclas {
5404	uint8 user_priority;
5405	uint8 fc_len;
5406	dot11_tclas_fc_t fc;
5407} wl_tclas_t;
5408
5409#define WL_TCLAS_FIXED_SIZE	OFFSETOF(wl_tclas_t, fc)
5410
5411typedef struct wl_tclas_list {
5412	uint32 num;
5413	wl_tclas_t tclas[1];
5414} wl_tclas_list_t;
5415
5416/* Definitions for WNM/NPS Traffic Filter Service */
5417typedef struct wl_tfs_filter {
5418	uint8 status;			/* Status returned by the AP */
5419	uint8 tclas_proc;		/* TCLAS processing value (0:and, 1:or)  */
5420	uint8 tclas_cnt;		/* count of all wl_tclas_t in tclas array */
5421	uint8 tclas[1];			/* VLA of wl_tclas_t */
5422} wl_tfs_filter_t;
5423#define WL_TFS_FILTER_FIXED_SIZE	OFFSETOF(wl_tfs_filter_t, tclas)
5424
5425typedef struct wl_tfs_fset {
5426	struct ether_addr ea;		/* Address of AP/STA involved with this filter set */
5427	uint8 tfs_id;			/* TFS ID field chosen by STA host */
5428	uint8 status;			/* Internal status TFS_STATUS_xxx */
5429	uint8 actcode;			/* Action code DOT11_TFS_ACTCODE_xxx */
5430	uint8 token;			/* Token used in last request frame */
5431	uint8 notify;			/* Notify frame sent/received because of this set */
5432	uint8 filter_cnt;		/* count of all wl_tfs_filter_t in filter array */
5433	uint8 filter[1];		/* VLA of wl_tfs_filter_t */
5434} wl_tfs_fset_t;
5435#define WL_TFS_FSET_FIXED_SIZE		OFFSETOF(wl_tfs_fset_t, filter)
5436
5437enum {
5438	TFS_STATUS_DISABLED = 0,	/* TFS filter set disabled by user */
5439	TFS_STATUS_DISABLING = 1,	/* Empty request just sent to AP */
5440	TFS_STATUS_VALIDATED = 2,	/* Filter set validated by AP (but maybe not enabled!) */
5441	TFS_STATUS_VALIDATING = 3,	/* Filter set just sent to AP */
5442	TFS_STATUS_NOT_ASSOC = 4,	/* STA not associated */
5443	TFS_STATUS_NOT_SUPPORT = 5,	/* TFS not supported by AP */
5444	TFS_STATUS_DENIED = 6,		/* Filter set refused by AP (=> all sets are disabled!) */
5445};
5446
5447typedef struct wl_tfs_status {
5448	uint8 fset_cnt;			/* count of all wl_tfs_fset_t in fset array */
5449	wl_tfs_fset_t fset[1];		/* VLA of wl_tfs_fset_t */
5450} wl_tfs_status_t;
5451
5452typedef struct wl_tfs_set {
5453	uint8 send;			/* Immediatly register registered sets on AP side */
5454	uint8 tfs_id;			/* ID of a specific set (existing or new), or 0 for all */
5455	uint8 actcode;			/* Action code for this filter set */
5456	uint8 tclas_proc;		/* TCLAS processing operator for this filter set */
5457} wl_tfs_set_t;
5458
5459enum {
5460	TFS_TERM_SEND_NOW = 1,		/* Send the TFS frame immediatly */
5461	TFS_TERM_DELETE = 2		/* Also delete set internally */
5462};
5463
5464typedef struct wl_tfs_term {
5465	uint8 flags;			/* Bitfield of WL_TFS_TERM_xxx */
5466	uint8 tfs_id;			/* ID of a specific set (existing), or 0 for all */
5467} wl_tfs_term_t;
5468
5469
5470/* Definitions for WNM/NPS Directed Multicast Service */
5471enum {
5472	DMS_STATUS_DISABLED = 0,	/* DMS desc disabled by user */
5473	DMS_STATUS_ACCEPTED = 1,	/* Request accepted by AP */
5474	DMS_STATUS_NOT_ASSOC = 2,	/* STA not associated */
5475	DMS_STATUS_NOT_SUPPORT = 3,	/* DMS not supported by AP */
5476	DMS_STATUS_DENIED = 4,		/* Request denied by AP */
5477	DMS_STATUS_TERM = 5,		/* Request terminated by AP */
5478	DMS_STATUS_REMOVING = 6,	/* Remove request just sent */
5479	DMS_STATUS_ADDING = 7,		/* Add request just sent */
5480	DMS_STATUS_ERROR = 8		/* Non compliant AP behvior */
5481};
5482
5483typedef struct wl_dms_desc {
5484	uint8 user_id;
5485	uint8 status;
5486	uint8 token;
5487	uint8 dms_id;
5488	uint8 tclas_proc;
5489	uint8 mac_len;		/* length of all ether_addr in data array, 0 if STA */
5490	uint8 tclas_len;	/* length of all wl_tclas_t in data array */
5491	uint8 data[1];		/* VLA of 'ether_addr' and 'wl_tclas_t' (in this order ) */
5492} wl_dms_desc_t;
5493
5494#define WL_DMS_DESC_FIXED_SIZE	OFFSETOF(wl_dms_desc_t, data)
5495
5496typedef struct wl_dms_status {
5497	uint32 cnt;
5498	wl_dms_desc_t desc[1];
5499} wl_dms_status_t;
5500
5501typedef struct wl_dms_set {
5502	uint8 send;
5503	uint8 user_id;
5504	uint8 tclas_proc;
5505} wl_dms_set_t;
5506
5507typedef struct wl_dms_term {
5508	uint8 del;
5509	uint8 user_id;
5510} wl_dms_term_t;
5511
5512typedef struct wl_service_term {
5513	uint8 service;
5514	union {
5515		wl_dms_term_t dms;
5516	} u;
5517} wl_service_term_t;
5518
5519/* Definitions for WNM/NPS BSS Transistion */
5520typedef struct wl_bsstrans_req {
5521	uint16 tbtt;			/* time of BSS to end of life, in unit of TBTT */
5522	uint16 dur;			/* time of BSS to keep off, in unit of minute */
5523	uint8 reqmode;			/* request mode of BSS transition request */
5524	uint8 unicast;			/* request by unicast or by broadcast */
5525} wl_bsstrans_req_t;
5526
5527/* Definitions for WNM/NPS TIM Broadcast */
5528typedef struct wl_timbc_offset {
5529	int16 offset;		/* offset in us */
5530	uint16 fix_intv;	/* override interval sent from STA */
5531	uint16 rate_override;	/* use rate override to send high rate TIM broadcast frame */
5532	uint8 tsf_present;	/* show timestamp in TIM broadcast frame */
5533} wl_timbc_offset_t;
5534
5535typedef struct wl_timbc_set {
5536	uint8 interval;		/* Interval in DTIM wished or required. */
5537	uint8 flags;		/* Bitfield described below */
5538	uint16 rate_min;	/* Minimum rate required for High/Low TIM frames. Optionnal */
5539	uint16 rate_max;	/* Maximum rate required for High/Low TIM frames. Optionnal */
5540} wl_timbc_set_t;
5541
5542enum {
5543	WL_TIMBC_SET_TSF_REQUIRED = 1,	/* Enable TIMBC only if TSF in TIM frames */
5544	WL_TIMBC_SET_NO_OVERRIDE = 2,	/* ... if AP does not override interval */
5545	WL_TIMBC_SET_PROXY_ARP = 4,	/* ... if AP support Proxy ARP */
5546	WL_TIMBC_SET_DMS_ACCEPTED = 8	/* ... if all DMS desc have been accepted */
5547};
5548
5549typedef struct wl_timbc_status {
5550	uint8 status_sta;		/* Status from internal state machine (check below) */
5551	uint8 status_ap;		/* From AP response frame (check 8.4.2.86 from 802.11) */
5552	uint8 interval;
5553	uint8 pad;
5554	int32 offset;
5555	uint16 rate_high;
5556	uint16 rate_low;
5557} wl_timbc_status_t;
5558
5559enum {
5560	WL_TIMBC_STATUS_DISABLE = 0,		/* TIMBC disabled by user */
5561	WL_TIMBC_STATUS_REQ_MISMATCH = 1,	/* AP settings do no match user requirements */
5562	WL_TIMBC_STATUS_NOT_ASSOC = 2,		/* STA not associated */
5563	WL_TIMBC_STATUS_NOT_SUPPORT = 3,	/* TIMBC not supported by AP */
5564	WL_TIMBC_STATUS_DENIED = 4,		/* Req to disable TIMBC sent to AP */
5565	WL_TIMBC_STATUS_ENABLE = 5		/* TIMBC enabled */
5566};
5567
5568#define WL_TIMBC_STATUS_AP_UNKNOWN	255	/* AP status for internal use only */
5569
5570/* Definitions for PM2 Dynamic Fast Return To Sleep */
5571typedef struct wl_pm2_sleep_ret_ext {
5572	uint8 logic;			/* DFRTS logic: see WL_DFRTS_LOGIC_* below */
5573	uint16 low_ms;			/* Low FRTS timeout */
5574	uint16 high_ms;			/* High FRTS timeout */
5575	uint16 rx_pkts_threshold;	/* switching threshold: # rx pkts */
5576	uint16 tx_pkts_threshold;	/* switching threshold: # tx pkts */
5577	uint16 txrx_pkts_threshold;	/* switching threshold: # (tx+rx) pkts */
5578	uint32 rx_bytes_threshold;	/* switching threshold: # rx bytes */
5579	uint32 tx_bytes_threshold;	/* switching threshold: # tx bytes */
5580	uint32 txrx_bytes_threshold;	/* switching threshold: # (tx+rx) bytes */
5581} wl_pm2_sleep_ret_ext_t;
5582
5583#define WL_DFRTS_LOGIC_OFF	0	/* Feature is disabled */
5584#define WL_DFRTS_LOGIC_OR	1	/* OR all non-zero threshold conditions */
5585#define WL_DFRTS_LOGIC_AND	2	/* AND all non-zero threshold conditions */
5586
5587/* Definitions for Reliable Multicast */
5588#define WL_RELMCAST_MAX_CLIENT		32
5589#define WL_RELMCAST_FLAG_INBLACKLIST	1
5590#define WL_RELMCAST_FLAG_ACTIVEACKER	2
5591#define WL_RELMCAST_FLAG_RELMCAST	4
5592
5593#define WL_RELMCAST_VER			1
5594
5595typedef struct wl_relmcast_client {
5596	uint8 flag;
5597	int16 rssi;
5598	struct ether_addr addr;
5599} wl_relmcast_client_t;
5600
5601typedef struct wl_relmcast_st {
5602	uint8 ver;
5603	uint8 num;
5604	wl_relmcast_client_t clients[WL_RELMCAST_MAX_CLIENT];
5605} wl_relmcast_status_t;
5606
5607/* structures for proximity detection device role */
5608#define WL_PROXD_MODE_DISABLE	0
5609#define WL_PROXD_MODE_NEUTRAL	1
5610#define WL_PROXD_MODE_INITIATOR	2
5611#define WL_PROXD_MODE_TARGET	3
5612#define WL_PROXD_RANDOM_WAKEUP	0x8000
5613
5614typedef struct wl_proxd_iovar {
5615	uint16	method;		/* Proxmity Detection method */
5616	uint16	mode;		/* Mode (neutral, initiator, target) */
5617} wl_proxd_iovar_t;
5618
5619/* structures for proximity detection parameters */
5620typedef struct wl_proxd_params_rssi_method {
5621	chanspec_t	chanspec;	/* chanspec for home channel */
5622	uint16		interval;	/* interval between neighbor finding attempts (in TU) */
5623	uint16		duration;	/* duration of neighbor finding attempts (in ms) */
5624	int16		rssi_thresh;	/* RSSI threshold (in dBm) */
5625	int16		tx_power;	/* tx power of Proximity Detection frames (in dBm) */
5626	uint16		tx_rate;	/* tx rate of Proximity Detection frames
5627					 * (in 500kbps units)
5628					 */
5629	uint16		timeout;	/* state machine wait timeout of the frames (in ms) */
5630	uint16		maxconvergtmo;	/* max wait converge timeout (in ms) */
5631} wl_proxd_params_rssi_method_t;
5632
5633typedef struct wl_proxd_params_iovar {
5634	uint16	method;			/* Proxmity Detection method */
5635	union {
5636		wl_proxd_params_rssi_method_t rssi_params;
5637	} u;				/* Method specific optional parameters */
5638} wl_proxd_params_iovar_t;
5639
5640enum {
5641	RSSI_REASON_UNKNOW,
5642	RSSI_REASON_LOWRSSI,
5643	RSSI_REASON_NSYC,
5644	RSSI_REASON_TIMEOUT
5645};
5646
5647enum {
5648	RSSI_STATE_POLL,
5649	RSSI_STATE_TPAIRING,
5650	RSSI_STATE_IPAIRING,
5651	RSSI_STATE_THANDSHAKE,
5652	RSSI_STATE_IHANDSHAKE,
5653	RSSI_STATE_CONFIRMED,
5654	RSSI_STATE_PIPELINE,
5655	RSSI_STATE_NEGMODE,
5656	RSSI_STATE_MONITOR,
5657	RSSI_STATE_LAST
5658};
5659
5660typedef struct wl_proxd_status_iovar {
5661	uint8			mode;
5662	uint8			peermode;
5663	uint8			state;
5664	uint8			reason;
5665	uint32			txcnt;
5666	uint32			rxcnt;
5667	struct ether_addr	peer;
5668	int16			hi_rssi;
5669	int16			low_rssi;
5670} wl_proxd_status_iovar_t;
5671
5672#ifdef NET_DETECT
5673
5674#define NET_DETECT_MAX_WAKE_DATA_SIZE	2048
5675#define NET_DETECT_MAX_PROFILES		16
5676#define NET_DETECT_MAX_CHANNELS		50
5677
5678typedef struct net_detect_adapter_features {
5679	bool	wowl_enabled;
5680	bool	net_detect_enabled;
5681	bool	nlo_enabled;
5682} net_detect_adapter_features_t;
5683
5684typedef enum net_detect_bss_type {
5685	nd_bss_any = 0,
5686	nd_ibss,
5687	nd_ess
5688} net_detect_bss_type_t;
5689
5690typedef struct net_detect_profile {
5691	wlc_ssid_t		ssid;
5692	net_detect_bss_type_t   bss_type;	/* Ignore for now since Phase 1 is only for ESS */
5693	uint32			cipher_type;	/* DOT11_CIPHER_ALGORITHM enumeration values */
5694	uint32			auth_type;	/* DOT11_AUTH_ALGORITHM enumeration values */
5695} net_detect_profile_t;
5696
5697typedef struct net_detect_profile_list {
5698	uint32			num_nd_profiles;
5699	net_detect_profile_t	nd_profile[0];
5700} net_detect_profile_list_t;
5701
5702typedef struct net_detect_config {
5703	bool			    nd_enabled;
5704	uint32			    scan_interval;
5705	uint32			    wait_period;
5706	bool			    wake_if_connected;
5707	bool			    wake_if_disconnected;
5708	net_detect_profile_list_t   nd_profile_list;
5709} net_detect_config_t;
5710
5711typedef enum net_detect_wake_reason {
5712	nd_reason_unknown,
5713	nd_net_detected,
5714	nd_wowl_event,
5715	nd_ucode_error
5716} net_detect_wake_reason_t;
5717
5718typedef struct net_detect_wake_data {
5719	net_detect_wake_reason_t    nd_wake_reason;
5720	uint32			    nd_wake_date_length;
5721	uint8			    nd_wake_data[0];	    /* Wake data (currently unused) */
5722} net_detect_wake_data_t;
5723
5724#endif /* NET_DETECT */
5725
5726#endif /* LINUX_POSTMOGRIFY_REMOVAL */
5727
5728typedef struct bcnreq {
5729	uint8 bcn_mode;
5730	int dur;
5731	int channel;
5732	struct ether_addr da;
5733	uint16 random_int;
5734	wlc_ssid_t ssid;
5735	uint16 reps;
5736} bcnreq_t;
5737
5738typedef struct rrmreq {
5739	struct ether_addr da;
5740	uint8 reg;
5741	uint8 chan;
5742	uint16 random_int;
5743	uint16 dur;
5744	uint16 reps;
5745} rrmreq_t;
5746
5747typedef struct framereq {
5748	struct ether_addr da;
5749	uint8 reg;
5750	uint8 chan;
5751	uint16 random_int;
5752	uint16 dur;
5753	struct ether_addr ta;
5754	uint16 reps;
5755} framereq_t;
5756
5757typedef struct statreq {
5758	struct ether_addr da;
5759	struct ether_addr peer;
5760	uint16 random_int;
5761	uint16 dur;
5762	uint8 group_id;
5763	uint16 reps;
5764} statreq_t;
5765
5766typedef struct wlc_l2keepalive_ol_params {
5767	uint8 	flags;
5768	uint8	prio;
5769	uint16	period_ms;
5770} wlc_l2keepalive_ol_params_t;
5771
5772typedef struct wlc_dwds_config {
5773	uint32		enable;
5774	uint32		mode; /* STA/AP interface */
5775	struct ether_addr ea;
5776} wlc_dwds_config_t;
5777
5778/* Video Traffic Interference Monitor config */
5779#define INTFER_VERSION		1
5780typedef struct wl_intfer_params {
5781	uint16 version;			/* version */
5782	uint8 period;			/* sample period */
5783	uint8 cnt;			/* sample cnt */
5784	uint8 txfail_thresh;	/* non-TCP txfail threshold */
5785	uint8 tcptxfail_thresh;	/* tcptxfail threshold */
5786} wl_intfer_params_t;
5787
5788typedef struct wl_staprio_cfg {
5789	struct ether_addr ea;	/* mac addr */
5790	uint8 prio;		/* scb priority */
5791} wl_staprio_cfg_t;
5792
5793typedef enum wl_stamon_cfg_cmd_type {
5794	STAMON_CFG_CMD_DEL = 0,
5795	STAMON_CFG_CMD_ADD = 1,
5796	STAMON_CFG_CMD_ENB = 2,
5797	STAMON_CFG_CMD_DSB = 3
5798} wl_stamon_cfg_cmd_type_t;
5799
5800typedef struct wlc_stamon_sta_config {
5801	wl_stamon_cfg_cmd_type_t cmd; /* 0 - delete, 1 - add */
5802	struct ether_addr ea;
5803} wlc_stamon_sta_config_t;
5804
5805/* monitor_promisc_level bits */
5806#define WL_MONPROMISC_PROMISC 0x0001
5807#define WL_MONPROMISC_CTRL 0x0002
5808#define WL_MONPROMISC_FCS 0x0004
5809
5810typedef struct wl_taf_sta {
5811	struct ether_addr ea;	/* STA MAC or null for default */
5812	uint16 pad;
5813	uint32 rules_enabled;	/* Bitfield of rules to enable */
5814	uint32 rule_user_val;	/* Parameter for rule User */
5815} wl_taf_sta_t;
5816
5817/* WDS net interface types */
5818#define WL_WDSIFTYPE_NONE  0x0 /* The interface type is neither WDS nor DWDS. */
5819#define WL_WDSIFTYPE_WDS   0x1 /* The interface is WDS type. */
5820#define WL_WDSIFTYPE_DWDS  0x2 /* The interface is DWDS type. */
5821
5822#endif /* _wlioctl_h_ */
5823