blob: 81ea8b2a52d662807fee33606f80c9c6c444c127 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Kapil Gupta086c6202016-12-11 18:17:06 +05302 * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#ifndef CDS_COMMON__IEEE80211_I_H_
29#define CDS_COMMON__IEEE80211_I_H_
30
Krishna Kumaar Natarajanfa598f92016-03-14 17:19:18 -070031/**
32 * enum ieee80211_phymode - not really a mode; there are really multiple PHY's
33 * @IEEE80211_MODE_AUTO - autoselect
34 * @IEEE80211_MODE_11A - 5GHz, OFDM
35 * @IEEE80211_MODE_11B - 2GHz, CCK
36 * @IEEE80211_MODE_11G - 2GHz, OFDM
37 * @IEEE80211_MODE_FH - 2GHz, GFSK
38 * @IEEE80211_MODE_TURBO_A - 5GHz, OFDM, 2x clock dynamic turbo
39 * @IEEE80211_MODE_TURBO_G - 2GHz, OFDM, 2x clock dynamic turbo
40 * @IEEE80211_MODE_11NA_HT20 - 5Ghz, HT20
41 * @IEEE80211_MODE_11NG_HT20 - 2Ghz, HT20
42 * @IEEE80211_MODE_11NA_HT40PLUS - 5Ghz, HT40 (ext ch +1)
43 * @IEEE80211_MODE_11NA_HT40MINUS - 5Ghz, HT40 (ext ch -1)
44 * @IEEE80211_MODE_11NG_HT40PLUS - 2Ghz, HT40 (ext ch +1)
45 * @IEEE80211_MODE_11NG_HT40MINUS - 2Ghz, HT40 (ext ch -1)
46 * @IEEE80211_MODE_11NG_HT40 - 2Ghz, Auto HT40
47 * @IEEE80211_MODE_11NA_HT40 - 2Ghz, Auto HT40
48 * @IEEE80211_MODE_11AC_VHT20 - 5Ghz, VHT20
49 * @IEEE80211_MODE_11AC_VHT40PLUS - 5Ghz, VHT40 (Ext ch +1)
50 * @IEEE80211_MODE_11AC_VHT40MINUS - 5Ghz VHT40 (Ext ch -1)
51 * @IEEE80211_MODE_11AC_VHT40 - 5Ghz, VHT40
52 * @IEEE80211_MODE_11AC_VHT80 - 5Ghz, VHT80
53 * @IEEE80211_MODE_2G_AUTO - 2G 11 b/g/n autoselect
54 * @IEEE80211_MODE_5G_AUTO - 5G 11 a/n/ac autoselect
55 * @IEEE80211_MODE_11AGN - Support 11N in both 2G and 5G
56 * @IEEE80211_MODE_MAX - Maximum possible value
57 */
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080058enum ieee80211_phymode {
Krishna Kumaar Natarajanfa598f92016-03-14 17:19:18 -070059 IEEE80211_MODE_AUTO = 0,
60 IEEE80211_MODE_11A = 1,
61 IEEE80211_MODE_11B = 2,
62 IEEE80211_MODE_11G = 3,
63 IEEE80211_MODE_FH = 4,
64 IEEE80211_MODE_TURBO_A = 5,
65 IEEE80211_MODE_TURBO_G = 6,
66 IEEE80211_MODE_11NA_HT20 = 7,
67 IEEE80211_MODE_11NG_HT20 = 8,
68 IEEE80211_MODE_11NA_HT40PLUS = 9,
69 IEEE80211_MODE_11NA_HT40MINUS = 10,
70 IEEE80211_MODE_11NG_HT40PLUS = 11,
71 IEEE80211_MODE_11NG_HT40MINUS = 12,
72 IEEE80211_MODE_11NG_HT40 = 13,
73 IEEE80211_MODE_11NA_HT40 = 14,
74 IEEE80211_MODE_11AC_VHT20 = 15,
75 IEEE80211_MODE_11AC_VHT40PLUS = 16,
76 IEEE80211_MODE_11AC_VHT40MINUS = 17,
77 IEEE80211_MODE_11AC_VHT40 = 18,
78 IEEE80211_MODE_11AC_VHT80 = 19,
79 IEEE80211_MODE_2G_AUTO = 20,
80 IEEE80211_MODE_5G_AUTO = 21,
81 IEEE80211_MODE_11AGN = 22,
82
83 /* Do not add after this line */
84 IEEE80211_MODE_MAX = IEEE80211_MODE_11AGN,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080085};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080086
Krishna Kumaar Natarajanfa598f92016-03-14 17:19:18 -070087/**
88 * enum ieee80211_opmode - operating mode
89 * @IEEE80211_M_IBSS - IBSS (adhoc) station
90 * @IEEE80211_M_HOSTAP - Software Access Point
91 * @IEEE80211_OPMODE_MAX = Highest numbered opmode in the list
92 * @IEEE80211_M_ANY - Any of the above; used by NDIS 6.x
93 *
94*/
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080095enum ieee80211_opmode {
Krishna Kumaar Natarajanfa598f92016-03-14 17:19:18 -070096 IEEE80211_M_IBSS = 0,
97 IEEE80211_M_HOSTAP = 6,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080098
Krishna Kumaar Natarajanfa598f92016-03-14 17:19:18 -070099 /* Do not add after this line */
100 IEEE80211_OPMODE_MAX = IEEE80211_M_HOSTAP,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800101
Krishna Kumaar Natarajanfa598f92016-03-14 17:19:18 -0700102 IEEE80211_M_ANY = 0xFF,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800103};
104
105/*
106 * 802.11n
107 */
108#define IEEE80211_CWM_EXTCH_BUSY_THRESHOLD 30
109
110enum ieee80211_cwm_mode {
111 IEEE80211_CWM_MODE20,
112 IEEE80211_CWM_MODE2040,
113 IEEE80211_CWM_MODE40,
114 IEEE80211_CWM_MODEMAX
115};
116
117enum ieee80211_cwm_extprotspacing {
118 IEEE80211_CWM_EXTPROTSPACING20,
119 IEEE80211_CWM_EXTPROTSPACING25,
120 IEEE80211_CWM_EXTPROTSPACINGMAX
121};
122
123enum ieee80211_cwm_width {
124 IEEE80211_CWM_WIDTH20,
125 IEEE80211_CWM_WIDTH40,
126 IEEE80211_CWM_WIDTH80,
127 IEEE80211_CWM_WIDTHINVALID = 0xff /* user invalid value */
128};
129
130enum ieee80211_cwm_extprotmode {
131 IEEE80211_CWM_EXTPROTNONE, /* no protection */
132 IEEE80211_CWM_EXTPROTCTSONLY, /* CTS to self */
133 IEEE80211_CWM_EXTPROTRTSCTS, /* RTS-CTS */
134 IEEE80211_CWM_EXTPROTMAX
135};
136
137enum ieee80211_fixed_rate_mode {
138 IEEE80211_FIXED_RATE_NONE = 0,
139 IEEE80211_FIXED_RATE_MCS = 1, /* HT rates */
140 IEEE80211_FIXED_RATE_LEGACY = 2, /* legacy rates */
141 IEEE80211_FIXED_RATE_VHT = 3 /* VHT rates */
142};
143
144/* Holds the fixed rate information for each VAP */
145struct ieee80211_fixed_rate {
146 enum ieee80211_fixed_rate_mode mode;
147 uint32_t series;
148 uint32_t retries;
149};
150
151/*
152 * 802.11g protection mode.
153 */
154enum ieee80211_protmode {
155 IEEE80211_PROT_NONE = 0, /* no protection */
156 IEEE80211_PROT_CTSONLY = 1, /* CTS to self */
157 IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */
158};
159
160/*
161 * Roaming mode is effectively who controls the operation
162 * of the 802.11 state machine when operating as a station.
163 * State transitions are controlled either by the driver
164 * (typically when management frames are processed by the
165 * hardware/firmware), the host (auto/normal operation of
166 * the 802.11 layer), or explicitly through ioctl requests
167 * when applications like wpa_supplicant want control.
168 */
169enum ieee80211_roamingmode {
170 IEEE80211_ROAMING_DEVICE = 0, /* driver/hardware control */
171 IEEE80211_ROAMING_AUTO = 1, /* 802.11 layer control */
172 IEEE80211_ROAMING_MANUAL = 2, /* application control */
173};
174
175/*
176 * Scanning mode controls station scanning work; this is
177 * used only when roaming mode permits the host to select
178 * the bss to join/channel to use.
179 */
180enum ieee80211_scanmode {
181 IEEE80211_SCAN_DEVICE = 0, /* driver/hardware control */
182 IEEE80211_SCAN_BEST = 1, /* 802.11 layer selects best */
183 IEEE80211_SCAN_FIRST = 2, /* take first suitable candidate */
184};
185
186#define IEEE80211_NWID_LEN 32
187#define IEEE80211_CHAN_MAX 255
188#define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */
189#define IEEE80211_CHAN_ANY (-1) /* token for ``any channel'' */
190#define IEEE80211_CHAN_ANYC \
191 ((struct ieee80211_channel *) IEEE80211_CHAN_ANY)
192
193#define IEEE80211_CHAN_DEFAULT 11
194#define IEEE80211_CHAN_DEFAULT_11A 52
195#define IEEE80211_CHAN_ADHOC_DEFAULT1 10
196#define IEEE80211_CHAN_ADHOC_DEFAULT2 11
197
198#define IEEE80211_RADAR_11HCOUNT 5
199#define IEEE80211_RADAR_TEST_MUTE_CHAN_11A 36 /* Move to channel 36 for mute test */
200#define IEEE80211_RADAR_TEST_MUTE_CHAN_11NHT20 36
201#define IEEE80211_RADAR_TEST_MUTE_CHAN_11NHT40U 36
202#define IEEE80211_RADAR_TEST_MUTE_CHAN_11NHT40D 40 /* Move to channel 40 for HT40D mute test */
203#define IEEE80211_RADAR_DETECT_DEFAULT_DELAY 60000 /* STA ignore AP beacons during this period in millisecond */
204
205#define IEEE80211_2GCSA_TBTTCOUNT 3
206
207/* bits 0-3 are for private use by drivers */
208/* channel attributes */
209#define IEEE80211_CHAN_TURBO 0x00000010 /* Turbo channel */
210#define IEEE80211_CHAN_CCK 0x00000020 /* CCK channel */
211#define IEEE80211_CHAN_OFDM 0x00000040 /* OFDM channel */
212#define IEEE80211_CHAN_2GHZ 0x00000080 /* 2 GHz spectrum channel. */
213#define IEEE80211_CHAN_5GHZ 0x00000100 /* 5 GHz spectrum channel */
214#define IEEE80211_CHAN_PASSIVE 0x00000200 /* Only passive scan allowed */
215#define IEEE80211_CHAN_DYN 0x00000400 /* Dynamic CCK-OFDM channel */
216#define IEEE80211_CHAN_GFSK 0x00000800 /* GFSK channel (FHSS PHY) */
217#define IEEE80211_CHAN_RADAR_DFS 0x00001000 /* Radar found on channel */
218#define IEEE80211_CHAN_STURBO 0x00002000 /* 11a static turbo channel only */
219#define IEEE80211_CHAN_HALF 0x00004000 /* Half rate channel */
220#define IEEE80211_CHAN_QUARTER 0x00008000 /* Quarter rate channel */
221#define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */
222#define IEEE80211_CHAN_HT40PLUS 0x00020000 /* HT 40 with extension channel above */
223#define IEEE80211_CHAN_HT40MINUS 0x00040000 /* HT 40 with extension channel below */
224#define IEEE80211_CHAN_HT40INTOL 0x00080000 /* HT 40 Intolerant */
225#define IEEE80211_CHAN_VHT20 0x00100000 /* VHT 20 channel */
226#define IEEE80211_CHAN_VHT40PLUS 0x00200000 /* VHT 40 with extension channel above */
227#define IEEE80211_CHAN_VHT40MINUS 0x00400000 /* VHT 40 with extension channel below */
228#define IEEE80211_CHAN_VHT80 0x00800000 /* VHT 80 channel */
Kapil Gupta086c6202016-12-11 18:17:06 +0530229/* HT 40 Intolerant mark bit for ACS use */
230#define IEEE80211_CHAN_HT40INTOLMARK 0x01000000
231/* channel temporarily blocked due to noise */
232#define IEEE80211_CHAN_BLOCKED 0x02000000
233/* VHT 160 channel */
234#define IEEE80211_CHAN_VHT160 0x04000000
235/* VHT 80_80 channel */
236#define IEEE80211_CHAN_VHT80_80 0x08000000
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800237
238/* flagext */
239#define IEEE80211_CHAN_RADAR_FOUND 0x01
240#define IEEE80211_CHAN_DFS 0x0002 /* DFS required on channel */
241#define IEEE80211_CHAN_DFS_CLEAR 0x0008 /* if channel has been checked for DFS */
242#define IEEE80211_CHAN_11D_EXCLUDED 0x0010 /* excluded in 11D */
243#define IEEE80211_CHAN_CSA_RECEIVED 0x0020 /* Channel Switch Announcement received on this channel */
244#define IEEE80211_CHAN_DISALLOW_ADHOC 0x0040 /* ad-hoc is not allowed */
245#define IEEE80211_CHAN_DISALLOW_HOSTAP 0x0080 /* Station only channel */
246
247/*
248 * Useful combinations of channel characteristics.
249 */
250#define IEEE80211_CHAN_FHSS \
251 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
252#define IEEE80211_CHAN_A \
253 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
254#define IEEE80211_CHAN_B \
255 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
256#define IEEE80211_CHAN_PUREG \
257 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
258#define IEEE80211_CHAN_G \
259 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
260#define IEEE80211_CHAN_108A \
261 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
262#define IEEE80211_CHAN_108G \
263 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
264#define IEEE80211_CHAN_ST \
265 (IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO)
266
267#define IEEE80211_IS_CHAN_11AC_2G(_c) \
268 (IEEE80211_IS_CHAN_2GHZ((_c)) && IEEE80211_IS_CHAN_VHT((_c)))
269#define IEEE80211_CHAN_11AC_VHT20_2G \
270 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT20)
271#define IEEE80211_CHAN_11AC_VHT40_2G \
272 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS)
273#define IEEE80211_CHAN_11AC_VHT80_2G \
274 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT80)
275
276#define IEEE80211_IS_CHAN_11AC_VHT20_2G(_c) \
277 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT20_2G) == IEEE80211_CHAN_11AC_VHT20_2G)
278#define IEEE80211_IS_CHAN_11AC_VHT40_2G(_c) \
279 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40_2G) != 0)
280#define IEEE80211_IS_CHAN_11AC_VHT80_2G(_c) \
281 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT80_2G) == IEEE80211_CHAN_11AC_VHT80_2G)
282
283#define IEEE80211_CHAN_11NG_HT20 \
284 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT20)
285#define IEEE80211_CHAN_11NA_HT20 \
286 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT20)
287#define IEEE80211_CHAN_11NG_HT40PLUS \
288 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40PLUS)
289#define IEEE80211_CHAN_11NG_HT40MINUS \
290 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40MINUS)
291#define IEEE80211_CHAN_11NA_HT40PLUS \
292 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40PLUS)
293#define IEEE80211_CHAN_11NA_HT40MINUS \
294 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40MINUS)
295
296#define IEEE80211_CHAN_ALL \
297 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
298 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \
299 IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS | \
300 IEEE80211_CHAN_VHT20 | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS | IEEE80211_CHAN_VHT80 | \
301 IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)
302#define IEEE80211_CHAN_ALLTURBO \
303 (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)
304
305#define IEEE80211_IS_CHAN_FHSS(_c) \
306 (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
307#define IEEE80211_IS_CHAN_A(_c) \
308 (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
309#define IEEE80211_IS_CHAN_B(_c) \
310 (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
311#define IEEE80211_IS_CHAN_PUREG(_c) \
312 (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
313#define IEEE80211_IS_CHAN_G(_c) \
314 (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
315#define IEEE80211_IS_CHAN_ANYG(_c) \
316 (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c))
317#define IEEE80211_IS_CHAN_ST(_c) \
318 (((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST)
319#define IEEE80211_IS_CHAN_108A(_c) \
320 (((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A)
321#define IEEE80211_IS_CHAN_108G(_c) \
322 (((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)
323
324#define IEEE80211_IS_CHAN_2GHZ(_c) \
325 (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
326#define IEEE80211_IS_CHAN_5GHZ(_c) \
327 (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
328#define IEEE80211_IS_CHAN_OFDM(_c) \
329 (((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0)
330#define IEEE80211_IS_CHAN_CCK(_c) \
331 (((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0)
332#define IEEE80211_IS_CHAN_GFSK(_c) \
333 (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
334#define IEEE80211_IS_CHAN_TURBO(_c) \
335 (((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0)
336#define IEEE80211_IS_CHAN_WEATHER_RADAR(_c) \
337 ((((_c)->ic_freq >= 5600) && ((_c)->ic_freq <= 5650)) \
338 || (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) && (5580 == (_c)->ic_freq)))
339#define IEEE80211_IS_CHAN_STURBO(_c) \
340 (((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0)
341#define IEEE80211_IS_CHAN_DTURBO(_c) \
342 (((_c)->ic_flags & \
343 (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO)
344#define IEEE80211_IS_CHAN_HALF(_c) \
345 (((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0)
346#define IEEE80211_IS_CHAN_QUARTER(_c) \
347 (((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0)
348#define IEEE80211_IS_CHAN_PASSIVE(_c) \
349 (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0)
350
351#define IEEE80211_IS_CHAN_DFS(_c) \
352 (((_c)->ic_flagext & (IEEE80211_CHAN_DFS|IEEE80211_CHAN_DFS_CLEAR)) == IEEE80211_CHAN_DFS)
353#define IEEE80211_IS_CHAN_DFSFLAG(_c) \
354 (((_c)->ic_flagext & IEEE80211_CHAN_DFS) == IEEE80211_CHAN_DFS)
355#define IEEE80211_IS_CHAN_DISALLOW_ADHOC(_c) \
356 (((_c)->ic_flagext & IEEE80211_CHAN_DISALLOW_ADHOC) != 0)
357#define IEEE80211_IS_CHAN_11D_EXCLUDED(_c) \
358 (((_c)->ic_flagext & IEEE80211_CHAN_11D_EXCLUDED) != 0)
359#define IEEE80211_IS_CHAN_CSA(_c) \
360 (((_c)->ic_flagext & IEEE80211_CHAN_CSA_RECEIVED) != 0)
361#define IEEE80211_IS_CHAN_ODD(_c) \
362 (((_c)->ic_freq == 5170) || ((_c)->ic_freq == 5190) || \
363 ((_c)->ic_freq == 5210) || ((_c)->ic_freq == 5230))
364#define IEEE80211_IS_CHAN_DISALLOW_HOSTAP(_c) \
365 (((_c)->ic_flagext & IEEE80211_CHAN_DISALLOW_HOSTAP) != 0)
366
367#define IEEE80211_IS_CHAN_11NG_HT20(_c) \
368 (((_c)->ic_flags & IEEE80211_CHAN_11NG_HT20) == IEEE80211_CHAN_11NG_HT20)
369#define IEEE80211_IS_CHAN_11NA_HT20(_c) \
370 (((_c)->ic_flags & IEEE80211_CHAN_11NA_HT20) == IEEE80211_CHAN_11NA_HT20)
371#define IEEE80211_IS_CHAN_11NG_HT40PLUS(_c) \
372 (((_c)->ic_flags & IEEE80211_CHAN_11NG_HT40PLUS) == IEEE80211_CHAN_11NG_HT40PLUS)
373#define IEEE80211_IS_CHAN_11NG_HT40MINUS(_c) \
374 (((_c)->ic_flags & IEEE80211_CHAN_11NG_HT40MINUS) == IEEE80211_CHAN_11NG_HT40MINUS)
375#define IEEE80211_IS_CHAN_11NA_HT40PLUS(_c) \
376 (((_c)->ic_flags & IEEE80211_CHAN_11NA_HT40PLUS) == IEEE80211_CHAN_11NA_HT40PLUS)
377#define IEEE80211_IS_CHAN_11NA_HT40MINUS(_c) \
378 (((_c)->ic_flags & IEEE80211_CHAN_11NA_HT40MINUS) == IEEE80211_CHAN_11NA_HT40MINUS)
379
380#define IEEE80211_IS_CHAN_11N(_c) \
381 (((_c)->ic_flags & (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS)) != 0)
382#define IEEE80211_IS_CHAN_11N_HT20(_c) \
383 (((_c)->ic_flags & (IEEE80211_CHAN_HT20)) != 0)
384#define IEEE80211_IS_CHAN_11N_HT40(_c) \
385 (((_c)->ic_flags & (IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS)) != 0)
386#define IEEE80211_IS_CHAN_11NG(_c) \
387 (IEEE80211_IS_CHAN_2GHZ((_c)) && IEEE80211_IS_CHAN_11N((_c)))
388#define IEEE80211_IS_CHAN_11NA(_c) \
389 (IEEE80211_IS_CHAN_5GHZ((_c)) && IEEE80211_IS_CHAN_11N((_c)))
390#define IEEE80211_IS_CHAN_11N_HT40PLUS(_c) \
391 (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) != 0)
392#define IEEE80211_IS_CHAN_11N_HT40MINUS(_c) \
393 (((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) != 0)
394
395#define IEEE80211_IS_CHAN_HT20_CAPABLE(_c) \
396 (((_c)->ic_flags & IEEE80211_CHAN_HT20) == IEEE80211_CHAN_HT20)
397#define IEEE80211_IS_CHAN_HT40PLUS_CAPABLE(_c) \
398 (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) == IEEE80211_CHAN_HT40PLUS)
399#define IEEE80211_IS_CHAN_HT40MINUS_CAPABLE(_c) \
400 (((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) == IEEE80211_CHAN_HT40MINUS)
401#define IEEE80211_IS_CHAN_HT40_CAPABLE(_c) \
402 (IEEE80211_IS_CHAN_HT40PLUS_CAPABLE(_c) || IEEE80211_IS_CHAN_HT40MINUS_CAPABLE(_c))
403#define IEEE80211_IS_CHAN_HT_CAPABLE(_c) \
404 (IEEE80211_IS_CHAN_HT20_CAPABLE(_c) || IEEE80211_IS_CHAN_HT40_CAPABLE(_c))
405#define IEEE80211_IS_CHAN_11N_CTL_CAPABLE(_c) IEEE80211_IS_CHAN_HT20_CAPABLE(_c)
406#define IEEE80211_IS_CHAN_11N_CTL_U_CAPABLE(_c) \
407 (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) == IEEE80211_CHAN_HT40PLUS)
408#define IEEE80211_IS_CHAN_11N_CTL_L_CAPABLE(_c) \
409 (((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) == IEEE80211_CHAN_HT40MINUS)
410#define IEEE80211_IS_CHAN_11N_CTL_40_CAPABLE(_c) \
411 (IEEE80211_IS_CHAN_11N_CTL_U_CAPABLE((_c)) || IEEE80211_IS_CHAN_11N_CTL_L_CAPABLE((_c)))
412
413#define IEEE80211_IS_CHAN_VHT(_c) \
414 (((_c)->ic_flags & (IEEE80211_CHAN_VHT20 | \
415 IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS | IEEE80211_CHAN_VHT80)) != 0)
416#define IEEE80211_IS_CHAN_11AC(_c) \
417 ( IEEE80211_IS_CHAN_5GHZ((_c)) && IEEE80211_IS_CHAN_VHT((_c)) )
418#define IEEE80211_CHAN_11AC_VHT20 \
419 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT20)
420#define IEEE80211_CHAN_11AC_VHT40 \
421 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS )
422#define IEEE80211_CHAN_11AC_VHT40PLUS \
423 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40PLUS)
424#define IEEE80211_CHAN_11AC_VHT40MINUS \
425 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40MINUS)
426#define IEEE80211_CHAN_11AC_VHT80 \
427 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT80)
428#define IEEE80211_IS_CHAN_11AC_VHT20(_c) \
429 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT20) == IEEE80211_CHAN_11AC_VHT20)
430
431#define IEEE80211_IS_CHAN_11AC_VHT40(_c) \
432 (((_c)->ic_flags & (IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS)) !=0)
433#define IEEE80211_IS_CHAN_11AC_VHT40PLUS(_c) \
434 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40PLUS) == IEEE80211_CHAN_11AC_VHT40PLUS)
435#define IEEE80211_IS_CHAN_11AC_VHT40MINUS(_c) \
436 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40MINUS) == IEEE80211_CHAN_11AC_VHT40MINUS)
437#define IEEE80211_IS_CHAN_11AC_VHT80(_c) \
438 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT80) == IEEE80211_CHAN_11AC_VHT80)
439
440#define IEEE80211_IS_CHAN_RADAR(_c) \
441 (((_c)->ic_flags & IEEE80211_CHAN_RADAR_DFS) == IEEE80211_CHAN_RADAR_DFS)
442#define IEEE80211_CHAN_SET_RADAR(_c) \
443 ((_c)->ic_flags |= IEEE80211_CHAN_RADAR_DFS)
444#define IEEE80211_CHAN_CLR_RADAR(_c) \
445 ((_c)->ic_flags &= ~IEEE80211_CHAN_RADAR_DFS)
446#define IEEE80211_CHAN_SET_DISALLOW_ADHOC(_c) \
447 ((_c)->ic_flagext |= IEEE80211_CHAN_DISALLOW_ADHOC)
448#define IEEE80211_CHAN_SET_DISALLOW_HOSTAP(_c) \
449 ((_c)->ic_flagext |= IEEE80211_CHAN_DISALLOW_HOSTAP)
450#define IEEE80211_CHAN_SET_DFS(_c) \
451 ((_c)->ic_flagext |= IEEE80211_CHAN_DFS)
452#define IEEE80211_CHAN_SET_DFS_CLEAR(_c) \
453 ((_c)->ic_flagext |= IEEE80211_CHAN_DFS_CLEAR)
454#define IEEE80211_CHAN_EXCLUDE_11D(_c) \
455 ((_c)->ic_flagext |= IEEE80211_CHAN_11D_EXCLUDED)
456
457/* channel encoding for FH phy */
458#define IEEE80211_FH_CHANMOD 80
459#define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
460#define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1)
461#define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD)
462
463/*
464 * 802.11 rate set.
465 */
466#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
467#define IEEE80211_RATE_MAXSIZE 36 /* max rates we'll handle */
468#define IEEE80211_HT_RATE_SIZE 128
469#define IEEE80211_RATE_SINGLE_STREAM_MCS_MAX 7 /* MCS7 */
470
471#define IEEE80211_RATE_MCS 0x8000
472#define IEEE80211_RATE_MCS_VAL 0x7FFF
473
474#define IEEE80211_RATE_IDX_ENTRY(val, idx) (((val&(0xff<<(idx*8)))>>(idx*8)))
475
476/*
477 * RSSI range
478 */
479#define IEEE80211_RSSI_MAX -10 /* in db */
480#define IEEE80211_RSSI_MIN -200
481
482/*
483 * 11n A-MPDU & A-MSDU limits
484 */
485#define IEEE80211_AMPDU_LIMIT_MIN (1 * 1024)
486#define IEEE80211_AMPDU_LIMIT_MAX (64 * 1024 - 1)
487#define IEEE80211_AMPDU_LIMIT_DEFAULT IEEE80211_AMPDU_LIMIT_MAX
488#define IEEE80211_AMPDU_SUBFRAME_MIN 2
489#define IEEE80211_AMPDU_SUBFRAME_MAX 64
490#define IEEE80211_AMPDU_SUBFRAME_DEFAULT 32
491#define IEEE80211_AMSDU_LIMIT_MAX 4096
492#define IEEE80211_RIFS_AGGR_DIV 10
493#define IEEE80211_MAX_AMPDU_MIN 0
494#define IEEE80211_MAX_AMPDU_MAX 3
495
496/*
497 * 11ac A-MPDU limits
498 */
499#define IEEE80211_VHT_MAX_AMPDU_MIN 0
500#define IEEE80211_VHT_MAX_AMPDU_MAX 7
501
502struct ieee80211_rateset {
503 uint8_t rs_nrates;
504 uint8_t rs_rates[IEEE80211_RATE_MAXSIZE];
505};
506
507struct ieee80211_beacon_info {
508 uint8_t essid[IEEE80211_NWID_LEN + 1];
509 uint8_t esslen;
510 uint8_t rssi_ctl_0;
511 uint8_t rssi_ctl_1;
512 uint8_t rssi_ctl_2;
513 int numchains;
514};
515
516#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
517
518struct ieee80211_ibss_peer_list {
519 uint8_t bssid[IEEE80211_ADDR_LEN];
520};
521
522struct ieee80211_roam {
523 int8_t rssi11a; /* rssi thresh for 11a bss */
524 int8_t rssi11b; /* for 11g sta in 11b bss */
525 int8_t rssi11bOnly; /* for 11b sta */
526 uint8_t pad1;
527 uint8_t rate11a; /* rate thresh for 11a bss */
528 uint8_t rate11b; /* for 11g sta in 11b bss */
529 uint8_t rate11bOnly; /* for 11b sta */
530 uint8_t pad2;
531};
532
533#define IEEE80211_TID_SIZE 17 /* total number of TIDs */
534#define IEEE80211_NON_QOS_SEQ 16 /* index for non-QoS (including management) sequence number space */
535#define IEEE80211_SEQ_MASK 0xfff /* sequence generator mask */
536#define MIN_SW_SEQ 0x100 /* minimum sequence for SW generate packect */
537
538/* crypto related defines*/
539#define IEEE80211_KEYBUF_SIZE 16
540#define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx+rx keys */
541
542enum ieee80211_clist_cmd {
543 CLIST_UPDATE,
544 CLIST_DFS_UPDATE,
545 CLIST_NEW_COUNTRY,
546 CLIST_NOL_UPDATE
547};
548
549enum ieee80211_nawds_param {
550 IEEE80211_NAWDS_PARAM_NUM = 0,
551 IEEE80211_NAWDS_PARAM_MODE,
552 IEEE80211_NAWDS_PARAM_DEFCAPS,
553 IEEE80211_NAWDS_PARAM_OVERRIDE,
554};
555
556struct ieee80211_mib_cycle_cnts {
557 uint32_t tx_frame_count;
558 uint32_t rx_frame_count;
559 uint32_t rx_clear_count;
560 uint32_t cycle_count;
561 uint8_t is_rx_active;
562 uint8_t is_tx_active;
563};
564
565struct ieee80211_chanutil_info {
566 uint32_t rx_clear_count;
567 uint32_t cycle_count;
568 uint8_t value;
569 uint32_t beacon_count;
570 uint8_t beacon_intervals;
571};
572
573#endif /* CDS_COMMON__IEEE80211_I_H_ */