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