_ieee80211.h revision 219606
1138568Ssam/*-
2138568Ssam * Copyright (c) 2001 Atsushi Onoe
3178354Ssam * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
4138568Ssam * All rights reserved.
5138568Ssam *
6138568Ssam * Redistribution and use in source and binary forms, with or without
7138568Ssam * modification, are permitted provided that the following conditions
8138568Ssam * are met:
9138568Ssam * 1. Redistributions of source code must retain the above copyright
10138568Ssam *    notice, this list of conditions and the following disclaimer.
11138568Ssam * 2. Redistributions in binary form must reproduce the above copyright
12138568Ssam *    notice, this list of conditions and the following disclaimer in the
13138568Ssam *    documentation and/or other materials provided with the distribution.
14138568Ssam *
15138568Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16138568Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17138568Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18138568Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19138568Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20138568Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21138568Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22138568Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23138568Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24138568Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25138568Ssam *
26138568Ssam * $FreeBSD: head/sys/net80211/_ieee80211.h 219606 2011-03-13 13:05:50Z bschmidt $
27138568Ssam */
28138568Ssam#ifndef _NET80211__IEEE80211_H_
29138568Ssam#define _NET80211__IEEE80211_H_
30138568Ssam
31178354Ssam/*
32178354Ssam * 802.11 implementation definitions.
33178354Ssam *
34178354Ssam * NB: this file is used by applications.
35178354Ssam */
36178354Ssam
37178354Ssam/*
38178354Ssam * PHY type; mostly used to identify FH phys.
39178354Ssam */
40138568Ssamenum ieee80211_phytype {
41138568Ssam	IEEE80211_T_DS,			/* direct sequence spread spectrum */
42138568Ssam	IEEE80211_T_FH,			/* frequency hopping */
43138568Ssam	IEEE80211_T_OFDM,		/* frequency division multiplexing */
44138568Ssam	IEEE80211_T_TURBO,		/* high rate OFDM, aka turbo mode */
45178354Ssam	IEEE80211_T_HT,			/* high throughput */
46188772Ssam	IEEE80211_T_OFDM_HALF,		/* 1/2 rate OFDM */
47188772Ssam	IEEE80211_T_OFDM_QUARTER,	/* 1/4 rate OFDM */
48138568Ssam};
49138568Ssam#define	IEEE80211_T_CCK	IEEE80211_T_DS	/* more common nomenclature */
50138568Ssam
51178354Ssam/*
52178354Ssam * PHY mode; this is not really a mode as multi-mode devices
53178354Ssam * have multiple PHY's.  Mode is mostly used as a shorthand
54178354Ssam * for constraining which channels to consider in setting up
55178354Ssam * operation.  Modes used to be used more extensively when
56178354Ssam * channels were identified as IEEE channel numbers.
57178354Ssam */
58138568Ssamenum ieee80211_phymode {
59138568Ssam	IEEE80211_MODE_AUTO	= 0,	/* autoselect */
60138568Ssam	IEEE80211_MODE_11A	= 1,	/* 5GHz, OFDM */
61138568Ssam	IEEE80211_MODE_11B	= 2,	/* 2GHz, CCK */
62138568Ssam	IEEE80211_MODE_11G	= 3,	/* 2GHz, OFDM */
63138568Ssam	IEEE80211_MODE_FH	= 4,	/* 2GHz, GFSK */
64138568Ssam	IEEE80211_MODE_TURBO_A	= 5,	/* 5GHz, OFDM, 2x clock */
65138568Ssam	IEEE80211_MODE_TURBO_G	= 6,	/* 2GHz, OFDM, 2x clock */
66170530Ssam	IEEE80211_MODE_STURBO_A	= 7,	/* 5GHz, OFDM, 2x clock, static */
67170530Ssam	IEEE80211_MODE_11NA	= 8,	/* 5GHz, w/ HT */
68170530Ssam	IEEE80211_MODE_11NG	= 9,	/* 2GHz, w/ HT */
69188782Ssam	IEEE80211_MODE_HALF	= 10,	/* OFDM, 1/2x clock */
70188782Ssam	IEEE80211_MODE_QUARTER	= 11,	/* OFDM, 1/4x clock */
71138568Ssam};
72188782Ssam#define	IEEE80211_MODE_MAX	(IEEE80211_MODE_QUARTER+1)
73138568Ssam
74178354Ssam/*
75178354Ssam * Operating mode.  Devices do not necessarily support
76178354Ssam * all modes; they indicate which are supported in their
77178354Ssam * capabilities.
78178354Ssam */
79138568Ssamenum ieee80211_opmode {
80178354Ssam	IEEE80211_M_IBSS 	= 0,	/* IBSS (adhoc) station */
81138568Ssam	IEEE80211_M_STA		= 1,	/* infrastructure station */
82178354Ssam	IEEE80211_M_WDS		= 2,	/* WDS link */
83138568Ssam	IEEE80211_M_AHDEMO	= 3,	/* Old lucent compatible adhoc demo */
84178354Ssam	IEEE80211_M_HOSTAP	= 4,	/* Software Access Point */
85178354Ssam	IEEE80211_M_MONITOR	= 5,	/* Monitor mode */
86195618Srpaulo	IEEE80211_M_MBSS	= 6,	/* MBSS (Mesh Point) link */
87138568Ssam};
88195618Srpaulo#define	IEEE80211_OPMODE_MAX	(IEEE80211_M_MBSS+1)
89138568Ssam
90138568Ssam/*
91170530Ssam * 802.11g/802.11n protection mode.
92138568Ssam */
93138568Ssamenum ieee80211_protmode {
94138568Ssam	IEEE80211_PROT_NONE	= 0,	/* no protection */
95138568Ssam	IEEE80211_PROT_CTSONLY	= 1,	/* CTS to self */
96138568Ssam	IEEE80211_PROT_RTSCTS	= 2,	/* RTS-CTS */
97138568Ssam};
98138568Ssam
99138568Ssam/*
100178354Ssam * Authentication mode.  The open and shared key authentication
101178354Ssam * modes are implemented within the 802.11 layer.  802.1x and
102178354Ssam * WPA/802.11i are implemented in user mode by setting the
103178354Ssam * 802.11 layer into IEEE80211_AUTH_8021X and deferring
104178354Ssam * authentication to user space programs.
105138568Ssam */
106138568Ssamenum ieee80211_authmode {
107138568Ssam	IEEE80211_AUTH_NONE	= 0,
108138568Ssam	IEEE80211_AUTH_OPEN	= 1,		/* open */
109138568Ssam	IEEE80211_AUTH_SHARED	= 2,		/* shared-key */
110138568Ssam	IEEE80211_AUTH_8021X	= 3,		/* 802.1x */
111138568Ssam	IEEE80211_AUTH_AUTO	= 4,		/* auto-select/accept */
112138568Ssam	/* NB: these are used only for ioctls */
113138568Ssam	IEEE80211_AUTH_WPA	= 5,		/* WPA/RSN w/ 802.1x/PSK */
114138568Ssam};
115138568Ssam
116138568Ssam/*
117138568Ssam * Roaming mode is effectively who controls the operation
118138568Ssam * of the 802.11 state machine when operating as a station.
119138568Ssam * State transitions are controlled either by the driver
120138568Ssam * (typically when management frames are processed by the
121138568Ssam * hardware/firmware), the host (auto/normal operation of
122138568Ssam * the 802.11 layer), or explicitly through ioctl requests
123138568Ssam * when applications like wpa_supplicant want control.
124138568Ssam */
125138568Ssamenum ieee80211_roamingmode {
126138568Ssam	IEEE80211_ROAMING_DEVICE= 0,	/* driver/hardware control */
127138568Ssam	IEEE80211_ROAMING_AUTO	= 1,	/* 802.11 layer control */
128138568Ssam	IEEE80211_ROAMING_MANUAL= 2,	/* application control */
129138568Ssam};
130138568Ssam
131138568Ssam/*
132138568Ssam * Channels are specified by frequency and attributes.
133138568Ssam */
134138568Ssamstruct ieee80211_channel {
135170530Ssam	uint32_t	ic_flags;	/* see below */
136219606Sbschmidt	uint16_t	ic_freq;	/* setting in MHz */
137170530Ssam	uint8_t		ic_ieee;	/* IEEE channel number */
138170530Ssam	int8_t		ic_maxregpower;	/* maximum regulatory tx power in dBm */
139170530Ssam	int8_t		ic_maxpower;	/* maximum tx power in .5 dBm */
140170530Ssam	int8_t		ic_minpower;	/* minimum tx power in .5 dBm */
141172056Ssam	uint8_t		ic_state;	/* dynamic state */
142172056Ssam	uint8_t		ic_extieee;	/* HT40 extension channel number */
143187803Ssam	int8_t		ic_maxantgain;	/* maximum antenna gain in .5 dBm */
144187803Ssam	uint8_t		ic_pad;
145187803Ssam	uint16_t	ic_devdata;	/* opaque device/driver data */
146138568Ssam};
147138568Ssam
148186107Ssam#define	IEEE80211_CHAN_MAX	256
149138568Ssam#define	IEEE80211_CHAN_BYTES	32	/* howmany(IEEE80211_CHAN_MAX, NBBY) */
150138568Ssam#define	IEEE80211_CHAN_ANY	0xffff	/* token for ``any channel'' */
151138568Ssam#define	IEEE80211_CHAN_ANYC \
152138568Ssam	((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
153138568Ssam
154138568Ssam/* channel attributes */
155187634Ssam#define	IEEE80211_CHAN_PRIV0	0x00000001 /* driver private bit 0 */
156187634Ssam#define	IEEE80211_CHAN_PRIV1	0x00000002 /* driver private bit 1 */
157187634Ssam#define	IEEE80211_CHAN_PRIV2	0x00000004 /* driver private bit 2 */
158187634Ssam#define	IEEE80211_CHAN_PRIV3	0x00000008 /* driver private bit 3 */
159172056Ssam#define	IEEE80211_CHAN_TURBO	0x00000010 /* Turbo channel */
160172056Ssam#define	IEEE80211_CHAN_CCK	0x00000020 /* CCK channel */
161172056Ssam#define	IEEE80211_CHAN_OFDM	0x00000040 /* OFDM channel */
162172056Ssam#define	IEEE80211_CHAN_2GHZ	0x00000080 /* 2 GHz spectrum channel. */
163172056Ssam#define	IEEE80211_CHAN_5GHZ	0x00000100 /* 5 GHz spectrum channel */
164172056Ssam#define	IEEE80211_CHAN_PASSIVE	0x00000200 /* Only passive scan allowed */
165172056Ssam#define	IEEE80211_CHAN_DYN	0x00000400 /* Dynamic CCK-OFDM channel */
166172056Ssam#define	IEEE80211_CHAN_GFSK	0x00000800 /* GFSK channel (FHSS PHY) */
167172056Ssam#define	IEEE80211_CHAN_GSM	0x00001000 /* 900 MHz spectrum channel */
168172056Ssam#define	IEEE80211_CHAN_STURBO	0x00002000 /* 11a static turbo channel only */
169172056Ssam#define	IEEE80211_CHAN_HALF	0x00004000 /* Half rate channel */
170172056Ssam#define	IEEE80211_CHAN_QUARTER	0x00008000 /* Quarter rate channel */
171172056Ssam#define	IEEE80211_CHAN_HT20	0x00010000 /* HT 20 channel */
172172056Ssam#define	IEEE80211_CHAN_HT40U	0x00020000 /* HT 40 channel w/ ext above */
173172056Ssam#define	IEEE80211_CHAN_HT40D	0x00040000 /* HT 40 channel w/ ext below */
174172056Ssam#define	IEEE80211_CHAN_DFS	0x00080000 /* DFS required */
175172056Ssam#define	IEEE80211_CHAN_4MSXMIT	0x00100000 /* 4ms limit on frame length */
176172056Ssam#define	IEEE80211_CHAN_NOADHOC	0x00200000 /* adhoc mode not allowed */
177172056Ssam#define	IEEE80211_CHAN_NOHOSTAP	0x00400000 /* hostap mode not allowed */
178172056Ssam#define	IEEE80211_CHAN_11D	0x00800000 /* 802.11d required */
179138568Ssam
180170530Ssam#define	IEEE80211_CHAN_HT40	(IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)
181170530Ssam#define	IEEE80211_CHAN_HT	(IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40)
182170530Ssam
183187797Ssam#define	IEEE80211_CHAN_BITS \
184187797Ssam	"\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \
185187797Ssam	"\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \
186187797Ssam	"\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D"
187187797Ssam
188138568Ssam/*
189138568Ssam * Useful combinations of channel characteristics.
190138568Ssam */
191138568Ssam#define	IEEE80211_CHAN_FHSS \
192138568Ssam	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
193138568Ssam#define	IEEE80211_CHAN_A \
194138568Ssam	(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
195138568Ssam#define	IEEE80211_CHAN_B \
196138568Ssam	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
197138568Ssam#define	IEEE80211_CHAN_PUREG \
198138568Ssam	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
199138568Ssam#define	IEEE80211_CHAN_G \
200138568Ssam	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
201170530Ssam#define IEEE80211_CHAN_108A \
202187793Ssam	(IEEE80211_CHAN_A | IEEE80211_CHAN_TURBO)
203138568Ssam#define	IEEE80211_CHAN_108G \
204187793Ssam	(IEEE80211_CHAN_PUREG | IEEE80211_CHAN_TURBO)
205170530Ssam#define	IEEE80211_CHAN_ST \
206170530Ssam	(IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO)
207138568Ssam
208153347Ssam#define	IEEE80211_CHAN_ALL \
209153347Ssam	(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
210170530Ssam	 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \
211184269Ssam	 IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER | \
212170530Ssam	 IEEE80211_CHAN_HT)
213153347Ssam#define	IEEE80211_CHAN_ALLTURBO \
214170530Ssam	(IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)
215153347Ssam
216138568Ssam#define	IEEE80211_IS_CHAN_FHSS(_c) \
217138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
218138568Ssam#define	IEEE80211_IS_CHAN_A(_c) \
219138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
220138568Ssam#define	IEEE80211_IS_CHAN_B(_c) \
221138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
222138568Ssam#define	IEEE80211_IS_CHAN_PUREG(_c) \
223138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
224138568Ssam#define	IEEE80211_IS_CHAN_G(_c) \
225138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
226148941Ssam#define	IEEE80211_IS_CHAN_ANYG(_c) \
227148941Ssam	(IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c))
228170530Ssam#define	IEEE80211_IS_CHAN_ST(_c) \
229170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST)
230170530Ssam#define	IEEE80211_IS_CHAN_108A(_c) \
231170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A)
232138568Ssam#define	IEEE80211_IS_CHAN_108G(_c) \
233138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)
234138568Ssam
235138568Ssam#define	IEEE80211_IS_CHAN_2GHZ(_c) \
236138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
237138568Ssam#define	IEEE80211_IS_CHAN_5GHZ(_c) \
238138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
239170530Ssam#define	IEEE80211_IS_CHAN_PASSIVE(_c) \
240170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0)
241138568Ssam#define	IEEE80211_IS_CHAN_OFDM(_c) \
242187794Ssam	(((_c)->ic_flags & (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)) != 0)
243138568Ssam#define	IEEE80211_IS_CHAN_CCK(_c) \
244187794Ssam	(((_c)->ic_flags & (IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN)) != 0)
245138568Ssam#define	IEEE80211_IS_CHAN_GFSK(_c) \
246138568Ssam	(((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
247170530Ssam#define	IEEE80211_IS_CHAN_TURBO(_c) \
248170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0)
249170530Ssam#define	IEEE80211_IS_CHAN_STURBO(_c) \
250170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0)
251170530Ssam#define	IEEE80211_IS_CHAN_DTURBO(_c) \
252170530Ssam	(((_c)->ic_flags & \
253170530Ssam	(IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO)
254165569Ssam#define	IEEE80211_IS_CHAN_HALF(_c) \
255165569Ssam	(((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0)
256165569Ssam#define	IEEE80211_IS_CHAN_QUARTER(_c) \
257165569Ssam	(((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0)
258166012Ssam#define	IEEE80211_IS_CHAN_FULL(_c) \
259166012Ssam	(((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0)
260166012Ssam#define	IEEE80211_IS_CHAN_GSM(_c) \
261166012Ssam	(((_c)->ic_flags & IEEE80211_CHAN_GSM) != 0)
262170530Ssam#define	IEEE80211_IS_CHAN_HT(_c) \
263170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
264170530Ssam#define	IEEE80211_IS_CHAN_HT20(_c) \
265170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_HT20) != 0)
266170530Ssam#define	IEEE80211_IS_CHAN_HT40(_c) \
267170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_HT40) != 0)
268170530Ssam#define	IEEE80211_IS_CHAN_HT40U(_c) \
269170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_HT40U) != 0)
270170530Ssam#define	IEEE80211_IS_CHAN_HT40D(_c) \
271170530Ssam	(((_c)->ic_flags & IEEE80211_CHAN_HT40D) != 0)
272170530Ssam#define	IEEE80211_IS_CHAN_HTA(_c) \
273170530Ssam	(IEEE80211_IS_CHAN_5GHZ(_c) && \
274170530Ssam	 ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
275170530Ssam#define	IEEE80211_IS_CHAN_HTG(_c) \
276170530Ssam	(IEEE80211_IS_CHAN_2GHZ(_c) && \
277170530Ssam	 ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)
278172056Ssam#define	IEEE80211_IS_CHAN_DFS(_c) \
279172056Ssam	(((_c)->ic_flags & IEEE80211_CHAN_DFS) != 0)
280172056Ssam#define	IEEE80211_IS_CHAN_NOADHOC(_c) \
281172056Ssam	(((_c)->ic_flags & IEEE80211_CHAN_NOADHOC) != 0)
282172056Ssam#define	IEEE80211_IS_CHAN_NOHOSTAP(_c) \
283172056Ssam	(((_c)->ic_flags & IEEE80211_CHAN_NOHOSTAP) != 0)
284172056Ssam#define	IEEE80211_IS_CHAN_11D(_c) \
285172056Ssam	(((_c)->ic_flags & IEEE80211_CHAN_11D) != 0)
286138568Ssam
287171124Sthompsa#define	IEEE80211_CHAN2IEEE(_c)		(_c)->ic_ieee
288171124Sthompsa
289172056Ssam/* dynamic state */
290172056Ssam#define	IEEE80211_CHANSTATE_RADAR	0x01	/* radar detected */
291172056Ssam#define	IEEE80211_CHANSTATE_CACDONE	0x02	/* CAC completed */
292187795Ssam#define	IEEE80211_CHANSTATE_CWINT	0x04	/* interference detected */
293172056Ssam#define	IEEE80211_CHANSTATE_NORADAR	0x10	/* post notify on radar clear */
294172056Ssam
295172056Ssam#define	IEEE80211_IS_CHAN_RADAR(_c) \
296172056Ssam	(((_c)->ic_state & IEEE80211_CHANSTATE_RADAR) != 0)
297172056Ssam#define	IEEE80211_IS_CHAN_CACDONE(_c) \
298172056Ssam	(((_c)->ic_state & IEEE80211_CHANSTATE_CACDONE) != 0)
299187795Ssam#define	IEEE80211_IS_CHAN_CWINT(_c) \
300187795Ssam	(((_c)->ic_state & IEEE80211_CHANSTATE_CWINT) != 0)
301172056Ssam
302138568Ssam/* ni_chan encoding for FH phy */
303138568Ssam#define	IEEE80211_FH_CHANMOD	80
304138568Ssam#define	IEEE80211_FH_CHAN(set,pat)	(((set)-1)*IEEE80211_FH_CHANMOD+(pat))
305138568Ssam#define	IEEE80211_FH_CHANSET(chan)	((chan)/IEEE80211_FH_CHANMOD+1)
306138568Ssam#define	IEEE80211_FH_CHANPAT(chan)	((chan)%IEEE80211_FH_CHANMOD)
307138568Ssam
308172225Ssam#define	IEEE80211_TID_SIZE	(WME_NUM_TID+1)	/* WME TID's +1 for non-QoS */
309172225Ssam#define	IEEE80211_NONQOS_TID	WME_NUM_TID	/* index for non-QoS sta */
310172225Ssam
311138568Ssam/*
312178354Ssam * The 802.11 spec says at most 2007 stations may be
313178354Ssam * associated at once.  For most AP's this is way more
314178354Ssam * than is feasible so we use a default of 128.  This
315178354Ssam * number may be overridden by the driver and/or by
316178354Ssam * user configuration but may not be less than IEEE80211_AID_MIN.
317178354Ssam */
318178354Ssam#define	IEEE80211_AID_DEF		128
319178354Ssam#define	IEEE80211_AID_MIN		16
320178354Ssam
321178354Ssam/*
322138568Ssam * 802.11 rate set.
323138568Ssam */
324138568Ssam#define	IEEE80211_RATE_SIZE	8		/* 802.11 standard */
325138568Ssam#define	IEEE80211_RATE_MAXSIZE	15		/* max rates we'll handle */
326138568Ssam
327138568Ssamstruct ieee80211_rateset {
328178354Ssam	uint8_t		rs_nrates;
329178354Ssam	uint8_t		rs_rates[IEEE80211_RATE_MAXSIZE];
330138568Ssam};
331138568Ssam
332170530Ssam/*
333178354Ssam * 802.11n variant of ieee80211_rateset.  Instead of
334170530Ssam * legacy rates the entries are MCS rates.  We define
335170530Ssam * the structure such that it can be used interchangeably
336170530Ssam * with an ieee80211_rateset (modulo structure size).
337170530Ssam */
338219456Sbschmidt#define	IEEE80211_HTRATE_MAXSIZE	77
339170530Ssam
340170530Ssamstruct ieee80211_htrateset {
341178354Ssam	uint8_t		rs_nrates;
342178354Ssam	uint8_t		rs_rates[IEEE80211_HTRATE_MAXSIZE];
343170530Ssam};
344170530Ssam
345172226Ssam#define	IEEE80211_RATE_MCS	0x80
346172226Ssam
347170530Ssam/*
348178354Ssam * Per-mode transmit parameters/controls visible to user space.
349178354Ssam * These can be used to set fixed transmit rate for all operating
350178354Ssam * modes or on a per-client basis according to the capabilities
351178354Ssam * of the client (e.g. an 11b client associated to an 11g ap).
352178354Ssam *
353178354Ssam * MCS are distinguished from legacy rates by or'ing in 0x80.
354170530Ssam */
355178354Ssamstruct ieee80211_txparam {
356178354Ssam	uint8_t		ucastrate;	/* ucast data rate (legacy/MCS|0x80) */
357178354Ssam	uint8_t		mgmtrate;	/* mgmt frame rate (legacy/MCS|0x80) */
358178354Ssam	uint8_t		mcastrate;	/* multicast rate (legacy/MCS|0x80) */
359178354Ssam	uint8_t		maxretry;	/* max unicast data retry count */
360170530Ssam};
361178354Ssam
362178354Ssam/*
363178354Ssam * Per-mode roaming state visible to user space.  There are two
364178354Ssam * thresholds that control whether roaming is considered; when
365178354Ssam * either is exceeded the 802.11 layer will check the scan cache
366178354Ssam * for another AP.  If the cache is stale then a scan may be
367178354Ssam * triggered.
368178354Ssam */
369178354Ssamstruct ieee80211_roamparam {
370178354Ssam	int8_t		rssi;		/* rssi thresh (.5 dBm) */
371178354Ssam	uint8_t		rate;		/* tx rate thresh (.5 Mb/s or MCS) */
372178354Ssam	uint16_t	pad;		/* reserve */
373178354Ssam};
374178354Ssam
375178354Ssam/*
376178354Ssam * Regulatory Information.
377178354Ssam */
378178354Ssamstruct ieee80211_regdomain {
379178354Ssam	uint16_t	regdomain;	/* SKU */
380178354Ssam	uint16_t	country;	/* ISO country code */
381178354Ssam	uint8_t		location;	/* I (indoor), O (outdoor), other */
382178354Ssam	uint8_t		ecm;		/* Extended Channel Mode */
383178354Ssam	char		isocc[2];	/* country code string */
384178354Ssam	short		pad[2];
385178354Ssam};
386178354Ssam
387178354Ssam/*
388178354Ssam * MIMO antenna/radio state.
389178354Ssam */
390178354Ssamstruct ieee80211_mimo_info {
391178354Ssam	int8_t		rssi[3];	/* per-antenna rssi */
392178354Ssam	int8_t		noise[3];	/* per-antenna noise floor */
393194022Ssam	uint8_t		pad[2];
394178354Ssam	uint32_t	evm[3];		/* EVM data */
395178354Ssam};
396138568Ssam#endif /* _NET80211__IEEE80211_H_ */
397