blob: cccbdeb1b3793f42f359f2aa362a8e108d5956c7 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Krishna Kumaar Natarajanfa598f92016-03-14 17:19:18 -07002 * Copyright (c) 2013-2016 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 */
229
230/* flagext */
231#define IEEE80211_CHAN_RADAR_FOUND 0x01
232#define IEEE80211_CHAN_DFS 0x0002 /* DFS required on channel */
233#define IEEE80211_CHAN_DFS_CLEAR 0x0008 /* if channel has been checked for DFS */
234#define IEEE80211_CHAN_11D_EXCLUDED 0x0010 /* excluded in 11D */
235#define IEEE80211_CHAN_CSA_RECEIVED 0x0020 /* Channel Switch Announcement received on this channel */
236#define IEEE80211_CHAN_DISALLOW_ADHOC 0x0040 /* ad-hoc is not allowed */
237#define IEEE80211_CHAN_DISALLOW_HOSTAP 0x0080 /* Station only channel */
238
239/*
240 * Useful combinations of channel characteristics.
241 */
242#define IEEE80211_CHAN_FHSS \
243 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
244#define IEEE80211_CHAN_A \
245 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
246#define IEEE80211_CHAN_B \
247 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)
248#define IEEE80211_CHAN_PUREG \
249 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)
250#define IEEE80211_CHAN_G \
251 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)
252#define IEEE80211_CHAN_108A \
253 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
254#define IEEE80211_CHAN_108G \
255 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_TURBO)
256#define IEEE80211_CHAN_ST \
257 (IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO)
258
259#define IEEE80211_IS_CHAN_11AC_2G(_c) \
260 (IEEE80211_IS_CHAN_2GHZ((_c)) && IEEE80211_IS_CHAN_VHT((_c)))
261#define IEEE80211_CHAN_11AC_VHT20_2G \
262 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT20)
263#define IEEE80211_CHAN_11AC_VHT40_2G \
264 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS)
265#define IEEE80211_CHAN_11AC_VHT80_2G \
266 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_VHT80)
267
268#define IEEE80211_IS_CHAN_11AC_VHT20_2G(_c) \
269 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT20_2G) == IEEE80211_CHAN_11AC_VHT20_2G)
270#define IEEE80211_IS_CHAN_11AC_VHT40_2G(_c) \
271 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40_2G) != 0)
272#define IEEE80211_IS_CHAN_11AC_VHT80_2G(_c) \
273 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT80_2G) == IEEE80211_CHAN_11AC_VHT80_2G)
274
275#define IEEE80211_CHAN_11NG_HT20 \
276 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT20)
277#define IEEE80211_CHAN_11NA_HT20 \
278 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT20)
279#define IEEE80211_CHAN_11NG_HT40PLUS \
280 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40PLUS)
281#define IEEE80211_CHAN_11NG_HT40MINUS \
282 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_HT40MINUS)
283#define IEEE80211_CHAN_11NA_HT40PLUS \
284 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40PLUS)
285#define IEEE80211_CHAN_11NA_HT40MINUS \
286 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_HT40MINUS)
287
288#define IEEE80211_CHAN_ALL \
289 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \
290 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \
291 IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS | \
292 IEEE80211_CHAN_VHT20 | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS | IEEE80211_CHAN_VHT80 | \
293 IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER)
294#define IEEE80211_CHAN_ALLTURBO \
295 (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)
296
297#define IEEE80211_IS_CHAN_FHSS(_c) \
298 (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)
299#define IEEE80211_IS_CHAN_A(_c) \
300 (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)
301#define IEEE80211_IS_CHAN_B(_c) \
302 (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)
303#define IEEE80211_IS_CHAN_PUREG(_c) \
304 (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)
305#define IEEE80211_IS_CHAN_G(_c) \
306 (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)
307#define IEEE80211_IS_CHAN_ANYG(_c) \
308 (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c))
309#define IEEE80211_IS_CHAN_ST(_c) \
310 (((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST)
311#define IEEE80211_IS_CHAN_108A(_c) \
312 (((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A)
313#define IEEE80211_IS_CHAN_108G(_c) \
314 (((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)
315
316#define IEEE80211_IS_CHAN_2GHZ(_c) \
317 (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)
318#define IEEE80211_IS_CHAN_5GHZ(_c) \
319 (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)
320#define IEEE80211_IS_CHAN_OFDM(_c) \
321 (((_c)->ic_flags & IEEE80211_CHAN_OFDM) != 0)
322#define IEEE80211_IS_CHAN_CCK(_c) \
323 (((_c)->ic_flags & IEEE80211_CHAN_CCK) != 0)
324#define IEEE80211_IS_CHAN_GFSK(_c) \
325 (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)
326#define IEEE80211_IS_CHAN_TURBO(_c) \
327 (((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0)
328#define IEEE80211_IS_CHAN_WEATHER_RADAR(_c) \
329 ((((_c)->ic_freq >= 5600) && ((_c)->ic_freq <= 5650)) \
330 || (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) && (5580 == (_c)->ic_freq)))
331#define IEEE80211_IS_CHAN_STURBO(_c) \
332 (((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0)
333#define IEEE80211_IS_CHAN_DTURBO(_c) \
334 (((_c)->ic_flags & \
335 (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO)
336#define IEEE80211_IS_CHAN_HALF(_c) \
337 (((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0)
338#define IEEE80211_IS_CHAN_QUARTER(_c) \
339 (((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0)
340#define IEEE80211_IS_CHAN_PASSIVE(_c) \
341 (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0)
342
343#define IEEE80211_IS_CHAN_DFS(_c) \
344 (((_c)->ic_flagext & (IEEE80211_CHAN_DFS|IEEE80211_CHAN_DFS_CLEAR)) == IEEE80211_CHAN_DFS)
345#define IEEE80211_IS_CHAN_DFSFLAG(_c) \
346 (((_c)->ic_flagext & IEEE80211_CHAN_DFS) == IEEE80211_CHAN_DFS)
347#define IEEE80211_IS_CHAN_DISALLOW_ADHOC(_c) \
348 (((_c)->ic_flagext & IEEE80211_CHAN_DISALLOW_ADHOC) != 0)
349#define IEEE80211_IS_CHAN_11D_EXCLUDED(_c) \
350 (((_c)->ic_flagext & IEEE80211_CHAN_11D_EXCLUDED) != 0)
351#define IEEE80211_IS_CHAN_CSA(_c) \
352 (((_c)->ic_flagext & IEEE80211_CHAN_CSA_RECEIVED) != 0)
353#define IEEE80211_IS_CHAN_ODD(_c) \
354 (((_c)->ic_freq == 5170) || ((_c)->ic_freq == 5190) || \
355 ((_c)->ic_freq == 5210) || ((_c)->ic_freq == 5230))
356#define IEEE80211_IS_CHAN_DISALLOW_HOSTAP(_c) \
357 (((_c)->ic_flagext & IEEE80211_CHAN_DISALLOW_HOSTAP) != 0)
358
359#define IEEE80211_IS_CHAN_11NG_HT20(_c) \
360 (((_c)->ic_flags & IEEE80211_CHAN_11NG_HT20) == IEEE80211_CHAN_11NG_HT20)
361#define IEEE80211_IS_CHAN_11NA_HT20(_c) \
362 (((_c)->ic_flags & IEEE80211_CHAN_11NA_HT20) == IEEE80211_CHAN_11NA_HT20)
363#define IEEE80211_IS_CHAN_11NG_HT40PLUS(_c) \
364 (((_c)->ic_flags & IEEE80211_CHAN_11NG_HT40PLUS) == IEEE80211_CHAN_11NG_HT40PLUS)
365#define IEEE80211_IS_CHAN_11NG_HT40MINUS(_c) \
366 (((_c)->ic_flags & IEEE80211_CHAN_11NG_HT40MINUS) == IEEE80211_CHAN_11NG_HT40MINUS)
367#define IEEE80211_IS_CHAN_11NA_HT40PLUS(_c) \
368 (((_c)->ic_flags & IEEE80211_CHAN_11NA_HT40PLUS) == IEEE80211_CHAN_11NA_HT40PLUS)
369#define IEEE80211_IS_CHAN_11NA_HT40MINUS(_c) \
370 (((_c)->ic_flags & IEEE80211_CHAN_11NA_HT40MINUS) == IEEE80211_CHAN_11NA_HT40MINUS)
371
372#define IEEE80211_IS_CHAN_11N(_c) \
373 (((_c)->ic_flags & (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS)) != 0)
374#define IEEE80211_IS_CHAN_11N_HT20(_c) \
375 (((_c)->ic_flags & (IEEE80211_CHAN_HT20)) != 0)
376#define IEEE80211_IS_CHAN_11N_HT40(_c) \
377 (((_c)->ic_flags & (IEEE80211_CHAN_HT40PLUS | IEEE80211_CHAN_HT40MINUS)) != 0)
378#define IEEE80211_IS_CHAN_11NG(_c) \
379 (IEEE80211_IS_CHAN_2GHZ((_c)) && IEEE80211_IS_CHAN_11N((_c)))
380#define IEEE80211_IS_CHAN_11NA(_c) \
381 (IEEE80211_IS_CHAN_5GHZ((_c)) && IEEE80211_IS_CHAN_11N((_c)))
382#define IEEE80211_IS_CHAN_11N_HT40PLUS(_c) \
383 (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) != 0)
384#define IEEE80211_IS_CHAN_11N_HT40MINUS(_c) \
385 (((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) != 0)
386
387#define IEEE80211_IS_CHAN_HT20_CAPABLE(_c) \
388 (((_c)->ic_flags & IEEE80211_CHAN_HT20) == IEEE80211_CHAN_HT20)
389#define IEEE80211_IS_CHAN_HT40PLUS_CAPABLE(_c) \
390 (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) == IEEE80211_CHAN_HT40PLUS)
391#define IEEE80211_IS_CHAN_HT40MINUS_CAPABLE(_c) \
392 (((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) == IEEE80211_CHAN_HT40MINUS)
393#define IEEE80211_IS_CHAN_HT40_CAPABLE(_c) \
394 (IEEE80211_IS_CHAN_HT40PLUS_CAPABLE(_c) || IEEE80211_IS_CHAN_HT40MINUS_CAPABLE(_c))
395#define IEEE80211_IS_CHAN_HT_CAPABLE(_c) \
396 (IEEE80211_IS_CHAN_HT20_CAPABLE(_c) || IEEE80211_IS_CHAN_HT40_CAPABLE(_c))
397#define IEEE80211_IS_CHAN_11N_CTL_CAPABLE(_c) IEEE80211_IS_CHAN_HT20_CAPABLE(_c)
398#define IEEE80211_IS_CHAN_11N_CTL_U_CAPABLE(_c) \
399 (((_c)->ic_flags & IEEE80211_CHAN_HT40PLUS) == IEEE80211_CHAN_HT40PLUS)
400#define IEEE80211_IS_CHAN_11N_CTL_L_CAPABLE(_c) \
401 (((_c)->ic_flags & IEEE80211_CHAN_HT40MINUS) == IEEE80211_CHAN_HT40MINUS)
402#define IEEE80211_IS_CHAN_11N_CTL_40_CAPABLE(_c) \
403 (IEEE80211_IS_CHAN_11N_CTL_U_CAPABLE((_c)) || IEEE80211_IS_CHAN_11N_CTL_L_CAPABLE((_c)))
404
405#define IEEE80211_IS_CHAN_VHT(_c) \
406 (((_c)->ic_flags & (IEEE80211_CHAN_VHT20 | \
407 IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS | IEEE80211_CHAN_VHT80)) != 0)
408#define IEEE80211_IS_CHAN_11AC(_c) \
409 ( IEEE80211_IS_CHAN_5GHZ((_c)) && IEEE80211_IS_CHAN_VHT((_c)) )
410#define IEEE80211_CHAN_11AC_VHT20 \
411 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT20)
412#define IEEE80211_CHAN_11AC_VHT40 \
413 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS )
414#define IEEE80211_CHAN_11AC_VHT40PLUS \
415 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40PLUS)
416#define IEEE80211_CHAN_11AC_VHT40MINUS \
417 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT40MINUS)
418#define IEEE80211_CHAN_11AC_VHT80 \
419 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_VHT80)
420#define IEEE80211_IS_CHAN_11AC_VHT20(_c) \
421 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT20) == IEEE80211_CHAN_11AC_VHT20)
422
423#define IEEE80211_IS_CHAN_11AC_VHT40(_c) \
424 (((_c)->ic_flags & (IEEE80211_CHAN_VHT40PLUS | IEEE80211_CHAN_VHT40MINUS)) !=0)
425#define IEEE80211_IS_CHAN_11AC_VHT40PLUS(_c) \
426 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40PLUS) == IEEE80211_CHAN_11AC_VHT40PLUS)
427#define IEEE80211_IS_CHAN_11AC_VHT40MINUS(_c) \
428 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT40MINUS) == IEEE80211_CHAN_11AC_VHT40MINUS)
429#define IEEE80211_IS_CHAN_11AC_VHT80(_c) \
430 (((_c)->ic_flags & IEEE80211_CHAN_11AC_VHT80) == IEEE80211_CHAN_11AC_VHT80)
431
432#define IEEE80211_IS_CHAN_RADAR(_c) \
433 (((_c)->ic_flags & IEEE80211_CHAN_RADAR_DFS) == IEEE80211_CHAN_RADAR_DFS)
434#define IEEE80211_CHAN_SET_RADAR(_c) \
435 ((_c)->ic_flags |= IEEE80211_CHAN_RADAR_DFS)
436#define IEEE80211_CHAN_CLR_RADAR(_c) \
437 ((_c)->ic_flags &= ~IEEE80211_CHAN_RADAR_DFS)
438#define IEEE80211_CHAN_SET_DISALLOW_ADHOC(_c) \
439 ((_c)->ic_flagext |= IEEE80211_CHAN_DISALLOW_ADHOC)
440#define IEEE80211_CHAN_SET_DISALLOW_HOSTAP(_c) \
441 ((_c)->ic_flagext |= IEEE80211_CHAN_DISALLOW_HOSTAP)
442#define IEEE80211_CHAN_SET_DFS(_c) \
443 ((_c)->ic_flagext |= IEEE80211_CHAN_DFS)
444#define IEEE80211_CHAN_SET_DFS_CLEAR(_c) \
445 ((_c)->ic_flagext |= IEEE80211_CHAN_DFS_CLEAR)
446#define IEEE80211_CHAN_EXCLUDE_11D(_c) \
447 ((_c)->ic_flagext |= IEEE80211_CHAN_11D_EXCLUDED)
448
449/* channel encoding for FH phy */
450#define IEEE80211_FH_CHANMOD 80
451#define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat))
452#define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1)
453#define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD)
454
455/*
456 * 802.11 rate set.
457 */
458#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */
459#define IEEE80211_RATE_MAXSIZE 36 /* max rates we'll handle */
460#define IEEE80211_HT_RATE_SIZE 128
461#define IEEE80211_RATE_SINGLE_STREAM_MCS_MAX 7 /* MCS7 */
462
463#define IEEE80211_RATE_MCS 0x8000
464#define IEEE80211_RATE_MCS_VAL 0x7FFF
465
466#define IEEE80211_RATE_IDX_ENTRY(val, idx) (((val&(0xff<<(idx*8)))>>(idx*8)))
467
468/*
469 * RSSI range
470 */
471#define IEEE80211_RSSI_MAX -10 /* in db */
472#define IEEE80211_RSSI_MIN -200
473
474/*
475 * 11n A-MPDU & A-MSDU limits
476 */
477#define IEEE80211_AMPDU_LIMIT_MIN (1 * 1024)
478#define IEEE80211_AMPDU_LIMIT_MAX (64 * 1024 - 1)
479#define IEEE80211_AMPDU_LIMIT_DEFAULT IEEE80211_AMPDU_LIMIT_MAX
480#define IEEE80211_AMPDU_SUBFRAME_MIN 2
481#define IEEE80211_AMPDU_SUBFRAME_MAX 64
482#define IEEE80211_AMPDU_SUBFRAME_DEFAULT 32
483#define IEEE80211_AMSDU_LIMIT_MAX 4096
484#define IEEE80211_RIFS_AGGR_DIV 10
485#define IEEE80211_MAX_AMPDU_MIN 0
486#define IEEE80211_MAX_AMPDU_MAX 3
487
488/*
489 * 11ac A-MPDU limits
490 */
491#define IEEE80211_VHT_MAX_AMPDU_MIN 0
492#define IEEE80211_VHT_MAX_AMPDU_MAX 7
493
494struct ieee80211_rateset {
495 uint8_t rs_nrates;
496 uint8_t rs_rates[IEEE80211_RATE_MAXSIZE];
497};
498
499struct ieee80211_beacon_info {
500 uint8_t essid[IEEE80211_NWID_LEN + 1];
501 uint8_t esslen;
502 uint8_t rssi_ctl_0;
503 uint8_t rssi_ctl_1;
504 uint8_t rssi_ctl_2;
505 int numchains;
506};
507
508#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
509
510struct ieee80211_ibss_peer_list {
511 uint8_t bssid[IEEE80211_ADDR_LEN];
512};
513
514struct ieee80211_roam {
515 int8_t rssi11a; /* rssi thresh for 11a bss */
516 int8_t rssi11b; /* for 11g sta in 11b bss */
517 int8_t rssi11bOnly; /* for 11b sta */
518 uint8_t pad1;
519 uint8_t rate11a; /* rate thresh for 11a bss */
520 uint8_t rate11b; /* for 11g sta in 11b bss */
521 uint8_t rate11bOnly; /* for 11b sta */
522 uint8_t pad2;
523};
524
525#define IEEE80211_TID_SIZE 17 /* total number of TIDs */
526#define IEEE80211_NON_QOS_SEQ 16 /* index for non-QoS (including management) sequence number space */
527#define IEEE80211_SEQ_MASK 0xfff /* sequence generator mask */
528#define MIN_SW_SEQ 0x100 /* minimum sequence for SW generate packect */
529
530/* crypto related defines*/
531#define IEEE80211_KEYBUF_SIZE 16
532#define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx+rx keys */
533
534enum ieee80211_clist_cmd {
535 CLIST_UPDATE,
536 CLIST_DFS_UPDATE,
537 CLIST_NEW_COUNTRY,
538 CLIST_NOL_UPDATE
539};
540
541enum ieee80211_nawds_param {
542 IEEE80211_NAWDS_PARAM_NUM = 0,
543 IEEE80211_NAWDS_PARAM_MODE,
544 IEEE80211_NAWDS_PARAM_DEFCAPS,
545 IEEE80211_NAWDS_PARAM_OVERRIDE,
546};
547
548struct ieee80211_mib_cycle_cnts {
549 uint32_t tx_frame_count;
550 uint32_t rx_frame_count;
551 uint32_t rx_clear_count;
552 uint32_t cycle_count;
553 uint8_t is_rx_active;
554 uint8_t is_tx_active;
555};
556
557struct ieee80211_chanutil_info {
558 uint32_t rx_clear_count;
559 uint32_t cycle_count;
560 uint8_t value;
561 uint32_t beacon_count;
562 uint8_t beacon_intervals;
563};
564
565#endif /* CDS_COMMON__IEEE80211_I_H_ */