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) 2014, 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,v 1.3 2010-12-23 05:37:38 $
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/bcmevent.h>
31#include <proto/802.11.h>
32#include <bcmwifi_channels.h>
33
34#include <bcmcdc.h>
35#ifdef __NetBSD__
36/* NetBSD 2.0 does not have SIOCDEVPRIVATE. */
37#define SIOCDEVPRIVATE	_IOWR('i', 139, struct ifreq)
38#endif
39
40#ifndef INTF_NAME_SIZ
41#define INTF_NAME_SIZ	16
42#endif
43
44/* Used to send ioctls over the transport pipe */
45typedef struct remote_ioctl {
46	cdc_ioctl_t 	msg;
47	uint		data_len;
48	char            intf_name[INTF_NAME_SIZ];
49} rem_ioctl_t;
50#define REMOTE_SIZE	sizeof(rem_ioctl_t)
51#ifdef EFI
52#define BCMWL_IOCTL_GUID \
53	{0xB4910A35, 0x88C5, 0x4328, 0x90, 0x08, 0x9F, 0xB2, 0x00, 0x00, 0x0, 0x0}
54#endif /* EFI */
55
56#define ACTION_FRAME_SIZE 1040
57
58typedef struct wl_action_frame {
59	struct ether_addr 	da;
60	uint16 			len;
61	uint32 			packetId;
62	uint8			data[ACTION_FRAME_SIZE];
63} wl_action_frame_t;
64
65#define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame)
66
67typedef struct wl_af_params {
68	uint32 			channel;
69	int32 			dwell_time;
70	wl_action_frame_t	action_frame;
71} wl_af_params_t;
72
73#define WL_WIFI_AF_PARAMS_SIZE sizeof(struct wl_af_params)
74
75/* require default structure packing */
76#define BWL_DEFAULT_PACKING
77#include <packed_section_start.h>
78
79
80#ifndef LINUX_POSTMOGRIFY_REMOVAL
81/* Legacy structure to help keep backward compatible wl tool and tray app */
82
83#define	LEGACY_WL_BSS_INFO_VERSION	107	/* older version of wl_bss_info struct */
84
85typedef struct wl_bss_info_107 {
86	uint32		version;		/* version field */
87	uint32		length;			/* byte length of data in this record,
88						 * starting at version and including IEs
89						 */
90	struct ether_addr BSSID;
91	uint16		beacon_period;		/* units are Kusec */
92	uint16		capability;		/* Capability information */
93	uint8		SSID_len;
94	uint8		SSID[32];
95	struct {
96		uint	count;			/* # rates in this set */
97		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
98	} rateset;				/* supported rates */
99	uint8		channel;		/* Channel no. */
100	uint16		atim_window;		/* units are Kusec */
101	uint8		dtim_period;		/* DTIM period */
102	int16		RSSI;			/* receive signal strength (in dBm) */
103	int8		phy_noise;		/* noise (in dBm) */
104	uint32		ie_length;		/* byte length of Information Elements */
105	/* variable length Information Elements */
106} wl_bss_info_107_t;
107#endif /* LINUX_POSTMOGRIFY_REMOVAL */
108
109/*
110 * Per-BSS information structure.
111 */
112
113#define	LEGACY2_WL_BSS_INFO_VERSION	108		/* old version of wl_bss_info struct */
114
115/* BSS info structure
116 * Applications MUST CHECK ie_offset field and length field to access IEs and
117 * next bss_info structure in a vector (in wl_scan_results_t)
118 */
119typedef struct wl_bss_info_108 {
120	uint32		version;		/* version field */
121	uint32		length;			/* byte length of data in this record,
122						 * starting at version and including IEs
123						 */
124	struct ether_addr BSSID;
125	uint16		beacon_period;		/* units are Kusec */
126	uint16		capability;		/* Capability information */
127	uint8		SSID_len;
128	uint8		SSID[32];
129	struct {
130		uint	count;			/* # rates in this set */
131		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
132	} rateset;				/* supported rates */
133	chanspec_t	chanspec;		/* chanspec for bss */
134	uint16		atim_window;		/* units are Kusec */
135	uint8		dtim_period;		/* DTIM period */
136	int16		RSSI;			/* receive signal strength (in dBm) */
137	int8		phy_noise;		/* noise (in dBm) */
138
139	uint8		n_cap;			/* BSS is 802.11N Capable */
140	uint32		nbss_cap;		/* 802.11N BSS Capabilities (based on HT_CAP_*) */
141	uint8		ctl_ch;			/* 802.11N BSS control channel number */
142	uint32		reserved32[1];		/* Reserved for expansion of BSS properties */
143	uint8		flags;			/* flags */
144	uint8		reserved[3];		/* Reserved for expansion of BSS properties */
145	uint8		basic_mcs[MCSSET_LEN];	/* 802.11N BSS required MCS set */
146
147	uint16		ie_offset;		/* offset at which IEs start, from beginning */
148	uint32		ie_length;		/* byte length of Information Elements */
149	/* Add new fields here */
150	/* variable length Information Elements */
151} wl_bss_info_108_t;
152
153#define	WL_BSS_INFO_VERSION	109		/* current version of wl_bss_info struct */
154
155/* BSS info structure
156 * Applications MUST CHECK ie_offset field and length field to access IEs and
157 * next bss_info structure in a vector (in wl_scan_results_t)
158 */
159typedef struct wl_bss_info {
160	uint32		version;		/* version field */
161	uint32		length;			/* byte length of data in this record,
162						 * starting at version and including IEs
163						 */
164	struct ether_addr BSSID;
165	uint16		beacon_period;		/* units are Kusec */
166	uint16		capability;		/* Capability information */
167	uint8		SSID_len;
168	uint8		SSID[32];
169	struct {
170		uint	count;			/* # rates in this set */
171		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
172	} rateset;				/* supported rates */
173	chanspec_t	chanspec;		/* chanspec for bss */
174	uint16		atim_window;		/* units are Kusec */
175	uint8		dtim_period;		/* DTIM period */
176	int16		RSSI;			/* receive signal strength (in dBm) */
177	int8		phy_noise;		/* noise (in dBm) */
178
179	uint8		n_cap;			/* BSS is 802.11N Capable */
180	uint32		nbss_cap;		/* 802.11N BSS Capabilities (based on HT_CAP_*) */
181	uint8		ctl_ch;			/* 802.11N BSS control channel number */
182	uint32		reserved32[1];		/* Reserved for expansion of BSS properties */
183	uint8		flags;			/* flags */
184	uint8		reserved[3];		/* Reserved for expansion of BSS properties */
185	uint8		basic_mcs[MCSSET_LEN];	/* 802.11N BSS required MCS set */
186
187	uint16		ie_offset;		/* offset at which IEs start, from beginning */
188	uint32		ie_length;		/* byte length of Information Elements */
189	int16		SNR;			/* average SNR of during frame reception */
190	/* Add new fields here */
191	/* variable length Information Elements */
192} wl_bss_info_t;
193
194#ifdef DHD_NDIS_OID
195typedef struct wl_bsscfg {
196	uint32	wsec;
197	uint32	WPA_auth;
198	uint32	wsec_index;
199	uint32	associated;
200	uint32	BSS;
201	struct ether_addr	prev_BSSID;
202	struct ether_addr	BSSID;
203} wl_bsscfg_t;
204
205typedef struct wl_bss_config {
206	uint32	atim_window;
207	uint32	beacon_period;
208	uint32	chanspec;
209} wl_bss_config_t;
210#endif /* DHD_NDIS_OID */
211
212typedef struct wlc_ssid {
213	uint32		SSID_len;
214	uchar		SSID[32];
215} wlc_ssid_t;
216
217#ifndef LINUX_POSTMOGRIFY_REMOVAL
218typedef struct chan_scandata {
219	uint8		txpower;
220	uint8		pad;
221	chanspec_t	channel;	/* Channel num, bw, ctrl_sb and band */
222	uint32		channel_mintime;
223	uint32		channel_maxtime;
224} chan_scandata_t;
225
226typedef enum wl_scan_type {
227	EXTDSCAN_FOREGROUND_SCAN,
228	EXTDSCAN_BACKGROUND_SCAN,
229	EXTDSCAN_FORCEDBACKGROUND_SCAN
230} wl_scan_type_t;
231
232#define WLC_EXTDSCAN_MAX_SSID		5
233
234#define WL_BSS_FLAGS_FROM_BEACON	0x01	/* bss_info derived from beacon */
235#define WL_BSS_FLAGS_FROM_CACHE		0x02	/* bss_info collected from cache */
236#define WL_BSS_FLAGS_RSSI_ONCHANNEL     0x04 /* rssi info was received on channel (vs offchannel) */
237
238typedef struct wl_extdscan_params {
239	int8 		nprobes;		/* 0, passive, otherwise active */
240	int8    	split_scan;		/* split scan */
241	int8		band;			/* band */
242	int8		pad;
243	wlc_ssid_t 	ssid[WLC_EXTDSCAN_MAX_SSID]; /* ssid list */
244	uint32		tx_rate;		/* in 500ksec units */
245	wl_scan_type_t	scan_type;		/* enum */
246	int32 		channel_num;
247	chan_scandata_t channel_list[1];	/* list of chandata structs */
248} wl_extdscan_params_t;
249
250#define WL_EXTDSCAN_PARAMS_FIXED_SIZE 	(sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
251#endif /* LINUX_POSTMOGRIFY_REMOVAL */
252
253#define WL_BSSTYPE_INFRA 1
254#define WL_BSSTYPE_INDEP 0
255#define WL_BSSTYPE_ANY   2
256
257#ifndef LINUX_POSTMOGRIFY_REMOVAL
258typedef struct wl_scan_params {
259	wlc_ssid_t ssid;		/* default: {0, ""} */
260	struct ether_addr bssid;	/* default: bcast */
261	int8 bss_type;			/* default: any,
262					 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
263					 */
264	int8 scan_type;			/* -1 use default, DOT11_SCANTYPE_ACTIVE/PASSIVE */
265	int32 nprobes;			/* -1 use default, number of probes per channel */
266	int32 active_time;		/* -1 use default, dwell time per channel for
267					 * active scanning
268					 */
269	int32 passive_time;		/* -1 use default, dwell time per channel
270					 * for passive scanning
271					 */
272	int32 home_time;		/* -1 use default, dwell time for the home channel
273					 * between channel scans
274					 */
275	int32 channel_num;		/* count of channels and ssids that follow
276					 *
277					 * low half is count of channels in channel_list, 0
278					 * means default (use all available channels)
279					 *
280					 * high half is entries in wlc_ssid_t array that
281					 * follows channel_list, aligned for int32 (4 bytes)
282					 * meaning an odd channel count implies a 2-byte pad
283					 * between end of channel_list and first ssid
284					 *
285					 * if ssid count is zero, single ssid in the fixed
286					 * parameter portion is assumed, otherwise ssid in
287					 * the fixed portion is ignored
288					 */
289	uint16 channel_list[1];		/* list of chanspecs */
290} wl_scan_params_t;
291
292/* size of wl_scan_params not including variable length array */
293#define WL_SCAN_PARAMS_FIXED_SIZE 64
294
295/* masks for channel and ssid count */
296#define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff
297#define WL_SCAN_PARAMS_NSSID_SHIFT 16
298
299#define WL_SCAN_ACTION_START      1
300#define WL_SCAN_ACTION_CONTINUE   2
301#define WL_SCAN_ACTION_ABORT      3
302
303#define ISCAN_REQ_VERSION 1
304
305/* incremental scan struct */
306typedef struct wl_iscan_params {
307	uint32 version;
308	uint16 action;
309	uint16 scan_duration;
310	wl_scan_params_t params;
311} wl_iscan_params_t;
312
313/* 3 fields + size of wl_scan_params, not including variable length array */
314#define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
315#endif /* LINUX_POSTMOGRIFY_REMOVAL */
316
317typedef struct wl_scan_results {
318	uint32 buflen;
319	uint32 version;
320	uint32 count;
321	wl_bss_info_t bss_info[1];
322} wl_scan_results_t;
323
324/* size of wl_scan_results not including variable length array */
325#define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
326
327/* wl_iscan_results status values */
328#define WL_SCAN_RESULTS_SUCCESS	0
329#define WL_SCAN_RESULTS_PARTIAL	1
330#define WL_SCAN_RESULTS_PENDING	2
331#define WL_SCAN_RESULTS_ABORTED	3
332
333#define ESCAN_REQ_VERSION 1
334
335typedef struct wl_escan_params {
336	uint32 version;
337	uint16 action;
338	uint16 sync_id;
339	wl_scan_params_t params;
340} wl_escan_params_t;
341
342#define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
343
344typedef struct wl_escan_result {
345	uint32 buflen;
346	uint32 version;
347	uint16 sync_id;
348	uint16 bss_count;
349	wl_bss_info_t bss_info[1];
350} wl_escan_result_t;
351
352#define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
353
354/* incremental scan results struct */
355typedef struct wl_iscan_results {
356	uint32 status;
357	wl_scan_results_t results;
358} wl_iscan_results_t;
359
360/* size of wl_iscan_results not including variable length array */
361#define WL_ISCAN_RESULTS_FIXED_SIZE \
362	(WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
363
364typedef struct wl_probe_params {
365	wlc_ssid_t ssid;
366	struct ether_addr bssid;
367	struct ether_addr mac;
368} wl_probe_params_t;
369
370#define WL_NUMRATES		16	/* max # of rates in a rateset */
371typedef struct wl_rateset {
372	uint32	count;			/* # rates in this set */
373	uint8	rates[WL_NUMRATES];	/* rates in 500kbps units w/hi bit set if basic */
374} wl_rateset_t;
375
376typedef struct wl_rateset_args {
377	uint32	count;			/* # rates in this set */
378	uint8	rates[WL_NUMRATES];	/* rates in 500kbps units w/hi bit set if basic */
379	uint8   mcs[MCSSET_LEN];        /* supported mcs index bit map */
380} wl_rateset_args_t;
381
382/* uint32 list */
383typedef struct wl_uint32_list {
384	/* in - # of elements, out - # of entries */
385	uint32 count;
386	/* variable length uint32 list */
387	uint32 element[1];
388} wl_uint32_list_t;
389
390#ifndef LINUX_POSTMOGRIFY_REMOVAL
391/* used for association with a specific BSSID and chanspec list */
392typedef struct wl_assoc_params {
393	struct ether_addr bssid;	/* 00:00:00:00:00:00: broadcast scan */
394	int32 chanspec_num;		/* 0: all available channels,
395					 * otherwise count of chanspecs in chanspec_list
396					 */
397	chanspec_t chanspec_list[1];	/* list of chanspecs */
398} wl_assoc_params_t;
399#define WL_ASSOC_PARAMS_FIXED_SIZE 	(sizeof(wl_assoc_params_t) - sizeof(chanspec_t))
400
401/* used for reassociation/roam to a specific BSSID and channel */
402typedef wl_assoc_params_t wl_reassoc_params_t;
403#define WL_REASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
404
405/* used for join with or without a specific bssid and channel list */
406typedef struct wl_join_params {
407	wlc_ssid_t ssid;
408	wl_assoc_params_t params;	/* optional field, but it must include the fixed portion
409					 * of the wl_assoc_params_t struct when it does present.
410					 */
411} wl_join_params_t;
412#define WL_JOIN_PARAMS_FIXED_SIZE 	(sizeof(wl_join_params_t) - sizeof(chanspec_t))
413
414/* defines used by the nrate iovar */
415#define NRATE_MCS_INUSE	0x00000080	/* MSC in use,indicates b0-6 holds an mcs */
416#define NRATE_RATE_MASK 0x0000007f	/* rate/mcs value */
417#define NRATE_STF_MASK	0x0000ff00	/* stf mode mask: siso, cdd, stbc, sdm */
418#define NRATE_STF_SHIFT	8		/* stf mode shift */
419#define NRATE_OVERRIDE	0x80000000	/* bit indicates override both rate & mode */
420#define NRATE_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicate to override mcs only */
421#define NRATE_SGI_MASK  0x00800000      /* sgi mode */
422#define NRATE_SGI_SHIFT 23              /* sgi mode */
423
424#define NRATE_STF_SISO	0		/* stf mode SISO */
425#define NRATE_STF_CDD	1		/* stf mode CDD */
426#define NRATE_STF_STBC	2		/* stf mode STBC */
427#define NRATE_STF_SDM	3		/* stf mode SDM */
428
429#define ANTENNA_NUM_1	1		/* total number of antennas to be used */
430#define ANTENNA_NUM_2	2
431#define ANTENNA_NUM_3	3
432#define ANTENNA_NUM_4	4
433
434#define ANT_SELCFG_AUTO		0x80	/* bit indicates antenna sel AUTO */
435#define ANT_SELCFG_MASK		0x33	/* antenna configuration mask */
436#define ANT_SELCFG_MAX		4	/* max number of antenna configurations */
437#define ANT_SELCFG_TX_UNICAST	0	/* unicast tx antenna configuration */
438#define ANT_SELCFG_RX_UNICAST	1	/* unicast rx antenna configuration */
439#define ANT_SELCFG_TX_DEF	2	/* default tx antenna configuration */
440#define ANT_SELCFG_RX_DEF	3	/* default rx antenna configuration */
441
442typedef struct {
443	uint8 ant_config[ANT_SELCFG_MAX];	/* antenna configuration */
444	uint8 num_antcfg;	/* number of available antenna configurations */
445} wlc_antselcfg_t;
446
447#define HIGHEST_SINGLE_STREAM_MCS	7 /* MCS values greater than this enable multiple streams */
448
449#define MAX_CCA_CHANNELS 38	/* Max number of 20 Mhz wide channels */
450#define MAX_CCA_SECS     60	/* CCA keeps this many seconds history */
451
452#define IBSS_MED        15	/* Mediom in-bss congestion percentage */
453#define IBSS_HI         25	/* Hi in-bss congestion percentage */
454#define OBSS_MED        12
455#define OBSS_HI         25
456#define INTERFER_MED    5
457#define INTERFER_HI     10
458
459#define  CCA_FLAG_2G_ONLY		0x01	/* Return a channel from 2.4 Ghz band */
460#define  CCA_FLAG_5G_ONLY		0x02	/* Return a channel from 2.4 Ghz band */
461#define  CCA_FLAG_IGNORE_DURATION	0x04	/* Ignore dwell time for each channel */
462#define  CCA_FLAGS_PREFER_1_6_11	0x10
463
464#define CCA_ERRNO_BAND 		1	/* After filtering for band pref, no choices left */
465#define CCA_ERRNO_DURATION	2	/* After filtering for duration, no choices left */
466#define CCA_ERRNO_PREF_CHAN	3	/* After filtering for chan pref, no choices left */
467#define CCA_ERRNO_INTERFER	4	/* After filtering for interference, no choices left */
468#define CCA_ERRNO_TOO_FEW	5	/* Only 1 channel was input */
469
470typedef struct {
471	uint32 duration;	/* millisecs spent sampling this channel */
472	uint32 congest_ibss;	/* millisecs in our bss (presumably this traffic will */
473				/*  move if cur bss moves channels) */
474	uint32 congest_obss;	/* traffic not in our bss */
475	uint32 interference;	/* millisecs detecting a non 802.11 interferer. */
476	uint32 timestamp;	/* second timestamp */
477} cca_congest_t;
478
479typedef struct {
480	chanspec_t chanspec;	/* Which channel? */
481	uint8 num_secs;		/* How many secs worth of data */
482	cca_congest_t  secs[1];	/* Data */
483} cca_congest_channel_req_t;
484
485#define WLC_CNTRY_BUF_SZ	4		/* Country string is 3 bytes + NUL */
486
487typedef struct wl_country {
488	char country_abbrev[WLC_CNTRY_BUF_SZ];	/* nul-terminated country code used in
489						 * the Country IE
490						 */
491	int32 rev;				/* revision specifier for ccode
492						 * on set, -1 indicates unspecified.
493						 * on get, rev >= 0
494						 */
495	char ccode[WLC_CNTRY_BUF_SZ];		/* nul-terminated built-in country code.
496						 * variable length, but fixed size in
497						 * struct allows simple allocation for
498						 * expected country strings <= 3 chars.
499						 */
500} wl_country_t;
501
502typedef struct wl_channels_in_country {
503	uint32 buflen;
504	uint32 band;
505	char country_abbrev[WLC_CNTRY_BUF_SZ];
506	uint32 count;
507	uint32 channel[1];
508} wl_channels_in_country_t;
509
510typedef struct wl_country_list {
511	uint32 buflen;
512	uint32 band_set;
513	uint32 band;
514	uint32 count;
515	char country_abbrev[1];
516} wl_country_list_t;
517
518#define WL_NUM_RPI_BINS		8
519#define WL_RM_TYPE_BASIC	1
520#define WL_RM_TYPE_CCA		2
521#define WL_RM_TYPE_RPI		3
522
523#define WL_RM_FLAG_PARALLEL	(1<<0)
524
525#define WL_RM_FLAG_LATE		(1<<1)
526#define WL_RM_FLAG_INCAPABLE	(1<<2)
527#define WL_RM_FLAG_REFUSED	(1<<3)
528
529typedef struct wl_rm_req_elt {
530	int8	type;
531	int8	flags;
532	chanspec_t	chanspec;
533	uint32	token;		/* token for this measurement */
534	uint32	tsf_h;		/* TSF high 32-bits of Measurement start time */
535	uint32	tsf_l;		/* TSF low 32-bits */
536	uint32	dur;		/* TUs */
537} wl_rm_req_elt_t;
538
539typedef struct wl_rm_req {
540	uint32	token;		/* overall measurement set token */
541	uint32	count;		/* number of measurement requests */
542	void	*cb;		/* completion callback function: may be NULL */
543	void	*cb_arg;	/* arg to completion callback function */
544	wl_rm_req_elt_t	req[1];	/* variable length block of requests */
545} wl_rm_req_t;
546#define WL_RM_REQ_FIXED_LEN	OFFSETOF(wl_rm_req_t, req)
547
548typedef struct wl_rm_rep_elt {
549	int8	type;
550	int8	flags;
551	chanspec_t	chanspec;
552	uint32	token;		/* token for this measurement */
553	uint32	tsf_h;		/* TSF high 32-bits of Measurement start time */
554	uint32	tsf_l;		/* TSF low 32-bits */
555	uint32	dur;		/* TUs */
556	uint32	len;		/* byte length of data block */
557	uint8	data[1];	/* variable length data block */
558} wl_rm_rep_elt_t;
559#define WL_RM_REP_ELT_FIXED_LEN	24	/* length excluding data block */
560
561#define WL_RPI_REP_BIN_NUM 8
562typedef struct wl_rm_rpi_rep {
563	uint8	rpi[WL_RPI_REP_BIN_NUM];
564	int8	rpi_max[WL_RPI_REP_BIN_NUM];
565} wl_rm_rpi_rep_t;
566
567typedef struct wl_rm_rep {
568	uint32	token;		/* overall measurement set token */
569	uint32	len;		/* length of measurement report block */
570	wl_rm_rep_elt_t	rep[1];	/* variable length block of reports */
571} wl_rm_rep_t;
572#define WL_RM_REP_FIXED_LEN	8
573#endif /* LINUX_POSTMOGRIFY_REMOVAL */
574
575
576#if defined(BCMSUP_PSK)
577typedef enum sup_auth_status {
578	/* Basic supplicant authentication states */
579	WLC_SUP_DISCONNECTED = 0,
580	WLC_SUP_CONNECTING,
581	WLC_SUP_IDREQUIRED,
582	WLC_SUP_AUTHENTICATING,
583	WLC_SUP_AUTHENTICATED,
584	WLC_SUP_KEYXCHANGE,
585	WLC_SUP_KEYED,
586	WLC_SUP_TIMEOUT,
587	WLC_SUP_LAST_BASIC_STATE,
588
589	/* Extended supplicant authentication states */
590	WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
591	                                /* Waiting to receive handshake msg M1 */
592	WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
593	                                /* Preparing to send handshake msg M2 */
594	WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
595	                                /* Waiting to receive handshake msg M3 */
596	WLC_SUP_KEYXCHANGE_PREP_M4,	/* Preparing to send handshake msg M4 */
597	WLC_SUP_KEYXCHANGE_WAIT_G1,	/* Waiting to receive handshake msg G1 */
598	WLC_SUP_KEYXCHANGE_PREP_G2	/* Preparing to send handshake msg G2 */
599} sup_auth_status_t;
600#endif
601
602/* Enumerate crypto algorithms */
603#define	CRYPTO_ALGO_OFF			0
604#define	CRYPTO_ALGO_WEP1		1
605#define	CRYPTO_ALGO_TKIP		2
606#define	CRYPTO_ALGO_WEP128		3
607#define CRYPTO_ALGO_AES_CCM		4
608#define CRYPTO_ALGO_AES_OCB_MSDU	5
609#define CRYPTO_ALGO_AES_OCB_MPDU	6
610#define CRYPTO_ALGO_NALG		7
611
612#define WSEC_GEN_MIC_ERROR	0x0001
613#define WSEC_GEN_REPLAY		0x0002
614#define WSEC_GEN_ICV_ERROR	0x0004
615
616#define WL_SOFT_KEY	(1 << 0)	/* Indicates this key is using soft encrypt */
617#define WL_PRIMARY_KEY	(1 << 1)	/* Indicates this key is the primary (ie tx) key */
618#define WL_KF_RES_4	(1 << 4)	/* Reserved for backward compat */
619#define WL_KF_RES_5	(1 << 5)	/* Reserved for backward compat */
620#define WL_IBSS_PEER_GROUP_KEY	(1 << 6)	/* Indicates a group key for a IBSS PEER */
621
622typedef struct wl_wsec_key {
623	uint32		index;		/* key index */
624	uint32		len;		/* key length */
625	uint8		data[DOT11_MAX_KEY_SIZE];	/* key data */
626	uint32		pad_1[18];
627	uint32		algo;		/* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
628	uint32		flags;		/* misc flags */
629	uint32		pad_2[2];
630	int		pad_3;
631	int		iv_initialized;	/* has IV been initialized already? */
632	int		pad_4;
633	/* Rx IV */
634	struct {
635		uint32	hi;		/* upper 32 bits of IV */
636		uint16	lo;		/* lower 16 bits of IV */
637	} rxiv;
638	uint32		pad_5[2];
639	struct ether_addr ea;		/* per station */
640} wl_wsec_key_t;
641
642#define WSEC_MIN_PSK_LEN	8
643#define WSEC_MAX_PSK_LEN	64
644
645/* Flag for key material needing passhash'ing */
646#define WSEC_PASSPHRASE		(1<<0)
647
648/* receptacle for WLC_SET_WSEC_PMK parameter */
649typedef struct {
650	ushort	key_len;		/* octets in key material */
651	ushort	flags;			/* key handling qualification */
652	uint8	key[WSEC_MAX_PSK_LEN];	/* PMK material */
653} wsec_pmk_t;
654
655/* wireless security bitvec */
656#define WEP_ENABLED		0x0001
657#define TKIP_ENABLED		0x0002
658#define AES_ENABLED		0x0004
659#define WSEC_SWFLAG		0x0008
660#define SES_OW_ENABLED		0x0040	/* to go into transition mode without setting wep */
661
662/* WPA authentication mode bitvec */
663#define WPA_AUTH_DISABLED	0x0000	/* Legacy (i.e., non-WPA) */
664#define WPA_AUTH_NONE		0x0001	/* none (IBSS) */
665#define WPA_AUTH_UNSPECIFIED	0x0002	/* over 802.1x */
666#define WPA_AUTH_PSK		0x0004	/* Pre-shared key */
667/* #define WPA_AUTH_8021X 0x0020 */	/* 802.1x, reserved */
668#define WPA2_AUTH_UNSPECIFIED	0x0040	/* over 802.1x */
669#define WPA2_AUTH_PSK		0x0080	/* Pre-shared key */
670#ifndef LINUX_POSTMOGRIFY_REMOVAL
671#define BRCM_AUTH_PSK           0x0100  /* BRCM specific PSK */
672#define BRCM_AUTH_DPT		0x0200	/* DPT PSK without group keys */
673#endif /* LINUX_POSTMOGRIFY_REMOVAL */
674
675/* pmkid */
676#define	MAXPMKID		16
677
678typedef struct _pmkid {
679	struct ether_addr	BSSID;
680	uint8			PMKID[WPA2_PMKID_LEN];
681} pmkid_t;
682
683typedef struct _pmkid_list {
684	uint32	npmkid;
685	pmkid_t	pmkid[1];
686} pmkid_list_t;
687
688typedef struct _pmkid_cand {
689	struct ether_addr	BSSID;
690	uint8			preauth;
691} pmkid_cand_t;
692
693typedef struct _pmkid_cand_list {
694	uint32	npmkid_cand;
695	pmkid_cand_t	pmkid_cand[1];
696} pmkid_cand_list_t;
697
698#ifndef LINUX_POSTMOGRIFY_REMOVAL
699typedef struct wl_led_info {
700	uint32		index;		/* led index */
701	uint32		behavior;
702	uint8		activehi;
703} wl_led_info_t;
704
705typedef struct wl_assoc_info {
706	uint32		req_len;
707	uint32		resp_len;
708	uint32		flags;
709	struct dot11_assoc_req req;
710	struct ether_addr reassoc_bssid; /* used in reassoc's */
711	struct dot11_assoc_resp resp;
712} wl_assoc_info_t;
713
714/* flags */
715#define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */
716
717/* srom read/write struct passed through ioctl */
718typedef struct {
719	uint	byteoff;	/* byte offset */
720	uint	nbytes;		/* number of bytes */
721	uint16	buf[1];
722} srom_rw_t;
723
724/* similar cis (srom or otp) struct [iovar: may not be aligned] */
725typedef struct {
726	uint32	source;		/* cis source */
727	uint32	byteoff;	/* byte offset */
728	uint32	nbytes;		/* number of bytes */
729	/* data follows here */
730} cis_rw_t;
731
732#define WLC_CIS_DEFAULT	0	/* built-in default */
733#define WLC_CIS_SROM	1	/* source is sprom */
734#define WLC_CIS_OTP	2	/* source is otp */
735
736/* R_REG and W_REG struct passed through ioctl */
737typedef struct {
738	uint32	byteoff;	/* byte offset of the field in d11regs_t */
739	uint32	val;		/* read/write value of the field */
740	uint32	size;		/* sizeof the field */
741	uint	band;		/* band (optional) */
742} rw_reg_t;
743
744/* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */
745/* PCL - Power Control Loop */
746/* current gain setting is replaced by user input */
747#define WL_ATTEN_APP_INPUT_PCL_OFF	0	/* turn off PCL, apply supplied input */
748#define WL_ATTEN_PCL_ON			1	/* turn on PCL */
749/* current gain setting is maintained */
750#define WL_ATTEN_PCL_OFF		2	/* turn off PCL. */
751
752typedef struct {
753	uint16	auto_ctrl;	/* WL_ATTEN_XX */
754	uint16	bb;		/* Baseband attenuation */
755	uint16	radio;		/* Radio attenuation */
756	uint16	txctl1;		/* Radio TX_CTL1 value */
757} atten_t;
758
759/* Per-AC retry parameters */
760struct wme_tx_params_s {
761	uint8  short_retry;
762	uint8  short_fallback;
763	uint8  long_retry;
764	uint8  long_fallback;
765	uint16 max_rate;  /* In units of 512 Kbps */
766};
767
768typedef struct wme_tx_params_s wme_tx_params_t;
769
770#define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
771
772/* defines used by poweridx iovar - it controls power in a-band */
773/* current gain setting is maintained */
774#define WL_PWRIDX_PCL_OFF	-2	/* turn off PCL.  */
775#define WL_PWRIDX_PCL_ON	-1	/* turn on PCL */
776#define WL_PWRIDX_LOWER_LIMIT	-2	/* lower limit */
777#define WL_PWRIDX_UPPER_LIMIT	63	/* upper limit */
778/* value >= 0 causes
779 *	- input to be set to that value
780 *	- PCL to be off
781 */
782
783/* Used to get specific STA parameters */
784typedef struct {
785	uint32	val;
786	struct ether_addr ea;
787} scb_val_t;
788
789/* Used to get specific link/ac parameters */
790typedef struct {
791	int ac;
792	uint8 val;
793	struct ether_addr ea;
794} link_val_t;
795
796/* Used by iovar versions of some ioctls, i.e. WLC_SCB_AUTHORIZE et al */
797typedef struct {
798	uint32 code;
799	scb_val_t ioctl_args;
800} authops_t;
801
802#define BCM_MAC_STATUS_INDICATION	(0x40010200L)
803
804typedef struct {
805	uint16			ver;		/* version of this struct */
806	uint16			len;		/* length in bytes of this structure */
807	uint16			cap;		/* sta's advertised capabilities */
808	uint32			flags;		/* flags defined below */
809	uint32			idle;		/* time since data pkt rx'd from sta */
810	struct ether_addr	ea;		/* Station address */
811	wl_rateset_t		rateset;	/* rateset in use */
812	uint32			in;		/* seconds elapsed since associated */
813	uint32			listen_interval_inms; /* Min Listen interval in ms for this STA */
814	uint32			tx_pkts;	/* # of packets transmitted */
815	uint32			tx_failures;	/* # of packets failed */
816	uint32			rx_ucast_pkts;	/* # of unicast packets received */
817	uint32			rx_mcast_pkts;	/* # of multicast packets received */
818	uint32			tx_rate;	/* Rate of last successful tx frame */
819	uint32			rx_rate;	/* Rate of last successful rx frame */
820	uint32			rx_decrypt_succeeds;	/* # of packet decrypted successfully */
821	uint32			rx_decrypt_failures;	/* # of packet decrypted unsuccessfully */
822} sta_info_t;
823
824#define WL_OLD_STAINFO_SIZE	OFFSETOF(sta_info_t, tx_pkts)
825
826#define WL_STA_VER		3
827
828/* Flags for sta_info_t indicating properties of STA */
829#define WL_STA_BRCM		0x1		/* Running a Broadcom driver */
830#define WL_STA_WME		0x2		/* WMM association */
831#define WL_STA_UNUSED		0x4
832#define WL_STA_AUTHE		0x8		/* Authenticated */
833#define WL_STA_ASSOC		0x10		/* Associated */
834#define WL_STA_AUTHO		0x20		/* Authorized */
835#define WL_STA_WDS		0x40		/* Wireless Distribution System */
836#define WL_STA_WDS_LINKUP	0x80		/* WDS traffic/probes flowing properly */
837#define WL_STA_PS		0x100		/* STA is in power save mode from AP's viewpoint */
838#define WL_STA_APSD_BE		0x200		/* APSD delv/trigger for AC_BE is default enabled */
839#define WL_STA_APSD_BK		0x400		/* APSD delv/trigger for AC_BK is default enabled */
840#define WL_STA_APSD_VI		0x800		/* APSD delv/trigger for AC_VI is default enabled */
841#define WL_STA_APSD_VO		0x1000		/* APSD delv/trigger for AC_VO is default enabled */
842#define WL_STA_N_CAP		0x2000		/* STA 802.11n capable */
843#define WL_STA_SCBSTATS		0x4000		/* Per STA debug stats */
844
845#define WL_WDS_LINKUP		WL_STA_WDS_LINKUP	/* deprecated */
846#endif /* LINUX_POSTMOGRIFY_REMOVAL */
847
848/* channel encoding */
849typedef struct channel_info {
850	int hw_channel;
851	int target_channel;
852	int scan_channel;
853} channel_info_t;
854
855/* For ioctls that take a list of MAC addresses */
856struct maclist {
857	uint count;			/* number of MAC addresses */
858	struct ether_addr ea[1];	/* variable length array of MAC addresses */
859};
860
861/* get pkt count struct passed through ioctl */
862typedef struct get_pktcnt {
863	uint rx_good_pkt;
864	uint rx_bad_pkt;
865	uint tx_good_pkt;
866	uint tx_bad_pkt;
867	uint rx_ocast_good_pkt; /* unicast packets destined for others */
868} get_pktcnt_t;
869
870/* Linux network driver ioctl encoding */
871typedef struct wl_ioctl {
872	uint cmd;	/* common ioctl definition */
873	void *buf;	/* pointer to user buffer */
874	uint len;	/* length of user buffer */
875	uint8 set;	/* get or set request (optional) */
876	uint used;	/* bytes read or written (optional) */
877	uint needed;	/* bytes needed (optional) */
878} wl_ioctl_t;
879
880/* reference to wl_ioctl_t struct used by usermode driver */
881#define ioctl_subtype	set		/* subtype param */
882#define ioctl_pid	used		/* pid param */
883#define ioctl_status	needed		/* status param */
884
885#ifndef LINUX_POSTMOGRIFY_REMOVAL
886/*
887 * Structure for passing hardware and software
888 * revision info up from the driver.
889 */
890typedef struct wlc_rev_info {
891	uint		vendorid;	/* PCI vendor id */
892	uint		deviceid;	/* device id of chip */
893	uint		radiorev;	/* radio revision */
894	uint		chiprev;	/* chip revision */
895	uint		corerev;	/* core revision */
896	uint		boardid;	/* board identifier (usu. PCI sub-device id) */
897	uint		boardvendor;	/* board vendor (usu. PCI sub-vendor id) */
898	uint		boardrev;	/* board revision */
899	uint		driverrev;	/* driver version */
900	uint		ucoderev;	/* microcode version */
901	uint		bus;		/* bus type */
902	uint		chipnum;	/* chip number */
903	uint		phytype;	/* phy type */
904	uint		phyrev;		/* phy revision */
905	uint		anarev;		/* anacore rev */
906	uint		chippkg;	/* chip package info */
907} wlc_rev_info_t;
908
909#define WL_REV_INFO_LEGACY_LENGTH	48
910
911#define WL_BRAND_MAX 10
912typedef struct wl_instance_info {
913	uint instance;
914	char brand[WL_BRAND_MAX];
915} wl_instance_info_t;
916
917/* structure to change size of tx fifo */
918typedef struct wl_txfifo_sz {
919	uint8	fifo;
920	uint8	size;
921} wl_txfifo_sz_t;
922
923/* Transfer info about an IOVar from the driver */
924/* Max supported IOV name size in bytes, + 1 for nul termination */
925#define WLC_IOV_NAME_LEN 30
926typedef struct wlc_iov_trx_s {
927	uint8 module;
928	uint8 type;
929	char name[WLC_IOV_NAME_LEN];
930} wlc_iov_trx_t;
931
932#endif /* LINUX_POSTMOGRIFY_REMOVAL */
933/* check this magic number */
934#define WLC_IOCTL_MAGIC		0x14e46c77
935
936/* bump this number if you change the ioctl interface */
937#define WLC_IOCTL_VERSION	1
938
939#define	WLC_IOCTL_MAXLEN	8192		/* max length ioctl buffer required */
940#define	WLC_IOCTL_SMLEN		256		/* "small" length ioctl buffer required */
941#define WLC_IOCTL_MEDLEN        1536    	/* "med" length ioctl buffer required */
942#define WLC_SAMPLECOLLECT_MAXLEN	10240	/* Max Sample Collect buffer for two cores */
943
944/* common ioctl definitions */
945#define WLC_GET_MAGIC				0
946#define WLC_GET_VERSION				1
947#define WLC_UP					2
948#define WLC_DOWN				3
949#define WLC_GET_LOOP				4
950#define WLC_SET_LOOP				5
951#define WLC_DUMP				6
952#define WLC_GET_MSGLEVEL			7
953#define WLC_SET_MSGLEVEL			8
954#define WLC_GET_PROMISC				9
955#define WLC_SET_PROMISC				10
956/* #define WLC_DUMP_RSSI			11 */ /* no longer supported */
957#define WLC_GET_RATE				12
958/* #define WLC_SET_RATE				13 */ /* no longer supported */
959#define WLC_GET_INSTANCE			14
960/* #define WLC_GET_FRAG				15 */ /* no longer supported */
961/* #define WLC_SET_FRAG				16 */ /* no longer supported */
962/* #define WLC_GET_RTS				17 */ /* no longer supported */
963/* #define WLC_SET_RTS				18 */ /* no longer supported */
964#define WLC_GET_INFRA				19
965#define WLC_SET_INFRA				20
966#define WLC_GET_AUTH				21
967#define WLC_SET_AUTH				22
968#define WLC_GET_BSSID				23
969#define WLC_SET_BSSID				24
970#define WLC_GET_SSID				25
971#define WLC_SET_SSID				26
972#define WLC_RESTART				27
973/* #define WLC_DUMP_SCB				28 */ /* no longer supported */
974#define WLC_GET_CHANNEL				29
975#define WLC_SET_CHANNEL				30
976#define WLC_GET_SRL				31
977#define WLC_SET_SRL				32
978#define WLC_GET_LRL				33
979#define WLC_SET_LRL				34
980#define WLC_GET_PLCPHDR				35
981#define WLC_SET_PLCPHDR				36
982#define WLC_GET_RADIO				37
983#define WLC_SET_RADIO				38
984#define WLC_GET_PHYTYPE				39
985#define WLC_DUMP_RATE				40
986#define WLC_SET_RATE_PARAMS			41
987#define WLC_GET_FIXRATE				42
988#define WLC_SET_FIXRATE				43
989/* #define WLC_GET_WEP				42 */ /* no longer supported */
990/* #define WLC_SET_WEP				43 */ /* no longer supported */
991#define WLC_GET_KEY				44
992#define WLC_SET_KEY				45
993#define WLC_GET_REGULATORY			46
994#define WLC_SET_REGULATORY			47
995#define WLC_GET_PASSIVE_SCAN			48
996#define WLC_SET_PASSIVE_SCAN			49
997#define WLC_SCAN				50
998#define WLC_SCAN_RESULTS			51
999#define WLC_DISASSOC				52
1000#define WLC_REASSOC				53
1001#define WLC_GET_ROAM_TRIGGER			54
1002#define WLC_SET_ROAM_TRIGGER			55
1003#define WLC_GET_ROAM_DELTA			56
1004#define WLC_SET_ROAM_DELTA			57
1005#define WLC_GET_ROAM_SCAN_PERIOD		58
1006#define WLC_SET_ROAM_SCAN_PERIOD		59
1007#define WLC_EVM					60	/* diag */
1008#define WLC_GET_TXANT				61
1009#define WLC_SET_TXANT				62
1010#define WLC_GET_ANTDIV				63
1011#define WLC_SET_ANTDIV				64
1012/* #define WLC_GET_TXPWR			65 */ /* no longer supported */
1013/* #define WLC_SET_TXPWR			66 */ /* no longer supported */
1014#define WLC_GET_CLOSED				67
1015#define WLC_SET_CLOSED				68
1016#define WLC_GET_MACLIST				69
1017#define WLC_SET_MACLIST				70
1018#define WLC_GET_RATESET				71
1019#define WLC_SET_RATESET				72
1020/* #define WLC_GET_LOCALE			73 */ /* no longer supported */
1021#define WLC_LONGTRAIN				74
1022#define WLC_GET_BCNPRD				75
1023#define WLC_SET_BCNPRD				76
1024#define WLC_GET_DTIMPRD				77
1025#define WLC_SET_DTIMPRD				78
1026#define WLC_GET_SROM				79
1027#define WLC_SET_SROM				80
1028#define WLC_GET_WEP_RESTRICT			81
1029#define WLC_SET_WEP_RESTRICT			82
1030#define WLC_GET_COUNTRY				83
1031#define WLC_SET_COUNTRY				84
1032#define WLC_GET_PM				85
1033#define WLC_SET_PM				86
1034#define WLC_GET_WAKE				87
1035#define WLC_SET_WAKE				88
1036/* #define WLC_GET_D11CNTS			89 */ /* -> "counters" iovar */
1037#define WLC_GET_FORCELINK			90	/* ndis only */
1038#define WLC_SET_FORCELINK			91	/* ndis only */
1039#define WLC_FREQ_ACCURACY			92	/* diag */
1040#define WLC_CARRIER_SUPPRESS			93	/* diag */
1041#define WLC_GET_PHYREG				94
1042#define WLC_SET_PHYREG				95
1043#define WLC_GET_RADIOREG			96
1044#define WLC_SET_RADIOREG			97
1045#define WLC_GET_REVINFO				98
1046#define WLC_GET_UCANTDIV			99
1047#define WLC_SET_UCANTDIV			100
1048#define WLC_R_REG				101
1049#define WLC_W_REG				102
1050/* #define WLC_DIAG_LOOPBACK			103	old tray diag */
1051/* #define WLC_RESET_D11CNTS			104 */ /* -> "reset_d11cnts" iovar */
1052#define WLC_GET_MACMODE				105
1053#define WLC_SET_MACMODE				106
1054#define WLC_GET_MONITOR				107
1055#define WLC_SET_MONITOR				108
1056#define WLC_GET_GMODE				109
1057#define WLC_SET_GMODE				110
1058#define WLC_GET_LEGACY_ERP			111
1059#define WLC_SET_LEGACY_ERP			112
1060#define WLC_GET_RX_ANT				113
1061#define WLC_GET_CURR_RATESET			114	/* current rateset */
1062#define WLC_GET_SCANSUPPRESS			115
1063#define WLC_SET_SCANSUPPRESS			116
1064#define WLC_GET_AP				117
1065#define WLC_SET_AP				118
1066#define WLC_GET_EAP_RESTRICT			119
1067#define WLC_SET_EAP_RESTRICT			120
1068#define WLC_SCB_AUTHORIZE			121
1069#define WLC_SCB_DEAUTHORIZE			122
1070#define WLC_GET_WDSLIST				123
1071#define WLC_SET_WDSLIST				124
1072#define WLC_GET_ATIM				125
1073#define WLC_SET_ATIM				126
1074#define WLC_GET_RSSI				127
1075#define WLC_GET_PHYANTDIV			128
1076#define WLC_SET_PHYANTDIV			129
1077#define WLC_AP_RX_ONLY				130
1078#define WLC_GET_TX_PATH_PWR			131
1079#define WLC_SET_TX_PATH_PWR			132
1080#define WLC_GET_WSEC				133
1081#define WLC_SET_WSEC				134
1082#define WLC_GET_PHY_NOISE			135
1083#define WLC_GET_BSS_INFO			136
1084#define WLC_GET_PKTCNTS				137
1085#define WLC_GET_LAZYWDS				138
1086#define WLC_SET_LAZYWDS				139
1087#define WLC_GET_BANDLIST			140
1088#define WLC_GET_BAND				141
1089#define WLC_SET_BAND				142
1090#define WLC_SCB_DEAUTHENTICATE			143
1091#define WLC_GET_SHORTSLOT			144
1092#define WLC_GET_SHORTSLOT_OVERRIDE		145
1093#define WLC_SET_SHORTSLOT_OVERRIDE		146
1094#define WLC_GET_SHORTSLOT_RESTRICT		147
1095#define WLC_SET_SHORTSLOT_RESTRICT		148
1096#define WLC_GET_GMODE_PROTECTION		149
1097#define WLC_GET_GMODE_PROTECTION_OVERRIDE	150
1098#define WLC_SET_GMODE_PROTECTION_OVERRIDE	151
1099#define WLC_UPGRADE				152
1100/* #define WLC_GET_MRATE			153 */ /* no longer supported */
1101/* #define WLC_SET_MRATE			154 */ /* no longer supported */
1102#define WLC_GET_IGNORE_BCNS			155
1103#define WLC_SET_IGNORE_BCNS			156
1104#define WLC_GET_SCB_TIMEOUT			157
1105#define WLC_SET_SCB_TIMEOUT			158
1106#define WLC_GET_ASSOCLIST			159
1107#define WLC_GET_CLK				160
1108#define WLC_SET_CLK				161
1109#define WLC_GET_UP				162
1110#define WLC_OUT					163
1111#define WLC_GET_WPA_AUTH			164
1112#define WLC_SET_WPA_AUTH			165
1113#define WLC_GET_UCFLAGS				166
1114#define WLC_SET_UCFLAGS				167
1115#define WLC_GET_PWRIDX				168
1116#define WLC_SET_PWRIDX				169
1117#define WLC_GET_TSSI				170
1118#define WLC_GET_SUP_RATESET_OVERRIDE		171
1119#define WLC_SET_SUP_RATESET_OVERRIDE		172
1120/* #define WLC_SET_FAST_TIMER			173 */ /* no longer supported */
1121/* #define WLC_GET_FAST_TIMER			174 */ /* no longer supported */
1122/* #define WLC_SET_SLOW_TIMER			175 */ /* no longer supported */
1123/* #define WLC_GET_SLOW_TIMER			176 */ /* no longer supported */
1124/* #define WLC_DUMP_PHYREGS			177 */ /* no longer supported */
1125#define WLC_GET_PROTECTION_CONTROL		178
1126#define WLC_SET_PROTECTION_CONTROL		179
1127#define WLC_GET_PHYLIST				180
1128#define WLC_ENCRYPT_STRENGTH			181	/* ndis only */
1129#define WLC_DECRYPT_STATUS			182	/* ndis only */
1130#define WLC_GET_KEY_SEQ				183
1131#define WLC_GET_SCAN_CHANNEL_TIME		184
1132#define WLC_SET_SCAN_CHANNEL_TIME		185
1133#define WLC_GET_SCAN_UNASSOC_TIME		186
1134#define WLC_SET_SCAN_UNASSOC_TIME		187
1135#define WLC_GET_SCAN_HOME_TIME			188
1136#define WLC_SET_SCAN_HOME_TIME			189
1137#define WLC_GET_SCAN_NPROBES			190
1138#define WLC_SET_SCAN_NPROBES			191
1139#define WLC_GET_PRB_RESP_TIMEOUT		192
1140#define WLC_SET_PRB_RESP_TIMEOUT		193
1141#define WLC_GET_ATTEN				194
1142#define WLC_SET_ATTEN				195
1143#define WLC_GET_SHMEM				196	/* diag */
1144#define WLC_SET_SHMEM				197	/* diag */
1145/* #define WLC_GET_GMODE_PROTECTION_CTS		198 */ /* no longer supported */
1146/* #define WLC_SET_GMODE_PROTECTION_CTS		199 */ /* no longer supported */
1147#define WLC_SET_WSEC_TEST			200
1148#define WLC_SCB_DEAUTHENTICATE_FOR_REASON	201
1149#define WLC_TKIP_COUNTERMEASURES		202
1150#define WLC_GET_PIOMODE				203
1151#define WLC_SET_PIOMODE				204
1152#define WLC_SET_ASSOC_PREFER			205
1153#define WLC_GET_ASSOC_PREFER			206
1154#define WLC_SET_ROAM_PREFER			207
1155#define WLC_GET_ROAM_PREFER			208
1156#define WLC_SET_LED				209
1157#define WLC_GET_LED				210
1158#define WLC_GET_INTERFERENCE_MODE		211
1159#define WLC_SET_INTERFERENCE_MODE		212
1160#define WLC_GET_CHANNEL_QA			213
1161#define WLC_START_CHANNEL_QA			214
1162#define WLC_GET_CHANNEL_SEL			215
1163#define WLC_START_CHANNEL_SEL			216
1164#define WLC_GET_VALID_CHANNELS			217
1165#define WLC_GET_FAKEFRAG			218
1166#define WLC_SET_FAKEFRAG			219
1167#define WLC_GET_PWROUT_PERCENTAGE		220
1168#define WLC_SET_PWROUT_PERCENTAGE		221
1169#define WLC_SET_BAD_FRAME_PREEMPT		222
1170#define WLC_GET_BAD_FRAME_PREEMPT		223
1171#define WLC_SET_LEAP_LIST			224
1172#define WLC_GET_LEAP_LIST			225
1173#define WLC_GET_CWMIN				226
1174#define WLC_SET_CWMIN				227
1175#define WLC_GET_CWMAX				228
1176#define WLC_SET_CWMAX				229
1177#define WLC_GET_WET				230
1178#define WLC_SET_WET				231
1179#define WLC_GET_PUB				232
1180/* #define WLC_SET_GLACIAL_TIMER		233 */ /* no longer supported */
1181/* #define WLC_GET_GLACIAL_TIMER		234 */ /* no longer supported */
1182#define WLC_GET_KEY_PRIMARY			235
1183#define WLC_SET_KEY_PRIMARY			236
1184/* #define WLC_DUMP_RADIOREGS			237 */ /* no longer supported */
1185#define WLC_GET_ACI_ARGS			238
1186#define WLC_SET_ACI_ARGS			239
1187#define WLC_UNSET_CALLBACK			240
1188#define WLC_SET_CALLBACK			241
1189#define WLC_GET_RADAR				242
1190#define WLC_SET_RADAR				243
1191#define WLC_SET_SPECT_MANAGMENT			244
1192#define WLC_GET_SPECT_MANAGMENT			245
1193#define WLC_WDS_GET_REMOTE_HWADDR		246	/* handled in wl_linux.c/wl_vx.c */
1194#define WLC_WDS_GET_WPA_SUP			247
1195#define WLC_SET_CS_SCAN_TIMER			248
1196#define WLC_GET_CS_SCAN_TIMER			249
1197#define WLC_MEASURE_REQUEST			250
1198#define WLC_INIT				251
1199#define WLC_SEND_QUIET				252
1200#define WLC_KEEPALIVE			253
1201#define WLC_SEND_PWR_CONSTRAINT			254
1202#define WLC_UPGRADE_STATUS			255
1203#define WLC_CURRENT_PWR				256
1204#define WLC_GET_SCAN_PASSIVE_TIME		257
1205#define WLC_SET_SCAN_PASSIVE_TIME		258
1206#define WLC_LEGACY_LINK_BEHAVIOR		259
1207#define WLC_GET_CHANNELS_IN_COUNTRY		260
1208#define WLC_GET_COUNTRY_LIST			261
1209#define WLC_GET_VAR				262	/* get value of named variable */
1210#define WLC_SET_VAR				263	/* set named variable to value */
1211#define WLC_NVRAM_GET				264	/* deprecated */
1212#define WLC_NVRAM_SET				265
1213#define WLC_NVRAM_DUMP				266
1214#define WLC_REBOOT				267
1215#define WLC_SET_WSEC_PMK			268
1216#define WLC_GET_AUTH_MODE			269
1217#define WLC_SET_AUTH_MODE			270
1218#define WLC_GET_WAKEENTRY			271
1219#define WLC_SET_WAKEENTRY			272
1220#define WLC_NDCONFIG_ITEM			273	/* currently handled in wl_oid.c */
1221#define WLC_NVOTPW				274
1222#define WLC_OTPW				275
1223#define WLC_IOV_BLOCK_GET			276
1224#define WLC_IOV_MODULES_GET			277
1225#define WLC_SOFT_RESET				278
1226#define WLC_GET_ALLOW_MODE			279
1227#define WLC_SET_ALLOW_MODE			280
1228#define WLC_GET_DESIRED_BSSID			281
1229#define WLC_SET_DESIRED_BSSID			282
1230#define	WLC_DISASSOC_MYAP			283
1231#define WLC_GET_NBANDS				284	/* for Dongle EXT_STA support */
1232#define WLC_GET_BANDSTATES			285	/* for Dongle EXT_STA support */
1233#define WLC_GET_WLC_BSS_INFO			286	/* for Dongle EXT_STA support */
1234#define WLC_GET_ASSOC_INFO			287	/* for Dongle EXT_STA support */
1235#define WLC_GET_OID_PHY				288	/* for Dongle EXT_STA support */
1236#define WLC_SET_OID_PHY				289	/* for Dongle EXT_STA support */
1237#define WLC_SET_ASSOC_TIME			290	/* for Dongle EXT_STA support */
1238#define WLC_GET_DESIRED_SSID			291	/* for Dongle EXT_STA support */
1239#define WLC_GET_CHANSPEC			292	/* for Dongle EXT_STA support */
1240#define WLC_GET_ASSOC_STATE			293	/* for Dongle EXT_STA support */
1241#define WLC_SET_PHY_STATE			294	/* for Dongle EXT_STA support */
1242#define WLC_GET_SCAN_PENDING			295	/* for Dongle EXT_STA support */
1243#define WLC_GET_SCANREQ_PENDING			296	/* for Dongle EXT_STA support */
1244#define WLC_GET_PREV_ROAM_REASON		297	/* for Dongle EXT_STA support */
1245#define WLC_SET_PREV_ROAM_REASON		298	/* for Dongle EXT_STA support */
1246#define WLC_GET_BANDSTATES_PI			299	/* for Dongle EXT_STA support */
1247#define WLC_GET_PHY_STATE			300	/* for Dongle EXT_STA support */
1248#define WLC_GET_BSS_WPA_RSN			301	/* for Dongle EXT_STA support */
1249#define WLC_GET_BSS_WPA2_RSN			302	/* for Dongle EXT_STA support */
1250#define WLC_GET_BSS_BCN_TS			303	/* for Dongle EXT_STA support */
1251#define WLC_GET_INT_DISASSOC			304	/* for Dongle EXT_STA support */
1252#define WLC_SET_NUM_PEERS			305     /* for Dongle EXT_STA support */
1253#define WLC_GET_NUM_BSS				306	/* for Dongle EXT_STA support */
1254#define WLC_NPHY_SAMPLE_COLLECT			307	/* Nphy sample collect mode */
1255#define WLC_UM_PRIV				308	/* for usermode driver private ioctl */
1256#define WLC_GET_CMD				309
1257/* #define WLC_LAST				310 */	/* Never used - can be reused */
1258#define WLC_SET_INTERFERENCE_OVERRIDE_MODE	311	/* set inter mode override */
1259#define WLC_GET_INTERFERENCE_OVERRIDE_MODE	312	/* get inter mode override */
1260#define WLC_GET_WAI_RESTRICT			313	/* for WAPI */
1261#define WLC_SET_WAI_RESTRICT			314	/* for WAPI */
1262#define WLC_SET_WAI_REKEY			315	/* for WAPI */
1263#define WLC_LAST				316
1264
1265#ifndef LINUX_POSTMOGRIFY_REMOVAL
1266#ifndef EPICTRL_COOKIE
1267#define EPICTRL_COOKIE		0xABADCEDE
1268#endif
1269
1270/* vx wlc ioctl's offset */
1271#define CMN_IOCTL_OFF 0x180
1272
1273/*
1274 * custom OID support
1275 *
1276 * 0xFF - implementation specific OID
1277 * 0xE4 - first byte of Broadcom PCI vendor ID
1278 * 0x14 - second byte of Broadcom PCI vendor ID
1279 * 0xXX - the custom OID number
1280 */
1281
1282/* begin 0x1f values beyond the start of the ET driver range. */
1283#define WL_OID_BASE		0xFFE41420
1284
1285/* NDIS overrides */
1286#define OID_WL_GETINSTANCE	(WL_OID_BASE + WLC_GET_INSTANCE)
1287#define OID_WL_GET_FORCELINK	(WL_OID_BASE + WLC_GET_FORCELINK)
1288#define OID_WL_SET_FORCELINK	(WL_OID_BASE + WLC_SET_FORCELINK)
1289#define	OID_WL_ENCRYPT_STRENGTH	(WL_OID_BASE + WLC_ENCRYPT_STRENGTH)
1290#define OID_WL_DECRYPT_STATUS	(WL_OID_BASE + WLC_DECRYPT_STATUS)
1291#define OID_LEGACY_LINK_BEHAVIOR (WL_OID_BASE + WLC_LEGACY_LINK_BEHAVIOR)
1292#define OID_WL_NDCONFIG_ITEM	(WL_OID_BASE + WLC_NDCONFIG_ITEM)
1293
1294/* EXT_STA Dongle suuport */
1295#define OID_STA_CHANSPEC	(WL_OID_BASE + WLC_GET_CHANSPEC)
1296#define OID_STA_NBANDS		(WL_OID_BASE + WLC_GET_NBANDS)
1297#define OID_STA_GET_PHY		(WL_OID_BASE + WLC_GET_OID_PHY)
1298#define OID_STA_SET_PHY		(WL_OID_BASE + WLC_SET_OID_PHY)
1299#define OID_STA_ASSOC_TIME	(WL_OID_BASE + WLC_SET_ASSOC_TIME)
1300#define OID_STA_DESIRED_SSID	(WL_OID_BASE + WLC_GET_DESIRED_SSID)
1301#define OID_STA_SET_PHY_STATE	(WL_OID_BASE + WLC_SET_PHY_STATE)
1302#define OID_STA_SCAN_PENDING	(WL_OID_BASE + WLC_GET_SCAN_PENDING)
1303#define OID_STA_SCANREQ_PENDING (WL_OID_BASE + WLC_GET_SCANREQ_PENDING)
1304#define OID_STA_GET_ROAM_REASON (WL_OID_BASE + WLC_GET_PREV_ROAM_REASON)
1305#define OID_STA_SET_ROAM_REASON (WL_OID_BASE + WLC_SET_PREV_ROAM_REASON)
1306#define OID_STA_GET_PHY_STATE	(WL_OID_BASE + WLC_GET_PHY_STATE)
1307#define OID_STA_INT_DISASSOC	(WL_OID_BASE + WLC_GET_INT_DISASSOC)
1308#define OID_STA_SET_NUM_PEERS	(WL_OID_BASE + WLC_SET_NUM_PEERS)
1309#define OID_STA_GET_NUM_BSS	(WL_OID_BASE + WLC_GET_NUM_BSS)
1310
1311#define WL_DECRYPT_STATUS_SUCCESS	1
1312#define WL_DECRYPT_STATUS_FAILURE	2
1313#define WL_DECRYPT_STATUS_UNKNOWN	3
1314
1315/* allows user-mode app to poll the status of USB image upgrade */
1316#define WLC_UPGRADE_SUCCESS			0
1317#define WLC_UPGRADE_PENDING			1
1318
1319#ifdef CONFIG_USBRNDIS_RETAIL
1320/* struct passed in for WLC_NDCONFIG_ITEM */
1321typedef struct {
1322	char *name;
1323	void *param;
1324} ndconfig_item_t;
1325#endif
1326
1327#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1328
1329/* WLC_GET_AUTH, WLC_SET_AUTH values */
1330#define WL_AUTH_OPEN_SYSTEM		0	/* d11 open authentication */
1331#define WL_AUTH_SHARED_KEY		1	/* d11 shared authentication */
1332#define WL_AUTH_OPEN_SHARED		2	/* try open, then shared if open failed w/rc 13 */
1333
1334/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
1335#define WL_RADIO_SW_DISABLE		(1<<0)
1336#define WL_RADIO_HW_DISABLE		(1<<1)
1337#define WL_RADIO_MPC_DISABLE		(1<<2)
1338#define WL_RADIO_COUNTRY_DISABLE	(1<<3)	/* some countries don't support any channel */
1339
1340/* Override bit for WLC_SET_TXPWR.  if set, ignore other level limits */
1341#define WL_TXPWR_OVERRIDE	(1U<<31)
1342
1343#define WL_PHY_PAVARS_LEN	6	/* Phy type, Band range, chain, a1, b0, b1 */
1344
1345typedef struct wl_po {
1346	uint16	phy_type;	/* Phy type */
1347	uint16	band;
1348	uint16	cckpo;
1349	uint32	ofdmpo;
1350	uint16	mcspo[8];
1351} wl_po_t;
1352
1353/* a large TX Power as an init value to factor out of MIN() calculations,
1354 * keep low enough to fit in an int8, units are .25 dBm
1355 */
1356#define WLC_TXPWR_MAX		(127)	/* ~32 dBm = 1,500 mW */
1357
1358/* "diag" iovar argument and error code */
1359#define WL_DIAG_INTERRUPT			1	/* d11 loopback interrupt test */
1360#define WL_DIAG_LOOPBACK			2	/* d11 loopback data test */
1361#define WL_DIAG_MEMORY				3	/* d11 memory test */
1362#define WL_DIAG_LED				4	/* LED test */
1363#define WL_DIAG_REG				5	/* d11/phy register test */
1364#define WL_DIAG_SROM				6	/* srom read/crc test */
1365#define WL_DIAG_DMA				7	/* DMA test */
1366
1367#define WL_DIAGERR_SUCCESS			0
1368#define WL_DIAGERR_FAIL_TO_RUN			1	/* unable to run requested diag */
1369#define WL_DIAGERR_NOT_SUPPORTED		2	/* diag requested is not supported */
1370#define WL_DIAGERR_INTERRUPT_FAIL		3	/* loopback interrupt test failed */
1371#define WL_DIAGERR_LOOPBACK_FAIL		4	/* loopback data test failed */
1372#define WL_DIAGERR_SROM_FAIL			5	/* srom read failed */
1373#define WL_DIAGERR_SROM_BADCRC			6	/* srom crc failed */
1374#define WL_DIAGERR_REG_FAIL			7	/* d11/phy register test failed */
1375#define WL_DIAGERR_MEMORY_FAIL			8	/* d11 memory test failed */
1376#define WL_DIAGERR_NOMEM			9	/* diag test failed due to no memory */
1377#define WL_DIAGERR_DMA_FAIL			10	/* DMA test failed */
1378
1379#define WL_DIAGERR_MEMORY_TIMEOUT		11	/* d11 memory test didn't finish in time */
1380#define WL_DIAGERR_MEMORY_BADPATTERN		12	/* d11 memory test result in bad pattern */
1381
1382/* band types */
1383#define	WLC_BAND_AUTO		0	/* auto-select */
1384#define	WLC_BAND_5G		1	/* 5 Ghz */
1385#define	WLC_BAND_2G		2	/* 2.4 Ghz */
1386#define	WLC_BAND_ALL		3	/* all bands */
1387
1388/* band range returned by band_range iovar */
1389#define WL_CHAN_FREQ_RANGE_2G      0
1390#define WL_CHAN_FREQ_RANGE_5GL     1
1391#define WL_CHAN_FREQ_RANGE_5GM     2
1392#define WL_CHAN_FREQ_RANGE_5GH     3
1393
1394/* phy types (returned by WLC_GET_PHYTPE) */
1395#define	WLC_PHY_TYPE_A		0
1396#define	WLC_PHY_TYPE_B		1
1397#define	WLC_PHY_TYPE_G		2
1398#define	WLC_PHY_TYPE_N		4
1399#define	WLC_PHY_TYPE_LP		5
1400#define	WLC_PHY_TYPE_SSN	6
1401#define	WLC_PHY_TYPE_LCN	8
1402#define	WLC_PHY_TYPE_NULL	0xf
1403
1404/* MAC list modes */
1405#define WLC_MACMODE_DISABLED	0	/* MAC list disabled */
1406#define WLC_MACMODE_DENY	1	/* Deny specified (i.e. allow unspecified) */
1407#define WLC_MACMODE_ALLOW	2	/* Allow specified (i.e. deny unspecified) */
1408
1409/*
1410 * 54g modes (basic bits may still be overridden)
1411 *
1412 * GMODE_LEGACY_B			Rateset: 1b, 2b, 5.5, 11
1413 *					Preamble: Long
1414 *					Shortslot: Off
1415 * GMODE_AUTO				Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
1416 *					Extended Rateset: 6, 9, 12, 48
1417 *					Preamble: Long
1418 *					Shortslot: Auto
1419 * GMODE_ONLY				Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
1420 *					Extended Rateset: 6b, 9, 12b, 48
1421 *					Preamble: Short required
1422 *					Shortslot: Auto
1423 * GMODE_B_DEFERRED			Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
1424 *					Extended Rateset: 6, 9, 12, 48
1425 *					Preamble: Long
1426 *					Shortslot: On
1427 * GMODE_PERFORMANCE			Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
1428 *					Preamble: Short required
1429 *					Shortslot: On and required
1430 * GMODE_LRS				Rateset: 1b, 2b, 5.5b, 11b
1431 *					Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
1432 *					Preamble: Long
1433 *					Shortslot: Auto
1434 */
1435#define GMODE_LEGACY_B		0
1436#define GMODE_AUTO		1
1437#define GMODE_ONLY		2
1438#define GMODE_B_DEFERRED	3
1439#define GMODE_PERFORMANCE	4
1440#define GMODE_LRS		5
1441#define GMODE_MAX		6
1442
1443/* values for PLCPHdr_override */
1444#define WLC_PLCP_AUTO	-1
1445#define WLC_PLCP_SHORT	0
1446#define WLC_PLCP_LONG	1
1447
1448/* values for g_protection_override and n_protection_override */
1449#define WLC_PROTECTION_AUTO		-1
1450#define WLC_PROTECTION_OFF		0
1451#define WLC_PROTECTION_ON		1
1452#define WLC_PROTECTION_MMHDR_ONLY	2
1453#define WLC_PROTECTION_CTS_ONLY		3
1454
1455/* values for g_protection_control and n_protection_control */
1456#define WLC_PROTECTION_CTL_OFF		0
1457#define WLC_PROTECTION_CTL_LOCAL	1
1458#define WLC_PROTECTION_CTL_OVERLAP	2
1459
1460/* values for n_protection */
1461#define WLC_N_PROTECTION_OFF		0
1462#define WLC_N_PROTECTION_OPTIONAL	1
1463#define WLC_N_PROTECTION_20IN40		2
1464#define WLC_N_PROTECTION_MIXEDMODE	3
1465
1466/* values for n_preamble_type */
1467#define WLC_N_PREAMBLE_MIXEDMODE	0
1468#define WLC_N_PREAMBLE_GF		1
1469#define WLC_N_PREAMBLE_GF_BRCM          2
1470
1471/* values for band specific 40MHz capabilities */
1472#define WLC_N_BW_20ALL			0
1473#define WLC_N_BW_40ALL			1
1474#define WLC_N_BW_20IN2G_40IN5G		2
1475
1476/* values to force tx/rx chain */
1477#define WLC_N_TXRX_CHAIN0		0
1478#define WLC_N_TXRX_CHAIN1		1
1479
1480/* bitflags for SGI support (sgi_rx iovar) */
1481#define WLC_N_SGI_20			0x01
1482#define WLC_N_SGI_40			0x02
1483
1484/* Values for PM */
1485#define PM_OFF	0
1486#define PM_MAX	1
1487#define PM_FAST 2
1488
1489/* interference mitigation options */
1490#define	INTERFERE_OVRRIDE_OFF	-1	/* interference override off */
1491#define	INTERFERE_NONE	0	/* off */
1492#define	NON_WLAN	1	/* foreign/non 802.11 interference, no auto detect */
1493#define	WLAN_MANUAL	2	/* ACI: no auto detection */
1494#define	WLAN_AUTO	3	/* ACI: auto detect */
1495#define	WLAN_AUTO_W_NOISE	4	/* ACI: auto - detect and non 802.11 interference */
1496#define AUTO_ACTIVE	(1 << 7) /* Auto is currently active */
1497
1498typedef struct wl_aci_args {
1499	int enter_aci_thresh; /* Trigger level to start detecting ACI */
1500	int exit_aci_thresh; /* Trigger level to exit ACI mode */
1501	int usec_spin; /* microsecs to delay between rssi samples */
1502	int glitch_delay; /* interval between ACI scans when glitch count is consistently high */
1503	uint16 nphy_adcpwr_enter_thresh;	/* ADC power to enter ACI mitigation mode */
1504	uint16 nphy_adcpwr_exit_thresh;	/* ADC power to exit ACI mitigation mode */
1505	uint16 nphy_repeat_ctr;		/* Number of tries per channel to compute power */
1506	uint16 nphy_num_samples;	/* Number of samples to compute power on one channel */
1507	uint16 nphy_undetect_window_sz;	/* num of undetects to exit ACI Mitigation mode */
1508	uint16 nphy_b_energy_lo_aci;	/* low ACI power energy threshold for bphy */
1509	uint16 nphy_b_energy_md_aci;	/* mid ACI power energy threshold for bphy */
1510	uint16 nphy_b_energy_hi_aci;	/* high ACI power energy threshold for bphy */
1511} wl_aci_args_t;
1512
1513#define WL_ACI_ARGS_LEGACY_LENGTH	16	/* bytes of pre NPHY aci args */
1514
1515typedef struct wl_samplecollect_args {
1516	uint8 coll_us;
1517	int cores;
1518} wl_samplecollect_args_t;
1519
1520#ifndef LINUX_POSTMOGRIFY_REMOVAL
1521/* wl_radar_args_t */
1522typedef struct {
1523	int npulses; 	/* required number of pulses at n * t_int */
1524	int ncontig; 	/* required number of pulses at t_int */
1525	int min_pw; 	/* minimum pulse width (20 MHz clocks) */
1526	int max_pw; 	/* maximum pulse width (20 MHz clocks) */
1527	uint16 thresh0;	/* Radar detection, thresh 0 */
1528	uint16 thresh1;	/* Radar detection, thresh 1 */
1529	uint16 blank;	/* Radar detection, blank control */
1530	uint16 fmdemodcfg;	/* Radar detection, fmdemod config */
1531	int npulses_lp;  /* Radar detection, minimum long pulses */
1532	int min_pw_lp; /* Minimum pulsewidth for long pulses */
1533	int max_pw_lp; /* Maximum pulsewidth for long pulses */
1534	int min_fm_lp; /* Minimum fm for long pulses */
1535	int max_span_lp;  /* Maximum deltat for long pulses */
1536	int min_deltat; /* Minimum spacing between pulses */
1537	int max_deltat; /* Maximum spacing between pulses */
1538	uint16 autocorr;	/* Radar detection, autocorr on or off */
1539	uint16 st_level_time;	/* Radar detection, start_timing level */
1540	uint16 t2_min; /* minimum clocks needed to remain in state 2 */
1541	uint32 version; /* version */
1542	uint32 fra_pulse_err;	/* sample error margin for detecting French radar pulsed */
1543	int npulses_fra;  /* Radar detection, minimum French pulses set */
1544	int npulses_stg2;  /* Radar detection, minimum staggered-2 pulses set */
1545	int npulses_stg3;  /* Radar detection, minimum staggered-3 pulses set */
1546	uint16 percal_mask;	/* defines which period cal is masked from radar detection */
1547	int quant;	/* quantization resolution to pulse positions */
1548	uint32 min_burst_intv_lp;	/* minimum burst to burst interval for bin3 radar */
1549	uint32 max_burst_intv_lp;	/* maximum burst to burst interval for bin3 radar */
1550	int nskip_rst_lp;	/* number of skipped pulses before resetting lp buffer */
1551	int max_pw_tol;	/* maximum tollerance allowed in detected pulse width for radar detection */
1552	uint16 feature_mask; /* 16-bit mask to specify enabled features */
1553} wl_radar_args_t;
1554
1555#define WL_RADAR_ARGS_VERSION 2
1556
1557typedef struct {
1558	uint32 version; /* version */
1559	uint16 thresh0_20_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 20MHz */
1560	uint16 thresh1_20_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
1561	uint16 thresh0_40_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
1562	uint16 thresh1_40_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
1563	uint16 thresh0_20_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
1564	uint16 thresh1_20_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
1565	uint16 thresh0_40_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
1566	uint16 thresh1_40_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
1567} wl_radar_thr_t;
1568
1569#define WL_RADAR_THR_VERSION	1
1570#define WL_THRESHOLD_LO_BAND	70	/* range from 5250MHz - 5350MHz */
1571
1572/* radar iovar SET defines */
1573#define WL_RADAR_DETECTOR_OFF		0	/* radar detector off */
1574#define WL_RADAR_DETECTOR_ON		1	/* radar detector on */
1575#define WL_RADAR_SIMULATED		2	/* force radar detector to declare
1576						 * detection once
1577						 */
1578#define WL_RSSI_ANT_VERSION	1	/* current version of wl_rssi_ant_t */
1579#define WL_RSSI_ANT_MAX		4	/* max possible rx antennas */
1580#define WL_ANT_RX_MAX		2	/* max 2 receive antennas */
1581#define WL_ANT_IDX_1		0	/* antenna index 1 */
1582#define WL_ANT_IDX_2		1	/* antenna index 2 */
1583
1584/* RSSI per antenna */
1585typedef struct {
1586	uint32	version;		/* version field */
1587	uint32	count;			/* number of valid antenna rssi */
1588	int8 rssi_ant[WL_RSSI_ANT_MAX];	/* rssi per antenna */
1589} wl_rssi_ant_t;
1590
1591/* dfs_status iovar-related defines */
1592
1593/* cac - channel availability check,
1594 * ism - in-service monitoring
1595 * csa - channel switching announcement
1596 */
1597
1598/* cac state values */
1599#define WL_DFS_CACSTATE_IDLE		0	/* state for operating in non-radar channel */
1600#define	WL_DFS_CACSTATE_PREISM_CAC	1	/* CAC in progress */
1601#define WL_DFS_CACSTATE_ISM		2	/* ISM in progress */
1602#define WL_DFS_CACSTATE_CSA		3	/* csa */
1603#define WL_DFS_CACSTATE_POSTISM_CAC	4	/* ISM CAC */
1604#define WL_DFS_CACSTATE_PREISM_OOC	5	/* PREISM OOC */
1605#define WL_DFS_CACSTATE_POSTISM_OOC	6	/* POSTISM OOC */
1606#define WL_DFS_CACSTATES		7	/* this many states exist */
1607
1608/* data structure used in 'dfs_status' wl interface, which is used to query dfs status */
1609typedef struct {
1610	uint state;		/* noted by WL_DFS_CACSTATE_XX. */
1611	uint duration;		/* time spent in ms in state. */
1612	/* as dfs enters ISM state, it removes the operational channel from quiet channel
1613	 * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
1614	 */
1615	chanspec_t chanspec_cleared;
1616	/* chanspec cleared used to be a uint, add another to uint16 to maintain size */
1617	uint16 pad;
1618} wl_dfs_status_t;
1619
1620#define NUM_PWRCTRL_RATES 12
1621
1622typedef struct {
1623	uint8 txpwr_band_max[NUM_PWRCTRL_RATES];	/* User set target */
1624	uint8 txpwr_limit[NUM_PWRCTRL_RATES];		/* reg and local power limit */
1625	uint8 txpwr_local_max;				/* local max according to the AP */
1626	uint8 txpwr_local_constraint;			/* local constraint according to the AP */
1627	uint8 txpwr_chan_reg_max;			/* Regulatory max for this channel */
1628	uint8 txpwr_target[2][NUM_PWRCTRL_RATES];	/* Latest target for 2.4 and 5 Ghz */
1629	uint8 txpwr_est_Pout[2];			/* Latest estimate for 2.4 and 5 Ghz */
1630	uint8 txpwr_opo[NUM_PWRCTRL_RATES];		/* On G phy, OFDM power offset */
1631	uint8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];	/* Max CCK power for this band (SROM) */
1632	uint8 txpwr_bphy_ofdm_max;			/* Max OFDM power for this band (SROM) */
1633	uint8 txpwr_aphy_max[NUM_PWRCTRL_RATES];	/* Max power for A band (SROM) */
1634	int8  txpwr_antgain[2];				/* Ant gain for each band - from SROM */
1635	uint8 txpwr_est_Pout_gofdm;			/* Pwr estimate for 2.4 OFDM */
1636} tx_power_legacy_t;
1637
1638#define WL_TX_POWER_RATES_LEGACY	45
1639#define WL_TX_POWER_MCS20_FIRST	        12
1640#define WL_TX_POWER_MCS20_NUM	        16
1641#define WL_TX_POWER_MCS40_FIRST	        28
1642#define WL_TX_POWER_MCS40_NUM	        17
1643
1644typedef struct {
1645	uint32 flags;
1646	chanspec_t chanspec;			     /* txpwr report for this channel */
1647	chanspec_t local_chanspec;		     /* channel on which we are associated */
1648	uint8 local_max;			     /* local max according to the AP */
1649	uint8 local_constraint;			     /* local constraint according to the AP */
1650	int8  antgain[2];			     /* Ant gain for each band - from SROM */
1651	uint8 rf_cores;				     /* count of RF Cores being reported */
1652	uint8 est_Pout[4];                           /* Latest tx power out estimate per RF
1653						      * chain without adjustment
1654						      */
1655	uint8 est_Pout_cck;                          /* Latest CCK tx power out estimate */
1656	uint8 user_limit[WL_TX_POWER_RATES_LEGACY];  /* User limit */
1657	uint8 reg_limit[WL_TX_POWER_RATES_LEGACY];   /* Regulatory power limit */
1658	uint8 board_limit[WL_TX_POWER_RATES_LEGACY]; /* Max power board can support (SROM) */
1659	uint8 target[WL_TX_POWER_RATES_LEGACY];	     /* Latest target power */
1660} tx_power_legacy2_t;
1661
1662#define WL_TX_POWER_RATES	       101
1663#define WL_TX_POWER_CCK_FIRST	       0
1664#define WL_TX_POWER_CCK_NUM	       4
1665#define WL_TX_POWER_OFDM_FIRST	       4        /* Index for first 20MHz OFDM SISO rate */
1666#define WL_TX_POWER_OFDM20_CDD_FIRST   12       /* Index for first 20MHz OFDM CDD rate */
1667#define WL_TX_POWER_OFDM40_SISO_FIRST  52       /* Index for first 40MHz OFDM SISO rate */
1668#define WL_TX_POWER_OFDM40_CDD_FIRST   60       /* Index for first 40MHz OFDM CDD rate */
1669#define WL_TX_POWER_OFDM_NUM	       8
1670#define WL_TX_POWER_MCS20_SISO_FIRST   20       /* Index for first 20MHz MCS SISO rate */
1671#define WL_TX_POWER_MCS20_CDD_FIRST    28       /* Index for first 20MHz MCS CDD rate */
1672#define WL_TX_POWER_MCS20_STBC_FIRST   36       /* Index for first 20MHz MCS STBC rate */
1673#define WL_TX_POWER_MCS20_SDM_FIRST    44       /* Index for first 20MHz MCS SDM rate */
1674#define WL_TX_POWER_MCS40_SISO_FIRST   68       /* Index for first 40MHz MCS SISO rate */
1675#define WL_TX_POWER_MCS40_CDD_FIRST    76       /* Index for first 40MHz MCS CDD rate */
1676#define WL_TX_POWER_MCS40_STBC_FIRST   84       /* Index for first 40MHz MCS STBC rate */
1677#define WL_TX_POWER_MCS40_SDM_FIRST    92       /* Index for first 40MHz MCS SDM rate */
1678#define WL_TX_POWER_MCS_1_STREAM_NUM   8
1679#define WL_TX_POWER_MCS_2_STREAM_NUM   8
1680#define WL_TX_POWER_MCS_32	       100      /* Index for 40MHz rate MCS 32 */
1681#define WL_TX_POWER_MCS_32_NUM	       1
1682
1683/* sslpnphy specifics */
1684#define WL_TX_POWER_MCS20_SISO_FIRST_SSN   12       /* Index for first 20MHz MCS SISO rate */
1685
1686/* tx_power_t.flags bits */
1687#define WL_TX_POWER_F_ENABLED	1
1688#define WL_TX_POWER_F_HW	2
1689#define WL_TX_POWER_F_MIMO	4
1690#define WL_TX_POWER_F_SISO	8
1691
1692typedef struct {
1693	uint32 flags;
1694	chanspec_t chanspec;			/* txpwr report for this channel */
1695	chanspec_t local_chanspec;		/* channel on which we are associated */
1696	uint8 local_max;			/* local max according to the AP */
1697	uint8 local_constraint;			/* local constraint according to the AP */
1698	int8  antgain[2];			/* Ant gain for each band - from SROM */
1699	uint8 rf_cores;				/* count of RF Cores being reported */
1700	uint8 est_Pout[4];			/* Latest tx power out estimate per RF chain */
1701	uint8 est_Pout_act[4];                  /* Latest tx power out estimate per RF chain
1702						 * without adjustment
1703						 */
1704	uint8 est_Pout_cck;			/* Latest CCK tx power out estimate */
1705	uint8 tx_power_max[4];                  /* Maximum target power among all rates */
1706	uint8 tx_power_max_rate_ind[4];         /* Index of the rate with the max target power */
1707	uint8 user_limit[WL_TX_POWER_RATES];	/* User limit */
1708	uint8 reg_limit[WL_TX_POWER_RATES];	/* Regulatory power limit */
1709	uint8 board_limit[WL_TX_POWER_RATES];	/* Max power board can support (SROM) */
1710	uint8 target[WL_TX_POWER_RATES];	/* Latest target power */
1711} tx_power_t;
1712
1713typedef struct tx_inst_power {
1714	uint8 txpwr_est_Pout[2];			/* Latest estimate for 2.4 and 5 Ghz */
1715	uint8 txpwr_est_Pout_gofdm;			/* Pwr estimate for 2.4 OFDM */
1716} tx_inst_power_t;
1717
1718/* 802.11h measurement types */
1719#define WLC_MEASURE_TPC			1
1720#define WLC_MEASURE_CHANNEL_BASIC	2
1721#define WLC_MEASURE_CHANNEL_CCA		3
1722#define WLC_MEASURE_CHANNEL_RPI		4
1723
1724/* regulatory enforcement levels */
1725#define SPECT_MNGMT_OFF			0		/* both 11h and 11d disabled */
1726#define SPECT_MNGMT_LOOSE_11H		1		/* allow non-11h APs in scan lists */
1727#define SPECT_MNGMT_STRICT_11H		2		/* prune out non-11h APs from scan list */
1728#define SPECT_MNGMT_STRICT_11D		3		/* switch to 802.11D mode */
1729/* SPECT_MNGMT_LOOSE_11H_D - same as SPECT_MNGMT_LOOSE with the exception that Country IE
1730 * adoption is done regardless of capability spectrum_management
1731 */
1732#define SPECT_MNGMT_LOOSE_11H_D		4		/* operation defined above */
1733
1734#define WL_CHAN_VALID_HW	(1 << 0)	/* valid with current HW */
1735#define WL_CHAN_VALID_SW	(1 << 1)	/* valid with current country setting */
1736#define WL_CHAN_BAND_5G		(1 << 2)	/* 5GHz-band channel */
1737#define WL_CHAN_RADAR		(1 << 3)	/* radar sensitive  channel */
1738#define WL_CHAN_INACTIVE	(1 << 4)	/* temporarily inactive due to radar */
1739#define WL_CHAN_PASSIVE		(1 << 5)	/* channel is in passive mode */
1740#define WL_CHAN_RESTRICTED	(1 << 6)	/* restricted use channel */
1741
1742/* BTC mode used by "btc_mode" iovar */
1743#define	WL_BTC_DISABLE		0	/* disable BT coexistence */
1744#define WL_BTC_ENABLE		(1 << 0)	/* enable BT coexistence */
1745#define WL_BTC_PREMPT		(1 << 1)	/* enable BT coexistence and BT preemption */
1746#define WL_BTC_PARTIAL		(1 << 2)   /* enable partial BT coexistence  */
1747#define WL_BTC_DEFAULT		(1 << 3)	/* set the default mode for the device */
1748#define WL_BTC_HYBRID		(WL_BTC_ENABLE | WL_BTC_PARTIAL)
1749#define WL_INF_BTC_DISABLE      0
1750#define WL_INF_BTC_ENABLE       1
1751#define WL_INF_BTC_AUTO         3
1752
1753/* BTC wire used by "btc_wire" iovar */
1754#define	WL_BTC_DEFWIRE		0	/* use default wire setting */
1755#define WL_BTC_2WIRE		2	/* use 2-wire BTC */
1756#define WL_BTC_3WIRE		3	/* use 3-wire BTC */
1757#define WL_BTC_4WIRE		4	/* use 4-wire BTC */
1758
1759/* BTC flags: BTC configuration that can be set by host */
1760#define WL_BTC_FLAG_BT_DEF               (1 << 0)
1761#define WL_BTC_FLAG_PREMPT               (1 << 1)
1762#define WL_BTC_FLAG_ACTIVE_PROT          (1 << 2)
1763#define WL_BTC_FLAG_SIM_RSP              (1 << 3)
1764#define WL_BTC_FLAG_PS_PROTECT           (1 << 4)
1765#define WL_BTC_FLAG_SIM_TX_LP	         (1 << 5)
1766#define WL_BTC_FLAG_ECI                  (1 << 6)
1767#endif /* !defined(ESTA_POSTMOGRIFY_REMOVAL) */
1768
1769/* Message levels */
1770#define WL_ERROR_VAL		0x00000001
1771#define WL_TRACE_VAL		0x00000002
1772#define WL_PRHDRS_VAL		0x00000004
1773#define WL_PRPKT_VAL		0x00000008
1774#define WL_INFORM_VAL		0x00000010
1775#define WL_TMP_VAL		0x00000020
1776#define WL_OID_VAL		0x00000040
1777#define WL_RATE_VAL		0x00000080
1778#define WL_ASSOC_VAL		0x00000100
1779#define WL_PRUSR_VAL		0x00000200
1780#define WL_PS_VAL		0x00000400
1781#define WL_TXPWR_VAL		0x00000800	/* retired in TOT on 6/10/2009 */
1782#define WL_PORT_VAL		0x00001000
1783#define WL_DUAL_VAL		0x00002000
1784#define WL_WSEC_VAL		0x00004000
1785#define WL_WSEC_DUMP_VAL	0x00008000
1786#define WL_LOG_VAL		0x00010000
1787#define WL_NRSSI_VAL		0x00020000	/* retired in TOT on 6/10/2009 */
1788#define WL_LOFT_VAL		0x00040000	/* retired in TOT on 6/10/2009 */
1789#define WL_REGULATORY_VAL	0x00080000
1790#define WL_PHYCAL_VAL		0x00100000	/* retired in TOT on 6/10/2009 */
1791#define WL_RADAR_VAL		0x00200000	/* retired in TOT on 6/10/2009 */
1792#define WL_MPC_VAL		0x00400000
1793#define WL_APSTA_VAL		0x00800000
1794#define WL_DFS_VAL		0x01000000
1795#define WL_BA_VAL		0x02000000
1796#define WL_ACI_VAL		0x04000000
1797#define WL_MBSS_VAL		0x04000000
1798#define WL_CAC_VAL		0x08000000
1799#define WL_AMSDU_VAL		0x10000000
1800#define WL_AMPDU_VAL		0x20000000
1801#define WL_FFPLD_VAL		0x40000000
1802
1803/* wl_msg_level is full. For new bits take the next one and AND with
1804 * wl_msg_level2 in wl_dbg.h
1805 */
1806#define WL_DPT_VAL 		0x00000001
1807#define WL_SCAN_VAL		0x00000002
1808#define WL_WOWL_VAL		0x00000004
1809#define WL_COEX_VAL		0x00000008
1810#define WL_RTDC_VAL		0x00000010
1811#define WL_PROTO_VAL		0x00000020
1812#define WL_BTA_VAL		0x00000040
1813#define WL_CHANINT_VAL		0x00000080
1814#define WL_THERMAL_VAL		0x00000100	/* retired in TOT on 6/10/2009 */
1815#define WL_P2P_VAL		0x00000200
1816
1817/* max # of leds supported by GPIO (gpio pin# == led index#) */
1818#define	WL_LED_NUMGPIO		16	/* gpio 0-15 */
1819
1820/* led per-pin behaviors */
1821#define	WL_LED_OFF		0		/* always off */
1822#define	WL_LED_ON		1		/* always on */
1823#define	WL_LED_ACTIVITY		2		/* activity */
1824#define	WL_LED_RADIO		3		/* radio enabled */
1825#define	WL_LED_ARADIO		4		/* 5  Ghz radio enabled */
1826#define	WL_LED_BRADIO		5		/* 2.4Ghz radio enabled */
1827#define	WL_LED_BGMODE		6		/* on if gmode, off if bmode */
1828#define	WL_LED_WI1		7
1829#define	WL_LED_WI2		8
1830#define	WL_LED_WI3		9
1831#define	WL_LED_ASSOC		10		/* associated state indicator */
1832#define	WL_LED_INACTIVE		11		/* null behavior (clears default behavior) */
1833#define	WL_LED_ASSOCACT		12		/* on when associated; blink fast for activity */
1834#define WL_LED_WI4		13
1835#define WL_LED_WI5		14
1836#define	WL_LED_BLINKSLOW	15		/* blink slow */
1837#define	WL_LED_BLINKMED		16		/* blink med */
1838#define	WL_LED_BLINKFAST	17		/* blink fast */
1839#define	WL_LED_BLINKCUSTOM	18		/* blink custom */
1840#define	WL_LED_BLINKPERIODIC	19		/* blink periodic (custom 1000ms / off 400ms) */
1841#define WL_LED_ASSOC_WITH_SEC 	20		/* when connected with security */
1842						/* keep on for 300 sec */
1843#define WL_LED_START_OFF 	21		/* off upon boot, could be turned on later */
1844#define	WL_LED_NUMBEHAVIOR	22
1845
1846/* led behavior numeric value format */
1847#define	WL_LED_BEH_MASK		0x7f		/* behavior mask */
1848#define	WL_LED_AL_MASK		0x80		/* activelow (polarity) bit */
1849
1850/* maximum channels returned by the get valid channels iovar */
1851#define WL_NUMCHANNELS		64
1852#define WL_NUMCHANSPECS		100
1853
1854/* WDS link local endpoint WPA role */
1855#define WL_WDS_WPA_ROLE_AUTH	0	/* authenticator */
1856#define WL_WDS_WPA_ROLE_SUP	1	/* supplicant */
1857#define WL_WDS_WPA_ROLE_AUTO	255	/* auto, based on mac addr value */
1858
1859/* number of bytes needed to define a 128-bit mask for MAC event reporting */
1860#define WL_EVENTING_MASK_LEN	16
1861
1862/* Structures and constants used for "vndr_ie" IOVar interface */
1863#define VNDR_IE_CMD_LEN		4	/* length of the set command string:
1864					 * "add", "del" (+ NUL)
1865					 */
1866
1867/* 802.11 Mgmt Packet flags */
1868#define VNDR_IE_BEACON_FLAG	0x1
1869#define VNDR_IE_PRBRSP_FLAG	0x2
1870#define VNDR_IE_ASSOCRSP_FLAG	0x4
1871#define VNDR_IE_AUTHRSP_FLAG	0x8
1872#define VNDR_IE_PRBREQ_FLAG	0x10
1873#define VNDR_IE_ASSOCREQ_FLAG	0x20
1874#define VNDR_IE_CUSTOM_FLAG		0x100 /* allow custom IE id */
1875
1876#define VNDR_IE_INFO_HDR_LEN	(sizeof(uint32))
1877
1878typedef struct {
1879	uint32 pktflag;			/* bitmask indicating which packet(s) contain this IE */
1880	vndr_ie_t vndr_ie_data;		/* vendor IE data */
1881} vndr_ie_info_t;
1882
1883typedef struct {
1884	int iecount;			/* number of entries in the vndr_ie_list[] array */
1885	vndr_ie_info_t vndr_ie_list[1];	/* variable size list of vndr_ie_info_t structs */
1886} vndr_ie_buf_t;
1887
1888typedef struct {
1889	char cmd[VNDR_IE_CMD_LEN];	/* vndr_ie IOVar set command : "add", "del" + NUL */
1890	vndr_ie_buf_t vndr_ie_buffer;	/* buffer containing Vendor IE list information */
1891} vndr_ie_setbuf_t;
1892
1893/*
1894 * Join preference iovar value is an array of tuples. Each tuple has a one-byte type,
1895 * a one-byte length, and a variable length value.  RSSI type tuple must be present
1896 * in the array.
1897 *
1898 * Types are defined in "join preference types" section.
1899 *
1900 * Length is the value size in octets. It is reserved for WL_JOIN_PREF_WPA type tuple
1901 * and must be set to zero.
1902 *
1903 * Values are defined below.
1904 *
1905 * 1. RSSI - 2 octets
1906 * offset 0: reserved
1907 * offset 1: reserved
1908 *
1909 * 2. WPA - 2 + 12 * n octets (n is # tuples defined below)
1910 * offset 0: reserved
1911 * offset 1: # of tuples
1912 * offset 2: tuple 1
1913 * offset 14: tuple 2
1914 * ...
1915 * offset 2 + 12 * (n - 1) octets: tuple n
1916 *
1917 * struct wpa_cfg_tuple {
1918 *   uint8 akm[DOT11_OUI_LEN+1];     akm suite
1919 *   uint8 ucipher[DOT11_OUI_LEN+1]; unicast cipher suite
1920 *   uint8 mcipher[DOT11_OUI_LEN+1]; multicast cipher suite
1921 * };
1922 *
1923 * multicast cipher suite can be specified as a specific cipher suite or WL_WPA_ACP_MCS_ANY.
1924 *
1925 * 3. BAND - 2 octets
1926 * offset 0: reserved
1927 * offset 1: see "band preference" and "band types"
1928 *
1929 * 4. BAND RSSI - 2 octets
1930 * offset 0: band types
1931 * offset 1: +ve RSSI boost balue in dB
1932 */
1933
1934/* join preference types */
1935#define WL_JOIN_PREF_RSSI	1	/* by RSSI */
1936#define WL_JOIN_PREF_WPA	2	/* by akm and ciphers */
1937#define WL_JOIN_PREF_BAND	3	/* by 802.11 band */
1938#define WL_JOIN_PREF_RSSI_DELTA	4	/* by 802.11 band only if RSSI delta condition matches */
1939
1940/* band preference */
1941#define WLJP_BAND_ASSOC_PREF	255	/* use what WLC_SET_ASSOC_PREFER ioctl specifies */
1942
1943/* any multicast cipher suite */
1944#define WL_WPA_ACP_MCS_ANY	"\x00\x00\x00\x00"
1945
1946struct tsinfo_arg {
1947	uint8 octets[3];
1948};
1949
1950#define	NFIFO			6	/* # tx/rx fifopairs */
1951
1952#define	WL_CNT_T_VERSION	6	/* current version of wl_cnt_t struct */
1953
1954typedef struct {
1955	uint16	version;	/* see definition of WL_CNT_T_VERSION */
1956	uint16	length;		/* length of entire structure */
1957
1958	/* transmit stat counters */
1959	uint32	txframe;	/* tx data frames */
1960	uint32	txbyte;		/* tx data bytes */
1961	uint32	txretrans;	/* tx mac retransmits */
1962	uint32	txerror;	/* tx data errors (derived: sum of others) */
1963	uint32	txctl;		/* tx management frames */
1964	uint32	txprshort;	/* tx short preamble frames */
1965	uint32	txserr;		/* tx status errors */
1966	uint32	txnobuf;	/* tx out of buffers errors */
1967	uint32	txnoassoc;	/* tx discard because we're not associated */
1968	uint32	txrunt;		/* tx runt frames */
1969	uint32	txchit;		/* tx header cache hit (fastpath) */
1970	uint32	txcmiss;	/* tx header cache miss (slowpath) */
1971
1972	/* transmit chip error counters */
1973	uint32	txuflo;		/* tx fifo underflows */
1974	uint32	txphyerr;	/* tx phy errors (indicated in tx status) */
1975	uint32	txphycrs;
1976
1977	/* receive stat counters */
1978	uint32	rxframe;	/* rx data frames */
1979	uint32	rxbyte;		/* rx data bytes */
1980	uint32	rxerror;	/* rx data errors (derived: sum of others) */
1981	uint32	rxctl;		/* rx management frames */
1982	uint32	rxnobuf;	/* rx out of buffers errors */
1983	uint32	rxnondata;	/* rx non data frames in the data channel errors */
1984	uint32	rxbadds;	/* rx bad DS errors */
1985	uint32	rxbadcm;	/* rx bad control or management frames */
1986	uint32	rxfragerr;	/* rx fragmentation errors */
1987	uint32	rxrunt;		/* rx runt frames */
1988	uint32	rxgiant;	/* rx giant frames */
1989	uint32	rxnoscb;	/* rx no scb error */
1990	uint32	rxbadproto;	/* rx invalid frames */
1991	uint32	rxbadsrcmac;	/* rx frames with Invalid Src Mac */
1992	uint32	rxbadda;	/* rx frames tossed for invalid da */
1993	uint32	rxfilter;	/* rx frames filtered out */
1994
1995	/* receive chip error counters */
1996	uint32	rxoflo;		/* rx fifo overflow errors */
1997	uint32	rxuflo[NFIFO];	/* rx dma descriptor underflow errors */
1998
1999	uint32	d11cnt_txrts_off;	/* d11cnt txrts value when reset d11cnt */
2000	uint32	d11cnt_rxcrc_off;	/* d11cnt rxcrc value when reset d11cnt */
2001	uint32	d11cnt_txnocts_off;	/* d11cnt txnocts value when reset d11cnt */
2002
2003	/* misc counters */
2004	uint32	dmade;		/* tx/rx dma descriptor errors */
2005	uint32	dmada;		/* tx/rx dma data errors */
2006	uint32	dmape;		/* tx/rx dma descriptor protocol errors */
2007	uint32	reset;		/* reset count */
2008	uint32	tbtt;		/* cnts the TBTT int's */
2009	uint32	txdmawar;
2010	uint32	pkt_callback_reg_fail;	/* callbacks register failure */
2011
2012	/* MAC counters: 32-bit version of d11.h's macstat_t */
2013	uint32	txallfrm;	/* total number of frames sent, incl. Data, ACK, RTS, CTS,
2014				 * Control Management (includes retransmissions)
2015				 */
2016	uint32	txrtsfrm;	/* number of RTS sent out by the MAC */
2017	uint32	txctsfrm;	/* number of CTS sent out by the MAC */
2018	uint32	txackfrm;	/* number of ACK frames sent out */
2019	uint32	txdnlfrm;	/* Not used */
2020	uint32	txbcnfrm;	/* beacons transmitted */
2021	uint32	txfunfl[8];	/* per-fifo tx underflows */
2022	uint32	txtplunfl;	/* Template underflows (mac was too slow to transmit ACK/CTS
2023				 * or BCN)
2024				 */
2025	uint32	txphyerror;	/* Transmit phy error, type of error is reported in tx-status for
2026				 * driver enqueued frames
2027				 */
2028	uint32	rxfrmtoolong;	/* Received frame longer than legal limit (2346 bytes) */
2029	uint32	rxfrmtooshrt;	/* Received frame did not contain enough bytes for its frame type */
2030	uint32	rxinvmachdr;	/* Either the protocol version != 0 or frame type not
2031				 * data/control/management
2032				 */
2033	uint32	rxbadfcs;	/* number of frames for which the CRC check failed in the MAC */
2034	uint32	rxbadplcp;	/* parity check of the PLCP header failed */
2035	uint32	rxcrsglitch;	/* PHY was able to correlate the preamble but not the header */
2036	uint32	rxstrt;		/* Number of received frames with a good PLCP
2037				 * (i.e. passing parity check)
2038				 */
2039	uint32	rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
2040	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
2041	uint32	rxcfrmucast;	/* number of received CNTRL frames with good FCS and matching RA */
2042	uint32	rxrtsucast;	/* number of unicast RTS addressed to the MAC (good FCS) */
2043	uint32	rxctsucast;	/* number of unicast CTS addressed to the MAC (good FCS) */
2044	uint32	rxackucast;	/* number of ucast ACKS received (good FCS) */
2045	uint32	rxdfrmocast;	/* number of received DATA frames (good FCS and not matching RA) */
2046	uint32	rxmfrmocast;	/* number of received MGMT frames (good FCS and not matching RA) */
2047	uint32	rxcfrmocast;	/* number of received CNTRL frame (good FCS and not matching RA) */
2048	uint32	rxrtsocast;	/* number of received RTS not addressed to the MAC */
2049	uint32	rxctsocast;	/* number of received CTS not addressed to the MAC */
2050	uint32	rxdfrmmcast;	/* number of RX Data multicast frames received by the MAC */
2051	uint32	rxmfrmmcast;	/* number of RX Management multicast frames received by the MAC */
2052	uint32	rxcfrmmcast;	/* number of RX Control multicast frames received by the MAC
2053				 * (unlikely to see these)
2054				 */
2055	uint32	rxbeaconmbss;	/* beacons received from member of BSS */
2056	uint32	rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
2057				  * other BSS (WDS FRAME)
2058				  */
2059	uint32	rxbeaconobss;	/* beacons received from other BSS */
2060	uint32	rxrsptmout;	/* Number of response timeouts for transmitted frames
2061				 * expecting a response
2062				 */
2063	uint32	bcntxcancl;	/* transmit beacons canceled due to receipt of beacon (IBSS) */
2064	uint32	rxf0ovfl;	/* Number of receive fifo 0 overflows */
2065	uint32	rxf1ovfl;	/* Number of receive fifo 1 overflows (obsolete) */
2066	uint32	rxf2ovfl;	/* Number of receive fifo 2 overflows (obsolete) */
2067	uint32	txsfovfl;	/* Number of transmit status fifo overflows (obsolete) */
2068	uint32	pmqovfl;	/* Number of PMQ overflows */
2069	uint32	rxcgprqfrm;	/* Number of received Probe requests that made it into
2070				 * the PRQ fifo
2071				 */
2072	uint32	rxcgprsqovfl;	/* Rx Probe Request Que overflow in the AP */
2073	uint32	txcgprsfail;	/* Tx Probe Response Fail. AP sent probe response but did
2074				 * not get ACK
2075				 */
2076	uint32	txcgprssuc;	/* Tx Probe Response Success (ACK was received) */
2077	uint32	prs_timeout;	/* Number of probe requests that were dropped from the PRQ
2078				 * fifo because a probe response could not be sent out within
2079				 * the time limit defined in M_PRS_MAXTIME
2080				 */
2081	uint32	rxnack;		/* obsolete */
2082	uint32	frmscons;	/* obsolete */
2083	uint32	txnack;		/* obsolete */
2084	uint32	txglitch_nack;	/* obsolete */
2085	uint32	txburst;	/* obsolete */
2086
2087	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2088	uint32	txfrag;		/* dot11TransmittedFragmentCount */
2089	uint32	txmulti;	/* dot11MulticastTransmittedFrameCount */
2090	uint32	txfail;		/* dot11FailedCount */
2091	uint32	txretry;	/* dot11RetryCount */
2092	uint32	txretrie;	/* dot11MultipleRetryCount */
2093	uint32	rxdup;		/* dot11FrameduplicateCount */
2094	uint32	txrts;		/* dot11RTSSuccessCount */
2095	uint32	txnocts;	/* dot11RTSFailureCount */
2096	uint32	txnoack;	/* dot11ACKFailureCount */
2097	uint32	rxfrag;		/* dot11ReceivedFragmentCount */
2098	uint32	rxmulti;	/* dot11MulticastReceivedFrameCount */
2099	uint32	rxcrc;		/* dot11FCSErrorCount */
2100	uint32	txfrmsnt;	/* dot11TransmittedFrameCount (bogus MIB?) */
2101	uint32	rxundec;	/* dot11WEPUndecryptableCount */
2102
2103	/* WPA2 counters (see rxundec for DecryptFailureCount) */
2104	uint32	tkipmicfaill;	/* TKIPLocalMICFailures */
2105	uint32	tkipcntrmsr;	/* TKIPCounterMeasuresInvoked */
2106	uint32	tkipreplay;	/* TKIPReplays */
2107	uint32	ccmpfmterr;	/* CCMPFormatErrors */
2108	uint32	ccmpreplay;	/* CCMPReplays */
2109	uint32	ccmpundec;	/* CCMPDecryptErrors */
2110	uint32	fourwayfail;	/* FourWayHandshakeFailures */
2111	uint32	wepundec;	/* dot11WEPUndecryptableCount */
2112	uint32	wepicverr;	/* dot11WEPICVErrorCount */
2113	uint32	decsuccess;	/* DecryptSuccessCount */
2114	uint32	tkipicverr;	/* TKIPICVErrorCount */
2115	uint32	wepexcluded;	/* dot11WEPExcludedCount */
2116
2117	uint32	txchanrej;	/* Tx frames suppressed due to channel rejection */
2118	uint32	txexptime;	/* Tx frames suppressed due to timer expiration */
2119	uint32	psmwds;		/* Count PSM watchdogs */
2120	uint32	phywatchdog;	/* Count Phy watchdogs (triggered by ucode) */
2121
2122	/* MBSS counters, AP only */
2123	uint32	prq_entries_handled;	/* PRQ entries read in */
2124	uint32	prq_undirected_entries;	/*    which were bcast bss & ssid */
2125	uint32	prq_bad_entries;	/*    which could not be translated to info */
2126	uint32	atim_suppress_count;	/* TX suppressions on ATIM fifo */
2127	uint32	bcn_template_not_ready;	/* Template marked in use on send bcn ... */
2128	uint32	bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
2129	uint32	late_tbtt_dpc;	/* TBTT DPC did not happen in time */
2130
2131	/* per-rate receive stat counters */
2132	uint32  rx1mbps;	/* packets rx at 1Mbps */
2133	uint32  rx2mbps;	/* packets rx at 2Mbps */
2134	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
2135	uint32  rx6mbps;	/* packets rx at 6Mbps */
2136	uint32  rx9mbps;	/* packets rx at 9Mbps */
2137	uint32  rx11mbps;	/* packets rx at 11Mbps */
2138	uint32  rx12mbps;	/* packets rx at 12Mbps */
2139	uint32  rx18mbps;	/* packets rx at 18Mbps */
2140	uint32  rx24mbps;	/* packets rx at 24Mbps */
2141	uint32  rx36mbps;	/* packets rx at 36Mbps */
2142	uint32  rx48mbps;	/* packets rx at 48Mbps */
2143	uint32  rx54mbps;	/* packets rx at 54Mbps */
2144	uint32  rx108mbps; 	/* packets rx at 108mbps */
2145	uint32  rx162mbps;	/* packets rx at 162mbps */
2146	uint32  rx216mbps;	/* packets rx at 216 mbps */
2147	uint32  rx270mbps;	/* packets rx at 270 mbps */
2148	uint32  rx324mbps;	/* packets rx at 324 mbps */
2149	uint32  rx378mbps;	/* packets rx at 378 mbps */
2150	uint32  rx432mbps;	/* packets rx at 432 mbps */
2151	uint32  rx486mbps;	/* packets rx at 486 mbps */
2152	uint32  rx540mbps;	/* packets rx at 540 mbps */
2153
2154	/* pkteng rx frame stats */
2155	uint32	pktengrxducast; /* unicast frames rxed by the pkteng code */
2156	uint32	pktengrxdmcast; /* multicast frames rxed by the pkteng code */
2157
2158	uint32	rfdisable;	/* count of radio disables */
2159	uint32	bphy_rxcrsglitch;	/* PHY count of bphy glitches */
2160
2161	uint32	txmpdu_sgi;	/* count for sgi transmit */
2162	uint32	rxmpdu_sgi;	/* count for sgi received */
2163	uint32	txmpdu_stbc;	/* count for stbc transmit */
2164	uint32	rxmpdu_stbc;	/* count for stbc received */
2165} wl_cnt_t;
2166
2167#ifndef LINUX_POSTMOGRIFY_REMOVAL
2168#define	WL_DELTA_STATS_T_VERSION	1	/* current version of wl_delta_stats_t struct */
2169
2170typedef struct {
2171	uint16 version;     /* see definition of WL_DELTA_STATS_T_VERSION */
2172	uint16 length;      /* length of entire structure */
2173
2174	/* transmit stat counters */
2175	uint32 txframe;     /* tx data frames */
2176	uint32 txbyte;      /* tx data bytes */
2177	uint32 txretrans;   /* tx mac retransmits */
2178	uint32 txfail;      /* tx failures */
2179
2180	/* receive stat counters */
2181	uint32 rxframe;     /* rx data frames */
2182	uint32 rxbyte;      /* rx data bytes */
2183
2184	/* per-rate receive stat counters */
2185	uint32  rx1mbps;	/* packets rx at 1Mbps */
2186	uint32  rx2mbps;	/* packets rx at 2Mbps */
2187	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
2188	uint32  rx6mbps;	/* packets rx at 6Mbps */
2189	uint32  rx9mbps;	/* packets rx at 9Mbps */
2190	uint32  rx11mbps;	/* packets rx at 11Mbps */
2191	uint32  rx12mbps;	/* packets rx at 12Mbps */
2192	uint32  rx18mbps;	/* packets rx at 18Mbps */
2193	uint32  rx24mbps;	/* packets rx at 24Mbps */
2194	uint32  rx36mbps;	/* packets rx at 36Mbps */
2195	uint32  rx48mbps;	/* packets rx at 48Mbps */
2196	uint32  rx54mbps;	/* packets rx at 54Mbps */
2197	uint32  rx108mbps; 	/* packets rx at 108mbps */
2198	uint32  rx162mbps;	/* packets rx at 162mbps */
2199	uint32  rx216mbps;	/* packets rx at 216 mbps */
2200	uint32  rx270mbps;	/* packets rx at 270 mbps */
2201	uint32  rx324mbps;	/* packets rx at 324 mbps */
2202	uint32  rx378mbps;	/* packets rx at 378 mbps */
2203	uint32  rx432mbps;	/* packets rx at 432 mbps */
2204	uint32  rx486mbps;	/* packets rx at 486 mbps */
2205	uint32  rx540mbps;	/* packets rx at 540 mbps */
2206} wl_delta_stats_t;
2207#endif /* LINUX_POSTMOGRIFY_REMOVAL */
2208
2209#define WL_WME_CNT_VERSION	1	/* current version of wl_wme_cnt_t */
2210
2211typedef struct {
2212	uint32 packets;
2213	uint32 bytes;
2214} wl_traffic_stats_t;
2215
2216typedef struct {
2217	uint16	version;	/* see definition of WL_WME_CNT_VERSION */
2218	uint16	length;		/* length of entire structure */
2219
2220	wl_traffic_stats_t tx[AC_COUNT];	/* Packets transmitted */
2221	wl_traffic_stats_t tx_failed[AC_COUNT];	/* Packets dropped or failed to transmit */
2222	wl_traffic_stats_t rx[AC_COUNT];	/* Packets received */
2223	wl_traffic_stats_t rx_failed[AC_COUNT];	/* Packets failed to receive */
2224
2225	wl_traffic_stats_t forward[AC_COUNT];	/* Packets forwarded by AP */
2226
2227	wl_traffic_stats_t tx_expired[AC_COUNT];	/* packets dropped due to lifetime expiry */
2228
2229} wl_wme_cnt_t;
2230
2231struct wl_msglevel2 {
2232	uint32 low;
2233	uint32 high;
2234};
2235
2236#ifndef LINUX_POSTMOGRIFY_REMOVAL
2237#ifdef WLBA
2238
2239#define	WLC_BA_CNT_VERSION	1	/* current version of wlc_ba_cnt_t */
2240
2241/* block ack related stats */
2242typedef struct wlc_ba_cnt {
2243	uint16	version;	/* WLC_BA_CNT_VERSION */
2244	uint16	length;		/* length of entire structure */
2245
2246	/* transmit stat counters */
2247	uint32 txpdu;		/* pdus sent */
2248	uint32 txsdu;		/* sdus sent */
2249	uint32 txfc;		/* tx side flow controlled packets */
2250	uint32 txfci;		/* tx side flow control initiated */
2251	uint32 txretrans;	/* retransmitted pdus */
2252	uint32 txbatimer;	/* ba resend due to timer */
2253	uint32 txdrop;		/* dropped packets */
2254	uint32 txaddbareq;	/* addba req sent */
2255	uint32 txaddbaresp;	/* addba resp sent */
2256	uint32 txdelba;		/* delba sent */
2257	uint32 txba;		/* ba sent */
2258	uint32 txbar;		/* bar sent */
2259	uint32 txpad[4];	/* future */
2260
2261	/* receive side counters */
2262	uint32 rxpdu;		/* pdus recd */
2263	uint32 rxqed;		/* pdus buffered before sending up */
2264	uint32 rxdup;		/* duplicate pdus */
2265	uint32 rxnobuf;		/* pdus discarded due to no buf */
2266	uint32 rxaddbareq;	/* addba req recd */
2267	uint32 rxaddbaresp;	/* addba resp recd */
2268	uint32 rxdelba;		/* delba recd */
2269	uint32 rxba;		/* ba recd */
2270	uint32 rxbar;		/* bar recd */
2271	uint32 rxinvba;		/* invalid ba recd */
2272	uint32 rxbaholes;	/* ba recd with holes */
2273	uint32 rxunexp;		/* unexpected packets */
2274	uint32 rxpad[4];	/* future */
2275} wlc_ba_cnt_t;
2276#endif /* WLBA */
2277
2278/* structure for per-tid ampdu control */
2279struct ampdu_tid_control {
2280	uint8 tid;			/* tid */
2281	uint8 enable;			/* enable/disable */
2282};
2283
2284/* structure for identifying ea/tid for sending addba/delba */
2285struct ampdu_ea_tid {
2286	struct ether_addr ea;		/* Station address */
2287	uint8 tid;			/* tid */
2288};
2289/* structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
2290struct ampdu_retry_tid {
2291	uint8 tid;	/* tid */
2292	uint8 retry;	/* retry value */
2293};
2294
2295/* Different discovery modes for dpt */
2296#define	DPT_DISCOVERY_MANUAL	0x01	/* manual discovery mode */
2297#define	DPT_DISCOVERY_AUTO	0x02	/* auto discovery mode */
2298#define	DPT_DISCOVERY_SCAN	0x04	/* scan-based discovery mode */
2299
2300/* different path selection values */
2301#define DPT_PATHSEL_AUTO	0	/* auto mode for path selection */
2302#define DPT_PATHSEL_DIRECT	1	/* always use direct DPT path */
2303#define DPT_PATHSEL_APPATH	2	/* always use AP path */
2304
2305/* different ops for deny list */
2306#define DPT_DENY_LIST_ADD 	1	/* add to dpt deny list */
2307#define DPT_DENY_LIST_REMOVE 	2	/* remove from dpt deny list */
2308
2309/* different ops for manual end point */
2310#define DPT_MANUAL_EP_CREATE	1	/* create manual dpt endpoint */
2311#define DPT_MANUAL_EP_MODIFY	2	/* modify manual dpt endpoint */
2312#define DPT_MANUAL_EP_DELETE	3	/* delete manual dpt endpoint */
2313
2314/* structure for dpt iovars */
2315typedef struct dpt_iovar {
2316	struct ether_addr ea;		/* Station address */
2317	uint8 mode;			/* mode: depends on iovar */
2318	uint32 pad;			/* future */
2319} dpt_iovar_t;
2320
2321/* flags to indicate DPT status */
2322#define	DPT_STATUS_ACTIVE	0x01	/* link active (though may be suspended) */
2323#define	DPT_STATUS_AES		0x02	/* link secured through AES encryption */
2324#define	DPT_STATUS_FAILED	0x04	/* DPT link failed */
2325
2326#define	DPT_FNAME_LEN		48	/* Max length of friendly name */
2327
2328typedef struct dpt_status {
2329	uint8 status;			/* flags to indicate status */
2330	uint8 fnlen;			/* length of friendly name */
2331	uchar name[DPT_FNAME_LEN];	/* friendly name */
2332	uint32 rssi;			/* RSSI of the link */
2333	sta_info_t sta;			/* sta info */
2334} dpt_status_t;
2335
2336/* structure for dpt list */
2337typedef struct dpt_list {
2338	uint32 num;			/* number of entries in struct */
2339	dpt_status_t status[1];		/* per station info */
2340} dpt_list_t;
2341
2342/* structure for dpt friendly name */
2343typedef struct dpt_fname {
2344	uint8 len;			/* length of friendly name */
2345	uchar name[DPT_FNAME_LEN];	/* friendly name */
2346} dpt_fname_t;
2347
2348#define	BDD_FNAME_LEN		32	/* Max length of friendly name */
2349typedef struct bdd_fname {
2350	uint8 len;			/* length of friendly name */
2351	uchar name[BDD_FNAME_LEN];	/* friendly name */
2352} bdd_fname_t;
2353
2354/* structure for addts arguments */
2355/* For ioctls that take a list of TSPEC */
2356struct tslist {
2357	int count;			/* number of tspecs */
2358	struct tsinfo_arg tsinfo[1];	/* variable length array of tsinfo */
2359};
2360
2361/* structure for addts/delts arguments */
2362typedef struct tspec_arg {
2363	uint16 version;			/* see definition of TSPEC_ARG_VERSION */
2364	uint16 length;			/* length of entire structure */
2365	uint flag;			/* bit field */
2366	/* TSPEC Arguments */
2367	struct tsinfo_arg tsinfo;	/* TS Info bit field */
2368	uint16 nom_msdu_size;		/* (Nominal or fixed) MSDU Size (bytes) */
2369	uint16 max_msdu_size;		/* Maximum MSDU Size (bytes) */
2370	uint min_srv_interval;		/* Minimum Service Interval (us) */
2371	uint max_srv_interval;		/* Maximum Service Interval (us) */
2372	uint inactivity_interval;	/* Inactivity Interval (us) */
2373	uint suspension_interval;	/* Suspension Interval (us) */
2374	uint srv_start_time;		/* Service Start Time (us) */
2375	uint min_data_rate;		/* Minimum Data Rate (bps) */
2376	uint mean_data_rate;		/* Mean Data Rate (bps) */
2377	uint peak_data_rate;		/* Peak Data Rate (bps) */
2378	uint max_burst_size;		/* Maximum Burst Size (bytes) */
2379	uint delay_bound;		/* Delay Bound (us) */
2380	uint min_phy_rate;		/* Minimum PHY Rate (bps) */
2381	uint16 surplus_bw;		/* Surplus Bandwidth Allowance (range 1.0 to 8.0) */
2382	uint16 medium_time;		/* Medium Time (32 us/s periods) */
2383	uint8 dialog_token;		/* dialog token */
2384} tspec_arg_t;
2385
2386/* tspec arg for desired station */
2387typedef	struct tspec_per_sta_arg {
2388	struct ether_addr ea;
2389	struct tspec_arg ts;
2390} tspec_per_sta_arg_t;
2391
2392/* structure for max bandwidth for each access category */
2393typedef	struct wme_max_bandwidth {
2394	uint32	ac[AC_COUNT];	/* max bandwidth for each access category */
2395} wme_max_bandwidth_t;
2396
2397#define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
2398
2399/* current version of wl_tspec_arg_t struct */
2400#define	TSPEC_ARG_VERSION		2	/* current version of wl_tspec_arg_t struct */
2401#define TSPEC_ARG_LENGTH		55	/* argument length from tsinfo to medium_time */
2402#define TSPEC_DEFAULT_DIALOG_TOKEN	42	/* default dialog token */
2403#define TSPEC_DEFAULT_SBW_FACTOR	0x3000	/* default surplus bw */
2404
2405
2406/* define for flag */
2407#define TSPEC_PENDING		0	/* TSPEC pending */
2408#define TSPEC_ACCEPTED		1	/* TSPEC accepted */
2409#define TSPEC_REJECTED		2	/* TSPEC rejected */
2410#define TSPEC_UNKNOWN		3	/* TSPEC unknown */
2411#define TSPEC_STATUS_MASK	7	/* TSPEC status mask */
2412
2413
2414/* Software feature flag defines used by wlfeatureflag */
2415#define WL_SWFL_NOHWRADIO	0x0004
2416#define WL_SWFL_FLOWCONTROL     0x0008 /* Enable backpressure to OS stack */
2417#define WL_SWFL_WLBSSSORT	0x0010 /* Per-port supports sorting of BSS */
2418
2419#define WL_LIFETIME_MAX 0xFFFF /* Max value in ms */
2420
2421/* Packet lifetime configuration per ac */
2422typedef struct wl_lifetime {
2423	uint32 ac;	        /* access class */
2424	uint32 lifetime;    /* Packet lifetime value in ms */
2425} wl_lifetime_t;
2426
2427/* Channel Switch Announcement param */
2428typedef struct wl_chan_switch {
2429	uint8 mode;		/* value 0 or 1 */
2430	uint8 count;		/* count # of beacons before switching */
2431	chanspec_t chspec;	/* chanspec */
2432	uint8 reg;		/* regulatory class */
2433} wl_chan_switch_t;
2434#endif /* LINUX_POSTMOGRIFY_REMOVAL */
2435
2436/* Roaming trigger definitions for WLC_SET_ROAM_TRIGGER.
2437 *
2438 * (-100 < value < 0)   value is used directly as a roaming trigger in dBm
2439 * (0 <= value) value specifies a logical roaming trigger level from
2440 *                      the list below
2441 *
2442 * WLC_GET_ROAM_TRIGGER always returns roaming trigger value in dBm, never
2443 * the logical roam trigger value.
2444 */
2445#define WLC_ROAM_TRIGGER_DEFAULT	0 /* default roaming trigger */
2446#define WLC_ROAM_TRIGGER_BANDWIDTH	1 /* optimize for bandwidth roaming trigger */
2447#define WLC_ROAM_TRIGGER_DISTANCE	2 /* optimize for distance roaming trigger */
2448#define WLC_ROAM_TRIGGER_AUTO		3 /* auto-detect environment */
2449#define WLC_ROAM_TRIGGER_MAX_VALUE	3 /* max. valid value */
2450
2451/* Preferred Network Offload (PNO, formerly PFN) defines */
2452enum {
2453	PFN_LIST_ORDER,
2454	PFN_RSSI
2455};
2456
2457enum {
2458	DISABLE,
2459	ENABLE
2460};
2461
2462#define SORT_CRITERIA_BIT		0
2463#define AUTO_NET_SWITCH_BIT		1
2464#define ENABLE_BKGRD_SCAN_BIT		2
2465#define IMMEDIATE_SCAN_BIT		3
2466#define	AUTO_CONNECT_BIT		4
2467
2468#define SORT_CRITERIA_MASK		0x01
2469#define AUTO_NET_SWITCH_MASK		0x02
2470#define ENABLE_BKGRD_SCAN_MASK		0x04
2471#define IMMEDIATE_SCAN_MASK		0x08
2472#define	AUTO_CONNECT_MASK		0x10
2473
2474#define PFN_VERSION			1
2475
2476/* PFN data structure */
2477typedef struct wl_pfn_param {
2478	int32 version;			/* PNO parameters version */
2479	int32 scan_freq;		/* Scan frequency */
2480	int32 lost_network_timeout;	/* Timeout in sec. to declare
2481					 * discovered network as lost
2482					 */
2483	int16 flags;			/* Bit field to control features
2484					 * of PFN such as sort criteria auto
2485					 * enable switch and background scan
2486					 */
2487	int16 rssi_margin;		/* Margin to avoid jitter for choosing a
2488					 * PFN based on RSSI sort criteria
2489					 */
2490} wl_pfn_param_t;
2491
2492typedef struct wl_pfn {
2493	wlc_ssid_t		ssid;			/* ssid name and its length */
2494	int32			bss_type;		/* IBSS or infrastructure */
2495	int32			infra;			/* BSS Vs IBSS */
2496	int32			auth;			/* Open Vs Closed */
2497	int32			wpa_auth;		/* WPA type */
2498	int32			wsec;			/* wsec value */
2499	union {
2500		wl_wsec_key_t	sec_key;		/* Security Settings for WEP */
2501		wsec_pmk_t	wpa_sec_key;		/* Security setting for WPA */
2502	} pfn_security;
2503} wl_pfn_t;
2504
2505/* TCP Checksum Offload defines */
2506#define TOE_TX_CSUM_OL		0x00000001
2507#define TOE_RX_CSUM_OL		0x00000002
2508
2509/* TCP Checksum Offload error injection for testing */
2510#define TOE_ERRTEST_TX_CSUM	0x00000001
2511#define TOE_ERRTEST_RX_CSUM	0x00000002
2512#define TOE_ERRTEST_RX_CSUM2	0x00000004
2513
2514struct toe_ol_stats_t {
2515	/* Num of tx packets that don't need to be checksummed */
2516	uint32 tx_summed;
2517
2518	/* Num of tx packets where checksum is filled by offload engine */
2519	uint32 tx_iph_fill;
2520	uint32 tx_tcp_fill;
2521	uint32 tx_udp_fill;
2522	uint32 tx_icmp_fill;
2523
2524	/*  Num of rx packets where toe finds out if checksum is good or bad */
2525	uint32 rx_iph_good;
2526	uint32 rx_iph_bad;
2527	uint32 rx_tcp_good;
2528	uint32 rx_tcp_bad;
2529	uint32 rx_udp_good;
2530	uint32 rx_udp_bad;
2531	uint32 rx_icmp_good;
2532	uint32 rx_icmp_bad;
2533
2534	/* Num of tx packets in which csum error is injected */
2535	uint32 tx_tcp_errinj;
2536	uint32 tx_udp_errinj;
2537	uint32 tx_icmp_errinj;
2538
2539	/* Num of rx packets in which csum error is injected */
2540	uint32 rx_tcp_errinj;
2541	uint32 rx_udp_errinj;
2542	uint32 rx_icmp_errinj;
2543};
2544
2545/* ARP Offload feature flags for arp_ol iovar */
2546#define ARP_OL_AGENT		0x00000001
2547#define ARP_OL_SNOOP		0x00000002
2548#define ARP_OL_HOST_AUTO_REPLY	0x00000004
2549#define ARP_OL_PEER_AUTO_REPLY	0x00000008
2550
2551/* ARP Offload error injection */
2552#define ARP_ERRTEST_REPLY_PEER	0x1
2553#define ARP_ERRTEST_REPLY_HOST	0x2
2554
2555#define ARP_MULTIHOMING_MAX	8	/* Maximum local host IP addresses */
2556
2557/* Arp offload statistic counts */
2558struct arp_ol_stats_t {
2559	uint32  host_ip_entries;	/* Host IP table addresses (more than one if multihomed) */
2560	uint32  host_ip_overflow;	/* Host IP table additions skipped due to overflow */
2561
2562	uint32  arp_table_entries;	/* ARP table entries */
2563	uint32  arp_table_overflow;	/* ARP table additions skipped due to overflow */
2564
2565	uint32  host_request;		/* ARP requests from host */
2566	uint32  host_reply;		/* ARP replies from host */
2567	uint32  host_service;		/* ARP requests from host serviced by ARP Agent */
2568
2569	uint32  peer_request;		/* ARP requests received from network */
2570	uint32  peer_request_drop;	/* ARP requests from network that were dropped */
2571	uint32  peer_reply;		/* ARP replies received from network */
2572	uint32  peer_reply_drop;	/* ARP replies from network that were dropped */
2573	uint32  peer_service;		/* ARP request from host serviced by ARP Agent */
2574};
2575
2576/*
2577 * Keep-alive packet offloading.
2578 */
2579
2580/* NAT keep-alive packets format: specifies the re-transmission period, the packet
2581 * length, and packet contents.
2582 */
2583typedef struct wl_keep_alive_pkt {
2584	uint32	period_msec;	/* Retransmission period (0 to disable packet re-transmits) */
2585	uint16	len_bytes;	/* Size of packet to transmit (0 to disable packet re-transmits) */
2586	uint8	data[1];	/* Variable length packet to transmit.  Contents should include
2587				 * entire ethernet packet (enet header, IP header, UDP header,
2588				 * and UDP payload) in network byte order.
2589				 */
2590} wl_keep_alive_pkt_t;
2591
2592#define WL_KEEP_ALIVE_FIXED_LEN		OFFSETOF(wl_keep_alive_pkt_t, data)
2593
2594/*
2595 * Dongle pattern matching filter.
2596 */
2597
2598/* Packet filter types. Currently, only pattern matching is supported. */
2599typedef enum wl_pkt_filter_type {
2600	WL_PKT_FILTER_TYPE_PATTERN_MATCH	/* Pattern matching filter */
2601} wl_pkt_filter_type_t;
2602
2603#define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
2604
2605/* Pattern matching filter. Specifies an offset within received packets to
2606 * start matching, the pattern to match, the size of the pattern, and a bitmask
2607 * that indicates which bits within the pattern should be matched.
2608 */
2609typedef struct wl_pkt_filter_pattern {
2610	uint32	offset;		/* Offset within received packet to start pattern matching.
2611				 * Offset '0' is the first byte of the ethernet header.
2612				 */
2613	uint32	size_bytes;	/* Size of the pattern.  Bitmask must be the same size. */
2614	uint8   mask_and_pattern[1]; /* Variable length mask and pattern data.  mask starts
2615				      * at offset 0.  Pattern immediately follows mask.
2616				      */
2617} wl_pkt_filter_pattern_t;
2618
2619/* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
2620typedef struct wl_pkt_filter {
2621	uint32	id;		/* Unique filter id, specified by app. */
2622	uint32	type;		/* Filter type (WL_PKT_FILTER_TYPE_xxx). */
2623	uint32	negate_match;	/* Negate the result of filter matches */
2624	union {			/* Filter definitions */
2625		wl_pkt_filter_pattern_t pattern;	/* Pattern matching filter */
2626	} u;
2627} wl_pkt_filter_t;
2628
2629#define WL_PKT_FILTER_FIXED_LEN		  OFFSETOF(wl_pkt_filter_t, u)
2630#define WL_PKT_FILTER_PATTERN_FIXED_LEN	  OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
2631
2632/* IOVAR "pkt_filter_enable" parameter. */
2633typedef struct wl_pkt_filter_enable {
2634	uint32	id;		/* Unique filter id */
2635	uint32	enable;		/* Enable/disable bool */
2636} wl_pkt_filter_enable_t;
2637
2638/* IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
2639typedef struct wl_pkt_filter_list {
2640	uint32	num;		/* Number of installed packet filters */
2641	wl_pkt_filter_t	filter[1];	/* Variable array of packet filters. */
2642} wl_pkt_filter_list_t;
2643
2644#define WL_PKT_FILTER_LIST_FIXED_LEN	  OFFSETOF(wl_pkt_filter_list_t, filter)
2645
2646/* IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
2647typedef struct wl_pkt_filter_stats {
2648	uint32	num_pkts_matched;	/* # filter matches for specified filter id */
2649	uint32	num_pkts_forwarded;	/* # packets fwded from dongle to host for all filters */
2650	uint32	num_pkts_discarded;	/* # packets discarded by dongle for all filters */
2651} wl_pkt_filter_stats_t;
2652
2653/* Sequential Commands ioctl */
2654typedef struct wl_seq_cmd_ioctl {
2655	uint32 cmd;		/* common ioctl definition */
2656	uint32 len;		/* length of user buffer */
2657} wl_seq_cmd_ioctl_t;
2658
2659#define WL_SEQ_CMD_ALIGN_BYTES	4
2660
2661/* These are the set of get IOCTLs that should be allowed when using
2662 * IOCTL sequence commands. These are issued implicitly by wl.exe each time
2663 * it is invoked. We never want to buffer these, or else wl.exe will stop working.
2664 */
2665#define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
2666	(((cmd) == WLC_GET_MAGIC)		|| \
2667	 ((cmd) == WLC_GET_VERSION)		|| \
2668	 ((cmd) == WLC_GET_AP)			|| \
2669	 ((cmd) == WLC_GET_INSTANCE))
2670
2671/*
2672 * Packet engine interface
2673 */
2674
2675#define WL_PKTENG_PER_TX_START			0x01
2676#define WL_PKTENG_PER_TX_STOP			0x02
2677#define WL_PKTENG_PER_RX_START			0x04
2678#define WL_PKTENG_PER_RX_WITH_ACK_START 	0x05
2679#define WL_PKTENG_PER_TX_WITH_ACK_START 	0x06
2680#define WL_PKTENG_PER_RX_STOP			0x08
2681#define WL_PKTENG_PER_MASK			0xff
2682
2683#define WL_PKTENG_SYNCHRONOUS			0x100	/* synchronous flag */
2684
2685typedef struct wl_pkteng {
2686	uint32 flags;
2687	uint32 delay;			/* Inter-packet delay */
2688	uint32 nframes;			/* Number of frames */
2689	uint32 length;			/* Packet length */
2690	uint8  seqno;			/* Enable/disable sequence no. */
2691	struct ether_addr dest;		/* Destination address */
2692	struct ether_addr src;		/* Source address */
2693} wl_pkteng_t;
2694
2695#define NUM_80211b_RATES	4
2696#define NUM_80211ag_RATES	8
2697#define NUM_80211n_RATES	32
2698#define NUM_80211_RATES		(NUM_80211b_RATES+NUM_80211ag_RATES+NUM_80211n_RATES)
2699typedef struct wl_pkteng_stats {
2700	uint32 lostfrmcnt;		/* RX PER test: no of frames lost (skip seqno) */
2701	int32 rssi;			/* RSSI */
2702	int32 snr;			/* signal to noise ratio */
2703	uint16 rxpktcnt[NUM_80211_RATES+1];
2704} wl_pkteng_stats_t;
2705
2706typedef struct wl_sslpnphy_papd_debug_data {
2707	uint8 psat_pwr;
2708	uint8 psat_indx;
2709	uint8 final_idx;
2710	uint8 start_idx;
2711	int32 min_phase;
2712} wl_sslpnphy_papd_debug_data_t;
2713
2714#define WL_WOWL_MAGIC	(1 << 0)	/* Wakeup on Magic packet */
2715#define WL_WOWL_NET	(1 << 1)	/* Wakeup on Netpattern */
2716#define WL_WOWL_DIS	(1 << 2)	/* Wakeup on loss-of-link due to Disassoc/Deauth */
2717#define WL_WOWL_RETR	(1 << 3)	/* Wakeup on retrograde TSF */
2718#define WL_WOWL_BCN	(1 << 4)	/* Wakeup on loss of beacon */
2719#define WL_WOWL_TST	(1 << 5)	/* Wakeup after test */
2720#define WL_WOWL_M1      (1 << 6)        /* Wakeup after PTK refresh */
2721#define WL_WOWL_EAPID   (1 << 7)        /* Wakeup after receipt of EAP-Identity Req */
2722#define WL_WOWL_KEYROT  (1 << 14)       /* If the bit is set, use key rotaton */
2723#define WL_WOWL_BCAST	(1 << 15)	/* If the bit is set, frm received was bcast frame */
2724
2725#define MAGIC_PKT_MINLEN 102	/* Magic pkt min length is 6 * 0xFF + 16 * ETHER_ADDR_LEN */
2726
2727typedef struct {
2728	uint masksize;		/* Size of the mask in #of bytes */
2729	uint offset;		/* Offset to start looking for the packet in # of bytes */
2730	uint patternoffset;	/* Offset of start of pattern in the structure */
2731	uint patternsize;	/* Size of the pattern itself in #of bytes */
2732	ulong id;		/* id */
2733	/* Mask follows the structure above */
2734	/* Pattern follows the mask is at 'patternoffset' from the start */
2735} wl_wowl_pattern_t;
2736
2737typedef struct {
2738	uint			count;
2739	wl_wowl_pattern_t	pattern[1];
2740} wl_wowl_pattern_list_t;
2741
2742typedef struct {
2743	uint8	pci_wakeind;	/* Whether PCI PMECSR PMEStatus bit was set */
2744	uint16	ucode_wakeind;	/* What wakeup-event indication was set by ucode */
2745} wl_wowl_wakeind_t;
2746
2747/* per AC rate control related data structure */
2748typedef struct wl_txrate_class {
2749	uint8		init_rate;
2750	uint8		min_rate;
2751	uint8		max_rate;
2752} wl_txrate_class_t;
2753
2754
2755#if defined(DSLCPE_DELAY)
2756#define WL_DELAYMODE_DEFER	0	/* defer by scheduler's choice, make this driver default */
2757#define WL_DELAYMODE_FORCE	1	/* force, this is driver default */
2758#define WL_DELAYMODE_AUTO	2	/* defer if no sta associated, force if sta associated */
2759#endif
2760
2761/* Overlap BSS Scan parameters default, minimum, maximum */
2762#define WLC_OBSS_SCAN_PASSIVE_DWELL_DEFAULT		20	/* unit TU */
2763#define WLC_OBSS_SCAN_PASSIVE_DWELL_MIN			5	/* unit TU */
2764#define WLC_OBSS_SCAN_PASSIVE_DWELL_MAX			1000	/* unit TU */
2765#define WLC_OBSS_SCAN_ACTIVE_DWELL_DEFAULT		10	/* unit TU */
2766#define WLC_OBSS_SCAN_ACTIVE_DWELL_MIN			10	/* unit TU */
2767#define WLC_OBSS_SCAN_ACTIVE_DWELL_MAX			1000	/* unit TU */
2768#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_DEFAULT	300	/* unit Sec */
2769#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MIN		10	/* unit Sec */
2770#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MAX		900	/* unit Sec */
2771#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_DEFAULT	5
2772#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MIN	5
2773#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MAX	100
2774#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_DEFAULT	200	/* unit TU */
2775#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MIN	200	/* unit TU */
2776#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MAX	10000	/* unit TU */
2777#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_DEFAULT	20	/* unit TU */
2778#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MIN	20	/* unit TU */
2779#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MAX	10000	/* unit TU */
2780#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_DEFAULT	25	/* unit percent */
2781#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MIN		0	/* unit percent */
2782#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MAX		100	/* unit percent */
2783
2784/* structure for Overlap BSS scan arguments */
2785typedef struct wl_obss_scan_arg {
2786	int16	passive_dwell;
2787	int16	active_dwell;
2788	int16	bss_widthscan_interval;
2789	int16	passive_total;
2790	int16	active_total;
2791	int16	chanwidth_transition_delay;
2792	int16	activity_threshold;
2793} wl_obss_scan_arg_t;
2794
2795#define WL_OBSS_SCAN_PARAM_LEN	sizeof(wl_obss_scan_arg_t)
2796#define WL_MIN_NUM_OBSS_SCAN_ARG 7	/* minimum number of arguments required for OBSS Scan */
2797
2798#define WL_COEX_INFO_MASK		0x07
2799#define WL_COEX_INFO_REQ		0x01
2800#define	WL_COEX_40MHZ_INTOLERANT	0x02
2801#define	WL_COEX_WIDTH20			0x04
2802
2803#define	WLC_RSSI_INVALID	 0	/* invalid RSSI value */
2804
2805#define MAX_RSSI_LEVELS 8
2806
2807/* RSSI event notification configuration. */
2808typedef struct wl_rssi_event {
2809	uint32 rate_limit_msec;		/* # of events posted to application will be limited to
2810					 * one per specified period (0 to disable rate limit).
2811					 */
2812	uint8 num_rssi_levels;		/* Number of entries in rssi_levels[] below */
2813	int8 rssi_levels[MAX_RSSI_LEVELS];	/* Variable number of RSSI levels. An event
2814						 * will be posted each time the RSSI of received
2815						 * beacons/packets crosses a level.
2816						 */
2817} wl_rssi_event_t;
2818
2819typedef struct wl_action_obss_coex_req {
2820	uint8 info;
2821	uint8 num;
2822	uint8 ch_list[1];
2823} wl_action_obss_coex_req_t;
2824
2825/* **** EXTLOG **** */
2826#define EXTLOG_CUR_VER		0x0100
2827
2828#define MAX_ARGSTR_LEN		18 /* At least big enough for storing ETHER_ADDR_STR_LEN */
2829
2830/* log modules (bitmap) */
2831#define LOG_MODULE_COMMON	0x0001
2832#define LOG_MODULE_ASSOC	0x0002
2833#define LOG_MODULE_EVENT	0x0004
2834#define LOG_MODULE_MAX		3			/* Update when adding module */
2835
2836/* log levels */
2837#define WL_LOG_LEVEL_DISABLE	0
2838#define WL_LOG_LEVEL_ERR	1
2839#define WL_LOG_LEVEL_WARN	2
2840#define WL_LOG_LEVEL_INFO	3
2841#define WL_LOG_LEVEL_MAX	WL_LOG_LEVEL_INFO	/* Update when adding level */
2842
2843/* flag */
2844#define LOG_FLAG_EVENT		1
2845
2846/* log arg_type */
2847#define LOG_ARGTYPE_NULL	0
2848#define LOG_ARGTYPE_STR		1	/* %s */
2849#define LOG_ARGTYPE_INT		2	/* %d */
2850#define LOG_ARGTYPE_INT_STR	3	/* %d...%s */
2851#define LOG_ARGTYPE_STR_INT	4	/* %s...%d */
2852
2853typedef struct wlc_extlog_cfg {
2854	int max_number;
2855	uint16 module;	/* bitmap */
2856	uint8 level;
2857	uint8 flag;
2858	uint16 version;
2859} wlc_extlog_cfg_t;
2860
2861typedef struct log_record {
2862	uint32 time;
2863	uint16 module;
2864	uint16 id;
2865	uint8 level;
2866	uint8 sub_unit;
2867	uint8 seq_num;
2868	int32 arg;
2869	char str[MAX_ARGSTR_LEN];
2870} log_record_t;
2871
2872typedef struct wlc_extlog_req {
2873	uint32 from_last;
2874	uint32 num;
2875} wlc_extlog_req_t;
2876
2877typedef struct wlc_extlog_results {
2878	uint16 version;
2879	uint16 record_len;
2880	uint32 num;
2881	log_record_t logs[1];
2882} wlc_extlog_results_t;
2883
2884typedef struct log_idstr {
2885	uint16	id;
2886	uint16	flag;
2887	uint8	arg_type;
2888	const char	*fmt_str;
2889} log_idstr_t;
2890
2891#define FMTSTRF_USER		1
2892
2893/* flat ID definitions
2894 * New definitions HAVE TO BE ADDED at the end of the table. Otherwise, it will
2895 * affect backward compatibility with pre-existing apps
2896 */
2897typedef enum {
2898	FMTSTR_DRIVER_UP_ID = 0,
2899	FMTSTR_DRIVER_DOWN_ID = 1,
2900	FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
2901	FMTSTR_NO_PROGRESS_ID = 3,
2902	FMTSTR_RFDISABLE_ID = 4,
2903	FMTSTR_REG_PRINT_ID = 5,
2904	FMTSTR_EXPTIME_ID = 6,
2905	FMTSTR_JOIN_START_ID = 7,
2906	FMTSTR_JOIN_COMPLETE_ID = 8,
2907	FMTSTR_NO_NETWORKS_ID = 9,
2908	FMTSTR_SECURITY_MISMATCH_ID = 10,
2909	FMTSTR_RATE_MISMATCH_ID = 11,
2910	FMTSTR_AP_PRUNED_ID = 12,
2911	FMTSTR_KEY_INSERTED_ID = 13,
2912	FMTSTR_DEAUTH_ID = 14,
2913	FMTSTR_DISASSOC_ID = 15,
2914	FMTSTR_LINK_UP_ID = 16,
2915	FMTSTR_LINK_DOWN_ID = 17,
2916	FMTSTR_RADIO_HW_OFF_ID = 18,
2917	FMTSTR_RADIO_HW_ON_ID = 19,
2918	FMTSTR_EVENT_DESC_ID = 20,
2919	FMTSTR_PNP_SET_POWER_ID = 21,
2920	FMTSTR_RADIO_SW_OFF_ID = 22,
2921	FMTSTR_RADIO_SW_ON_ID = 23,
2922	FMTSTR_PWD_MISMATCH_ID = 24,
2923	FMTSTR_FATAL_ERROR_ID = 25,
2924	FMTSTR_AUTH_FAIL_ID = 26,
2925	FMTSTR_ASSOC_FAIL_ID = 27,
2926	FMTSTR_IBSS_FAIL_ID = 28,
2927	FMTSTR_EXTAP_FAIL_ID = 29,
2928	FMTSTR_MAX_ID
2929} log_fmtstr_id_t;
2930
2931/* require default structure packing */
2932#include <packed_section_end.h>
2933
2934/* require strict packing */
2935#include <packed_section_start.h>
2936/* structures used to define format of wps ie data from probe requests */
2937/* passed up to applications via iovar "prbreq_wpsie" */
2938typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_hdr {
2939	struct ether_addr staAddr;
2940	uint16 ieLen;
2941} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_hdr_t;
2942
2943typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
2944	sta_prbreq_wps_ie_hdr_t hdr;
2945	uint8 ieData[1];
2946} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
2947
2948typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
2949	uint32 totLen;
2950	uint8 ieDataList[1];
2951} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
2952
2953/* require strict packing */
2954#include <packed_section_end.h>
2955
2956/* Global ASSERT Logging */
2957#define ASSERTLOG_CUR_VER	0x0100
2958#define MAX_ASSRTSTR_LEN	64
2959
2960typedef struct assert_record {
2961	uint32 time;
2962	uint8 seq_num;
2963	char str[MAX_ASSRTSTR_LEN];
2964} assert_record_t;
2965
2966typedef struct assertlog_results {
2967	uint16 version;
2968	uint16 record_len;
2969	uint32 num;
2970	assert_record_t logs[1];
2971} assertlog_results_t;
2972
2973#define LOGRRC_FIX_LEN	8
2974#define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
2975
2976
2977/* channel interference measurement (chanim) related defines */
2978#define MAX_CHANIM_CHANNELS 38	/* Max number of 20 Mhz wide channels */
2979
2980/* chanim mode */
2981#define CHANIM_DISABLE	0	/* disabled */
2982#define CHANIM_DETECT	1	/* detection only */
2983#define CHANIM_ACT	2	/* detection and act */
2984
2985/* structure/defines for selective mgmt frame (smf) stats support */
2986
2987#define SMFS_VERSION 1
2988/* selected mgmt frame (smf) stats element */
2989typedef struct wl_smfs_elem {
2990	uint32 count;
2991	uint16 code;  /* SC or RC code */
2992} wl_smfs_elem_t;
2993
2994typedef struct wl_smf_stats {
2995	uint32 version;
2996	uint16 length;	/* reserved for future usage */
2997	uint8 type;
2998	uint8 codetype;
2999	uint32 ignored_cnt;
3000	uint32 malformed_cnt;
3001	uint32 count_total; /* count included the interested group */
3002	wl_smfs_elem_t elem[1];
3003} wl_smf_stats_t;
3004
3005#define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);
3006
3007enum {
3008	SMFS_CODETYPE_SC,
3009	SMFS_CODETYPE_RC
3010};
3011
3012/* reuse two number in the sc/rc space */
3013#define	SMFS_CODE_MALFORMED 0xFFFE
3014#define SMFS_CODE_IGNORED 	0xFFFD
3015
3016typedef enum smfs_type {
3017	SMFS_TYPE_AUTH,
3018	SMFS_TYPE_ASSOC,
3019	SMFS_TYPE_REASSOC,
3020	SMFS_TYPE_DISASSOC_TX,
3021	SMFS_TYPE_DISASSOC_RX,
3022	SMFS_TYPE_DEAUTH_TX,
3023	SMFS_TYPE_DEAUTH_RX,
3024	SMFS_TYPE_MAX
3025} smfs_type_t;
3026
3027#ifdef PHYMON
3028
3029#define PHYMON_VERSION 1
3030
3031typedef struct wl_phycal_core_state {
3032	/* Tx IQ/LO calibration coeffs */
3033	int16 tx_iqlocal_a;
3034	int16 tx_iqlocal_b;
3035	int8 tx_iqlocal_ci;
3036	int8 tx_iqlocal_cq;
3037	int8 tx_iqlocal_di;
3038	int8 tx_iqlocal_dq;
3039	int8 tx_iqlocal_ei;
3040	int8 tx_iqlocal_eq;
3041	int8 tx_iqlocal_fi;
3042	int8 tx_iqlocal_fq;
3043
3044	/* Rx IQ calibration coeffs */
3045	int16 rx_iqcal_a;
3046	int16 rx_iqcal_b;
3047
3048	uint8 tx_iqlocal_pwridx; /* Tx Power Index for Tx IQ/LO calibration */
3049	uint32 papd_epsilon_table[64]; /* PAPD epsilon table */
3050	int16 papd_epsilon_offset; /* PAPD epsilon offset */
3051	uint8 curr_tx_pwrindex; /* Tx power index */
3052	int8 idle_tssi; /* Idle TSSI */
3053	int8 est_tx_pwr; /* Estimated Tx Power (dB) */
3054	int8 est_rx_pwr; /* Estimated Rx Power (dB) from RSSI */
3055	uint16 rx_gaininfo; /* Rx gain applied on last Rx pkt */
3056	uint16 init_gaincode; /* initgain required for ACI */
3057	int8 estirr_tx;
3058	int8 estirr_rx;
3059
3060} wl_phycal_core_state_t;
3061
3062typedef struct wl_phycal_state {
3063	int version;
3064	int8 num_phy_cores; /* number of cores */
3065	int8 curr_temperature; /* on-chip temperature sensor reading */
3066	chanspec_t chspec; /* channspec for this state */
3067	bool aci_state; /* ACI state: ON/OFF */
3068	uint16 crsminpower; /* crsminpower required for ACI */
3069	uint16 crsminpowerl; /* crsminpowerl required for ACI */
3070	uint16 crsminpoweru; /* crsminpoweru required for ACI */
3071	wl_phycal_core_state_t phycal_core[1];
3072} wl_phycal_state_t;
3073
3074#define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
3075#endif /* PHYMON */
3076
3077#ifdef WLP2P
3078/* discovery state */
3079typedef struct wl_p2p_disc_st {
3080	uint8 state;	/* see state */
3081	chanspec_t chspec;	/* valid in listen state */
3082	uint16 dwell;	/* valid in listen state, in ms */
3083} wl_p2p_disc_st_t;
3084
3085/* state */
3086#define WL_P2P_DISC_ST_SCAN	0
3087#define WL_P2P_DISC_ST_LISTEN	1
3088#define WL_P2P_DISC_ST_SEARCH	2
3089
3090/* i/f request */
3091typedef struct wl_p2p_if {
3092	struct ether_addr addr;
3093	uint8 type;	/* see i/f type */
3094	chanspec_t chspec;	/* valid for GO */
3095} wl_p2p_if_t;
3096
3097/* i/f type */
3098#define WL_P2P_IF_CLIENT	0
3099#define WL_P2P_IF_GO		1
3100
3101/* OppPS & CTWindow */
3102typedef struct wl_p2p_ops {
3103	uint8 ops;	/* 0: disable 1: enable */
3104	uint8 ctw;	/* >= 10 */
3105} wl_p2p_ops_t;
3106
3107/* absence and presence request */
3108typedef struct wl_p2p_sched_desc {
3109	uint32 start;
3110	uint32 interval;
3111	uint32 duration;
3112	uint32 count;	/* see count */
3113} wl_p2p_sched_desc_t;
3114
3115/* count */
3116#define WL_P2P_SCHED_RSVD	0
3117#define WL_P2P_SCHED_REPEAT	255	/* anything > 255 will be treated as 255 */
3118
3119typedef struct wl_p2p_sched {
3120	uint8 type;	/* see schedule type */
3121	uint8 action;	/* see schedule action */
3122	uint8 option;	/* see schedule option */
3123	wl_p2p_sched_desc_t desc[1];
3124} wl_p2p_sched_t;
3125#define WL_P2P_SCHED_FIXED_LEN		3
3126
3127/* schedule type */
3128#define WL_P2P_SCHED_TYPE_ABS		0	/* Scheduled Absence */
3129#define WL_P2P_SCHED_TYPE_REQ_ABS	1	/* Requested Absence */
3130#define WL_P2P_SCHED_TYPE_REQ_PSC	2	/* Requested Presence */
3131
3132/* schedule action during absence periods (for WL_P2P_SCHED_ABS type) */
3133#define WL_P2P_SCHED_ACTION_NONE	0	/* no action */
3134#define WL_P2P_SCHED_ACTION_DOZE	1	/* doze */
3135#define WL_P2P_SCHED_ACTION_RESET	255	/* reset */
3136
3137/* schedule option - WL_P2P_SCHED_TYPE_ABS */
3138#define WL_P2P_SCHED_OPTION_NORMAL	0	/* normal start/interval/duration/count in time */
3139#define WL_P2P_SCHED_OPTION_BCNPCT	1	/* percentage of beacon interval */
3140#endif /* WLP2P */
3141
3142#endif /* _wlioctl_h_ */
3143