10ba2cbe9Sxc /* 20dc2366fSVenugopal Iyer * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 30ba2cbe9Sxc * Use is subject to license terms. 40ba2cbe9Sxc */ 50ba2cbe9Sxc 6976d66abSHans Rosenfeld /* 7976d66abSHans Rosenfeld * Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org> 8976d66abSHans Rosenfeld */ 9976d66abSHans Rosenfeld 100ba2cbe9Sxc /* 110ba2cbe9Sxc * Copyright (c) 2001 Atsushi Onoe 120ba2cbe9Sxc * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting 130ba2cbe9Sxc * All rights reserved. 140ba2cbe9Sxc * 150ba2cbe9Sxc * Redistribution and use in source and binary forms, with or without 160ba2cbe9Sxc * modification, are permitted provided that the following conditions 170ba2cbe9Sxc * are met: 180ba2cbe9Sxc * 1. Redistributions of source code must retain the above copyright 190ba2cbe9Sxc * notice, this list of conditions and the following disclaimer. 200ba2cbe9Sxc * 2. Redistributions in binary form must reproduce the above copyright 210ba2cbe9Sxc * notice, this list of conditions and the following disclaimer in the 220ba2cbe9Sxc * documentation and/or other materials provided with the distribution. 230ba2cbe9Sxc * 3. The name of the author may not be used to endorse or promote products 240ba2cbe9Sxc * derived from this software without specific prior written permission. 250ba2cbe9Sxc * 260ba2cbe9Sxc * Alternatively, this software may be distributed under the terms of the 270ba2cbe9Sxc * GNU General Public License ("GPL") version 2 as published by the Free 280ba2cbe9Sxc * Software Foundation. 290ba2cbe9Sxc * 300ba2cbe9Sxc * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 310ba2cbe9Sxc * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 320ba2cbe9Sxc * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 330ba2cbe9Sxc * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 340ba2cbe9Sxc * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 350ba2cbe9Sxc * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 360ba2cbe9Sxc * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 370ba2cbe9Sxc * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 380ba2cbe9Sxc * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 390ba2cbe9Sxc * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 400ba2cbe9Sxc */ 410ba2cbe9Sxc 420ba2cbe9Sxc #ifndef _SYS_NET80211_H 430ba2cbe9Sxc #define _SYS_NET80211_H 440ba2cbe9Sxc 450ba2cbe9Sxc #include <sys/mac.h> 460dc2366fSVenugopal Iyer #include <sys/mac_provider.h> 470ba2cbe9Sxc #include <sys/ethernet.h> 480ba2cbe9Sxc #include <sys/net80211_proto.h> 490ba2cbe9Sxc #include <sys/net80211_crypto.h> 50e2cf88acSQuaker Fang #include <sys/net80211_ht.h> 51976d66abSHans Rosenfeld #include <sys/net80211_amrr.h> 52a399b765Szf #include <net/wpa.h> 530ba2cbe9Sxc 540ba2cbe9Sxc /* 550ba2cbe9Sxc * IEEE802.11 kernel support module 560ba2cbe9Sxc */ 570ba2cbe9Sxc 580ba2cbe9Sxc #ifdef __cplusplus 590ba2cbe9Sxc extern "C" { 600ba2cbe9Sxc #endif 610ba2cbe9Sxc 620ba2cbe9Sxc /* ic_caps */ 630ba2cbe9Sxc #define IEEE80211_C_WEP 0x00000001 /* CAPABILITY: WEP available */ 640ba2cbe9Sxc #define IEEE80211_C_TKIP 0x00000002 /* CAPABILITY: TKIP available */ 650ba2cbe9Sxc #define IEEE80211_C_AES 0x00000004 /* CAPABILITY: AES OCB avail */ 660ba2cbe9Sxc #define IEEE80211_C_AES_CCM 0x00000008 /* CAPABILITY: AES CCM avail */ 670ba2cbe9Sxc #define IEEE80211_C_CKIP 0x00000010 /* CAPABILITY: CKIP available */ 680ba2cbe9Sxc #define IEEE80211_C_FF 0x00000040 /* CAPABILITY: ATH FF avail */ 690ba2cbe9Sxc #define IEEE80211_C_TURBOP 0x00000080 700ba2cbe9Sxc /* CAPABILITY: ATH Turbo available */ 710ba2cbe9Sxc #define IEEE80211_C_IBSS 0x00000100 /* CAPABILITY: IBSS available */ 720ba2cbe9Sxc #define IEEE80211_C_PMGT 0x00000200 /* CAPABILITY: Power mgmt */ 730ba2cbe9Sxc #define IEEE80211_C_HOSTAP 0x00000400 /* CAPABILITY: HOSTAP avail */ 740ba2cbe9Sxc #define IEEE80211_C_AHDEMO 0x00000800 /* CAPABILITY: Old Adhoc Demo */ 750ba2cbe9Sxc #define IEEE80211_C_SWRETRY 0x00001000 /* CAPABILITY: sw tx retry */ 760ba2cbe9Sxc #define IEEE80211_C_TXPMGT 0x00002000 /* CAPABILITY: tx power mgmt */ 770ba2cbe9Sxc #define IEEE80211_C_SHSLOT 0x00004000 /* CAPABILITY: short slottime */ 780ba2cbe9Sxc #define IEEE80211_C_SHPREAMBLE 0x00008000 /* CAPABILITY: short preamble */ 790ba2cbe9Sxc #define IEEE80211_C_MONITOR 0x00010000 /* CAPABILITY: monitor mode */ 800ba2cbe9Sxc #define IEEE80211_C_TKIPMIC 0x00020000 /* CAPABILITY: TKIP MIC avail */ 810ba2cbe9Sxc #define IEEE80211_C_WPA1 0x00800000 /* CAPABILITY: WPA1 avail */ 820ba2cbe9Sxc #define IEEE80211_C_WPA2 0x01000000 /* CAPABILITY: WPA2 avail */ 830ba2cbe9Sxc #define IEEE80211_C_WPA 0x01800000 840ba2cbe9Sxc /* CAPABILITY: WPA1+WPA2 avail */ 850ba2cbe9Sxc #define IEEE80211_C_BURST 0x02000000 /* CAPABILITY: frame bursting */ 860ba2cbe9Sxc #define IEEE80211_C_WME 0x04000000 /* CAPABILITY: WME avail */ 870ba2cbe9Sxc #define IEEE80211_C_WDS 0x08000000 /* CAPABILITY: 4-addr support */ 880ba2cbe9Sxc /* 0x10000000 reserved */ 890ba2cbe9Sxc #define IEEE80211_C_BGSCAN 0x20000000 /* CAPABILITY: bg scanning */ 900ba2cbe9Sxc #define IEEE80211_C_TXFRAG 0x40000000 /* CAPABILITY: tx fragments */ 910ba2cbe9Sxc /* XXX protection/barker? */ 920ba2cbe9Sxc 930ba2cbe9Sxc #define IEEE80211_C_CRYPTO 0x0000001f /* CAPABILITY: crypto alg's */ 940ba2cbe9Sxc 95e2cf88acSQuaker Fang /* 96e2cf88acSQuaker Fang * ic_htcaps: HT-specific device/driver capabilities 97e2cf88acSQuaker Fang * 98e2cf88acSQuaker Fang * NB: the low 16-bits are the 802.11 definitions, the upper 99e2cf88acSQuaker Fang * 16-bits are used to define s/w/driver capabilities. 100e2cf88acSQuaker Fang */ 101e2cf88acSQuaker Fang #define IEEE80211_HTC_AMPDU 0x00010000 /* CAPABILITY: A-MPDU tx */ 102e2cf88acSQuaker Fang #define IEEE80211_HTC_AMSDU 0x00020000 /* CAPABILITY: A-MSDU tx */ 103e2cf88acSQuaker Fang /* NB: HT40 is implied by IEEE80211_HTCAP_CHWIDTH40 */ 104e2cf88acSQuaker Fang #define IEEE80211_HTC_HT 0x00040000 /* CAPABILITY: HT operation */ 105e2cf88acSQuaker Fang 1060ba2cbe9Sxc /* ic_flags */ 1070ba2cbe9Sxc /* NB: bits 0x4c available */ 1080ba2cbe9Sxc #define IEEE80211_F_FF 0x00000001 /* CONF: ATH FF enabled */ 1090ba2cbe9Sxc #define IEEE80211_F_TURBOP 0x00000002 /* CONF: ATH Turbo enabled */ 1100ba2cbe9Sxc #define IEEE80211_F_BURST 0x00000004 /* CONF: bursting enabled */ 1110ba2cbe9Sxc /* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */ 1120ba2cbe9Sxc #define IEEE80211_F_PRIVACY 0x00000010 /* CONF: privacy enabled */ 1130ba2cbe9Sxc #define IEEE80211_F_PUREG 0x00000020 /* CONF: 11g w/o 11b sta's */ 1140ba2cbe9Sxc #define IEEE80211_F_SCANONLY 0x00000040 /* CONF: scan only */ 1150ba2cbe9Sxc #define IEEE80211_F_SCAN 0x00000080 /* STATUS: scanning */ 1160ba2cbe9Sxc #define IEEE80211_F_ASCAN 0x00000100 /* STATUS: active scan */ 1170ba2cbe9Sxc #define IEEE80211_F_SIBSS 0x00000200 /* STATUS: start IBSS */ 1180ba2cbe9Sxc /* NB: this is intentionally setup to be IEEE80211_CAPINFO_SHORT_SLOTTIME */ 1190ba2cbe9Sxc #define IEEE80211_F_SHSLOT 0x00000400 1200ba2cbe9Sxc /* STATUS: use short slot time */ 1210ba2cbe9Sxc #define IEEE80211_F_PMGTON 0x00000800 /* CONF: Power mgmt enable */ 1220ba2cbe9Sxc #define IEEE80211_F_DESBSSID 0x00001000 /* CONF: des_bssid is set */ 1230ba2cbe9Sxc #define IEEE80211_F_WME 0x00002000 /* CONF: enable WME use */ 1240ba2cbe9Sxc #define IEEE80211_F_BGSCAN 0x00004000 1250ba2cbe9Sxc /* CONF: bg scan enabled (???) */ 1260ba2cbe9Sxc #define IEEE80211_F_SWRETRY 0x00008000 /* CONF: sw tx retry enabled */ 1270ba2cbe9Sxc #define IEEE80211_F_TXPOW_FIXED 0x00010000 /* TX Power: fixed rate */ 1280ba2cbe9Sxc #define IEEE80211_F_IBSSON 0x00020000 /* CONF: IBSS creation enable */ 1290ba2cbe9Sxc #define IEEE80211_F_SHPREAMBLE 0x00040000 /* STATUS: use short preamble */ 1300ba2cbe9Sxc #define IEEE80211_F_DATAPAD 0x00080000 /* CONF: do alignment pad */ 1310ba2cbe9Sxc #define IEEE80211_F_USEPROT 0x00100000 /* STATUS: protection enabled */ 1320ba2cbe9Sxc #define IEEE80211_F_USEBARKER 0x00200000 1330ba2cbe9Sxc /* STATUS: use barker preamble */ 1340ba2cbe9Sxc #define IEEE80211_F_TIMUPDATE 0x00400000 /* STATUS: update beacon tim */ 1350ba2cbe9Sxc #define IEEE80211_F_WPA1 0x00800000 /* CONF: WPA enabled */ 1360ba2cbe9Sxc #define IEEE80211_F_WPA2 0x01000000 /* CONF: WPA2 enabled */ 1370ba2cbe9Sxc #define IEEE80211_F_WPA 0x01800000 /* CONF: WPA/WPA2 enabled */ 1380ba2cbe9Sxc #define IEEE80211_F_DROPUNENC 0x02000000 /* CONF: drop unencrypted */ 1390ba2cbe9Sxc #define IEEE80211_F_COUNTERM 0x04000000 /* CONF: TKIP countermeasures */ 1400ba2cbe9Sxc #define IEEE80211_F_HIDESSID 0x08000000 /* CONF: hide SSID in beacon */ 1410ba2cbe9Sxc #define IEEE80211_F_NOBRIDGE 0x10000000 /* CONF: dis. internal bridge */ 1420ba2cbe9Sxc #define IEEE80211_F_WMEUPDATE 0x20000000 /* STATUS: update beacon wme */ 1430ba2cbe9Sxc 1440ba2cbe9Sxc /* ic_flags_ext */ 145e2cf88acSQuaker Fang #define IEEE80211_FEXT_NONHT_PR 0x00000001 /* STATUS: non-HT sta present */ 146e2cf88acSQuaker Fang #define IEEE80211_FEXT_INACT 0x00000002 /* CONF: sta inact handling */ 1470ba2cbe9Sxc /* 0x00000006 reserved */ 1480ba2cbe9Sxc #define IEEE80211_FEXT_BGSCAN 0x00000008 1490ba2cbe9Sxc /* STATUS: enable full bgscan completion */ 1500ba2cbe9Sxc #define IEEE80211_FEXT_ERPUPDATE 0x00000200 /* STATUS: update ERP element */ 1510ba2cbe9Sxc #define IEEE80211_FEXT_SWBMISS 0x00000400 /* CONF: do bmiss in s/w */ 152e2cf88acSQuaker Fang #define IEEE80211_FEXT_PROBECHAN 0x00020000 /* CONF: probe passive chan */ 153e2cf88acSQuaker Fang #define IEEE80211_FEXT_HT 0x00080000 /* CONF: HT supported */ 154e2cf88acSQuaker Fang #define IEEE80211_FEXT_AMPDU_TX 0x00100000 /* CONF: A-MPDU tx supported */ 155e2cf88acSQuaker Fang #define IEEE80211_FEXT_AMPDU_RX 0x00200000 /* CONF: A-MPDU tx supported */ 156e2cf88acSQuaker Fang #define IEEE80211_FEXT_AMSDU_TX 0x00400000 /* CONF: A-MSDU tx supported */ 157e2cf88acSQuaker Fang #define IEEE80211_FEXT_AMSDU_RX 0x00800000 /* CONF: A-MSDU tx supported */ 158e2cf88acSQuaker Fang #define IEEE80211_FEXT_USEHT40 0x01000000 /* CONF: 20/40 use enabled */ 159e2cf88acSQuaker Fang #define IEEE80211_FEXT_PUREN 0x02000000 /* CONF: 11n w/o legacy sta's */ 160e2cf88acSQuaker Fang #define IEEE80211_FEXT_SHORTGI20 0x04000000 /* CONF: short GI in HT20 */ 161e2cf88acSQuaker Fang #define IEEE80211_FEXT_SHORTGI40 0x08000000 /* CONF: short GI in HT40 */ 162e2cf88acSQuaker Fang #define IEEE80211_FEXT_HTCOMPAT 0x10000000 /* CONF: HT vendor OUI's */ 1630ba2cbe9Sxc 1640ba2cbe9Sxc /* 1650ba2cbe9Sxc * Channel attributes (ich_flags) 1660ba2cbe9Sxc * bits 0-3 are for private use by drivers 1670ba2cbe9Sxc */ 168e2cf88acSQuaker Fang #define IEEE80211_CHAN_TURBO 0x00000010 /* Turbo channel */ 169e2cf88acSQuaker Fang #define IEEE80211_CHAN_CCK 0x00000020 /* CCK channel */ 170e2cf88acSQuaker Fang #define IEEE80211_CHAN_OFDM 0x00000040 /* OFDM channel */ 171e2cf88acSQuaker Fang #define IEEE80211_CHAN_2GHZ 0x00000080 /* 2 GHz spectrum channel. */ 172e2cf88acSQuaker Fang #define IEEE80211_CHAN_5GHZ 0x00000100 /* 5 GHz spectrum channel */ 173e2cf88acSQuaker Fang #define IEEE80211_CHAN_PASSIVE 0x00000200 /* Only passive scan allowed */ 174e2cf88acSQuaker Fang #define IEEE80211_CHAN_DYN 0x00000400 /* Dynamic CCK-OFDM channel */ 175e2cf88acSQuaker Fang #define IEEE80211_CHAN_GFSK 0x00000800 /* GFSK channel (FHSS PHY) */ 176e2cf88acSQuaker Fang #define IEEE80211_CHAN_GSM 0x00001000 /* 900 MHz spectrum channel */ 177e2cf88acSQuaker Fang #define IEEE80211_CHAN_STURBO 0x00002000 /* 11a static turbo channel only */ 178e2cf88acSQuaker Fang #define IEEE80211_CHAN_HALF 0x00004000 /* Half rate channel */ 179e2cf88acSQuaker Fang #define IEEE80211_CHAN_QUARTER 0x00008000 /* Quarter rate channel */ 180e2cf88acSQuaker Fang #define IEEE80211_CHAN_HT20 0x00010000 /* HT 20 channel */ 181e2cf88acSQuaker Fang #define IEEE80211_CHAN_HT40U 0x00020000 /* HT 40 channel w/ ext above */ 182e2cf88acSQuaker Fang #define IEEE80211_CHAN_HT40D 0x00040000 /* HT 40 channel w/ ext below */ 183e2cf88acSQuaker Fang #define IEEE80211_CHAN_DFS 0x00080000 /* DFS required */ 184e2cf88acSQuaker Fang #define IEEE80211_CHAN_4MSXMIT 0x00100000 /* 4ms limit on frame length */ 185e2cf88acSQuaker Fang #define IEEE80211_CHAN_NOADHOC 0x00200000 /* adhoc mode not allowed */ 186e2cf88acSQuaker Fang #define IEEE80211_CHAN_NOHOSTAP 0x00400000 /* hostap mode not allowed */ 187e2cf88acSQuaker Fang #define IEEE80211_CHAN_11D 0x00800000 /* 802.11d required */ 188e2cf88acSQuaker Fang 189e2cf88acSQuaker Fang #define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D) 190e2cf88acSQuaker Fang #define IEEE80211_CHAN_HT (IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40) 1910ba2cbe9Sxc 1920ba2cbe9Sxc #define IEEE80211_CHAN_MAX 255 1930ba2cbe9Sxc #define IEEE80211_CHAN_BYTES 32 /* howmany(IEEE80211_CHAN_MAX, NBBY) */ 1940ba2cbe9Sxc #define IEEE80211_CHAN_ANY 0xffff /* token for ``any channel'' */ 1950ba2cbe9Sxc #define IEEE80211_CHAN_ANYC \ 1960ba2cbe9Sxc ((struct ieee80211_channel *)IEEE80211_CHAN_ANY) 1970ba2cbe9Sxc 1980ba2cbe9Sxc #define IEEE80211_IS_CHAN_2GHZ(_c) \ 1990ba2cbe9Sxc (((_c)->ich_flags & IEEE80211_CHAN_2GHZ) != 0) 2000ba2cbe9Sxc #define IEEE80211_IS_CHAN_5GHZ(_c) \ 2010ba2cbe9Sxc (((_c)->ich_flags & IEEE80211_CHAN_5GHZ) != 0) 2020ba2cbe9Sxc 203e2cf88acSQuaker Fang #define IEEE80211_NODE_CHWUPDATE 0x0400 /* 11n channel width change */ 2040ba2cbe9Sxc #define IEEE80211_NODE_HASHSIZE 32 2050ba2cbe9Sxc 206e2cf88acSQuaker Fang #define IEEE80211_NODE_AUTH 0x0001 /* authorized for data */ 207e2cf88acSQuaker Fang #define IEEE80211_NODE_QOS 0x0002 /* QoS enabled */ 208e2cf88acSQuaker Fang #define IEEE80211_NODE_ERP 0x0004 /* ERP enabled */ 209e2cf88acSQuaker Fang /* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */ 210e2cf88acSQuaker Fang #define IEEE80211_NODE_PWR_MGT 0x0010 /* power save mode enabled */ 211e2cf88acSQuaker Fang #define IEEE80211_NODE_AREF 0x0020 /* authentication ref held */ 212e2cf88acSQuaker Fang #define IEEE80211_NODE_HT 0x0040 /* HT enabled */ 213e2cf88acSQuaker Fang #define IEEE80211_NODE_HTCOMPAT 0x0080 /* HT setup w/ vendor OUI's */ 214e2cf88acSQuaker Fang #define IEEE80211_NODE_AMPDU_RX 0x0400 /* AMPDU rx enabled */ 215e2cf88acSQuaker Fang #define IEEE80211_NODE_AMPDU_TX 0x0800 /* AMPDU tx enabled */ 216e2cf88acSQuaker Fang 217e2cf88acSQuaker Fang #define IEEE80211_NODE_AMPDU \ 218e2cf88acSQuaker Fang (IEEE80211_NODE_AMPDU_RX | IEEE80211_NODE_AMPDU_TX) 219e2cf88acSQuaker Fang 2200ba2cbe9Sxc #define IEEE80211_FIXED_RATE_NONE 0 221e2cf88acSQuaker Fang 222e2cf88acSQuaker Fang #define WME_OUI 0xf25000 223e2cf88acSQuaker Fang #define WME_OUI_TYPE 0x02 224e2cf88acSQuaker Fang #define WME_INFO_OUI_SUBTYPE 0x00 225e2cf88acSQuaker Fang #define WME_PARAM_OUI_SUBTYPE 0x01 226e2cf88acSQuaker Fang #define WME_VERSION 1 2270ba2cbe9Sxc 2280ba2cbe9Sxc /* WME stream classes */ 2290ba2cbe9Sxc #define WME_AC_BE 0 /* best effort */ 2300ba2cbe9Sxc #define WME_AC_BK 1 /* background */ 2310ba2cbe9Sxc #define WME_AC_VI 2 /* video */ 2320ba2cbe9Sxc #define WME_AC_VO 3 /* voice */ 2330ba2cbe9Sxc 234a399b765Szf #define MAX_EVENT 16 235a399b765Szf #define MAX_IEEE80211STR 256 236a399b765Szf 237e2cf88acSQuaker Fang /* For IEEE80211_RADIOTAP_FLAGS */ 238e2cf88acSQuaker Fang #define IEEE80211_RADIOTAP_F_CFP 0x01 239e2cf88acSQuaker Fang /* sent/received during CFP */ 240e2cf88acSQuaker Fang #define IEEE80211_RADIOTAP_F_SHORTPRE 0x02 241e2cf88acSQuaker Fang /* sent/received with short preamble */ 242e2cf88acSQuaker Fang #define IEEE80211_RADIOTAP_F_WEP 0x04 243e2cf88acSQuaker Fang /* sent/received with WEP encryption */ 244e2cf88acSQuaker Fang #define IEEE80211_RADIOTAP_F_FRAG 0x08 245e2cf88acSQuaker Fang /* sent/received with fragmentation */ 246e2cf88acSQuaker Fang #define IEEE80211_RADIOTAP_F_DATAPAD 0x20 247e2cf88acSQuaker Fang /* 248e2cf88acSQuaker Fang * frame has padding between 802.11 249e2cf88acSQuaker Fang * header and payload (to 32-bit 250e2cf88acSQuaker Fang * boundary 251e2cf88acSQuaker Fang */ 252e2cf88acSQuaker Fang #define IEEE80211_RADIOTAP_F_FCS 0x10 /* frame includes FCS */ 253e2cf88acSQuaker Fang #define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* does not pass FCS check */ 254e2cf88acSQuaker Fang #define IEEE80211_RADIOTAP_F_SHORTGI 0x80 /* HT short GI */ 255e2cf88acSQuaker Fang 2560ba2cbe9Sxc /* 2570ba2cbe9Sxc * Authentication mode. 2580ba2cbe9Sxc */ 2590ba2cbe9Sxc enum ieee80211_authmode { 2600ba2cbe9Sxc IEEE80211_AUTH_NONE = 0, 2610ba2cbe9Sxc IEEE80211_AUTH_OPEN = 1, /* open */ 2620ba2cbe9Sxc IEEE80211_AUTH_SHARED = 2, /* shared-key */ 2630ba2cbe9Sxc IEEE80211_AUTH_8021X = 3, /* 802.1x */ 2640ba2cbe9Sxc IEEE80211_AUTH_AUTO = 4, /* auto-select/accept */ 2650ba2cbe9Sxc /* NB: these are used only for ioctls */ 2660ba2cbe9Sxc IEEE80211_AUTH_WPA = 5 /* WPA/RSN w/ 802.1x/PSK */ 2670ba2cbe9Sxc }; 2680ba2cbe9Sxc 2690ba2cbe9Sxc enum ieee80211_state { 2700ba2cbe9Sxc IEEE80211_S_INIT = 0, /* default state */ 2710ba2cbe9Sxc IEEE80211_S_SCAN = 1, /* scanning */ 2720ba2cbe9Sxc IEEE80211_S_AUTH = 2, /* try to authenticate */ 2730ba2cbe9Sxc IEEE80211_S_ASSOC = 3, /* try to assoc */ 2740ba2cbe9Sxc IEEE80211_S_RUN = 4 /* associated */ 2750ba2cbe9Sxc }; 2760ba2cbe9Sxc #define IEEE80211_S_MAX (IEEE80211_S_RUN+1) 2770ba2cbe9Sxc 2780ba2cbe9Sxc /* 2790ba2cbe9Sxc * 802.11 rate set. 2800ba2cbe9Sxc */ 2810ba2cbe9Sxc #define IEEE80211_RATE_MAXSIZE 15 /* max rates we'll handle */ 2820ba2cbe9Sxc #define IEEE80211_RATE_SIZE 8 /* 802.11 standard */ 2830ba2cbe9Sxc #define IEEE80211_XRATE_SIZE (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) 2840ba2cbe9Sxc /* size of extended supported rates */ 2850ba2cbe9Sxc struct ieee80211_rateset { 2860ba2cbe9Sxc uint8_t ir_nrates; 2870ba2cbe9Sxc uint8_t ir_rates[IEEE80211_RATE_MAXSIZE]; 2880ba2cbe9Sxc }; 2890ba2cbe9Sxc 290e2cf88acSQuaker Fang /* 291e2cf88acSQuaker Fang * 802.11n variant of ieee80211_rateset. Instead 292e2cf88acSQuaker Fang * legacy rates the entries are MCS rates. We define 293e2cf88acSQuaker Fang * the structure such that it can be used interchangeably 294e2cf88acSQuaker Fang * with an ieee80211_rateset (modulo structure size). 295e2cf88acSQuaker Fang */ 296e2cf88acSQuaker Fang #define IEEE80211_HTRATE_MAXSIZE 127 297e2cf88acSQuaker Fang 298e2cf88acSQuaker Fang struct ieee80211_htrateset { 299e2cf88acSQuaker Fang uint8_t rs_nrates; 300e2cf88acSQuaker Fang uint8_t rs_rates[IEEE80211_HTRATE_MAXSIZE]; 301e2cf88acSQuaker Fang }; 302e2cf88acSQuaker Fang 303e2cf88acSQuaker Fang #define IEEE80211_RATE_MCS 0x80 304e2cf88acSQuaker Fang 3050ba2cbe9Sxc /* 3060ba2cbe9Sxc * Channels are specified by frequency and attributes. 3070ba2cbe9Sxc */ 3080ba2cbe9Sxc struct ieee80211_channel { 3090ba2cbe9Sxc uint16_t ich_freq; /* setting in Mhz */ 310e2cf88acSQuaker Fang uint32_t ich_flags; /* see below */ 3110ba2cbe9Sxc }; 3120ba2cbe9Sxc 3130ba2cbe9Sxc struct ieee80211_device_stats { 3140ba2cbe9Sxc uint32_t is_tx_frags; 3150ba2cbe9Sxc uint32_t is_tx_bytes; 3160ba2cbe9Sxc uint32_t is_tx_mcast; 3170ba2cbe9Sxc uint32_t is_tx_failed; 3180ba2cbe9Sxc uint32_t is_tx_retries; 3190ba2cbe9Sxc uint32_t is_rts_success; 3200ba2cbe9Sxc uint32_t is_rts_failure; 3210ba2cbe9Sxc uint32_t is_ack_failure; 3220ba2cbe9Sxc uint32_t is_rx_frags; 3230ba2cbe9Sxc uint32_t is_rx_bytes; 3240ba2cbe9Sxc uint32_t is_rx_mcast; 3250ba2cbe9Sxc uint32_t is_rx_dups; 3260ba2cbe9Sxc uint32_t is_fcs_errors; 3270ba2cbe9Sxc uint32_t is_wep_errors; 3280ba2cbe9Sxc uint32_t is_tx_nobuf; 3290ba2cbe9Sxc uint32_t is_tx_unknownmgt; 3300ba2cbe9Sxc }; 3310ba2cbe9Sxc 3320ba2cbe9Sxc struct ieee80211_crypto_state; 3330ba2cbe9Sxc typedef struct ieee80211_node_table ieee80211_node_table_t; 3340ba2cbe9Sxc typedef struct ieee80211_node ieee80211_node_t; 3350ba2cbe9Sxc typedef struct ieee80211com ieee80211com_t; 3360ba2cbe9Sxc 3370ba2cbe9Sxc struct ieee80211_node_table { 3380ba2cbe9Sxc struct ieee80211com *nt_ic; /* back reference */ 3390ba2cbe9Sxc 3400ba2cbe9Sxc const char *nt_name; /* for debugging */ 3410ba2cbe9Sxc /* For node inactivity processing */ 3420ba2cbe9Sxc int nt_inact_timer; /* inactivity timer */ 3430ba2cbe9Sxc int nt_inact_init; /* initial node inact setting */ 3440ba2cbe9Sxc void (*nt_timeout)(struct ieee80211_node_table *); 3450ba2cbe9Sxc uint32_t nt_scangen; /* gen# for timeout scan */ 3460ba2cbe9Sxc kmutex_t nt_scanlock; /* on nt_scangen */ 3470ba2cbe9Sxc kmutex_t nt_nodelock; /* on node table */ 3480ba2cbe9Sxc 3490ba2cbe9Sxc int nt_keyixmax; /* keyixmap size */ 3500ba2cbe9Sxc struct ieee80211_node **nt_keyixmap; /* key ix -> node map */ 3510ba2cbe9Sxc 3520ba2cbe9Sxc list_t nt_node; /* information of all nodes */ 3530ba2cbe9Sxc list_t nt_hash[IEEE80211_NODE_HASHSIZE]; 3540ba2cbe9Sxc }; 3550ba2cbe9Sxc 356e2cf88acSQuaker Fang #define IEEE80211_TID_SIZE (WME_NUM_TID+1) /* WME TID's +1 for non-QoS */ 357e2cf88acSQuaker Fang #define IEEE80211_NONQOS_TID WME_NUM_TID /* index for non-QoS sta */ 358e2cf88acSQuaker Fang 3590ba2cbe9Sxc /* 3600ba2cbe9Sxc * Node specific information. Note that drivers are expected 3610ba2cbe9Sxc * to derive from this structure to add device-specific per-node 3620ba2cbe9Sxc * state. This is done by overriding the ic_node_* methods in 3630ba2cbe9Sxc * the ieee80211com structure. 3640ba2cbe9Sxc */ 3650ba2cbe9Sxc struct ieee80211_node { 3660ba2cbe9Sxc struct ieee80211com *in_ic; 3670ba2cbe9Sxc struct ieee80211_node_table *in_table; 3680ba2cbe9Sxc 3690ba2cbe9Sxc uint8_t in_authmode; /* authentication algorithm */ 3700ba2cbe9Sxc uint16_t in_flags; /* special purpose state */ 3710ba2cbe9Sxc uint16_t in_associd; /* assoc response */ 3720ba2cbe9Sxc uint16_t in_txpower; /* current transmit power */ 3730ba2cbe9Sxc uint16_t in_vlan; /* vlan tag */ 3740ba2cbe9Sxc /* 3750ba2cbe9Sxc * Tx/Rx sequence number. 3760ba2cbe9Sxc * index 0 is used when QoS is not enabled. index 1-16 is used 3770ba2cbe9Sxc * when QoS is enabled. 1-16 corresponds to TID 0-15. 3780ba2cbe9Sxc */ 379e2cf88acSQuaker Fang uint16_t in_txseqs[IEEE80211_TID_SIZE]; 380e2cf88acSQuaker Fang uint16_t in_rxseqs[IEEE80211_TID_SIZE]; 3810ba2cbe9Sxc clock_t in_rxfragstamp; /* time stamp of last rx frag */ 3820ba2cbe9Sxc mblk_t *in_rxfrag; /* rx frag reassembly */ 3830ba2cbe9Sxc uint32_t in_scangen; /* gen# for timeout scan */ 3840ba2cbe9Sxc uint32_t in_refcnt; 3850ba2cbe9Sxc 3860ba2cbe9Sxc /* hardware */ 3870ba2cbe9Sxc uint32_t in_rstamp; /* recv timestamp */ 3880ba2cbe9Sxc uint8_t in_rssi; /* recv ssi */ 3890ba2cbe9Sxc 3900ba2cbe9Sxc /* header */ 3910ba2cbe9Sxc uint8_t in_macaddr[IEEE80211_ADDR_LEN]; 3920ba2cbe9Sxc uint8_t in_bssid[IEEE80211_ADDR_LEN]; 3930ba2cbe9Sxc 3940ba2cbe9Sxc /* beacon, probe response */ 3950ba2cbe9Sxc union { 3960ba2cbe9Sxc uint8_t data[8]; 3970ba2cbe9Sxc uint64_t tsf; 3980ba2cbe9Sxc } in_tstamp; /* from last rcv'd beacon */ 3990ba2cbe9Sxc uint16_t in_intval; /* beacon interval */ 4000ba2cbe9Sxc uint16_t in_capinfo; /* capabilities */ 4010ba2cbe9Sxc uint8_t in_esslen; 4020ba2cbe9Sxc uint8_t in_essid[IEEE80211_NWID_LEN]; 4030ba2cbe9Sxc struct ieee80211_rateset in_rates; /* negotiated rate set */ 4040ba2cbe9Sxc struct ieee80211_channel *in_chan; /* XXX multiple uses */ 4050ba2cbe9Sxc enum ieee80211_phytype in_phytype; 4060ba2cbe9Sxc uint16_t in_fhdwell; /* FH only */ 4070ba2cbe9Sxc uint8_t in_fhindex; /* FH only */ 4080ba2cbe9Sxc uint8_t in_erp; /* ERP from beacon/probe resp */ 4090ba2cbe9Sxc uint16_t in_tim_off; /* byte offset to TIM ie */ 4100ba2cbe9Sxc uint8_t in_dtim_period; /* DTIM period */ 4110ba2cbe9Sxc uint8_t in_dtim_count; /* DTIM count for last bcn */ 4120ba2cbe9Sxc 4130ba2cbe9Sxc uint32_t *in_challenge; /* shared-key challenge */ 4140ba2cbe9Sxc struct ieee80211_key in_ucastkey; /* unicast key */ 415a399b765Szf uint8_t *in_wpa_ie; /* captured WPA/RSN ie */ 416e2cf88acSQuaker Fang uint8_t *in_wme_ie; /* captured WME ie */ 417e2cf88acSQuaker Fang 418e2cf88acSQuaker Fang /* 11n state */ 419e2cf88acSQuaker Fang uint8_t *in_htcap_ie; /* captured HTCAP ie */ 420e2cf88acSQuaker Fang uint16_t in_htcap; /* HT capabilities */ 421e2cf88acSQuaker Fang uint8_t in_htparam; /* HT params */ 422e2cf88acSQuaker Fang uint8_t in_htctlchan; /* HT control channel */ 423e2cf88acSQuaker Fang uint8_t in_ht2ndchan; /* HT 2nd channel */ 424e2cf88acSQuaker Fang uint8_t in_htopmode; /* HT operating mode */ 425e2cf88acSQuaker Fang uint8_t in_htstbc; /* HT */ 426e2cf88acSQuaker Fang uint8_t in_reqcw; /* requested tx channel width */ 427e2cf88acSQuaker Fang uint8_t in_chw; /* negotiated channel width */ 428e2cf88acSQuaker Fang struct ieee80211_htrateset in_htrates; /* negotiated ht rate set */ 429e2cf88acSQuaker Fang struct ieee80211_tx_ampdu in_tx_ampdu[WME_NUM_AC]; 430e2cf88acSQuaker Fang struct ieee80211_rx_ampdu in_rx_ampdu[WME_NUM_TID]; 4310ba2cbe9Sxc 4320ba2cbe9Sxc /* others */ 4330ba2cbe9Sxc int32_t in_fails; /* failure count to associate */ 4340ba2cbe9Sxc int16_t in_inact; /* inactivity mark count */ 4350ba2cbe9Sxc int16_t in_inact_reload; /* inactivity reload value */ 436e2cf88acSQuaker Fang int32_t in_txrate; /* index to in_rates[] */ 4370ba2cbe9Sxc 4380ba2cbe9Sxc list_node_t in_node; /* element of nt->nt_node */ 4390ba2cbe9Sxc list_node_t in_hash; /* element of nt->nt_hash */ 4400ba2cbe9Sxc }; 4410ba2cbe9Sxc 442e2cf88acSQuaker Fang /* 443e2cf88acSQuaker Fang * WME/WMM support. 444e2cf88acSQuaker Fang */ 445e2cf88acSQuaker Fang struct wmeParams { 446e2cf88acSQuaker Fang uint8_t wmep_acm; 447e2cf88acSQuaker Fang uint8_t wmep_aifsn; 448e2cf88acSQuaker Fang uint8_t wmep_logcwmin; /* log2(cwmin) */ 449e2cf88acSQuaker Fang uint8_t wmep_logcwmax; /* log2(cwmax) */ 450e2cf88acSQuaker Fang uint8_t wmep_txopLimit; 451e2cf88acSQuaker Fang uint8_t wmep_noackPolicy; /* 0 (ack), 1 (no ack) */ 452e2cf88acSQuaker Fang }; 453e2cf88acSQuaker Fang #define IEEE80211_TXOP_TO_US(_txop) ((_txop)<<5) 454e2cf88acSQuaker Fang #define IEEE80211_US_TO_TXOP(_us) ((_us)>>5) 455e2cf88acSQuaker Fang 456e2cf88acSQuaker Fang struct chanAccParams { 457e2cf88acSQuaker Fang uint8_t cap_info; /* version of the current set */ 458e2cf88acSQuaker Fang struct wmeParams cap_wmeParams[WME_NUM_AC]; 459e2cf88acSQuaker Fang }; 460e2cf88acSQuaker Fang 461e2cf88acSQuaker Fang struct ieee80211_wme_state { 462e2cf88acSQuaker Fang uint_t wme_flags; 463e2cf88acSQuaker Fang #define WME_F_AGGRMODE 0x00000001 /* STATUS: WME agressive mode */ 464e2cf88acSQuaker Fang uint_t wme_hipri_traffic; /* VI/VO frames in beacon interval */ 465e2cf88acSQuaker Fang uint_t wme_hipri_switch_thresh; /* agressive mode switch thresh */ 466e2cf88acSQuaker Fang uint_t wme_hipri_switch_hysteresis; 467e2cf88acSQuaker Fang /* agressive mode switch hysteresis */ 468e2cf88acSQuaker Fang struct wmeParams wme_params[4]; /* from assoc resp for each AC */ 469e2cf88acSQuaker Fang struct chanAccParams wme_wmeChanParams; /* WME params applied to self */ 470e2cf88acSQuaker Fang struct chanAccParams wme_wmeBssChanParams; 471e2cf88acSQuaker Fang /* WME params bcast to stations */ 472e2cf88acSQuaker Fang struct chanAccParams wme_chanParams; /* params applied to self */ 473e2cf88acSQuaker Fang struct chanAccParams wme_bssChanParams; /* params bcast to stations */ 474e2cf88acSQuaker Fang int (*wme_update)(struct ieee80211com *); 475e2cf88acSQuaker Fang }; 476e2cf88acSQuaker Fang 4770ba2cbe9Sxc struct ieee80211com { 4780ba2cbe9Sxc mac_handle_t ic_mach; 4790ba2cbe9Sxc 4800ba2cbe9Sxc /* Initialized by driver */ 4810ba2cbe9Sxc uint8_t ic_macaddr[IEEE80211_ADDR_LEN]; 4820ba2cbe9Sxc uint32_t ic_caps; /* capabilities */ 483e2cf88acSQuaker Fang uint32_t ic_htcaps; /* HT capabilities */ 4840ba2cbe9Sxc enum ieee80211_phytype ic_phytype; /* XXX wrong for multi-mode */ 4850ba2cbe9Sxc enum ieee80211_opmode ic_opmode; /* current operation mode */ 4860ba2cbe9Sxc enum ieee80211_state ic_state; /* current 802.11 state */ 4870ba2cbe9Sxc struct ieee80211_channel ic_sup_channels[IEEE80211_CHAN_MAX+1]; 4880ba2cbe9Sxc struct ieee80211_rateset ic_sup_rates[IEEE80211_MODE_MAX]; 4890ba2cbe9Sxc enum ieee80211_phymode ic_curmode; /* OPT current mode */ 4900ba2cbe9Sxc struct ieee80211_channel *ic_curchan; /* OPT current channel */ 4910ba2cbe9Sxc struct ieee80211_channel *ic_ibss_chan; /* OPT bss channel */ 4920ba2cbe9Sxc uint8_t ic_maxrssi; /* maximum hardware RSSI */ 4930ba2cbe9Sxc 4940ba2cbe9Sxc /* INITIALIZED by IEEE80211, used/overridden by driver */ 4950ba2cbe9Sxc uint16_t ic_modecaps; /* set of mode capabilities */ 4960ba2cbe9Sxc uint8_t ic_chan_active[IEEE80211_CHAN_BYTES]; 4970ba2cbe9Sxc enum ieee80211_protmode ic_protmode; /* 802.11g protection mode */ 4980ba2cbe9Sxc uint16_t ic_bintval; /* beacon interval */ 4990ba2cbe9Sxc uint16_t ic_lintval; /* listen interval */ 5000ba2cbe9Sxc uint16_t ic_txpowlimit; /* global tx power limit */ 5010ba2cbe9Sxc uint8_t ic_bmissthreshold; 5020ba2cbe9Sxc uint16_t ic_rtsthreshold; 5030ba2cbe9Sxc uint16_t ic_fragthreshold; 5040ba2cbe9Sxc uint8_t ic_fixed_rate; /* value of fixed rate */ 5050ba2cbe9Sxc int32_t ic_des_esslen; /* length of desired essid */ 5060ba2cbe9Sxc uint8_t ic_des_essid[IEEE80211_NWID_LEN]; 5070ba2cbe9Sxc uint8_t ic_des_bssid[IEEE80211_ADDR_LEN]; 5080ba2cbe9Sxc struct ieee80211_channel *ic_des_chan; /* desired channel */ 5090ba2cbe9Sxc void *ic_opt_ie; /* user-specified IE's */ 5100ba2cbe9Sxc uint16_t ic_opt_ie_len; /* length of ic_opt_ie */ 5110ba2cbe9Sxc uint8_t ic_nickname[IEEE80211_NWID_LEN]; 5120ba2cbe9Sxc uint16_t ic_tim_len; /* ic_tim_bitmap size (bytes) */ 5130ba2cbe9Sxc uint8_t *ic_tim_bitmap; /* powersave stations w/ data */ 5140ba2cbe9Sxc timeout_id_t ic_watchdog_timer; /* watchdog timer */ 5150ba2cbe9Sxc /* Cipher state/configuration. */ 5160ba2cbe9Sxc struct ieee80211_crypto_state ic_crypto; 517239e91abShx const struct ieee80211_cipher *ic_ciphers[IEEE80211_CIPHER_MAX]; 5180ba2cbe9Sxc 519a399b765Szf kmutex_t ic_doorlock; 520a399b765Szf char ic_wpadoor[MAX_IEEE80211STR]; 521a399b765Szf 522a399b765Szf wpa_event_type ic_eventq[MAX_EVENT]; 523a399b765Szf uint32_t ic_evq_head, ic_evq_tail; 524a399b765Szf 5250ba2cbe9Sxc /* Runtime states */ 5260ba2cbe9Sxc uint32_t ic_flags; /* state/conf flags */ 5270ba2cbe9Sxc uint32_t ic_flags_ext; /* extended state flags */ 5280ba2cbe9Sxc struct ieee80211_node *ic_bss; /* information for this node */ 5290ba2cbe9Sxc struct ieee80211_device_stats ic_stats; 5300ba2cbe9Sxc struct ieee80211_node_table ic_scan; /* STA: scan candidates */ 5310ba2cbe9Sxc struct ieee80211_node_table ic_sta; /* AP:stations/IBSS:neighbors */ 5320ba2cbe9Sxc 533e2cf88acSQuaker Fang struct ieee80211_wme_state ic_wme; /* WME/WMM state */ 534e2cf88acSQuaker Fang 535e2cf88acSQuaker Fang int ic_ampdu_rxmax; /* A-MPDU rx limit (bytes) */ 536e2cf88acSQuaker Fang int ic_ampdu_density; /* A-MPDU density */ 537e2cf88acSQuaker Fang int ic_ampdu_limit; /* A-MPDU tx limit (bytes) */ 538e2cf88acSQuaker Fang int ic_amsdu_limit; /* A-MSDU tx limit (bytes) */ 539e2cf88acSQuaker Fang 540e2cf88acSQuaker Fang uint16_t ic_sta_assoc; /* stations associated */ 541e2cf88acSQuaker Fang uint16_t ic_ht_sta_assoc; /* HT stations associated */ 542e2cf88acSQuaker Fang uint16_t ic_ht40_sta_assoc; /* HT40 station associated */ 543e2cf88acSQuaker Fang uint8_t ic_curhtprotmode; /* HTINFO bss state */ 544e2cf88acSQuaker Fang enum ieee80211_protmode ic_htprotmode; /* HT protection mode */ 545e2cf88acSQuaker Fang int ic_lastnonerp; /* last time nonERP sta noted */ 546e2cf88acSQuaker Fang int ic_lastnonht; /* last time non-HT sta noted */ 547216e0daaSQuaker Fang int ic_beaconmiss; /* beacon miss counter */ 548e2cf88acSQuaker Fang 549e2cf88acSQuaker Fang 5500ba2cbe9Sxc /* callback functions */ 5510ba2cbe9Sxc /* 5520ba2cbe9Sxc * Functions initialized by driver before calling ieee80211_attach() 5530ba2cbe9Sxc * Those must be initialized are marked with M(andatory) 5540ba2cbe9Sxc * 5550ba2cbe9Sxc * ic_xmit - [M] transmit a management or null data frame 5560ba2cbe9Sxc * return 0 on success, non-zero on error 5570ba2cbe9Sxc * ic_watchdog - [O] periodic run function, enabled by 5580ba2cbe9Sxc * ieee80211_start_watchdog() 5590ba2cbe9Sxc * ic_set_tim - [O] set/clear traffic indication map 5600ba2cbe9Sxc * ic_set_shortslot - [O] enable/disable short slot timing 5610ba2cbe9Sxc * ic_node_newassoc - [O] driver specific operation on a newly 5620ba2cbe9Sxc * associated or re-assoced node 5630ba2cbe9Sxc */ 5640ba2cbe9Sxc int (*ic_xmit)(ieee80211com_t *, mblk_t *, uint8_t); 5650ba2cbe9Sxc void (*ic_watchdog)(void *); 5660ba2cbe9Sxc void (*ic_set_tim)(ieee80211com_t *, 5670ba2cbe9Sxc ieee80211_node_t *, int); 5680ba2cbe9Sxc void (*ic_set_shortslot)(ieee80211com_t *, int); 5690ba2cbe9Sxc void (*ic_node_newassoc)(ieee80211_node_t *, int); 5700ba2cbe9Sxc /* 5710ba2cbe9Sxc * Functions initialized by ieee80211_attach(), driver could 5720ba2cbe9Sxc * override these functions after calling ieee80211_attach() 5730ba2cbe9Sxc * 5740ba2cbe9Sxc * ic_reset - reset 5750ba2cbe9Sxc * ic_recv_mgmt - handle received management frames 5760ba2cbe9Sxc * ic_send_mgmt - construct and transmit management frames 5770ba2cbe9Sxc * ic_newstate - handle state transition 5780ba2cbe9Sxc * ic_node_alloc - allocate a new BSS info node 5790ba2cbe9Sxc * ic_node_cleanup - cleanup or free memory spaces of a node 5800ba2cbe9Sxc * ic_node_free - free a node 5810ba2cbe9Sxc * ic_node_getrssi - get node's rssi 5820ba2cbe9Sxc */ 5830ba2cbe9Sxc int (*ic_reset)(ieee80211com_t *); 5840ba2cbe9Sxc void (*ic_recv_mgmt)(ieee80211com_t *, 5850ba2cbe9Sxc mblk_t *, ieee80211_node_t *, 5860ba2cbe9Sxc int, int, uint32_t); 5870ba2cbe9Sxc int (*ic_send_mgmt)(ieee80211com_t *, 5880ba2cbe9Sxc ieee80211_node_t *, int, int); 5890ba2cbe9Sxc int (*ic_newstate)(ieee80211com_t *, 5900ba2cbe9Sxc enum ieee80211_state, int); 5910ba2cbe9Sxc struct ieee80211_node *(*ic_node_alloc)(ieee80211com_t *); 5920ba2cbe9Sxc void (*ic_node_cleanup)(ieee80211_node_t *); 5930ba2cbe9Sxc void (*ic_node_free)(ieee80211_node_t *); 5940ba2cbe9Sxc uint8_t (*ic_node_getrssi)(const ieee80211_node_t *); 595e2cf88acSQuaker Fang void (*ic_set_channel)(ieee80211com_t *); 596e2cf88acSQuaker Fang 597e2cf88acSQuaker Fang /* 598e2cf88acSQuaker Fang * 802.11n ADDBA support. A simple/generic implementation 599e2cf88acSQuaker Fang * of A-MPDU tx aggregation is provided; the driver may 600e2cf88acSQuaker Fang * override these methods to provide their own support. 601e2cf88acSQuaker Fang * A-MPDU rx re-ordering happens automatically if the 602e2cf88acSQuaker Fang * driver passes out-of-order frames to ieee80211_input 603e2cf88acSQuaker Fang * from an assocated HT station. 604e2cf88acSQuaker Fang */ 605e2cf88acSQuaker Fang void (*ic_recv_action)(ieee80211_node_t *, 606e2cf88acSQuaker Fang const uint8_t *, const uint8_t *); 607e2cf88acSQuaker Fang int (*ic_send_action)(ieee80211_node_t *, 608e2cf88acSQuaker Fang int, int, uint16_t[4]); 609e2cf88acSQuaker Fang /* start/stop doing A-MPDU tx aggregation for a station */ 610e2cf88acSQuaker Fang int (*ic_addba_request)(ieee80211_node_t *, 611e2cf88acSQuaker Fang struct ieee80211_tx_ampdu *, 612e2cf88acSQuaker Fang int, int, int); 613e2cf88acSQuaker Fang int (*ic_addba_response)(ieee80211_node_t *, 614e2cf88acSQuaker Fang struct ieee80211_tx_ampdu *, 615e2cf88acSQuaker Fang int, int, int); 616e2cf88acSQuaker Fang void (*ic_addba_stop)(ieee80211_node_t *, 617e2cf88acSQuaker Fang struct ieee80211_tx_ampdu *); 6180ba2cbe9Sxc 6190ba2cbe9Sxc kmutex_t ic_genlock; 6200ba2cbe9Sxc void *ic_private; /* ieee80211 private data */ 6210ba2cbe9Sxc }; 6220ba2cbe9Sxc #define ic_nw_keys ic_crypto.cs_nw_keys 6230ba2cbe9Sxc #define ic_def_txkey ic_crypto.cs_def_txkey 6240ba2cbe9Sxc 6250ba2cbe9Sxc extern const char *ieee80211_state_name[IEEE80211_S_MAX]; 626e2cf88acSQuaker Fang extern const char *ieee80211_wme_acnames[]; 6270ba2cbe9Sxc 6280ba2cbe9Sxc #define IEEE80211_RATE(_ix) \ 6290ba2cbe9Sxc (in->in_rates.ir_rates[(_ix)] & IEEE80211_RATE_VAL) 6300ba2cbe9Sxc 6310ba2cbe9Sxc #define ieee80211_new_state(_ic, _nstate, _arg) \ 6320ba2cbe9Sxc (((_ic)->ic_newstate)((_ic), (_nstate), (_arg))) 6330ba2cbe9Sxc 6340ba2cbe9Sxc #define ieee80211_macaddr_sprintf(_addr) \ 6350ba2cbe9Sxc ether_sprintf((struct ether_addr *)(_addr)) 6360ba2cbe9Sxc 6370ba2cbe9Sxc /* 6380ba2cbe9Sxc * Node reference counting definitions. 6390ba2cbe9Sxc * 6400ba2cbe9Sxc * ieee80211_node_initref initialize the reference count to 1 6410ba2cbe9Sxc * ieee80211_node_incref add a reference 6420ba2cbe9Sxc * ieee80211_node_decref remove a reference 6430ba2cbe9Sxc * ieee80211_node_decref_nv remove a reference and return new value 6440ba2cbe9Sxc * ieee80211_node_refcnt reference count for printing (only) 6450ba2cbe9Sxc */ 6460ba2cbe9Sxc #include <sys/atomic.h> 6470ba2cbe9Sxc #define ieee80211_node_initref(_in) \ 6480ba2cbe9Sxc ((_in)->in_refcnt = 1) 6490ba2cbe9Sxc #define ieee80211_node_incref(_in) \ 6500ba2cbe9Sxc atomic_inc_uint(&(_in)->in_refcnt) 6510ba2cbe9Sxc #define ieee80211_node_decref(_in) \ 6520ba2cbe9Sxc atomic_dec_uint(&(_in)->in_refcnt) 6530ba2cbe9Sxc #define ieee80211_node_decref_nv(_in) \ 6540ba2cbe9Sxc atomic_dec_uint_nv(&(_in)->in_refcnt) 6550ba2cbe9Sxc #define ieee80211_node_refcnt(_in) \ 6560ba2cbe9Sxc (_in)->in_refcnt 6570ba2cbe9Sxc 6580ba2cbe9Sxc typedef void ieee80211_iter_func(void *, ieee80211_node_t *); 6590ba2cbe9Sxc 6600ba2cbe9Sxc /* Initialization */ 6610ba2cbe9Sxc void ieee80211_attach(ieee80211com_t *); 6620ba2cbe9Sxc void ieee80211_detach(ieee80211com_t *); 6630ba2cbe9Sxc void ieee80211_media_init(ieee80211com_t *); 6640ba2cbe9Sxc int ieee80211_ioctl(ieee80211com_t *, queue_t *, mblk_t *); 6653a1a8936Szf void ieee80211_register_door(ieee80211com_t *, const char *, int); 6660ba2cbe9Sxc 6670ba2cbe9Sxc /* Protocol Processing */ 6680ba2cbe9Sxc int ieee80211_input(ieee80211com_t *, mblk_t *, ieee80211_node_t *, 6690ba2cbe9Sxc int32_t, uint32_t); 6700ba2cbe9Sxc mblk_t *ieee80211_encap(ieee80211com_t *, mblk_t *, ieee80211_node_t *); 6710ba2cbe9Sxc 6720ba2cbe9Sxc mblk_t *ieee80211_beacon_alloc(ieee80211com_t *, ieee80211_node_t *, 6730ba2cbe9Sxc struct ieee80211_beacon_offsets *); 6740ba2cbe9Sxc int ieee80211_beacon_update(ieee80211com_t *, ieee80211_node_t *, 6750ba2cbe9Sxc struct ieee80211_beacon_offsets *, mblk_t *, int); 6760ba2cbe9Sxc void ieee80211_beacon_miss(ieee80211com_t *); 6770ba2cbe9Sxc 6780ba2cbe9Sxc void ieee80211_begin_scan(ieee80211com_t *, boolean_t); 6790ba2cbe9Sxc void ieee80211_next_scan(ieee80211com_t *); 6800ba2cbe9Sxc void ieee80211_end_scan(ieee80211com_t *); 6810ba2cbe9Sxc void ieee80211_cancel_scan(ieee80211com_t *); 6820ba2cbe9Sxc 6830ba2cbe9Sxc void ieee80211_sta_join(ieee80211com_t *, ieee80211_node_t *); 6840ba2cbe9Sxc void ieee80211_sta_leave(ieee80211com_t *, ieee80211_node_t *); 6850ba2cbe9Sxc boolean_t ieee80211_ibss_merge(ieee80211_node_t *); 6860ba2cbe9Sxc 6870ba2cbe9Sxc /* Node Operation */ 6880ba2cbe9Sxc ieee80211_node_t *ieee80211_ref_node(ieee80211_node_t *); 6890ba2cbe9Sxc void ieee80211_unref_node(ieee80211_node_t **); 6900ba2cbe9Sxc void ieee80211_node_authorize(ieee80211_node_t *); 6910ba2cbe9Sxc void ieee80211_node_unauthorize(ieee80211_node_t *); 6920ba2cbe9Sxc ieee80211_node_t *ieee80211_alloc_node(ieee80211com_t *, 6930ba2cbe9Sxc ieee80211_node_table_t *, const uint8_t *); 6940ba2cbe9Sxc void ieee80211_free_node(ieee80211_node_t *); 6950ba2cbe9Sxc void ieee80211_node_table_reset(ieee80211_node_table_t *); 6960ba2cbe9Sxc void ieee80211_iterate_nodes(ieee80211_node_table_t *, ieee80211_iter_func *, 6970ba2cbe9Sxc void *); 6980ba2cbe9Sxc ieee80211_node_t *ieee80211_find_node(ieee80211_node_table_t *, 6990ba2cbe9Sxc const uint8_t *); 700a399b765Szf ieee80211_node_t *ieee80211_find_node_with_ssid(ieee80211_node_table_t *, 701a399b765Szf const uint8_t *, uint32_t, const uint8_t *); 7020ba2cbe9Sxc ieee80211_node_t *ieee80211_find_txnode(ieee80211com_t *, 703*f4203ebbSToomas Soome const uint8_t *daddr); 7040ba2cbe9Sxc ieee80211_node_t *ieee80211_find_rxnode(ieee80211com_t *, 7050ba2cbe9Sxc const struct ieee80211_frame *); 7060ba2cbe9Sxc 7070ba2cbe9Sxc 7080ba2cbe9Sxc /* Crypto */ 7090ba2cbe9Sxc extern struct ieee80211_key *ieee80211_crypto_encap(ieee80211com_t *, mblk_t *); 7100ba2cbe9Sxc extern struct ieee80211_key *ieee80211_crypto_decap(ieee80211com_t *, mblk_t *, 7110ba2cbe9Sxc int); 7120ba2cbe9Sxc extern int ieee80211_crypto_newkey(ieee80211com_t *, int, int, 7130ba2cbe9Sxc struct ieee80211_key *); 7140ba2cbe9Sxc extern int ieee80211_crypto_delkey(ieee80211com_t *, struct ieee80211_key *); 7150ba2cbe9Sxc extern int ieee80211_crypto_setkey(ieee80211com_t *, struct ieee80211_key *, 716*f4203ebbSToomas Soome const uint8_t *macaddr); 7170ba2cbe9Sxc 7180ba2cbe9Sxc /* Helper Functions */ 7190ba2cbe9Sxc int ieee80211_stat(ieee80211com_t *ic, uint_t stat, uint64_t *val); 7200ba2cbe9Sxc uint32_t ieee80211_chan2ieee(ieee80211com_t *, struct ieee80211_channel *); 7210ba2cbe9Sxc enum ieee80211_phymode ieee80211_chan2mode(ieee80211com_t *, 7220ba2cbe9Sxc struct ieee80211_channel *); 7230ba2cbe9Sxc uint32_t ieee80211_ieee2mhz(uint32_t, uint32_t); 7240ba2cbe9Sxc void ieee80211_reset_chan(ieee80211com_t *); 7250ba2cbe9Sxc void ieee80211_dump_pkt(const uint8_t *, int32_t, int32_t, int32_t); 7260ba2cbe9Sxc void ieee80211_watchdog(void *); 7270ba2cbe9Sxc void ieee80211_start_watchdog(ieee80211com_t *, uint32_t); 7280ba2cbe9Sxc void ieee80211_stop_watchdog(ieee80211com_t *); 729e2cf88acSQuaker Fang int ieee80211_classify(struct ieee80211com *, mblk_t *, 730e2cf88acSQuaker Fang struct ieee80211_node *); 731e2cf88acSQuaker Fang int ieee80211_hdrsize(const void *); 732e2cf88acSQuaker Fang int ieee80211_hdrspace(ieee80211com_t *, const void *); 733e2cf88acSQuaker Fang int ieee80211_anyhdrsize(const void *); 734e2cf88acSQuaker Fang int ieee80211_anyhdrspace(ieee80211com_t *, const void *); 7350ba2cbe9Sxc 736a399b765Szf void *ieee80211_malloc(size_t); 737a399b765Szf void ieee80211_free(void *); 738bcb5c89dSSowmini Varadhan int ieee80211_setprop(void *, const char *, mac_prop_id_t, uint_t, 739bcb5c89dSSowmini Varadhan const void *); 7400dc2366fSVenugopal Iyer int ieee80211_getprop(void *, const char *, mac_prop_id_t, uint_t, void *); 7410dc2366fSVenugopal Iyer void ieee80211_propinfo(void *, const char *, mac_prop_id_t, 7420dc2366fSVenugopal Iyer mac_prop_info_handle_t); 7430dc2366fSVenugopal Iyer 744a399b765Szf 745e2cf88acSQuaker Fang struct ieee80211_channel *ieee80211_find_channel(ieee80211com_t *, int, int); 746e2cf88acSQuaker Fang const struct ieee80211_rateset *ieee80211_get_suprates(ieee80211com_t *, 747e2cf88acSQuaker Fang struct ieee80211_channel *); 748e2cf88acSQuaker Fang 749e2cf88acSQuaker Fang /* HT */ 750e2cf88acSQuaker Fang 7510ba2cbe9Sxc #ifdef __cplusplus 7520ba2cbe9Sxc } 7530ba2cbe9Sxc #endif 7540ba2cbe9Sxc 7550ba2cbe9Sxc #endif /* _SYS_NET80211_H */ 756