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