1138568Ssam/*- 2138568Ssam * Copyright (c) 2001 Atsushi Onoe 3178354Ssam * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 4138568Ssam * All rights reserved. 5138568Ssam * 6138568Ssam * Redistribution and use in source and binary forms, with or without 7138568Ssam * modification, are permitted provided that the following conditions 8138568Ssam * are met: 9138568Ssam * 1. Redistributions of source code must retain the above copyright 10138568Ssam * notice, this list of conditions and the following disclaimer. 11138568Ssam * 2. Redistributions in binary form must reproduce the above copyright 12138568Ssam * notice, this list of conditions and the following disclaimer in the 13138568Ssam * documentation and/or other materials provided with the distribution. 14138568Ssam * 15138568Ssam * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16138568Ssam * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17138568Ssam * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18138568Ssam * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19138568Ssam * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20138568Ssam * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21138568Ssam * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22138568Ssam * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23138568Ssam * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24138568Ssam * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25138568Ssam * 26138568Ssam * $FreeBSD$ 27138568Ssam */ 28138568Ssam#ifndef _NET80211__IEEE80211_H_ 29138568Ssam#define _NET80211__IEEE80211_H_ 30138568Ssam 31178354Ssam/* 32178354Ssam * 802.11 implementation definitions. 33178354Ssam * 34178354Ssam * NB: this file is used by applications. 35178354Ssam */ 36178354Ssam 37178354Ssam/* 38178354Ssam * PHY type; mostly used to identify FH phys. 39178354Ssam */ 40138568Ssamenum ieee80211_phytype { 41138568Ssam IEEE80211_T_DS, /* direct sequence spread spectrum */ 42138568Ssam IEEE80211_T_FH, /* frequency hopping */ 43138568Ssam IEEE80211_T_OFDM, /* frequency division multiplexing */ 44138568Ssam IEEE80211_T_TURBO, /* high rate OFDM, aka turbo mode */ 45178354Ssam IEEE80211_T_HT, /* high throughput */ 46188772Ssam IEEE80211_T_OFDM_HALF, /* 1/2 rate OFDM */ 47188772Ssam IEEE80211_T_OFDM_QUARTER, /* 1/4 rate OFDM */ 48138568Ssam}; 49138568Ssam#define IEEE80211_T_CCK IEEE80211_T_DS /* more common nomenclature */ 50138568Ssam 51178354Ssam/* 52178354Ssam * PHY mode; this is not really a mode as multi-mode devices 53178354Ssam * have multiple PHY's. Mode is mostly used as a shorthand 54178354Ssam * for constraining which channels to consider in setting up 55178354Ssam * operation. Modes used to be used more extensively when 56178354Ssam * channels were identified as IEEE channel numbers. 57178354Ssam */ 58138568Ssamenum ieee80211_phymode { 59138568Ssam IEEE80211_MODE_AUTO = 0, /* autoselect */ 60138568Ssam IEEE80211_MODE_11A = 1, /* 5GHz, OFDM */ 61138568Ssam IEEE80211_MODE_11B = 2, /* 2GHz, CCK */ 62138568Ssam IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */ 63138568Ssam IEEE80211_MODE_FH = 4, /* 2GHz, GFSK */ 64138568Ssam IEEE80211_MODE_TURBO_A = 5, /* 5GHz, OFDM, 2x clock */ 65138568Ssam IEEE80211_MODE_TURBO_G = 6, /* 2GHz, OFDM, 2x clock */ 66170530Ssam IEEE80211_MODE_STURBO_A = 7, /* 5GHz, OFDM, 2x clock, static */ 67170530Ssam IEEE80211_MODE_11NA = 8, /* 5GHz, w/ HT */ 68170530Ssam IEEE80211_MODE_11NG = 9, /* 2GHz, w/ HT */ 69188782Ssam IEEE80211_MODE_HALF = 10, /* OFDM, 1/2x clock */ 70188782Ssam IEEE80211_MODE_QUARTER = 11, /* OFDM, 1/4x clock */ 71138568Ssam}; 72188782Ssam#define IEEE80211_MODE_MAX (IEEE80211_MODE_QUARTER+1) 73298899Savos#define IEEE80211_MODE_BYTES howmany(IEEE80211_MODE_MAX, NBBY) 74138568Ssam 75178354Ssam/* 76178354Ssam * Operating mode. Devices do not necessarily support 77178354Ssam * all modes; they indicate which are supported in their 78178354Ssam * capabilities. 79178354Ssam */ 80138568Ssamenum ieee80211_opmode { 81178354Ssam IEEE80211_M_IBSS = 0, /* IBSS (adhoc) station */ 82138568Ssam IEEE80211_M_STA = 1, /* infrastructure station */ 83178354Ssam IEEE80211_M_WDS = 2, /* WDS link */ 84138568Ssam IEEE80211_M_AHDEMO = 3, /* Old lucent compatible adhoc demo */ 85178354Ssam IEEE80211_M_HOSTAP = 4, /* Software Access Point */ 86178354Ssam IEEE80211_M_MONITOR = 5, /* Monitor mode */ 87195618Srpaulo IEEE80211_M_MBSS = 6, /* MBSS (Mesh Point) link */ 88138568Ssam}; 89195618Srpaulo#define IEEE80211_OPMODE_MAX (IEEE80211_M_MBSS+1) 90138568Ssam 91138568Ssam/* 92170530Ssam * 802.11g/802.11n protection mode. 93138568Ssam */ 94138568Ssamenum ieee80211_protmode { 95138568Ssam IEEE80211_PROT_NONE = 0, /* no protection */ 96138568Ssam IEEE80211_PROT_CTSONLY = 1, /* CTS to self */ 97138568Ssam IEEE80211_PROT_RTSCTS = 2, /* RTS-CTS */ 98138568Ssam}; 99138568Ssam 100138568Ssam/* 101178354Ssam * Authentication mode. The open and shared key authentication 102178354Ssam * modes are implemented within the 802.11 layer. 802.1x and 103178354Ssam * WPA/802.11i are implemented in user mode by setting the 104178354Ssam * 802.11 layer into IEEE80211_AUTH_8021X and deferring 105178354Ssam * authentication to user space programs. 106138568Ssam */ 107138568Ssamenum ieee80211_authmode { 108138568Ssam IEEE80211_AUTH_NONE = 0, 109138568Ssam IEEE80211_AUTH_OPEN = 1, /* open */ 110138568Ssam IEEE80211_AUTH_SHARED = 2, /* shared-key */ 111138568Ssam IEEE80211_AUTH_8021X = 3, /* 802.1x */ 112138568Ssam IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */ 113138568Ssam /* NB: these are used only for ioctls */ 114138568Ssam IEEE80211_AUTH_WPA = 5, /* WPA/RSN w/ 802.1x/PSK */ 115138568Ssam}; 116138568Ssam 117138568Ssam/* 118138568Ssam * Roaming mode is effectively who controls the operation 119138568Ssam * of the 802.11 state machine when operating as a station. 120138568Ssam * State transitions are controlled either by the driver 121138568Ssam * (typically when management frames are processed by the 122138568Ssam * hardware/firmware), the host (auto/normal operation of 123138568Ssam * the 802.11 layer), or explicitly through ioctl requests 124138568Ssam * when applications like wpa_supplicant want control. 125138568Ssam */ 126138568Ssamenum ieee80211_roamingmode { 127138568Ssam IEEE80211_ROAMING_DEVICE= 0, /* driver/hardware control */ 128138568Ssam IEEE80211_ROAMING_AUTO = 1, /* 802.11 layer control */ 129138568Ssam IEEE80211_ROAMING_MANUAL= 2, /* application control */ 130138568Ssam}; 131138568Ssam 132138568Ssam/* 133138568Ssam * Channels are specified by frequency and attributes. 134138568Ssam */ 135138568Ssamstruct ieee80211_channel { 136170530Ssam uint32_t ic_flags; /* see below */ 137219606Sbschmidt uint16_t ic_freq; /* setting in MHz */ 138170530Ssam uint8_t ic_ieee; /* IEEE channel number */ 139170530Ssam int8_t ic_maxregpower; /* maximum regulatory tx power in dBm */ 140170530Ssam int8_t ic_maxpower; /* maximum tx power in .5 dBm */ 141170530Ssam int8_t ic_minpower; /* minimum tx power in .5 dBm */ 142172056Ssam uint8_t ic_state; /* dynamic state */ 143172056Ssam uint8_t ic_extieee; /* HT40 extension channel number */ 144187803Ssam int8_t ic_maxantgain; /* maximum antenna gain in .5 dBm */ 145187803Ssam uint8_t ic_pad; 146187803Ssam uint16_t ic_devdata; /* opaque device/driver data */ 147138568Ssam}; 148138568Ssam 149186107Ssam#define IEEE80211_CHAN_MAX 256 150298899Savos#define IEEE80211_CHAN_BYTES howmany(IEEE80211_CHAN_MAX, NBBY) 151138568Ssam#define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */ 152138568Ssam#define IEEE80211_CHAN_ANYC \ 153138568Ssam ((struct ieee80211_channel *) IEEE80211_CHAN_ANY) 154138568Ssam 155138568Ssam/* channel attributes */ 156187634Ssam#define IEEE80211_CHAN_PRIV0 0x00000001 /* driver private bit 0 */ 157187634Ssam#define IEEE80211_CHAN_PRIV1 0x00000002 /* driver private bit 1 */ 158187634Ssam#define IEEE80211_CHAN_PRIV2 0x00000004 /* driver private bit 2 */ 159187634Ssam#define IEEE80211_CHAN_PRIV3 0x00000008 /* driver private bit 3 */ 160172056Ssam#define IEEE80211_CHAN_TURBO 0x00000010 /* Turbo channel */ 161172056Ssam#define IEEE80211_CHAN_CCK 0x00000020 /* CCK channel */ 162172056Ssam#define IEEE80211_CHAN_OFDM 0x00000040 /* OFDM channel */ 163172056Ssam#define IEEE80211_CHAN_2GHZ 0x00000080 /* 2 GHz spectrum channel. */ 164172056Ssam#define IEEE80211_CHAN_5GHZ 0x00000100 /* 5 GHz spectrum channel */ 165172056Ssam#define IEEE80211_CHAN_PASSIVE 0x00000200 /* Only passive scan allowed */ 166172056Ssam#define IEEE80211_CHAN_DYN 0x00000400 /* Dynamic CCK-OFDM channel */ 167172056Ssam#define IEEE80211_CHAN_GFSK 0x00000800 /* GFSK channel (FHSS PHY) */ 168172056Ssam#define IEEE80211_CHAN_GSM 0x00001000 /* 900 MHz spectrum channel */ 169172056Ssam#define IEEE80211_CHAN_STURBO 0x00002000 /* 11a static turbo channel only */ 170172056Ssam#define IEEE80211_CHAN_HALF 0x00004000 /* Half rate channel */ 171172056Ssam#define IEEE80211_CHAN_QUARTER 0x00008000 /* Quarter rate channel */ 172172056Ssam#define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */ 173172056Ssam#define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */ 174172056Ssam#define IEEE80211_CHAN_HT40D 0x00040000 /* HT 40 channel w/ ext below */ 175172056Ssam#define IEEE80211_CHAN_DFS 0x00080000 /* DFS required */ 176172056Ssam#define IEEE80211_CHAN_4MSXMIT 0x00100000 /* 4ms limit on frame length */ 177172056Ssam#define IEEE80211_CHAN_NOADHOC 0x00200000 /* adhoc mode not allowed */ 178172056Ssam#define IEEE80211_CHAN_NOHOSTAP 0x00400000 /* hostap mode not allowed */ 179172056Ssam#define IEEE80211_CHAN_11D 0x00800000 /* 802.11d required */ 180138568Ssam 181170530Ssam#define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D) 182170530Ssam#define IEEE80211_CHAN_HT (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40) 183170530Ssam 184187797Ssam#define IEEE80211_CHAN_BITS \ 185187797Ssam "\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \ 186187797Ssam "\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \ 187187797Ssam "\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D" 188187797Ssam 189138568Ssam/* 190138568Ssam * Useful combinations of channel characteristics. 191138568Ssam */ 192138568Ssam#define IEEE80211_CHAN_FHSS \ 193138568Ssam (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK) 194138568Ssam#define IEEE80211_CHAN_A \ 195138568Ssam (IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM) 196138568Ssam#define IEEE80211_CHAN_B \ 197138568Ssam (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK) 198138568Ssam#define IEEE80211_CHAN_PUREG \ 199138568Ssam (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM) 200138568Ssam#define IEEE80211_CHAN_G \ 201138568Ssam (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN) 202170530Ssam#define IEEE80211_CHAN_108A \ 203187793Ssam (IEEE80211_CHAN_A | IEEE80211_CHAN_TURBO) 204138568Ssam#define IEEE80211_CHAN_108G \ 205187793Ssam (IEEE80211_CHAN_PUREG | IEEE80211_CHAN_TURBO) 206170530Ssam#define IEEE80211_CHAN_ST \ 207170530Ssam (IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO) 208138568Ssam 209153347Ssam#define IEEE80211_CHAN_ALL \ 210153347Ssam (IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \ 211170530Ssam IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \ 212184269Ssam IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER | \ 213170530Ssam IEEE80211_CHAN_HT) 214153347Ssam#define IEEE80211_CHAN_ALLTURBO \ 215170530Ssam (IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO) 216153347Ssam 217138568Ssam#define IEEE80211_IS_CHAN_FHSS(_c) \ 218138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS) 219138568Ssam#define IEEE80211_IS_CHAN_A(_c) \ 220138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A) 221138568Ssam#define IEEE80211_IS_CHAN_B(_c) \ 222138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B) 223138568Ssam#define IEEE80211_IS_CHAN_PUREG(_c) \ 224138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG) 225138568Ssam#define IEEE80211_IS_CHAN_G(_c) \ 226138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G) 227148941Ssam#define IEEE80211_IS_CHAN_ANYG(_c) \ 228148941Ssam (IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c)) 229170530Ssam#define IEEE80211_IS_CHAN_ST(_c) \ 230170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST) 231170530Ssam#define IEEE80211_IS_CHAN_108A(_c) \ 232170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A) 233138568Ssam#define IEEE80211_IS_CHAN_108G(_c) \ 234138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G) 235138568Ssam 236138568Ssam#define IEEE80211_IS_CHAN_2GHZ(_c) \ 237138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0) 238138568Ssam#define IEEE80211_IS_CHAN_5GHZ(_c) \ 239138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0) 240170530Ssam#define IEEE80211_IS_CHAN_PASSIVE(_c) \ 241170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0) 242138568Ssam#define IEEE80211_IS_CHAN_OFDM(_c) \ 243187794Ssam (((_c)->ic_flags & (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)) != 0) 244138568Ssam#define IEEE80211_IS_CHAN_CCK(_c) \ 245187794Ssam (((_c)->ic_flags & (IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN)) != 0) 246237871Sadrian#define IEEE80211_IS_CHAN_DYN(_c) \ 247237871Sadrian (((_c)->ic_flags & IEEE80211_CHAN_DYN) == IEEE80211_CHAN_DYN) 248138568Ssam#define IEEE80211_IS_CHAN_GFSK(_c) \ 249138568Ssam (((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0) 250170530Ssam#define IEEE80211_IS_CHAN_TURBO(_c) \ 251170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0) 252170530Ssam#define IEEE80211_IS_CHAN_STURBO(_c) \ 253170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0) 254170530Ssam#define IEEE80211_IS_CHAN_DTURBO(_c) \ 255170530Ssam (((_c)->ic_flags & \ 256170530Ssam (IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO) 257165569Ssam#define IEEE80211_IS_CHAN_HALF(_c) \ 258165569Ssam (((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0) 259165569Ssam#define IEEE80211_IS_CHAN_QUARTER(_c) \ 260165569Ssam (((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0) 261166012Ssam#define IEEE80211_IS_CHAN_FULL(_c) \ 262166012Ssam (((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0) 263166012Ssam#define IEEE80211_IS_CHAN_GSM(_c) \ 264166012Ssam (((_c)->ic_flags & IEEE80211_CHAN_GSM) != 0) 265170530Ssam#define IEEE80211_IS_CHAN_HT(_c) \ 266170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 267170530Ssam#define IEEE80211_IS_CHAN_HT20(_c) \ 268170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_HT20) != 0) 269170530Ssam#define IEEE80211_IS_CHAN_HT40(_c) \ 270170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_HT40) != 0) 271170530Ssam#define IEEE80211_IS_CHAN_HT40U(_c) \ 272170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_HT40U) != 0) 273170530Ssam#define IEEE80211_IS_CHAN_HT40D(_c) \ 274170530Ssam (((_c)->ic_flags & IEEE80211_CHAN_HT40D) != 0) 275170530Ssam#define IEEE80211_IS_CHAN_HTA(_c) \ 276170530Ssam (IEEE80211_IS_CHAN_5GHZ(_c) && \ 277170530Ssam ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 278170530Ssam#define IEEE80211_IS_CHAN_HTG(_c) \ 279170530Ssam (IEEE80211_IS_CHAN_2GHZ(_c) && \ 280170530Ssam ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0) 281172056Ssam#define IEEE80211_IS_CHAN_DFS(_c) \ 282172056Ssam (((_c)->ic_flags & IEEE80211_CHAN_DFS) != 0) 283172056Ssam#define IEEE80211_IS_CHAN_NOADHOC(_c) \ 284172056Ssam (((_c)->ic_flags & IEEE80211_CHAN_NOADHOC) != 0) 285172056Ssam#define IEEE80211_IS_CHAN_NOHOSTAP(_c) \ 286172056Ssam (((_c)->ic_flags & IEEE80211_CHAN_NOHOSTAP) != 0) 287172056Ssam#define IEEE80211_IS_CHAN_11D(_c) \ 288172056Ssam (((_c)->ic_flags & IEEE80211_CHAN_11D) != 0) 289138568Ssam 290171124Sthompsa#define IEEE80211_CHAN2IEEE(_c) (_c)->ic_ieee 291171124Sthompsa 292172056Ssam/* dynamic state */ 293172056Ssam#define IEEE80211_CHANSTATE_RADAR 0x01 /* radar detected */ 294172056Ssam#define IEEE80211_CHANSTATE_CACDONE 0x02 /* CAC completed */ 295187795Ssam#define IEEE80211_CHANSTATE_CWINT 0x04 /* interference detected */ 296172056Ssam#define IEEE80211_CHANSTATE_NORADAR 0x10 /* post notify on radar clear */ 297172056Ssam 298172056Ssam#define IEEE80211_IS_CHAN_RADAR(_c) \ 299172056Ssam (((_c)->ic_state & IEEE80211_CHANSTATE_RADAR) != 0) 300172056Ssam#define IEEE80211_IS_CHAN_CACDONE(_c) \ 301172056Ssam (((_c)->ic_state & IEEE80211_CHANSTATE_CACDONE) != 0) 302187795Ssam#define IEEE80211_IS_CHAN_CWINT(_c) \ 303187795Ssam (((_c)->ic_state & IEEE80211_CHANSTATE_CWINT) != 0) 304172056Ssam 305138568Ssam/* ni_chan encoding for FH phy */ 306138568Ssam#define IEEE80211_FH_CHANMOD 80 307138568Ssam#define IEEE80211_FH_CHAN(set,pat) (((set)-1)*IEEE80211_FH_CHANMOD+(pat)) 308138568Ssam#define IEEE80211_FH_CHANSET(chan) ((chan)/IEEE80211_FH_CHANMOD+1) 309138568Ssam#define IEEE80211_FH_CHANPAT(chan) ((chan)%IEEE80211_FH_CHANMOD) 310138568Ssam 311172225Ssam#define IEEE80211_TID_SIZE (WME_NUM_TID+1) /* WME TID's +1 for non-QoS */ 312172225Ssam#define IEEE80211_NONQOS_TID WME_NUM_TID /* index for non-QoS sta */ 313172225Ssam 314138568Ssam/* 315178354Ssam * The 802.11 spec says at most 2007 stations may be 316178354Ssam * associated at once. For most AP's this is way more 317178354Ssam * than is feasible so we use a default of 128. This 318178354Ssam * number may be overridden by the driver and/or by 319178354Ssam * user configuration but may not be less than IEEE80211_AID_MIN. 320178354Ssam */ 321178354Ssam#define IEEE80211_AID_DEF 128 322178354Ssam#define IEEE80211_AID_MIN 16 323178354Ssam 324178354Ssam/* 325138568Ssam * 802.11 rate set. 326138568Ssam */ 327138568Ssam#define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ 328138568Ssam#define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ 329138568Ssam 330138568Ssamstruct ieee80211_rateset { 331178354Ssam uint8_t rs_nrates; 332178354Ssam uint8_t rs_rates[IEEE80211_RATE_MAXSIZE]; 333138568Ssam}; 334138568Ssam 335170530Ssam/* 336178354Ssam * 802.11n variant of ieee80211_rateset. Instead of 337170530Ssam * legacy rates the entries are MCS rates. We define 338170530Ssam * the structure such that it can be used interchangeably 339170530Ssam * with an ieee80211_rateset (modulo structure size). 340170530Ssam */ 341219456Sbschmidt#define IEEE80211_HTRATE_MAXSIZE 77 342170530Ssam 343170530Ssamstruct ieee80211_htrateset { 344178354Ssam uint8_t rs_nrates; 345178354Ssam uint8_t rs_rates[IEEE80211_HTRATE_MAXSIZE]; 346170530Ssam}; 347170530Ssam 348172226Ssam#define IEEE80211_RATE_MCS 0x80 349172226Ssam 350170530Ssam/* 351178354Ssam * Per-mode transmit parameters/controls visible to user space. 352178354Ssam * These can be used to set fixed transmit rate for all operating 353178354Ssam * modes or on a per-client basis according to the capabilities 354178354Ssam * of the client (e.g. an 11b client associated to an 11g ap). 355178354Ssam * 356178354Ssam * MCS are distinguished from legacy rates by or'ing in 0x80. 357170530Ssam */ 358178354Ssamstruct ieee80211_txparam { 359178354Ssam uint8_t ucastrate; /* ucast data rate (legacy/MCS|0x80) */ 360178354Ssam uint8_t mgmtrate; /* mgmt frame rate (legacy/MCS|0x80) */ 361178354Ssam uint8_t mcastrate; /* multicast rate (legacy/MCS|0x80) */ 362178354Ssam uint8_t maxretry; /* max unicast data retry count */ 363170530Ssam}; 364178354Ssam 365178354Ssam/* 366178354Ssam * Per-mode roaming state visible to user space. There are two 367178354Ssam * thresholds that control whether roaming is considered; when 368178354Ssam * either is exceeded the 802.11 layer will check the scan cache 369178354Ssam * for another AP. If the cache is stale then a scan may be 370178354Ssam * triggered. 371178354Ssam */ 372178354Ssamstruct ieee80211_roamparam { 373178354Ssam int8_t rssi; /* rssi thresh (.5 dBm) */ 374178354Ssam uint8_t rate; /* tx rate thresh (.5 Mb/s or MCS) */ 375178354Ssam uint16_t pad; /* reserve */ 376178354Ssam}; 377178354Ssam 378178354Ssam/* 379178354Ssam * Regulatory Information. 380178354Ssam */ 381178354Ssamstruct ieee80211_regdomain { 382178354Ssam uint16_t regdomain; /* SKU */ 383178354Ssam uint16_t country; /* ISO country code */ 384178354Ssam uint8_t location; /* I (indoor), O (outdoor), other */ 385178354Ssam uint8_t ecm; /* Extended Channel Mode */ 386178354Ssam char isocc[2]; /* country code string */ 387178354Ssam short pad[2]; 388178354Ssam}; 389178354Ssam 390178354Ssam/* 391178354Ssam * MIMO antenna/radio state. 392178354Ssam */ 393220445Sadrian 394220445Sadrian/* 395220445Sadrian * XXX This doesn't yet export both ctl/ext chain details 396288245Sadrian * XXX TODO: IEEE80211_MAX_CHAINS is defined in _freebsd.h, not here; 397288245Sadrian * figure out how to pull it in! 398220445Sadrian */ 399178354Ssamstruct ieee80211_mimo_info { 400288245Sadrian int8_t rssi[3]; /* per-antenna rssi */ 401288245Sadrian int8_t noise[3]; /* per-antenna noise floor */ 402220935Sadrian uint8_t pad[2]; 403220935Sadrian uint32_t evm[3]; /* EVM data */ 404178354Ssam}; 405138568Ssam#endif /* _NET80211__IEEE80211_H_ */ 406