1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2001 Atsushi Onoe 5 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 #ifndef _NET80211__IEEE80211_H_ 31 #define _NET80211__IEEE80211_H_ 32 33 /* 34 * 802.11 implementation definitions. 35 * 36 * NB: this file is used by applications. 37 */ 38 39 /* 40 * PHY type; mostly used to identify FH phys. 41 */ 42 enum ieee80211_phytype { 43 IEEE80211_T_DS, /* direct sequence spread spectrum */ 44 IEEE80211_T_FH, /* frequency hopping */ 45 IEEE80211_T_OFDM, /* frequency division multiplexing */ 46 IEEE80211_T_TURBO, /* high rate OFDM, aka turbo mode */ 47 IEEE80211_T_HT, /* high throughput */ 48 IEEE80211_T_OFDM_HALF, /* 1/2 rate OFDM */ 49 IEEE80211_T_OFDM_QUARTER, /* 1/4 rate OFDM */ 50 IEEE80211_T_VHT, /* VHT PHY */ 51 }; 52 #define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclature */ 53 54 /* 55 * PHY mode; this is not really a mode as multi-mode devices 56 * have multiple PHY's. Mode is mostly used as a shorthand 57 * for constraining which channels to consider in setting up 58 * operation. Modes used to be used more extensively when 59 * channels were identified as IEEE channel numbers. 60 */ 61 enum ieee80211_phymode { 62 IEEE80211_MODE_AUTO = 0, /* autoselect */ 63 IEEE80211_MODE_11A = 1, /* 5GHz, OFDM */ 64 IEEE80211_MODE_11B = 2, /* 2GHz, CCK */ 65 IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */ 66 IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */ 67 IEEE80211_MODE_TURBO_A = 5, /* 5GHz, OFDM, 2x clock */ 68 IEEE80211_MODE_TURBO_G = 6, /* 2GHz, OFDM, 2x clock */ 69 IEEE80211_MODE_STURBO_A = 7, /* 5GHz, OFDM, 2x clock, static */ 70 IEEE80211_MODE_11NA = 8, /* 5GHz, w/ HT */ 71 IEEE80211_MODE_11NG = 9, /* 2GHz, w/ HT */ 72 IEEE80211_MODE_HALF = 10, /* OFDM, 1/2x clock */ 73 IEEE80211_MODE_QUARTER = 11, /* OFDM, 1/4x clock */ 74 IEEE80211_MODE_VHT_2GHZ = 12, /* 2GHz, VHT */ 75 IEEE80211_MODE_VHT_5GHZ = 13, /* 5GHz, VHT */ 76 }; 77 #define IEEE80211_MODE_MAX (IEEE80211_MODE_VHT_5GHZ+1) 78 #define IEEE80211_MODE_BYTES howmany(IEEE80211_MODE_MAX, NBBY) 79 80 /* 81 * Operating mode. Devices do not necessarily support 82 * all modes; they indicate which are supported in their 83 * capabilities. 84 */ 85 enum ieee80211_opmode { 86 IEEE80211_M_IBSS = 0, /* IBSS (adhoc) station */ 87 IEEE80211_M_STA = 1, /* infrastructure station */ 88 IEEE80211_M_WDS = 2, /* WDS link */ 89 IEEE80211_M_AHDEMO = 3, /* Old lucent compatible adhoc demo */ 90 IEEE80211_M_HOSTAP = 4, /* Software Access Point */ 91 IEEE80211_M_MONITOR = 5, /* Monitor mode */ 92 IEEE80211_M_MBSS = 6, /* MBSS (Mesh Point) link */ 93 }; 94 #define IEEE80211_OPMODE_MAX (IEEE80211_M_MBSS+1) 95 96 /* 97 * 802.11g/802.11n protection mode. 98 */ 99 enum ieee80211_protmode { 100 IEEE80211_PROT_NONE = 0, /* no protection */ 101 IEEE80211_PROT_CTSONLY = 1, /* CTS to self */ 102 IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */ 103 }; 104 105 /* 106 * Authentication mode. The open and shared key authentication 107 * modes are implemented within the 802.11 layer. 802.1x and 108 * WPA/802.11i are implemented in user mode by setting the 109 * 802.11 layer into IEEE80211_AUTH_8021X and deferring 110 * authentication to user space programs. 111 */ 112 enum ieee80211_authmode { 113 IEEE80211_AUTH_NONE = 0, 114 IEEE80211_AUTH_OPEN = 1, /* open */ 115 IEEE80211_AUTH_SHARED = 2, /* shared-key */ 116 IEEE80211_AUTH_8021X = 3, /* 802.1x */ 117 IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */ 118 /* NB: these are used only for ioctls */ 119 IEEE80211_AUTH_WPA = 5, /* WPA/RSN w/ 802.1x/PSK */ 120 }; 121 122 /* 123 * Roaming mode is effectively who controls the operation 124 * of the 802.11 state machine when operating as a station. 125 * State transitions are controlled either by the driver 126 * (typically when management frames are processed by the 127 * hardware/firmware), the host (auto/normal operation of 128 * the 802.11 layer), or explicitly through ioctl requests 129 * when applications like wpa_supplicant want control. 130 */ 131 enum ieee80211_roamingmode { 132 IEEE80211_ROAMING_DEVICE= 0, /* driver/hardware control */ 133 IEEE80211_ROAMING_AUTO = 1, /* 802.11 layer control */ 134 IEEE80211_ROAMING_MANUAL= 2, /* application control */ 135 }; 136 137 /* 138 * Channels are specified by frequency and attributes. 139 */ 140 struct ieee80211_channel { 141 uint32_t ic_flags; /* see below */ 142 uint16_t ic_freq; /* primary centre frequency in MHz */ 143 uint8_t ic_ieee; /* IEEE channel number */ 144 int8_t ic_maxregpower; /* maximum regulatory tx power in dBm */ 145 int8_t ic_maxpower; /* maximum tx power in .5 dBm */ 146 int8_t ic_minpower; /* minimum tx power in .5 dBm */ 147 uint8_t ic_state; /* dynamic state */ 148 uint8_t ic_extieee; /* HT40 extension channel number */ 149 int8_t ic_maxantgain; /* maximum antenna gain in .5 dBm */ 150 uint8_t ic_pad; 151 uint16_t ic_devdata; /* opaque device/driver data */ 152 }; 153 154 #define IEEE80211_CHAN_MAX 256 155 #define IEEE80211_CHAN_BYTES howmany(IEEE80211_CHAN_MAX, NBBY) 156 #define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */ 157 #define IEEE80211_CHAN_ANYC \ 158 ((struct ieee80211_channel *) IEEE80211_CHAN_ANY) 159 160 /* channel attributes */ 161 #define IEEE80211_CHAN_PRIV0 0x00000001 /* driver private bit 0 */ 162 #define IEEE80211_CHAN_PRIV1 0x00000002 /* driver private bit 1 */ 163 #define IEEE80211_CHAN_PRIV2 0x00000004 /* driver private bit 2 */ 164 #define IEEE80211_CHAN_PRIV3 0x00000008 /* driver private bit 3 */ 165 #define IEEE80211_CHAN_TURBO 0x00000010 /* Turbo channel */ 166 #define IEEE80211_CHAN_CCK 0x00000020 /* CCK channel */ 167 #define IEEE80211_CHAN_OFDM 0x00000040 /* OFDM channel */ 168 #define IEEE80211_CHAN_2GHZ 0x00000080 /* 2 GHz spectrum channel. */ 169 #define IEEE80211_CHAN_5GHZ 0x00000100 /* 5 GHz spectrum channel */ 170 #define IEEE80211_CHAN_PASSIVE 0x00000200 /* Only passive scan allowed */ 171 #define IEEE80211_CHAN_DYN 0x00000400 /* Dynamic CCK-OFDM channel */ 172 #define IEEE80211_CHAN_GFSK 0x00000800 /* GFSK channel (FHSS PHY) */ 173 #define IEEE80211_CHAN_GSM 0x00001000 /* 900 MHz spectrum channel */ 174 #define IEEE80211_CHAN_STURBO 0x00002000 /* 11a static turbo channel only */ 175 #define IEEE80211_CHAN_HALF 0x00004000 /* Half rate channel */ 176 #define IEEE80211_CHAN_QUARTER 0x00008000 /* Quarter rate channel */ 177 #define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */ 178 #define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */ 179 #define IEEE80211_CHAN_HT40D 0x00040000 /* HT 40 channel w/ ext below */ 180 #define IEEE80211_CHAN_DFS 0x00080000 /* DFS required */ 181 #define IEEE80211_CHAN_4MSXMIT 0x00100000 /* 4ms limit on frame length */ 182 #define IEEE80211_CHAN_NOADHOC 0x00200000 /* adhoc mode not allowed */ 183 #define IEEE80211_CHAN_NOHOSTAP 0x00400000 /* hostap mode not allowed */ 184 #define IEEE80211_CHAN_11D 0x00800000 /* 802.11d required */ 185 #define IEEE80211_CHAN_VHT20 0x01000000 /* VHT20 channel */ 186 #define IEEE80211_CHAN_VHT40U 0x02000000 /* VHT40 channel, ext above */ 187 #define IEEE80211_CHAN_VHT40D 0x04000000 /* VHT40 channel, ext below */ 188 #define IEEE80211_CHAN_VHT80 0x08000000 /* VHT80 channel */ 189 #define IEEE80211_CHAN_VHT160 0x10000000 /* VHT160 channel */ 190 #define IEEE80211_CHAN_VHT80P80 0x20000000 /* VHT80+80 channel */ 191 /* XXX note: 0x80000000 is used in src/sbin/ifconfig/ifieee80211.c :( */ 192 193 #define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D) 194 #define IEEE80211_CHAN_HT (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40) 195 196 #define IEEE80211_CHAN_VHT40 (IEEE80211_CHAN_VHT40U | IEEE80211_CHAN_VHT40D) 197 #define IEEE80211_CHAN_VHT (IEEE80211_CHAN_VHT20 | IEEE80211_CHAN_VHT40 \ 198 | IEEE80211_CHAN_VHT80 | IEEE80211_CHAN_VHT160 \ 199 | IEEE80211_CHAN_VHT80P80) 200 201 #define IEEE80211_CHAN_BITS \ 202 "\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \ 203 "\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \ 204 "\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D" \ 205 "\031VHT20\032VHT40U\033VHT40D\034VHT80\035VHT160\036VHT80P80" 206 207 /* 208 * Useful combinations of channel characteristics. 209 */ 210 #define IEEE80211_CHAN_FHSS \ 211 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK) 212 #define IEEE80211_CHAN_A \ 213 (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM) 214 #define IEEE80211_CHAN_B \ 215 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK) 216 #define IEEE80211_CHAN_PUREG \ 217 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM) 218 #define IEEE80211_CHAN_G \ 219 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN) 220 #define IEEE80211_CHAN_108A \ 221 (IEEE80211_CHAN_A | IEEE80211_CHAN_TURBO) 222 #define IEEE80211_CHAN_108G \ 223 (IEEE80211_CHAN_PUREG | IEEE80211_CHAN_TURBO) 224 #define IEEE80211_CHAN_ST \ 225 (IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO) 226 227 #define IEEE80211_CHAN_ALL \ 228 (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \ 229 IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \ 230 IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER | \ 231 IEEE80211_CHAN_HT | IEEE80211_CHAN_VHT) 232 #define IEEE80211_CHAN_ALLTURBO \ 233 (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO) 234 235 #define IEEE80211_IS_CHAN_FHSS(_c) \ 236 (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS) 237 #define IEEE80211_IS_CHAN_A(_c) \ 238 (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A) 239 #define IEEE80211_IS_CHAN_B(_c) \ 240 (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B) 241 #define IEEE80211_IS_CHAN_PUREG(_c) \ 242 (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG) 243 #define IEEE80211_IS_CHAN_G(_c) \ 244 (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G) 245 #define IEEE80211_IS_CHAN_ANYG(_c) \ 246 (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c)) 247 #define IEEE80211_IS_CHAN_ST(_c) \ 248 (((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST) 249 #define IEEE80211_IS_CHAN_108A(_c) \ 250 (((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A) 251 #define IEEE80211_IS_CHAN_108G(_c) \ 252 (((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G) 253 254 #define IEEE80211_IS_CHAN_2GHZ(_c) \ 255 (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0) 256 #define IEEE80211_IS_CHAN_5GHZ(_c) \ 257 (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0) 258 #define IEEE80211_IS_CHAN_PASSIVE(_c) \ 259 (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0) 260 #define IEEE80211_IS_CHAN_OFDM(_c) \ 261 (((_c)->ic_flags & (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)) != 0) 262 #define IEEE80211_IS_CHAN_CCK(_c) \ 263 (((_c)->ic_flags & (IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN)) != 0) 264 #define IEEE80211_IS_CHAN_DYN(_c) \ 265 (((_c)->ic_flags & IEEE80211_CHAN_DYN) == IEEE80211_CHAN_DYN) 266 #define IEEE80211_IS_CHAN_GFSK(_c) \ 267 (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0) 268 #define IEEE80211_IS_CHAN_TURBO(_c) \ 269 (((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0) 270 #define IEEE80211_IS_CHAN_STURBO(_c) \ 271 (((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0) 272 #define IEEE80211_IS_CHAN_DTURBO(_c) \ 273 (((_c)->ic_flags & \ 274 (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO) 275 #define IEEE80211_IS_CHAN_HALF(_c) \ 276 (((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0) 277 #define IEEE80211_IS_CHAN_QUARTER(_c) \ 278 (((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0) 279 #define IEEE80211_IS_CHAN_FULL(_c) \ 280 (((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0) 281 #define IEEE80211_IS_CHAN_GSM(_c) \ 282 (((_c)->ic_flags & IEEE80211_CHAN_GSM) != 0) 283 #define IEEE80211_IS_CHAN_HT(_c) \ 284 (((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 285 #define IEEE80211_IS_CHAN_HT20(_c) \ 286 (((_c)->ic_flags & IEEE80211_CHAN_HT20) != 0) 287 #define IEEE80211_IS_CHAN_HT40(_c) \ 288 (((_c)->ic_flags & IEEE80211_CHAN_HT40) != 0) 289 #define IEEE80211_IS_CHAN_HT40U(_c) \ 290 (((_c)->ic_flags & IEEE80211_CHAN_HT40U) != 0) 291 #define IEEE80211_IS_CHAN_HT40D(_c) \ 292 (((_c)->ic_flags & IEEE80211_CHAN_HT40D) != 0) 293 #define IEEE80211_IS_CHAN_HTA(_c) \ 294 (IEEE80211_IS_CHAN_5GHZ(_c) && \ 295 ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 296 #define IEEE80211_IS_CHAN_HTG(_c) \ 297 (IEEE80211_IS_CHAN_2GHZ(_c) && \ 298 ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 299 #define IEEE80211_IS_CHAN_DFS(_c) \ 300 (((_c)->ic_flags & IEEE80211_CHAN_DFS) != 0) 301 #define IEEE80211_IS_CHAN_NOADHOC(_c) \ 302 (((_c)->ic_flags & IEEE80211_CHAN_NOADHOC) != 0) 303 #define IEEE80211_IS_CHAN_NOHOSTAP(_c) \ 304 (((_c)->ic_flags & IEEE80211_CHAN_NOHOSTAP) != 0) 305 #define IEEE80211_IS_CHAN_11D(_c) \ 306 (((_c)->ic_flags & IEEE80211_CHAN_11D) != 0) 307 308 #define IEEE80211_IS_CHAN_VHT(_c) \ 309 (((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0) 310 #define IEEE80211_IS_CHAN_VHT_2GHZ(_c) \ 311 (IEEE80211_IS_CHAN_2GHZ(_c) && \ 312 ((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0) 313 #define IEEE80211_IS_CHAN_VHT_5GHZ(_c) \ 314 (IEEE80211_IS_CHAN_5GHZ(_c) && \ 315 ((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0) 316 #define IEEE80211_IS_CHAN_VHT20(_c) \ 317 (((_c)->ic_flags & IEEE80211_CHAN_VHT20) != 0) 318 #define IEEE80211_IS_CHAN_VHT40(_c) \ 319 (((_c)->ic_flags & IEEE80211_CHAN_VHT40) != 0) 320 #define IEEE80211_IS_CHAN_VHT40U(_c) \ 321 (((_c)->ic_flags & IEEE80211_CHAN_VHT40U) != 0) 322 #define IEEE80211_IS_CHAN_VHT40D(_c) \ 323 (((_c)->ic_flags & IEEE80211_CHAN_VHT40D) != 0) 324 #define IEEE80211_IS_CHAN_VHTA(_c) \ 325 (IEEE80211_IS_CHAN_5GHZ(_c) && \ 326 ((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0) 327 #define IEEE80211_IS_CHAN_VHTG(_c) \ 328 (IEEE80211_IS_CHAN_2GHZ(_c) && \ 329 ((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0) 330 #define IEEE80211_IS_CHAN_VHT80(_c) \ 331 (((_c)->ic_flags & IEEE80211_CHAN_VHT80) != 0) 332 #define IEEE80211_IS_CHAN_VHT160(_c) \ 333 (((_c)->ic_flags & IEEE80211_CHAN_VHT160) != 0) 334 #define IEEE80211_IS_CHAN_VHT80P80(_c) \ 335 (((_c)->ic_flags & IEEE80211_CHAN_VHT80P80) != 0) 336 337 #define IEEE80211_CHAN2IEEE(_c) (_c)->ic_ieee 338 339 /* dynamic state */ 340 #define IEEE80211_CHANSTATE_RADAR 0x01 /* radar detected */ 341 #define IEEE80211_CHANSTATE_CACDONE 0x02 /* CAC completed */ 342 #define IEEE80211_CHANSTATE_CWINT 0x04 /* interference detected */ 343 #define IEEE80211_CHANSTATE_NORADAR 0x10 /* post notify on radar clear */ 344 345 #define IEEE80211_IS_CHAN_RADAR(_c) \ 346 (((_c)->ic_state & IEEE80211_CHANSTATE_RADAR) != 0) 347 #define IEEE80211_IS_CHAN_CACDONE(_c) \ 348 (((_c)->ic_state & IEEE80211_CHANSTATE_CACDONE) != 0) 349 #define IEEE80211_IS_CHAN_CWINT(_c) \ 350 (((_c)->ic_state & IEEE80211_CHANSTATE_CWINT) != 0) 351 352 /* ni_chan encoding for FH phy */ 353 #define IEEE80211_FH_CHANMOD 80 354 #define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat)) 355 #define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1) 356 #define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD) 357 358 #define IEEE80211_TID_SIZE (WME_NUM_TID+1) /* WME TID's +1 for non-QoS */ 359 #define IEEE80211_NONQOS_TID WME_NUM_TID /* index for non-QoS sta */ 360 361 /* 362 * The 802.11 spec says at most 2007 stations may be 363 * associated at once. For most AP's this is way more 364 * than is feasible so we use a default of 128. This 365 * number may be overridden by the driver and/or by 366 * user configuration but may not be less than IEEE80211_AID_MIN. 367 */ 368 #define IEEE80211_AID_DEF 128 369 #define IEEE80211_AID_MIN 16 370 371 /* 372 * 802.11 rate set. 373 */ 374 #define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ 375 #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ 376 377 struct ieee80211_rateset { 378 uint8_t rs_nrates; 379 uint8_t rs_rates[IEEE80211_RATE_MAXSIZE]; 380 }; 381 382 /* 383 * 802.11n variant of ieee80211_rateset. Instead of 384 * legacy rates the entries are MCS rates. We define 385 * the structure such that it can be used interchangeably 386 * with an ieee80211_rateset (modulo structure size). 387 */ 388 #define IEEE80211_HTRATE_MAXSIZE 77 389 390 struct ieee80211_htrateset { 391 uint8_t rs_nrates; 392 uint8_t rs_rates[IEEE80211_HTRATE_MAXSIZE]; 393 }; 394 395 #define IEEE80211_RATE_MCS 0x80 396 397 /* 398 * Per-mode transmit parameters/controls visible to user space. 399 * These can be used to set fixed transmit rate for all operating 400 * modes or on a per-client basis according to the capabilities 401 * of the client (e.g. an 11b client associated to an 11g ap). 402 * 403 * MCS are distinguished from legacy rates by or'ing in 0x80. 404 */ 405 struct ieee80211_txparam { 406 uint8_t ucastrate; /* ucast data rate (legacy/MCS|0x80) */ 407 uint8_t mgmtrate; /* mgmt frame rate (legacy/MCS|0x80) */ 408 uint8_t mcastrate; /* multicast rate (legacy/MCS|0x80) */ 409 uint8_t maxretry; /* max unicast data retry count */ 410 }; 411 412 /* 413 * Per-mode roaming state visible to user space. There are two 414 * thresholds that control whether roaming is considered; when 415 * either is exceeded the 802.11 layer will check the scan cache 416 * for another AP. If the cache is stale then a scan may be 417 * triggered. 418 */ 419 struct ieee80211_roamparam { 420 int8_t rssi; /* rssi thresh (.5 dBm) */ 421 uint8_t rate; /* tx rate thresh (.5 Mb/s or MCS) */ 422 uint16_t pad; /* reserve */ 423 }; 424 425 /* 426 * Regulatory Information. 427 */ 428 struct ieee80211_regdomain { 429 uint16_t regdomain; /* SKU */ 430 uint16_t country; /* ISO country code */ 431 uint8_t location; /* I (indoor), O (outdoor), other */ 432 uint8_t ecm; /* Extended Channel Mode */ 433 char isocc[2]; /* country code string */ 434 short pad[2]; 435 }; 436 437 /* 438 * MIMO antenna/radio state. 439 */ 440 441 /* 442 * XXX This doesn't yet export both ctl/ext chain details 443 * XXX TODO: IEEE80211_MAX_CHAINS is defined in _freebsd.h, not here; 444 * figure out how to pull it in! 445 */ 446 struct ieee80211_mimo_info { 447 int8_t rssi[3]; /* per-antenna rssi */ 448 int8_t noise[3]; /* per-antenna noise floor */ 449 uint8_t pad[2]; 450 uint32_t evm[3]; /* EVM data */ 451 }; 452 #endif /* _NET80211__IEEE80211_H_ */ 453