xref: /titanic_44/usr/src/uts/common/sys/net80211_proto.h (revision 1e4c938b57d1656808e4112127ff1dce3eba5314)
1 /*
2  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 2001 Atsushi Onoe
8  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  * 3. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * Alternatively, this software may be distributed under the terms of the
23  * GNU General Public License ("GPL") version 2 as published by the Free
24  * Software Foundation.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
28  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
29  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
30  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
31  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef _SYS_NET80211_PROTO_H
39 #define	_SYS_NET80211_PROTO_H
40 
41 /*
42  * 802.11 protocol definitions
43  */
44 
45 #ifdef	__cplusplus
46 extern "C" {
47 #endif
48 
49 #define	IEEE80211_ADDR_LEN	6	/* size of 802.11 address */
50 #define	IEEE80211_ADDR_COPY(dst, src)	\
51 	((void) bcopy(src, dst, IEEE80211_ADDR_LEN))
52 #define	IEEE80211_ADDR_EQ(a1, a2)	\
53 	(bcmp(a1, a2, IEEE80211_ADDR_LEN) == 0)
54 /* is 802.11 address multicast/broadcast? */
55 #define	IEEE80211_IS_MULTICAST(addr)	\
56 	((((uint8_t *)addr)[0]) & 0x01)
57 
58 /*
59  * Size of an ACK control frame in bytes.
60  */
61 #define	IEEE80211_ACK_SIZE	(2 + 2 + IEEE80211_ADDR_LEN + 4)
62 
63 #define	WME_NUM_AC		4	/* 4 AC categories */
64 
65 /*
66  * The formation of some management frames requires guidance to
67  * deal with legacy clients.  When the client is identified as
68  * "legacy 11b" this parameter can be passed in the arg param of a
69  * IEEE80211_SEND_MGMT call.
70  */
71 #define	IEEE80211_SEND_LEGACY_11B	0x1	/* legacy 11b client */
72 #define	IEEE80211_SEND_LEGACY_11	0x2	/* other legacy client */
73 #define	IEEE80211_SEND_LEGACY		0x3	/* any legacy client */
74 
75 /*
76  * Protocol Physical Layer
77  */
78 
79 /* XXX not really a mode; there are really multiple PHY's */
80 enum ieee80211_phymode {
81 	IEEE80211_MODE_AUTO	= 0,	/* autoselect */
82 	IEEE80211_MODE_11A	= 1,	/* 5GHz, OFDM */
83 	IEEE80211_MODE_11B	= 2,	/* 2GHz, CCK */
84 	IEEE80211_MODE_11G	= 3,	/* 2GHz, OFDM */
85 	IEEE80211_MODE_FH	= 4,	/* 2GHz, GFSK */
86 	IEEE80211_MODE_TURBO_A	= 5,	/* 5GHz, OFDM, 2x clock */
87 	IEEE80211_MODE_TURBO_G	= 6,	/* 2GHz, OFDM, 2x clock */
88 	IEEE80211_MODE_STURBO_A	= 7,	/* 5GHz, OFDM, 2x clock, static */
89 	IEEE80211_MODE_11NA	= 8,	/* 5GHz, w/ HT */
90 	IEEE80211_MODE_11NG	= 9	/* 2GHz, w/ HT */
91 };
92 #define	IEEE80211_MODE_MAX	(IEEE80211_MODE_11NG + 1)
93 
94 enum ieee80211_phytype {
95 	IEEE80211_T_DS,		/* direct sequence spread spectrum */
96 	IEEE80211_T_FH,		/* frequency hopping */
97 	IEEE80211_T_OFDM,	/* frequency division multiplexing */
98 	IEEE80211_T_TURBO,	/* high rate OFDM, aka turbo mode */
99 	IEEE80211_T_HT		/* high throughput, full GI */
100 };
101 #define	IEEE80211_T_CCK	IEEE80211_T_DS	/* more common nomenclature */
102 
103 enum ieee80211_opmode {
104 	IEEE80211_M_STA		= 1,	/* infrastructure station */
105 	IEEE80211_M_IBSS 	= 0,	/* IBSS (adhoc) station */
106 	IEEE80211_M_AHDEMO	= 3,	/* Old lucent compatible adhoc demo */
107 	IEEE80211_M_HOSTAP	= 6,	/* Software Access Point */
108 	IEEE80211_M_MONITOR	= 8	/* Monitor mode */
109 };
110 
111 /*
112  * 802.11g protection mode.
113  */
114 enum ieee80211_protmode {
115 	IEEE80211_PROT_NONE	= 0,	/* no protection */
116 	IEEE80211_PROT_CTSONLY	= 1,	/* CTS to self */
117 	IEEE80211_PROT_RTSCTS	= 2	/* RTS-CTS */
118 };
119 
120 /*
121  * generic definitions for IEEE 802.11 frames
122  */
123 #pragma pack(1)
124 struct ieee80211_frame {
125 	uint8_t		i_fc[2]; /* [0]-protocol version, [1]-type & subtype */
126 	uint8_t		i_dur[2];
127 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
128 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
129 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
130 	uint8_t		i_seq[2];
131 	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
132 	/* see below */
133 };
134 
135 struct ieee80211_qosframe {
136 	uint8_t		i_fc[2];
137 	uint8_t		i_dur[2];
138 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
139 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
140 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
141 	uint8_t		i_seq[2];
142 	uint8_t		i_qos[2];
143 	/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
144 	/* see below */
145 };
146 
147 struct ieee80211_qoscntl {
148 	uint8_t		i_qos[2];
149 };
150 
151 struct ieee80211_frame_addr4 {
152 	uint8_t		i_fc[2];
153 	uint8_t		i_dur[2];
154 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
155 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
156 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
157 	uint8_t		i_seq[2];
158 	uint8_t		i_addr4[IEEE80211_ADDR_LEN];
159 };
160 
161 struct ieee80211_qosframe_addr4 {
162 	uint8_t		i_fc[2];
163 	uint8_t		i_dur[2];
164 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
165 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
166 	uint8_t		i_addr3[IEEE80211_ADDR_LEN];
167 	uint8_t		i_seq[2];
168 	uint8_t		i_addr4[IEEE80211_ADDR_LEN];
169 	uint8_t		i_qos[2];
170 };
171 
172 /* Start part(LLC and SNAP) of payload of IEEE80211 frame */
173 struct ieee80211_llc {
174 	/* LLC */
175 	uint8_t		illc_dsap;
176 	uint8_t		illc_ssap;
177 	uint8_t		illc_control;
178 	/* SNAP */
179 	uint8_t		illc_oc[3]; /* protocol ID or organization code */
180 	uint16_t	illc_ether_type; /* ethernet type */
181 };
182 
183 /*
184  * Management Notification Frame
185  */
186 struct ieee80211_mnf {
187 	uint8_t		mnf_category;
188 	uint8_t		mnf_action;
189 	uint8_t		mnf_dialog;
190 	uint8_t		mnf_status;
191 };
192 
193 /*
194  * Control frames.
195  */
196 struct ieee80211_frame_min {
197 	uint8_t		i_fc[2];
198 	uint8_t		i_dur[2];
199 	uint8_t		i_addr1[IEEE80211_ADDR_LEN];
200 	uint8_t		i_addr2[IEEE80211_ADDR_LEN];
201 	/* FCS */
202 };
203 
204 struct ieee80211_frame_rts {
205 	uint8_t		i_fc[2];
206 	uint8_t		i_dur[2];
207 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
208 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
209 	/* FCS */
210 };
211 
212 struct ieee80211_frame_cts {
213 	uint8_t		i_fc[2];
214 	uint8_t		i_dur[2];
215 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
216 	/* FCS */
217 };
218 
219 struct ieee80211_frame_ack {
220 	uint8_t		i_fc[2];
221 	uint8_t		i_dur[2];
222 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
223 	/* FCS */
224 };
225 
226 struct ieee80211_frame_pspoll {
227 	uint8_t		i_fc[2];
228 	uint8_t		i_aid[2];
229 	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
230 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
231 	/* FCS */
232 };
233 
234 struct ieee80211_frame_cfend {		/* NB: also CF-End+CF-Ack */
235 	uint8_t		i_fc[2];
236 	uint8_t		i_dur[2];	/* should be zero */
237 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
238 	uint8_t		i_bssid[IEEE80211_ADDR_LEN];
239 	/* FCS */
240 };
241 
242 struct ieee80211_frame_bar {
243 	uint8_t		i_fc[2];
244 	uint8_t		i_dur[2];
245 	uint8_t		i_ra[IEEE80211_ADDR_LEN];
246 	uint8_t		i_ta[IEEE80211_ADDR_LEN];
247 	uint16_t	i_ctl;
248 	uint16_t	i_seq;
249 	/* FCS */
250 };
251 
252 struct ieee80211_tim_ie {
253 	uint8_t		tim_ie;			/* IEEE80211_ELEMID_TIM */
254 	uint8_t		tim_len;
255 	uint8_t		tim_count;		/* DTIM count */
256 	uint8_t		tim_period;		/* DTIM period */
257 	uint8_t		tim_bitctl;		/* bitmap control */
258 	uint8_t		tim_bitmap[1];		/* variable-length bitmap */
259 };
260 
261 /*
262  * 802.11i/WPA information element (maximally sized).
263  */
264 struct ieee80211_ie_wpa {
265 	uint8_t		wpa_id;		 /* IEEE80211_ELEMID_VENDOR */
266 	uint8_t		wpa_len;	 /* length in bytes */
267 	uint8_t		wpa_oui[3];	 /* 0x00, 0x50, 0xf2 */
268 	uint8_t		wpa_type;	 /* OUI type */
269 	uint16_t	wpa_version;	 /* spec revision */
270 	uint32_t	wpa_mcipher[1];	 /* multicast/group key cipher */
271 	uint16_t	wpa_uciphercnt;	 /* # pairwise key ciphers */
272 	uint32_t	wpa_uciphers[8]; /* ciphers */
273 	uint16_t	wpa_authselcnt;	 /* authentication selector cnt */
274 	uint32_t	wpa_authsels[8]; /* selectors */
275 	uint16_t	wpa_caps;	 /* 802.11i capabilities */
276 	uint16_t	wpa_pmkidcnt;	 /* 802.11i pmkid count */
277 	uint16_t	wpa_pmkids[8];	 /* 802.11i pmkids */
278 };
279 
280 /*
281  * WME AC parameter field
282  */
283 struct ieee80211_wme_acparams {
284 	uint8_t		acp_aci_aifsn;
285 	uint8_t		acp_logcwminmax;
286 	uint16_t	acp_txop;
287 };
288 
289 /*
290  * WME Parameter Element
291  */
292 struct ieee80211_wme_param {
293 	uint8_t		wme_id;
294 	uint8_t		wme_len;
295 	uint8_t		wme_oui[3];
296 	uint8_t		wme_oui_type;
297 	uint8_t		wme_oui_sybtype;
298 	uint8_t		wme_version;
299 	uint8_t		wme_qosInfo;
300 #define	WME_QOSINFO_COUNT	0x0f	/* Mask for param count field */
301 	uint8_t		wme_reserved;
302 	struct ieee80211_wme_acparams	wme_acParams[WME_NUM_AC];
303 };
304 
305 /*
306  * WME/802.11e information element.
307  */
308 struct ieee80211_wme_info {
309 	uint8_t		wme_id;		/* IEEE80211_ELEMID_VENDOR */
310 	uint8_t		wme_len;	/* length in bytes */
311 	uint8_t		wme_oui[3];	/* 0x00, 0x50, 0xf2 */
312 	uint8_t		wme_type;	/* OUI type */
313 	uint8_t		wme_subtype;	/* OUI subtype */
314 	uint8_t		wme_version;	/* spec revision */
315 	uint8_t		wme_info;	/* QoS info */
316 };
317 
318 /*
319  * WME/802.11e Tspec Element
320  */
321 struct ieee80211_wme_tspec {
322 	uint8_t		ts_id;
323 	uint8_t		ts_len;
324 	uint8_t		ts_oui[3];
325 	uint8_t		ts_oui_type;
326 	uint8_t		ts_oui_subtype;
327 	uint8_t		ts_version;
328 	uint8_t		ts_tsinfo[3];
329 	uint8_t		ts_nom_msdu[2];
330 	uint8_t		ts_max_msdu[2];
331 	uint8_t		ts_min_svc[4];
332 	uint8_t		ts_max_svc[4];
333 	uint8_t		ts_inactv_intv[4];
334 	uint8_t		ts_susp_intv[4];
335 	uint8_t		ts_start_svc[4];
336 	uint8_t		ts_min_rate[4];
337 	uint8_t		ts_mean_rate[4];
338 	uint8_t		ts_max_burst[4];
339 	uint8_t		ts_min_phy[4];
340 	uint8_t		ts_peak_rate[4];
341 	uint8_t		ts_delay[4];
342 	uint8_t		ts_surplus[2];
343 	uint8_t		ts_medium_time[2];
344 };
345 
346 /*
347  * 802.11n Management Action Frames
348  */
349 /* generic frame format */
350 struct ieee80211_action {
351 	uint8_t		ia_category;
352 	uint8_t		ia_action;
353 };
354 
355 /* HT - recommended transmission channel width */
356 struct ieee80211_action_ht_txchwidth {
357 	struct ieee80211_action	at_header;
358 	uint8_t		at_chwidth;
359 };
360 
361 struct ieee80211_action_ht_mimopowersave {
362 	struct ieee80211_action am_header;
363 	uint8_t		am_control;
364 };
365 
366 /* BA - ADDBA request */
367 struct ieee80211_action_ba_addbarequest {
368 	struct ieee80211_action rq_header;
369 	uint8_t		rq_dialogtoken;
370 	uint16_t	rq_baparamset;
371 	uint16_t	rq_batimeout;		/* in TUs */
372 	uint16_t	rq_baseqctl;
373 };
374 
375 /* BA - ADDBA response */
376 struct ieee80211_action_ba_addbaresponse {
377 	struct ieee80211_action rs_header;
378 	uint8_t		rs_dialogtoken;
379 	uint16_t	rs_statuscode;
380 	uint16_t	rs_baparamset;
381 	uint16_t	rs_batimeout;		/* in TUs */
382 };
383 
384 /* BA - DELBA */
385 struct ieee80211_action_ba_delba {
386 	struct ieee80211_action dl_header;
387 	uint16_t	dl_baparamset;
388 	uint16_t	dl_reasoncode;
389 };
390 
391 struct ieee80211_ba_request {
392 	uint16_t	rq_barctl;
393 	uint16_t	rq_barseqctl;
394 };
395 
396 /*
397  * 802.11n HT Capability IE
398  * NB: these reflect D1.10
399  */
400 struct ieee80211_ie_htcap {
401 	uint8_t		hc_id;			/* element ID */
402 	uint8_t		hc_len;			/* length in bytes */
403 	uint16_t	hc_cap;			/* HT caps (see below) */
404 	uint8_t		hc_param;		/* HT params (see below) */
405 	uint8_t 	hc_mcsset[16]; 		/* supported MCS set */
406 	uint16_t	hc_extcap;		/* extended HT capabilities */
407 	uint32_t	hc_txbf;		/* txbf capabilities */
408 	uint8_t		hc_antenna;		/* antenna capabilities */
409 };
410 
411 /*
412  * 802.11n HT Information IE
413  */
414 struct ieee80211_ie_htinfo {
415 	uint8_t		hi_id;			/* element ID */
416 	uint8_t		hi_len;			/* length in bytes */
417 	uint8_t		hi_ctrlchannel;		/* primary channel */
418 	uint8_t		hi_byte1;		/* ht ie byte 1 */
419 	uint8_t		hi_byte2;		/* ht ie byte 2 */
420 	uint8_t		hi_byte3;		/* ht ie byte 3 */
421 	uint16_t	hi_byte45;		/* ht ie bytes 4+5 */
422 	uint8_t 	hi_basicmcsset[16]; 	/* basic MCS set */
423 };
424 #pragma pack()
425 
426 #define	IEEE80211_FC0_VERSION_MASK		0x03
427 #define	IEEE80211_FC0_VERSION_SHIFT		0
428 #define	IEEE80211_FC0_VERSION_0			0x00
429 #define	IEEE80211_FC0_TYPE_MASK			0x0c
430 #define	IEEE80211_FC0_TYPE_SHIFT		2
431 #define	IEEE80211_FC0_TYPE_MGT			0x00
432 #define	IEEE80211_FC0_TYPE_CTL			0x04
433 #define	IEEE80211_FC0_TYPE_DATA			0x08
434 #define	IEEE80211_FC0_SUBTYPE_MASK		0xf0
435 #define	IEEE80211_FC0_SUBTYPE_SHIFT		4
436 /* for TYPE_MGT */
437 #define	IEEE80211_FC0_SUBTYPE_ASSOC_REQ		0x00
438 #define	IEEE80211_FC0_SUBTYPE_ASSOC_RESP	0x10
439 #define	IEEE80211_FC0_SUBTYPE_REASSOC_REQ	0x20
440 #define	IEEE80211_FC0_SUBTYPE_REASSOC_RESP	0x30
441 #define	IEEE80211_FC0_SUBTYPE_PROBE_REQ		0x40
442 #define	IEEE80211_FC0_SUBTYPE_PROBE_RESP	0x50
443 #define	IEEE80211_FC0_SUBTYPE_BEACON		0x80
444 #define	IEEE80211_FC0_SUBTYPE_ATIM		0x90
445 #define	IEEE80211_FC0_SUBTYPE_DISASSOC		0xa0
446 #define	IEEE80211_FC0_SUBTYPE_AUTH		0xb0
447 #define	IEEE80211_FC0_SUBTYPE_DEAUTH		0xc0
448 #define	IEEE80211_FC0_SUBTYPE_ACTION		0xd0
449 /* for TYPE_CTL */
450 #define	IEEE80211_FC0_SUBTYPE_BAR		0x80
451 #define	IEEE80211_FC0_SUBTYPE_PS_POLL		0xa0
452 #define	IEEE80211_FC0_SUBTYPE_RTS		0xb0
453 #define	IEEE80211_FC0_SUBTYPE_CTS		0xc0
454 #define	IEEE80211_FC0_SUBTYPE_ACK		0xd0
455 #define	IEEE80211_FC0_SUBTYPE_CF_END		0xe0
456 #define	IEEE80211_FC0_SUBTYPE_CF_END_ACK	0xf0
457 /* for TYPE_DATA (bit combination) */
458 #define	IEEE80211_FC0_SUBTYPE_DATA		0x00
459 #define	IEEE80211_FC0_SUBTYPE_CF_ACK		0x10
460 #define	IEEE80211_FC0_SUBTYPE_CF_POLL		0x20
461 #define	IEEE80211_FC0_SUBTYPE_CF_ACPL		0x30
462 #define	IEEE80211_FC0_SUBTYPE_NODATA		0x40
463 #define	IEEE80211_FC0_SUBTYPE_CFACK		0x50
464 #define	IEEE80211_FC0_SUBTYPE_CFPOLL		0x60
465 #define	IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK	0x70
466 #define	IEEE80211_FC0_SUBTYPE_QOS		0x80
467 #define	IEEE80211_FC0_SUBTYPE_QOS_NULL		0xc0
468 
469 #define	IEEE80211_FC1_DIR_MASK			0x03
470 #define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */
471 #define	IEEE80211_FC1_DIR_TODS			0x01	/* STA->AP  */
472 #define	IEEE80211_FC1_DIR_FROMDS		0x02	/* AP ->STA */
473 #define	IEEE80211_FC1_DIR_DSTODS		0x03	/* AP ->AP  */
474 
475 #define	IEEE80211_FC1_MORE_FRAG			0x04
476 #define	IEEE80211_FC1_RETRY			0x08
477 #define	IEEE80211_FC1_PWR_MGT			0x10
478 #define	IEEE80211_FC1_MORE_DATA			0x20
479 #define	IEEE80211_FC1_WEP			0x40
480 #define	IEEE80211_FC1_ORDER			0x80
481 
482 #define	IEEE80211_SEQ_FRAG_MASK			0x000f
483 #define	IEEE80211_SEQ_FRAG_SHIFT		0
484 #define	IEEE80211_SEQ_SEQ_MASK			0xfff0
485 #define	IEEE80211_SEQ_SEQ_SHIFT			4	/* 4bit frag number */
486 #define	IEEE80211_SEQ_RANGE			4096
487 
488 #define	IEEE80211_SEQ_ADD(seq, incr) \
489 	(((seq) + (incr)) & (IEEE80211_SEQ_RANGE - 1))
490 #define	IEEE80211_SEQ_INC(seq)	IEEE80211_SEQ_ADD(seq, 1)
491 #define	IEEE80211_SEQ_SUB(a, b) \
492 	(((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE - 1))
493 
494 #define	IEEE80211_SEQ_BA_RANGE			2048	/* 2^11 */
495 #define	IEEE80211_SEQ_BA_BEFORE(a, b) \
496 	(IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1)
497 
498 /* Length of management frame variable-length components in bytes */
499 #define	IEEE80211_NWID_LEN			32	/* SSID */
500 #define	IEEE80211_FH_LEN			5	/* FH parameters */
501 #define	IEEE80211_DS_LEN			1	/* DS parameters */
502 #define	IEEE80211_IBSS_LEN			4	/* IBSS parameters */
503 #define	IEEE80211_ERP_LEN			1	/* ERP information */
504 
505 #define	IEEE80211_QOS_TXOP			0x00ff
506 /* bit 8 is reserved */
507 #define	IEEE80211_QOS_AMSDU			0x80
508 #define	IEEE80211_QOS_AMSDU_S			7
509 #define	IEEE80211_QOS_ACKPOLICY			0x60
510 #define	IEEE80211_QOS_ACKPOLICY_S		5
511 #define	IEEE80211_QOS_ACKPOLICY_NOACK		0x20	/* No ACK required */
512 #define	IEEE80211_QOS_ACKPOLICY_BA		0x60	/* Block ACK */
513 #define	IEEE80211_QOS_ESOP			0x10
514 #define	IEEE80211_QOS_ESOP_S			4
515 #define	IEEE80211_QOS_TID			0x0f
516 
517 /* does frame have QoS sequence control data */
518 #define	IEEE80211_QOS_HAS_SEQ(wh) \
519 	(((wh)->i_fc[0] & \
520 	(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
521 	(IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
522 
523 #define	WME_NUM_AC		4	/* 4 AC categories */
524 #define	WME_NUM_TID		16	/* 16 tids */
525 
526 #define	WME_PARAM_ACI		0x60	/* Mask for ACI field */
527 #define	WME_PARAM_ACI_S		5	/* Shift for ACI field */
528 #define	WME_PARAM_ACM		0x10	/* Mask for ACM bit */
529 #define	WME_PARAM_ACM_S		4	/* Shift for ACM bit */
530 #define	WME_PARAM_AIFSN		0x0f	/* Mask for aifsn field */
531 #define	WME_PARAM_AIFSN_S	0	/* Shift for aifsn field */
532 #define	WME_PARAM_LOGCWMIN	0x0f	/* Mask for CwMin field (in log) */
533 #define	WME_PARAM_LOGCWMIN_S	0	/* Shift for CwMin field */
534 #define	WME_PARAM_LOGCWMAX	0xf0	/* Mask for CwMax field (in log) */
535 #define	WME_PARAM_LOGCWMAX_S	4	/* Shift for CwMax field */
536 
537 #define	WME_AC_TO_TID(_ac) (       \
538 	((_ac) == WME_AC_VO) ? 6 : \
539 	((_ac) == WME_AC_VI) ? 5 : \
540 	((_ac) == WME_AC_BK) ? 1 : \
541 	0)
542 
543 #define	TID_TO_WME_AC(_tid) (      \
544 	((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \
545 	((_tid) < 3) ? WME_AC_BK : \
546 	((_tid) < 6) ? WME_AC_VI : \
547 	WME_AC_VO)
548 
549 #define	IEEE80211_MNF_SETUP_REQ		0
550 #define	IEEE80211_MNF_SETUP_RESP	1
551 #define	IEEE80211_MNF_TEARDOWN		2
552 
553 #define	IEEE80211_ACTION_CAT_QOS	0	/* QoS */
554 #define	IEEE80211_ACTION_CAT_BA		3	/* BA */
555 #define	IEEE80211_ACTION_CAT_HT		7	/* HT */
556 
557 #define	IEEE80211_ACTION_HT_TXCHWIDTH	0	/* recommend xmit chan width */
558 #define	IEEE80211_ACTION_HT_MIMOPWRSAVE	1	/* MIMO power save */
559 
560 #define	IEEE80211_A_HT_TXCHWIDTH_20	0
561 #define	IEEE80211_A_HT_TXCHWIDTH_2040	1
562 
563 #define	IEEE80211_A_HT_MIMOPWRSAVE_ENA		0x01	/* PS enabled */
564 #define	IEEE80211_A_HT_MIMOPWRSAVE_MODE		0x02
565 #define	IEEE80211_A_HT_MIMOPWRSAVE_MODE_S	1
566 #define	IEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC	0x02	/* Dynamic Mode */
567 #define	IEEE80211_A_HT_MIMOPWRSAVE_STATIC	0x00	/* no SM packets */
568 /* bits 2-7 reserved */
569 
570 /* Block Ack actions */
571 #define	IEEE80211_ACTION_BA_ADDBA_REQUEST	0   /* ADDBA request */
572 #define	IEEE80211_ACTION_BA_ADDBA_RESPONSE	1   /* ADDBA response */
573 #define	IEEE80211_ACTION_BA_DELBA		2   /* DELBA */
574 
575 /* Block Ack Parameter Set */
576 #define	IEEE80211_BAPS_BUFSIZ	0xffc0		/* buffer size */
577 #define	IEEE80211_BAPS_BUFSIZ_S	6
578 #define	IEEE80211_BAPS_TID	0x003c		/* TID */
579 #define	IEEE80211_BAPS_TID_S	2
580 #define	IEEE80211_BAPS_POLICY	0x0002		/* block ack policy */
581 #define	IEEE80211_BAPS_POLICY_S	1
582 
583 #define	IEEE80211_BAPS_POLICY_DELAYED	(0<<IEEE80211_BAPS_POLICY_S)
584 #define	IEEE80211_BAPS_POLICY_IMMEDIATE	(1<<IEEE80211_BAPS_POLICY_S)
585 
586 /* Block Ack Sequence Control */
587 #define	IEEE80211_BASEQ_START	0xfff0		/* starting seqnum */
588 #define	IEEE80211_BASEQ_START_S	4
589 #define	IEEE80211_BASEQ_FRAG	0x000f		/* fragment number */
590 #define	IEEE80211_BASEQ_FRAG_S	0
591 
592 /* Delayed Block Ack Parameter Set */
593 #define	IEEE80211_DELBAPS_TID	0xf000		/* TID */
594 #define	IEEE80211_DELBAPS_TID_S	12
595 #define	IEEE80211_DELBAPS_INIT	0x0800		/* initiator */
596 #define	IEEE80211_DELBAPS_INIT_S 11
597 
598 /* BAR Control */
599 #define	IEEE80211_BAR_TID	0xf000		/* TID */
600 #define	IEEE80211_BAR_TID_S	12
601 #define	IEEE80211_BAR_COMP	0x0004		/* compressed */
602 #define	IEEE80211_BAR_MTID	0x0002
603 #define	IEEE80211_BAR_NOACK	0x0001		/* no-ack policy */
604 
605 /* HT capability flags (ht_cap) */
606 #define	IEEE80211_HTCAP_LDPC		0x0001	/* LDPC supported */
607 #define	IEEE80211_HTCAP_CHWIDTH40	0x0002	/* 20/40 supported */
608 #define	IEEE80211_HTCAP_SMPS		0x000c	/* SM Power Save mode */
609 #define	IEEE80211_HTCAP_SMPS_OFF	0x0000	/* none (static mode) */
610 #define	IEEE80211_HTCAP_SMPS_DYNAMIC	0x0004	/* send RTS first */
611 /* NB: SMPS value 2 is reserved */
612 #define	IEEE80211_HTCAP_SMPS_ENA	0x000c	/* enabled */
613 #define	IEEE80211_HTCAP_GREENFIELD	0x0010	/* Greenfield supported */
614 #define	IEEE80211_HTCAP_SHORTGI20	0x0020	/* Short GI in 20MHz */
615 #define	IEEE80211_HTCAP_SHORTGI40	0x0040	/* Short GI in 40MHz */
616 #define	IEEE80211_HTCAP_TXSTBC		0x0080	/* STBC tx ok */
617 #define	IEEE80211_HTCAP_RXSTBC		0x0300  /* STBC rx support */
618 #define	IEEE80211_HTCAP_RXSTBC_S	8
619 #define	IEEE80211_HTCAP_RXSTBC_1STREAM	0x0100  /* 1 spatial stream */
620 #define	IEEE80211_HTCAP_RXSTBC_2STREAM	0x0200  /* 1-2 spatial streams */
621 #define	IEEE80211_HTCAP_RXSTBC_3STREAM	0x0300  /* 1-3 spatial streams */
622 #define	IEEE80211_HTCAP_DELBA		0x0400	/* HT DELBA supported */
623 #define	IEEE80211_HTCAP_MAXAMSDU	0x0800	/* max A-MSDU length */
624 #define	IEEE80211_HTCAP_MAXAMSDU_7935	0x0800	/* 7935 octets */
625 #define	IEEE80211_HTCAP_MAXAMSDU_3839	0x0000	/* 3839 octets */
626 #define	IEEE80211_HTCAP_DSSSCCK40	0x1000  /* DSSS/CCK in 40MHz */
627 #define	IEEE80211_HTCAP_PSMP		0x2000  /* PSMP supported */
628 #define	IEEE80211_HTCAP_40INTOLERANT	0x4000  /* 40MHz intolerant */
629 #define	IEEE80211_HTCAP_LSIGTXOPPROT	0x8000  /* L-SIG TXOP prot */
630 
631 /* HT parameters (hc_param) */
632 #define	IEEE80211_HTCAP_MAXRXAMPDU	0x03	/* max rx A-MPDU factor */
633 #define	IEEE80211_HTCAP_MAXRXAMPDU_S	0
634 #define	IEEE80211_HTCAP_MAXRXAMPDU_8K	0
635 #define	IEEE80211_HTCAP_MAXRXAMPDU_16K	1
636 #define	IEEE80211_HTCAP_MAXRXAMPDU_32K	2
637 #define	IEEE80211_HTCAP_MAXRXAMPDU_64K	3
638 #define	IEEE80211_HTCAP_MPDUDENSITY	0x1c	/* min MPDU start spacing */
639 #define	IEEE80211_HTCAP_MPDUDENSITY_S	2
640 #define	IEEE80211_HTCAP_MPDUDENSITY_NA	0	/* no time restriction */
641 #define	IEEE80211_HTCAP_MPDUDENSITY_025	1	/* 1/4 us */
642 #define	IEEE80211_HTCAP_MPDUDENSITY_05	2	/* 1/2 us */
643 #define	IEEE80211_HTCAP_MPDUDENSITY_1	3	/* 1 us */
644 #define	IEEE80211_HTCAP_MPDUDENSITY_2	4	/* 2 us */
645 #define	IEEE80211_HTCAP_MPDUDENSITY_4	5	/* 4 us */
646 #define	IEEE80211_HTCAP_MPDUDENSITY_8	6	/* 8 us */
647 #define	IEEE80211_HTCAP_MPDUDENSITY_16	7	/* 16 us */
648 
649 /* HT extended capabilities (hc_extcap) */
650 #define	IEEE80211_HTCAP_PCO		0x0001	/* PCO capable */
651 #define	IEEE80211_HTCAP_PCOTRANS	0x0006	/* PCO transition time */
652 #define	IEEE80211_HTCAP_PCOTRANS_S	1
653 #define	IEEE80211_HTCAP_PCOTRANS_04	0x0002	/* 400 us */
654 #define	IEEE80211_HTCAP_PCOTRANS_15	0x0004	/* 1.5 ms */
655 #define	IEEE80211_HTCAP_PCOTRANS_5	0x0006	/* 5 ms */
656 /* bits 3-7 reserved */
657 #define	IEEE80211_HTCAP_MCSFBACK	0x0300	/* MCS feedback */
658 #define	IEEE80211_HTCAP_MCSFBACK_S	8
659 #define	IEEE80211_HTCAP_MCSFBACK_NONE	0x0000	/* nothing provided */
660 #define	IEEE80211_HTCAP_MCSFBACK_UNSOL	0x0200	/* unsolicited feedback */
661 #define	IEEE80211_HTCAP_MCSFBACK_MRQ	0x0300	/* " "+respond to MRQ */
662 #define	IEEE80211_HTCAP_HTC		0x0400	/* +HTC support */
663 #define	IEEE80211_HTCAP_RDR		0x0800
664 					/* reverse direction responder */
665 /* bits 12-15 reserved */
666 
667 /* byte1 */
668 #define	IEEE80211_HTINFO_2NDCHAN	0x03	/* secondary/ext chan offset */
669 #define	IEEE80211_HTINFO_2NDCHAN_S	0
670 #define	IEEE80211_HTINFO_2NDCHAN_NONE	0x00	/* no secondary/ext channel */
671 #define	IEEE80211_HTINFO_2NDCHAN_ABOVE	0x01	/* above private channel */
672 /* NB: 2 is reserved */
673 #define	IEEE80211_HTINFO_2NDCHAN_BELOW	0x03	/* below primary channel */
674 #define	IEEE80211_HTINFO_TXWIDTH	0x04	/* tx channel width */
675 #define	IEEE80211_HTINFO_TXWIDTH_20	0x00	/* 20MHz width */
676 #define	IEEE80211_HTINFO_TXWIDTH_2040	0x04	/* any supported width */
677 #define	IEEE80211_HTINFO_RIFSMODE	0x08	/* Reduced IFS (RIFS) use */
678 #define	IEEE80211_HTINFO_RIFSMODE_PROH	0x00	/* RIFS use prohibited */
679 #define	IEEE80211_HTINFO_RIFSMODE_PERM	0x08	/* RIFS use permitted */
680 #define	IEEE80211_HTINFO_PMSPONLY	0x10	/* PSMP required to associate */
681 #define	IEEE80211_HTINFO_SIGRAN		0xe0	/* shortest Service Interval */
682 #define	IEEE80211_HTINFO_SIGRAN_S	5
683 #define	IEEE80211_HTINFO_SIGRAN_5	0x00	/* 5 ms */
684 /* XXX add rest */
685 
686 /* bytes 2+3 */
687 #define	IEEE80211_HTINFO_OPMODE		0x03	/* operating mode */
688 #define	IEEE80211_HTINFO_OPMODE_S	0
689 #define	IEEE80211_HTINFO_OPMODE_PURE	0x00	/* no protection */
690 #define	IEEE80211_HTINFO_OPMODE_PROTOPT	0x01	/* protection optional */
691 #define	IEEE80211_HTINFO_OPMODE_HT20PR	0x02	/* protection for HT20 sta's */
692 #define	IEEE80211_HTINFO_OPMODE_MIXED	0x03	/* protection for legacy sta */
693 #define	IEEE80211_HTINFO_NONGF_PRESENT	0x04	/* non-GF sta's present */
694 #define	IEEE80211_HTINFO_TXBL		0x08	/* transmit burst limit */
695 #define	IEEE80211_HTINFO_NONHT_PRESENT	0x10	/* non-HT sta's present */
696 /* bits 5-15 reserved */
697 
698 /* bytes 4+5 */
699 #define	IEEE80211_HTINFO_2NDARYBEACON	0x01
700 #define	IEEE80211_HTINFO_LSIGTXOPPROT	0x02
701 #define	IEEE80211_HTINFO_PCO_ACTIVE	0x04
702 #define	IEEE80211_HTINFO_40MHZPHASE	0x08
703 
704 /* byte5 */
705 #define	IEEE80211_HTINFO_BASIC_STBCMCS	0x7f
706 #define	IEEE80211_HTINFO_BASIC_STBCMCS_S 0
707 #define	IEEE80211_HTINFO_DUALPROTECTED	0x80
708 
709 /*
710  * Length of management frame information elements containing
711  * a variable-length component is:
712  *    element_id(1 byte) + length(1 byte) + component(variable bytes)
713  */
714 #define	IEEE80211_ELEM_LEN(complen)		(2 + (complen))
715 
716 /*
717  * minimal length of beacon/probe response frame elements
718  *  time stamp[8] + beacon interval[2] + capability[2]
719  */
720 #define	IEEE80211_BEACON_ELEM_MIN		12
721 /*
722  * Minimal length of authentication frame elements
723  *    algorithm[2] + sequence[2] + status[2]
724  */
725 #define	IEEE80211_AUTH_ELEM_MIN			6
726 /*
727  * Minimal length of association response frame elements
728  *    capability[2] + status[2] + association ID[2]
729  */
730 #define	IEEE80211_ASSOC_RESP_ELEM_MIN		6
731 
732 #define	IEEE80211_CAPINFO_ESS			0x0001
733 #define	IEEE80211_CAPINFO_IBSS			0x0002
734 #define	IEEE80211_CAPINFO_CF_POLLABLE		0x0004
735 #define	IEEE80211_CAPINFO_CF_POLLREQ		0x0008
736 #define	IEEE80211_CAPINFO_PRIVACY		0x0010
737 #define	IEEE80211_CAPINFO_SHORT_PREAMBLE	0x0020
738 #define	IEEE80211_CAPINFO_PBCC			0x0040
739 #define	IEEE80211_CAPINFO_CHNL_AGILITY		0x0080
740 #define	IEEE80211_CAPINFO_SPECTRUM_MGMT		0x0100
741 /* bits 8-9 are reserved */
742 #define	IEEE80211_CAPINFO_SHORT_SLOTTIME	0x0400
743 #define	IEEE80211_CAPINFO_RSN			0x0800
744 /* bit 12 is reserved */
745 #define	IEEE80211_CAPINFO_DSSSOFDM		0x2000
746 /* bits 14-15 are reserved */
747 
748 /*
749  * Management information element payloads.
750  */
751 
752 enum {
753 	IEEE80211_ELEMID_SSID			= 0,
754 	IEEE80211_ELEMID_RATES			= 1,
755 	IEEE80211_ELEMID_FHPARMS		= 2,
756 	IEEE80211_ELEMID_DSPARMS		= 3,
757 	IEEE80211_ELEMID_CFPARMS		= 4,
758 	IEEE80211_ELEMID_TIM			= 5,
759 	IEEE80211_ELEMID_IBSSPARMS		= 6,
760 	IEEE80211_ELEMID_COUNTRY		= 7,
761 	IEEE80211_ELEMID_CHALLENGE		= 16,
762 	/* 17-31 reserved for challenge text extension */
763 	IEEE80211_ELEMID_PWRCNSTR		= 32,
764 	IEEE80211_ELEMID_PWRCAP			= 33,
765 	IEEE80211_ELEMID_TPCREQ			= 34,
766 	IEEE80211_ELEMID_TPCREP			= 35,
767 	IEEE80211_ELEMID_SUPPCHAN		= 36,
768 	IEEE80211_ELEMID_CHANSWITCHANN		= 37,
769 	IEEE80211_ELEMID_MEASREQ		= 38,
770 	IEEE80211_ELEMID_MEASREP		= 39,
771 	IEEE80211_ELEMID_QUIET			= 40,
772 	IEEE80211_ELEMID_IBSSDFS		= 41,
773 	IEEE80211_ELEMID_ERP			= 42,
774 	IEEE80211_ELEMID_HTCAP			= 45,
775 	IEEE80211_ELEMID_RSN			= 48,
776 	IEEE80211_ELEMID_XRATES			= 50,
777 	IEEE80211_ELEMID_HTINFO			= 61,
778 	/* 128-129 proprietary elements used by Agere chipsets */
779 	IEEE80211_ELEMID_AGERE1			= 128,
780 	IEEE80211_ELEMID_AGERE2			= 129,
781 	IEEE80211_ELEMID_TPC			= 150,
782 	IEEE80211_ELEMID_CCKM			= 156,
783 	IEEE80211_ELEMID_VENDOR			= 221	/* vendor private */
784 };
785 
786 #define	BCM_OUI			0x4c9000	/* Broadcom OUI */
787 #define	BCM_OUI_HTCAP		51		/* pre-draft HTCAP ie */
788 #define	BCM_OUI_HTINFO		52		/* pre-draft HTINFO ie */
789 
790 #define	WPA_OUI			0xf25000
791 #define	WPA_OUI_TYPE		0x01
792 #define	WPA_VERSION		1		/* current supported version */
793 
794 #define	IEEE80211_CHALLENGE_LEN			128
795 
796 #define	IEEE80211_RATE_BASIC			0x80
797 #define	IEEE80211_RATE_VAL			0x7f
798 
799 /* EPR information element flags */
800 #define	IEEE80211_ERP_NON_ERP_PRESENT		0x01
801 #define	IEEE80211_ERP_USE_PROTECTION		0x02
802 #define	IEEE80211_ERP_LONG_PREAMBLE		0x04
803 
804 #define	IEEE80211_AUTH_ALG_OPEN			0x0000
805 #define	IEEE80211_AUTH_ALG_SHARED		0x0001
806 #define	IEEE80211_AUTH_ALG_LEAP			0x0080
807 
808 
809 enum {
810 	IEEE80211_AUTH_OPEN_REQUEST		= 1,
811 	IEEE80211_AUTH_OPEN_RESPONSE		= 2
812 };
813 
814 enum {
815 	IEEE80211_AUTH_SHARED_REQUEST		= 1,
816 	IEEE80211_AUTH_SHARED_CHALLENGE		= 2,
817 	IEEE80211_AUTH_SHARED_RESPONSE		= 3,
818 	IEEE80211_AUTH_SHARED_PASS		= 4
819 };
820 
821 /*
822  * Reason codes
823  *
824  * Unlisted codes are reserved
825  */
826 enum {
827 	IEEE80211_REASON_UNSPECIFIED		= 1,
828 	IEEE80211_REASON_AUTH_EXPIRE		= 2,
829 	IEEE80211_REASON_AUTH_LEAVE		= 3,
830 	IEEE80211_REASON_ASSOC_EXPIRE		= 4,
831 	IEEE80211_REASON_ASSOC_TOOMANY		= 5,
832 	IEEE80211_REASON_NOT_AUTHED		= 6,
833 	IEEE80211_REASON_NOT_ASSOCED		= 7,
834 	IEEE80211_REASON_ASSOC_LEAVE		= 8,
835 	IEEE80211_REASON_ASSOC_NOT_AUTHED	= 9,
836 	IEEE80211_REASON_DISASSOC_PWRCAP_BAD	= 10,	/* 11h */
837 	IEEE80211_REASON_DISASSOC_SUPCHAN_BAD	= 11,	/* 11h */
838 	IEEE80211_REASON_IE_INVALID		= 13,	/* 11i */
839 	IEEE80211_REASON_MIC_FAILURE		= 14,	/* 11i */
840 	IEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT	= 15,	/* 11i */
841 	IEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,	/* 11i */
842 	IEEE80211_REASON_IE_IN_4WAY_DIFFERS	= 17,	/* 11i */
843 	IEEE80211_REASON_GROUP_CIPHER_INVALID	= 18,	/* 11i */
844 	IEEE80211_REASON_PAIRWISE_CIPHER_INVALID = 19,	/* 11i */
845 	IEEE80211_REASON_AKMP_INVALID		= 20,	/* 11i */
846 	IEEE80211_REASON_UNSUPP_RSN_IE_VERSION	= 21,	/* 11i */
847 	IEEE80211_REASON_INVALID_RSN_IE_CAP	= 22,	/* 11i */
848 	IEEE80211_REASON_802_1X_AUTH_FAILED	= 23,	/* 11i */
849 	IEEE80211_REASON_CIPHER_SUITE_REJECTED	= 24	/* 11i */
850 };
851 
852 /*
853  * Status codes
854  *
855  * Unlisted codes are reserved and unused
856  */
857 enum {
858 	IEEE80211_STATUS_SUCCESS		= 0,
859 	IEEE80211_STATUS_UNSPECIFIED		= 1,
860 	IEEE80211_STATUS_CAPINFO		= 10,
861 	IEEE80211_STATUS_NOT_ASSOCED		= 11,
862 	IEEE80211_STATUS_OTHER			= 12,
863 	IEEE80211_STATUS_ALG			= 13,
864 	IEEE80211_STATUS_SEQUENCE		= 14,
865 	IEEE80211_STATUS_CHALLENGE		= 15,
866 	IEEE80211_STATUS_TIMEOUT		= 16,
867 	IEEE80211_STATUS_TOOMANY		= 17,
868 	IEEE80211_STATUS_BASIC_RATE		= 18,
869 	IEEE80211_STATUS_SP_REQUIRED		= 19,	/* 11b */
870 	IEEE80211_STATUS_PBCC_REQUIRED		= 20,	/* 11b */
871 	IEEE80211_STATUS_CA_REQUIRED		= 21,	/* 11b */
872 	IEEE80211_STATUS_SPECMGMT_REQUIRED	= 22,	/* 11h */
873 	IEEE80211_STATUS_PWRCAP_REQUIRED	= 23,	/* 11h */
874 	IEEE80211_STATUS_SUPCHAN_REQUIRED	= 24,	/* 11h */
875 	IEEE80211_STATUS_SHORTSLOT_REQUIRED	= 25,	/* 11g */
876 	IEEE80211_STATUS_DSSSOFDM_REQUIRED	= 26,	/* 11g */
877 	IEEE80211_STATUS_INVALID_IE		= 40,	/* 11i */
878 	IEEE80211_STATUS_GROUP_CIPHER_INVALID	= 41,	/* 11i */
879 	IEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42,	/* 11i */
880 	IEEE80211_STATUS_AKMP_INVALID		= 43,	/* 11i */
881 	IEEE80211_STATUS_UNSUPP_RSN_IE_VERSION	= 44,	/* 11i */
882 	IEEE80211_STATUS_INVALID_RSN_IE_CAP	= 45,	/* 11i */
883 	IEEE80211_STATUS_CIPHER_SUITE_REJECTED	= 46	/* 11i */
884 };
885 
886 #define	IEEE80211_WEP_KEYLEN		5	/* 40bit */
887 #define	IEEE80211_WEP_IVLEN		3	/* 24bit */
888 #define	IEEE80211_WEP_KIDLEN		1	/* 1 octet */
889 #define	IEEE80211_WEP_CRCLEN		4	/* CRC-32 */
890 #define	IEEE80211_WEP_NKID		4	/* number of key ids */
891 
892 /*
893  * 802.11i defines an extended IV for use with non-WEP ciphers.
894  * When the EXTIV bit is set in the key id byte an additional
895  * 4 bytes immediately follow the IV for TKIP.  For CCMP the
896  * EXTIV bit is likewise set but the 8 bytes represent the
897  * CCMP header rather than IV+extended-IV.
898  */
899 #define	IEEE80211_WEP_EXTIV		0x20
900 #define	IEEE80211_WEP_EXTIVLEN		4	/* extended IV length */
901 #define	IEEE80211_WEP_MICLEN		8	/* trailing MIC */
902 
903 #define	IEEE80211_CRC_LEN		4
904 
905 /*
906  * Maximum acceptable MTU is defined by 802.11
907  * Min is arbitrarily chosen > IEEE80211_MIN_LEN.
908  */
909 #define	IEEE80211_MTU_MAX		2304
910 #define	IEEE80211_MTU_MIN		32
911 #define	IEEE80211_MTU			1500
912 
913 #define	IEEE80211_MAX_LEN				\
914 	(sizeof (struct ieee80211_frame_addr4) +	\
915 	(IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN) + \
916 	IEEE80211_MTU_MAX + IEEE80211_CRC_LEN)
917 #define	IEEE80211_ACK_LEN				\
918 	(sizeof (struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
919 #define	IEEE80211_MIN_LEN				\
920 	(sizeof (struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
921 
922 /*
923  * The 802.11 spec says at most 2007 stations may be
924  * associated at once.  For most AP's this is way more
925  * than is feasible so we use a default of 128.  This
926  * number may be overridden by the driver and/or by
927  * user configuration.
928  */
929 #define	IEEE80211_AID_MAX		2007
930 #define	IEEE80211_AID_DEF		128
931 
932 #define	IEEE80211_AID(b)		((b) &~ 0xc000)
933 
934 /*
935  * RTS frame length parameters.  The default is specified in
936  * the 802.11 spec as 512; we treat it as implementation-dependent
937  * so it's defined in ieee80211_var.h.  The max may be wrong
938  * for jumbo frames.
939  */
940 #define	IEEE80211_RTS_MIN		1
941 #define	IEEE80211_RTS_MAX		2346
942 
943 /*
944  * TX fragmentation parameters.  As above for RTS, we treat
945  * default as implementation-dependent so define it elsewhere.
946  */
947 #define	IEEE80211_FRAG_MIN		256
948 #define	IEEE80211_FRAG_MAX		2346
949 
950 /* flags for ieee80211_fix_rate() */
951 #define	IEEE80211_F_DOSORT		0x00000001 /* sort rate list */
952 #define	IEEE80211_F_DOFRATE		0x00000002 /* use fixed rate */
953 #define	IEEE80211_F_DONEGO		0x00000004 /* calc negotiated rate */
954 #define	IEEE80211_F_DODEL		0x00000008 /* delete ignore rate */
955 #define	IEEE80211_F_DOBRS		0x00000010 /* check basic rate set */
956 #define	IEEE80211_F_JOIN		0x00000020 /* sta joining our bss */
957 
958 /*
959  * Beacon frames constructed by ieee80211_beacon_alloc
960  * have the following structure filled in so drivers
961  * can update the frame later w/ minimal overhead.
962  */
963 struct ieee80211_beacon_offsets {
964 	uint16_t	*bo_caps;	/* capabilities */
965 	uint8_t		*bo_tim;	/* start of atim/dtim */
966 	uint8_t		*bo_wme;	/* start of WME parameters */
967 	uint8_t		*bo_trailer;	/* start of fixed-size trailer */
968 	uint16_t	bo_tim_len;	/* atim/dtim length in bytes */
969 	uint16_t	bo_trailer_len;	/* trailer length in bytes */
970 	uint8_t		*bo_erp;	/* start of ERP element */
971 	uint8_t		*bo_htinfo;	/* start of HT info element */
972 };
973 
974 #ifdef	__cplusplus
975 }
976 #endif
977 
978 #endif	/* _SYS_NET80211_PROTO_H */
979