xref: /onnv-gate/usr/src/uts/common/sys/net80211.h (revision 11878:ac93462db6d7)
13147Sxc151355 /*
2*11878SVenu.Iyer@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
33147Sxc151355  * Use is subject to license terms.
43147Sxc151355  */
53147Sxc151355 
63147Sxc151355 /*
73147Sxc151355  * Copyright (c) 2001 Atsushi Onoe
83147Sxc151355  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
93147Sxc151355  * All rights reserved.
103147Sxc151355  *
113147Sxc151355  * Redistribution and use in source and binary forms, with or without
123147Sxc151355  * modification, are permitted provided that the following conditions
133147Sxc151355  * are met:
143147Sxc151355  * 1. Redistributions of source code must retain the above copyright
153147Sxc151355  *    notice, this list of conditions and the following disclaimer.
163147Sxc151355  * 2. Redistributions in binary form must reproduce the above copyright
173147Sxc151355  *    notice, this list of conditions and the following disclaimer in the
183147Sxc151355  *    documentation and/or other materials provided with the distribution.
193147Sxc151355  * 3. The name of the author may not be used to endorse or promote products
203147Sxc151355  *    derived from this software without specific prior written permission.
213147Sxc151355  *
223147Sxc151355  * Alternatively, this software may be distributed under the terms of the
233147Sxc151355  * GNU General Public License ("GPL") version 2 as published by the Free
243147Sxc151355  * Software Foundation.
253147Sxc151355  *
263147Sxc151355  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
273147Sxc151355  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
283147Sxc151355  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
293147Sxc151355  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
303147Sxc151355  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
313147Sxc151355  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
323147Sxc151355  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
333147Sxc151355  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
343147Sxc151355  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
353147Sxc151355  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
363147Sxc151355  */
373147Sxc151355 
383147Sxc151355 #ifndef _SYS_NET80211_H
393147Sxc151355 #define	_SYS_NET80211_H
403147Sxc151355 
413147Sxc151355 #include <sys/mac.h>
42*11878SVenu.Iyer@Sun.COM #include <sys/mac_provider.h>
433147Sxc151355 #include <sys/ethernet.h>
443147Sxc151355 #include <sys/net80211_proto.h>
453147Sxc151355 #include <sys/net80211_crypto.h>
4610266SQuaker.Fang@Sun.COM #include <sys/net80211_ht.h>
474126Szf162725 #include <net/wpa.h>
483147Sxc151355 
493147Sxc151355 /*
503147Sxc151355  * IEEE802.11 kernel support module
513147Sxc151355  */
523147Sxc151355 
533147Sxc151355 #ifdef	__cplusplus
543147Sxc151355 extern "C" {
553147Sxc151355 #endif
563147Sxc151355 
573147Sxc151355 /* ic_caps */
583147Sxc151355 #define	IEEE80211_C_WEP		0x00000001	/* CAPABILITY: WEP available */
593147Sxc151355 #define	IEEE80211_C_TKIP	0x00000002	/* CAPABILITY: TKIP available */
603147Sxc151355 #define	IEEE80211_C_AES		0x00000004	/* CAPABILITY: AES OCB avail */
613147Sxc151355 #define	IEEE80211_C_AES_CCM	0x00000008	/* CAPABILITY: AES CCM avail */
623147Sxc151355 #define	IEEE80211_C_CKIP	0x00000010	/* CAPABILITY: CKIP available */
633147Sxc151355 #define	IEEE80211_C_FF		0x00000040	/* CAPABILITY: ATH FF avail */
643147Sxc151355 #define	IEEE80211_C_TURBOP	0x00000080
653147Sxc151355 				/* CAPABILITY: ATH Turbo available */
663147Sxc151355 #define	IEEE80211_C_IBSS	0x00000100	/* CAPABILITY: IBSS available */
673147Sxc151355 #define	IEEE80211_C_PMGT	0x00000200	/* CAPABILITY: Power mgmt */
683147Sxc151355 #define	IEEE80211_C_HOSTAP	0x00000400	/* CAPABILITY: HOSTAP avail */
693147Sxc151355 #define	IEEE80211_C_AHDEMO	0x00000800	/* CAPABILITY: Old Adhoc Demo */
703147Sxc151355 #define	IEEE80211_C_SWRETRY	0x00001000	/* CAPABILITY: sw tx retry */
713147Sxc151355 #define	IEEE80211_C_TXPMGT	0x00002000	/* CAPABILITY: tx power mgmt */
723147Sxc151355 #define	IEEE80211_C_SHSLOT	0x00004000	/* CAPABILITY: short slottime */
733147Sxc151355 #define	IEEE80211_C_SHPREAMBLE	0x00008000	/* CAPABILITY: short preamble */
743147Sxc151355 #define	IEEE80211_C_MONITOR	0x00010000	/* CAPABILITY: monitor mode */
753147Sxc151355 #define	IEEE80211_C_TKIPMIC	0x00020000	/* CAPABILITY: TKIP MIC avail */
763147Sxc151355 #define	IEEE80211_C_WPA1	0x00800000	/* CAPABILITY: WPA1 avail */
773147Sxc151355 #define	IEEE80211_C_WPA2	0x01000000	/* CAPABILITY: WPA2 avail */
783147Sxc151355 #define	IEEE80211_C_WPA		0x01800000
793147Sxc151355 				/* CAPABILITY: WPA1+WPA2 avail */
803147Sxc151355 #define	IEEE80211_C_BURST	0x02000000	/* CAPABILITY: frame bursting */
813147Sxc151355 #define	IEEE80211_C_WME		0x04000000	/* CAPABILITY: WME avail */
823147Sxc151355 #define	IEEE80211_C_WDS		0x08000000	/* CAPABILITY: 4-addr support */
833147Sxc151355 /* 0x10000000 reserved */
843147Sxc151355 #define	IEEE80211_C_BGSCAN	0x20000000	/* CAPABILITY: bg scanning */
853147Sxc151355 #define	IEEE80211_C_TXFRAG	0x40000000	/* CAPABILITY: tx fragments */
863147Sxc151355 /* XXX protection/barker? */
873147Sxc151355 
883147Sxc151355 #define	IEEE80211_C_CRYPTO	0x0000001f	/* CAPABILITY: crypto alg's */
893147Sxc151355 
9010266SQuaker.Fang@Sun.COM /*
9110266SQuaker.Fang@Sun.COM  * ic_htcaps: HT-specific device/driver capabilities
9210266SQuaker.Fang@Sun.COM  *
9310266SQuaker.Fang@Sun.COM  * NB: the low 16-bits are the 802.11 definitions, the upper
9410266SQuaker.Fang@Sun.COM  *     16-bits are used to define s/w/driver capabilities.
9510266SQuaker.Fang@Sun.COM  */
9610266SQuaker.Fang@Sun.COM #define	IEEE80211_HTC_AMPDU	0x00010000	/* CAPABILITY: A-MPDU tx */
9710266SQuaker.Fang@Sun.COM #define	IEEE80211_HTC_AMSDU	0x00020000	/* CAPABILITY: A-MSDU tx */
9810266SQuaker.Fang@Sun.COM /* NB: HT40 is implied by IEEE80211_HTCAP_CHWIDTH40 */
9910266SQuaker.Fang@Sun.COM #define	IEEE80211_HTC_HT	0x00040000	/* CAPABILITY: HT operation */
10010266SQuaker.Fang@Sun.COM 
1013147Sxc151355 /* ic_flags */
1023147Sxc151355 /* NB: bits 0x4c available */
1033147Sxc151355 #define	IEEE80211_F_FF		0x00000001	/* CONF: ATH FF enabled */
1043147Sxc151355 #define	IEEE80211_F_TURBOP	0x00000002	/* CONF: ATH Turbo enabled */
1053147Sxc151355 #define	IEEE80211_F_BURST	0x00000004	/* CONF: bursting enabled */
1063147Sxc151355 /* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */
1073147Sxc151355 #define	IEEE80211_F_PRIVACY	0x00000010	/* CONF: privacy enabled */
1083147Sxc151355 #define	IEEE80211_F_PUREG	0x00000020	/* CONF: 11g w/o 11b sta's */
1093147Sxc151355 #define	IEEE80211_F_SCANONLY	0x00000040	/* CONF: scan only */
1103147Sxc151355 #define	IEEE80211_F_SCAN	0x00000080	/* STATUS: scanning */
1113147Sxc151355 #define	IEEE80211_F_ASCAN	0x00000100	/* STATUS: active scan */
1123147Sxc151355 #define	IEEE80211_F_SIBSS	0x00000200	/* STATUS: start IBSS */
1133147Sxc151355 /* NB: this is intentionally setup to be IEEE80211_CAPINFO_SHORT_SLOTTIME */
1143147Sxc151355 #define	IEEE80211_F_SHSLOT	0x00000400
1153147Sxc151355 				/* STATUS: use short slot time */
1163147Sxc151355 #define	IEEE80211_F_PMGTON	0x00000800	/* CONF: Power mgmt enable */
1173147Sxc151355 #define	IEEE80211_F_DESBSSID	0x00001000	/* CONF: des_bssid is set */
1183147Sxc151355 #define	IEEE80211_F_WME		0x00002000	/* CONF: enable WME use */
1193147Sxc151355 #define	IEEE80211_F_BGSCAN	0x00004000
1203147Sxc151355 				/* CONF: bg scan enabled (???) */
1213147Sxc151355 #define	IEEE80211_F_SWRETRY	0x00008000	/* CONF: sw tx retry enabled */
1223147Sxc151355 #define	IEEE80211_F_TXPOW_FIXED	0x00010000	/* TX Power: fixed rate */
1233147Sxc151355 #define	IEEE80211_F_IBSSON	0x00020000	/* CONF: IBSS creation enable */
1243147Sxc151355 #define	IEEE80211_F_SHPREAMBLE	0x00040000	/* STATUS: use short preamble */
1253147Sxc151355 #define	IEEE80211_F_DATAPAD	0x00080000	/* CONF: do alignment pad */
1263147Sxc151355 #define	IEEE80211_F_USEPROT	0x00100000	/* STATUS: protection enabled */
1273147Sxc151355 #define	IEEE80211_F_USEBARKER	0x00200000
1283147Sxc151355 				/* STATUS: use barker preamble */
1293147Sxc151355 #define	IEEE80211_F_TIMUPDATE	0x00400000	/* STATUS: update beacon tim */
1303147Sxc151355 #define	IEEE80211_F_WPA1	0x00800000	/* CONF: WPA enabled */
1313147Sxc151355 #define	IEEE80211_F_WPA2	0x01000000	/* CONF: WPA2 enabled */
1323147Sxc151355 #define	IEEE80211_F_WPA		0x01800000	/* CONF: WPA/WPA2 enabled */
1333147Sxc151355 #define	IEEE80211_F_DROPUNENC	0x02000000	/* CONF: drop unencrypted */
1343147Sxc151355 #define	IEEE80211_F_COUNTERM	0x04000000	/* CONF: TKIP countermeasures */
1353147Sxc151355 #define	IEEE80211_F_HIDESSID	0x08000000	/* CONF: hide SSID in beacon */
1363147Sxc151355 #define	IEEE80211_F_NOBRIDGE	0x10000000	/* CONF: dis. internal bridge */
1373147Sxc151355 #define	IEEE80211_F_WMEUPDATE	0x20000000	/* STATUS: update beacon wme */
1383147Sxc151355 
1393147Sxc151355 /* ic_flags_ext */
14010266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_NONHT_PR	0x00000001	/* STATUS: non-HT sta present */
14110266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_INACT	0x00000002	/* CONF: sta inact handling */
1423147Sxc151355 /* 0x00000006 reserved */
1433147Sxc151355 #define	IEEE80211_FEXT_BGSCAN	0x00000008
1443147Sxc151355 				/* STATUS: enable full bgscan completion */
1453147Sxc151355 #define	IEEE80211_FEXT_ERPUPDATE 0x00000200	/* STATUS: update ERP element */
1463147Sxc151355 #define	IEEE80211_FEXT_SWBMISS	0x00000400	/* CONF: do bmiss in s/w */
14710266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_PROBECHAN 0x00020000	/* CONF: probe passive chan */
14810266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_HT	0x00080000	/* CONF: HT supported */
14910266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_AMPDU_TX	0x00100000	/* CONF: A-MPDU tx supported */
15010266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_AMPDU_RX	0x00200000	/* CONF: A-MPDU tx supported */
15110266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_AMSDU_TX	0x00400000	/* CONF: A-MSDU tx supported */
15210266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_AMSDU_RX	0x00800000	/* CONF: A-MSDU tx supported */
15310266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_USEHT40	0x01000000	/* CONF: 20/40 use enabled */
15410266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_PUREN	0x02000000	/* CONF: 11n w/o legacy sta's */
15510266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_SHORTGI20 0x04000000	/* CONF: short GI in HT20 */
15610266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_SHORTGI40 0x08000000	/* CONF: short GI in HT40 */
15710266SQuaker.Fang@Sun.COM #define	IEEE80211_FEXT_HTCOMPAT 0x10000000	/* CONF: HT vendor OUI's */
1583147Sxc151355 
1593147Sxc151355 /*
1603147Sxc151355  * Channel attributes (ich_flags)
1613147Sxc151355  * bits 0-3 are for private use by drivers
1623147Sxc151355  */
16310266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_TURBO	0x00000010 /* Turbo channel */
16410266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_CCK	0x00000020 /* CCK channel */
16510266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_OFDM	0x00000040 /* OFDM channel */
16610266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_2GHZ	0x00000080 /* 2 GHz spectrum channel. */
16710266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_5GHZ	0x00000100 /* 5 GHz spectrum channel */
16810266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_PASSIVE	0x00000200 /* Only passive scan allowed */
16910266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_DYN	0x00000400 /* Dynamic CCK-OFDM channel */
17010266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_GFSK	0x00000800 /* GFSK channel (FHSS PHY) */
17110266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_GSM	0x00001000 /* 900 MHz spectrum channel */
17210266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_STURBO	0x00002000 /* 11a static turbo channel only */
17310266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_HALF	0x00004000 /* Half rate channel */
17410266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_QUARTER	0x00008000 /* Quarter rate channel */
17510266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_HT20	0x00010000 /* HT 20 channel */
17610266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_HT40U	0x00020000 /* HT 40 channel w/ ext above */
17710266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_HT40D	0x00040000 /* HT 40 channel w/ ext below */
17810266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_DFS	0x00080000 /* DFS required */
17910266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_4MSXMIT	0x00100000 /* 4ms limit on frame length */
18010266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_NOADHOC	0x00200000 /* adhoc mode not allowed */
18110266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_NOHOSTAP	0x00400000 /* hostap mode not allowed */
18210266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_11D	0x00800000 /* 802.11d required */
18310266SQuaker.Fang@Sun.COM 
18410266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_HT40	(IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)
18510266SQuaker.Fang@Sun.COM #define	IEEE80211_CHAN_HT	(IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40)
1863147Sxc151355 
1873147Sxc151355 #define	IEEE80211_CHAN_MAX	255
1883147Sxc151355 #define	IEEE80211_CHAN_BYTES	32	/* howmany(IEEE80211_CHAN_MAX, NBBY) */
1893147Sxc151355 #define	IEEE80211_CHAN_ANY	0xffff	/* token for ``any channel'' */
1903147Sxc151355 #define	IEEE80211_CHAN_ANYC	\
1913147Sxc151355 	((struct ieee80211_channel *)IEEE80211_CHAN_ANY)
1923147Sxc151355 
1933147Sxc151355 #define	IEEE80211_IS_CHAN_2GHZ(_c)	\
1943147Sxc151355 	(((_c)->ich_flags & IEEE80211_CHAN_2GHZ) != 0)
1953147Sxc151355 #define	IEEE80211_IS_CHAN_5GHZ(_c)	\
1963147Sxc151355 	(((_c)->ich_flags & IEEE80211_CHAN_5GHZ) != 0)
1973147Sxc151355 
19810266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_CHWUPDATE 0x0400		/* 11n channel width change */
1993147Sxc151355 #define	IEEE80211_NODE_HASHSIZE	32
2003147Sxc151355 
20110266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_AUTH	0x0001		/* authorized for data */
20210266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_QOS	0x0002		/* QoS enabled */
20310266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_ERP	0x0004		/* ERP enabled */
20410266SQuaker.Fang@Sun.COM /* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */
20510266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_PWR_MGT	0x0010		/* power save mode enabled */
20610266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_AREF	0x0020		/* authentication ref held */
20710266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_HT	0x0040		/* HT enabled */
20810266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_HTCOMPAT	0x0080		/* HT setup w/ vendor OUI's */
20910266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_AMPDU_RX	0x0400		/* AMPDU rx enabled */
21010266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_AMPDU_TX	0x0800		/* AMPDU tx enabled */
21110266SQuaker.Fang@Sun.COM 
21210266SQuaker.Fang@Sun.COM #define	IEEE80211_NODE_AMPDU \
21310266SQuaker.Fang@Sun.COM 	(IEEE80211_NODE_AMPDU_RX | IEEE80211_NODE_AMPDU_TX)
21410266SQuaker.Fang@Sun.COM 
2153147Sxc151355 #define	IEEE80211_FIXED_RATE_NONE	0
21610266SQuaker.Fang@Sun.COM 
21710266SQuaker.Fang@Sun.COM #define	WME_OUI			0xf25000
21810266SQuaker.Fang@Sun.COM #define	WME_OUI_TYPE		0x02
21910266SQuaker.Fang@Sun.COM #define	WME_INFO_OUI_SUBTYPE	0x00
22010266SQuaker.Fang@Sun.COM #define	WME_PARAM_OUI_SUBTYPE	0x01
22110266SQuaker.Fang@Sun.COM #define	WME_VERSION		1
2223147Sxc151355 
2233147Sxc151355 /* WME stream classes */
2243147Sxc151355 #define	WME_AC_BE		0	/* best effort */
2253147Sxc151355 #define	WME_AC_BK		1	/* background */
2263147Sxc151355 #define	WME_AC_VI		2	/* video */
2273147Sxc151355 #define	WME_AC_VO		3	/* voice */
2283147Sxc151355 
2294126Szf162725 #define	MAX_EVENT		16
2304126Szf162725 #define	MAX_IEEE80211STR	256
2314126Szf162725 
23210266SQuaker.Fang@Sun.COM /* For IEEE80211_RADIOTAP_FLAGS */
23310266SQuaker.Fang@Sun.COM #define	IEEE80211_RADIOTAP_F_CFP	0x01
23410266SQuaker.Fang@Sun.COM 					/* sent/received during CFP */
23510266SQuaker.Fang@Sun.COM #define	IEEE80211_RADIOTAP_F_SHORTPRE	0x02
23610266SQuaker.Fang@Sun.COM 					/* sent/received with short preamble */
23710266SQuaker.Fang@Sun.COM #define	IEEE80211_RADIOTAP_F_WEP	0x04
23810266SQuaker.Fang@Sun.COM 					/* sent/received with WEP encryption */
23910266SQuaker.Fang@Sun.COM #define	IEEE80211_RADIOTAP_F_FRAG	0x08
24010266SQuaker.Fang@Sun.COM 					/* sent/received with fragmentation */
24110266SQuaker.Fang@Sun.COM #define	IEEE80211_RADIOTAP_F_DATAPAD	0x20
24210266SQuaker.Fang@Sun.COM 					/*
24310266SQuaker.Fang@Sun.COM 					 * frame has padding between 802.11
24410266SQuaker.Fang@Sun.COM 					 * header and payload (to 32-bit
24510266SQuaker.Fang@Sun.COM 					 * boundary
24610266SQuaker.Fang@Sun.COM 					 */
24710266SQuaker.Fang@Sun.COM #define	IEEE80211_RADIOTAP_F_FCS	0x10	/* frame includes FCS */
24810266SQuaker.Fang@Sun.COM #define	IEEE80211_RADIOTAP_F_BADFCS	0x40	/* does not pass FCS check */
24910266SQuaker.Fang@Sun.COM #define	IEEE80211_RADIOTAP_F_SHORTGI	0x80	/* HT short GI */
25010266SQuaker.Fang@Sun.COM 
2513147Sxc151355 /*
2523147Sxc151355  * Authentication mode.
2533147Sxc151355  */
2543147Sxc151355 enum ieee80211_authmode {
2553147Sxc151355 	IEEE80211_AUTH_NONE	= 0,
2563147Sxc151355 	IEEE80211_AUTH_OPEN	= 1,	/* open */
2573147Sxc151355 	IEEE80211_AUTH_SHARED	= 2,	/* shared-key */
2583147Sxc151355 	IEEE80211_AUTH_8021X	= 3,	/* 802.1x */
2593147Sxc151355 	IEEE80211_AUTH_AUTO	= 4,	/* auto-select/accept */
2603147Sxc151355 	/* NB: these are used only for ioctls */
2613147Sxc151355 	IEEE80211_AUTH_WPA	= 5	/* WPA/RSN w/ 802.1x/PSK */
2623147Sxc151355 };
2633147Sxc151355 
2643147Sxc151355 enum ieee80211_state {
2653147Sxc151355 	IEEE80211_S_INIT	= 0,	/* default state */
2663147Sxc151355 	IEEE80211_S_SCAN	= 1,	/* scanning */
2673147Sxc151355 	IEEE80211_S_AUTH	= 2,	/* try to authenticate */
2683147Sxc151355 	IEEE80211_S_ASSOC	= 3,	/* try to assoc */
2693147Sxc151355 	IEEE80211_S_RUN		= 4	/* associated */
2703147Sxc151355 };
2713147Sxc151355 #define	IEEE80211_S_MAX	(IEEE80211_S_RUN+1)
2723147Sxc151355 
2733147Sxc151355 /*
2743147Sxc151355  * 802.11 rate set.
2753147Sxc151355  */
2763147Sxc151355 #define	IEEE80211_RATE_MAXSIZE	15	/* max rates we'll handle */
2773147Sxc151355 #define	IEEE80211_RATE_SIZE	8	/* 802.11 standard */
2783147Sxc151355 #define	IEEE80211_XRATE_SIZE	(IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE)
2793147Sxc151355 					/* size of extended supported rates */
2803147Sxc151355 struct ieee80211_rateset {
2813147Sxc151355 	uint8_t			ir_nrates;
2823147Sxc151355 	uint8_t			ir_rates[IEEE80211_RATE_MAXSIZE];
2833147Sxc151355 };
2843147Sxc151355 
2853147Sxc151355 /*
28610266SQuaker.Fang@Sun.COM  * 802.11n variant of ieee80211_rateset.  Instead
28710266SQuaker.Fang@Sun.COM  * legacy rates the entries are MCS rates.  We define
28810266SQuaker.Fang@Sun.COM  * the structure such that it can be used interchangeably
28910266SQuaker.Fang@Sun.COM  * with an ieee80211_rateset (modulo structure size).
29010266SQuaker.Fang@Sun.COM  */
29110266SQuaker.Fang@Sun.COM #define	IEEE80211_HTRATE_MAXSIZE 127
29210266SQuaker.Fang@Sun.COM 
29310266SQuaker.Fang@Sun.COM struct ieee80211_htrateset {
29410266SQuaker.Fang@Sun.COM 	uint8_t			rs_nrates;
29510266SQuaker.Fang@Sun.COM 	uint8_t			rs_rates[IEEE80211_HTRATE_MAXSIZE];
29610266SQuaker.Fang@Sun.COM };
29710266SQuaker.Fang@Sun.COM 
29810266SQuaker.Fang@Sun.COM #define	IEEE80211_RATE_MCS	0x80
29910266SQuaker.Fang@Sun.COM 
30010266SQuaker.Fang@Sun.COM /*
3013147Sxc151355  * Channels are specified by frequency and attributes.
3023147Sxc151355  */
3033147Sxc151355 struct ieee80211_channel {
3043147Sxc151355 	uint16_t		ich_freq;	/* setting in Mhz */
30510266SQuaker.Fang@Sun.COM 	uint32_t		ich_flags;	/* see below */
3063147Sxc151355 };
3073147Sxc151355 
3083147Sxc151355 struct ieee80211_device_stats {
3093147Sxc151355 	uint32_t		is_tx_frags;
3103147Sxc151355 	uint32_t		is_tx_bytes;
3113147Sxc151355 	uint32_t		is_tx_mcast;
3123147Sxc151355 	uint32_t		is_tx_failed;
3133147Sxc151355 	uint32_t		is_tx_retries;
3143147Sxc151355 	uint32_t		is_rts_success;
3153147Sxc151355 	uint32_t		is_rts_failure;
3163147Sxc151355 	uint32_t		is_ack_failure;
3173147Sxc151355 	uint32_t		is_rx_frags;
3183147Sxc151355 	uint32_t		is_rx_bytes;
3193147Sxc151355 	uint32_t		is_rx_mcast;
3203147Sxc151355 	uint32_t		is_rx_dups;
3213147Sxc151355 	uint32_t		is_fcs_errors;
3223147Sxc151355 	uint32_t		is_wep_errors;
3233147Sxc151355 	uint32_t		is_tx_nobuf;
3243147Sxc151355 	uint32_t		is_tx_unknownmgt;
3253147Sxc151355 };
3263147Sxc151355 
3273147Sxc151355 struct ieee80211_crypto_state;
3283147Sxc151355 typedef struct ieee80211_node_table ieee80211_node_table_t;
3293147Sxc151355 typedef struct ieee80211_node ieee80211_node_t;
3303147Sxc151355 typedef struct ieee80211com ieee80211com_t;
3313147Sxc151355 
3323147Sxc151355 struct ieee80211_node_table {
3333147Sxc151355 	struct ieee80211com	*nt_ic;		/* back reference */
3343147Sxc151355 
3353147Sxc151355 	const char		*nt_name;	/* for debugging */
3363147Sxc151355 	/* For node inactivity processing */
3373147Sxc151355 	int			nt_inact_timer;	/* inactivity timer */
3383147Sxc151355 	int			nt_inact_init;	/* initial node inact setting */
3393147Sxc151355 	void			(*nt_timeout)(struct ieee80211_node_table *);
3403147Sxc151355 	uint32_t		nt_scangen;	/* gen# for timeout scan */
3413147Sxc151355 	kmutex_t		nt_scanlock;    /* on nt_scangen */
3423147Sxc151355 	kmutex_t		nt_nodelock;	/* on node table */
3433147Sxc151355 
3443147Sxc151355 	int			nt_keyixmax;	/* keyixmap size */
3453147Sxc151355 	struct ieee80211_node	**nt_keyixmap;	/* key ix -> node map */
3463147Sxc151355 
3473147Sxc151355 	list_t			nt_node;	/* information of all nodes */
3483147Sxc151355 	list_t			nt_hash[IEEE80211_NODE_HASHSIZE];
3493147Sxc151355 };
3503147Sxc151355 
35110266SQuaker.Fang@Sun.COM #define	IEEE80211_TID_SIZE	(WME_NUM_TID+1)	/* WME TID's +1 for non-QoS */
35210266SQuaker.Fang@Sun.COM #define	IEEE80211_NONQOS_TID	WME_NUM_TID	/* index for non-QoS sta */
35310266SQuaker.Fang@Sun.COM 
3543147Sxc151355 /*
3553147Sxc151355  * Node specific information.  Note that drivers are expected
3563147Sxc151355  * to derive from this structure to add device-specific per-node
3573147Sxc151355  * state.  This is done by overriding the ic_node_* methods in
3583147Sxc151355  * the ieee80211com structure.
3593147Sxc151355  */
3603147Sxc151355 struct ieee80211_node {
3613147Sxc151355 	struct ieee80211com		*in_ic;
3623147Sxc151355 	struct ieee80211_node_table	*in_table;
3633147Sxc151355 
3643147Sxc151355 	uint8_t			in_authmode;	/* authentication algorithm */
3653147Sxc151355 	uint16_t		in_flags;	/* special purpose state */
3663147Sxc151355 	uint16_t		in_associd;	/* assoc response */
3673147Sxc151355 	uint16_t		in_txpower;	/* current transmit power */
3683147Sxc151355 	uint16_t		in_vlan;	/* vlan tag */
3693147Sxc151355 	/*
3703147Sxc151355 	 * Tx/Rx sequence number.
3713147Sxc151355 	 * index 0 is used when QoS is not enabled. index 1-16 is used
3723147Sxc151355 	 * when QoS is enabled. 1-16 corresponds to TID 0-15.
3733147Sxc151355 	 */
37410266SQuaker.Fang@Sun.COM 	uint16_t		in_txseqs[IEEE80211_TID_SIZE];
37510266SQuaker.Fang@Sun.COM 	uint16_t		in_rxseqs[IEEE80211_TID_SIZE];
3763147Sxc151355 	clock_t			in_rxfragstamp;	/* time stamp of last rx frag */
3773147Sxc151355 	mblk_t			*in_rxfrag;	/* rx frag reassembly */
3783147Sxc151355 	uint32_t		in_scangen;	/* gen# for timeout scan */
3793147Sxc151355 	uint32_t		in_refcnt;
3803147Sxc151355 
3813147Sxc151355 	/* hardware */
3823147Sxc151355 	uint32_t		in_rstamp;	/* recv timestamp */
3833147Sxc151355 	uint8_t			in_rssi;	/* recv ssi */
3843147Sxc151355 
3853147Sxc151355 	/* header */
3863147Sxc151355 	uint8_t			in_macaddr[IEEE80211_ADDR_LEN];
3873147Sxc151355 	uint8_t			in_bssid[IEEE80211_ADDR_LEN];
3883147Sxc151355 
3893147Sxc151355 	/* beacon, probe response */
3903147Sxc151355 	union {
3913147Sxc151355 		uint8_t		data[8];
3923147Sxc151355 		uint64_t	tsf;
3933147Sxc151355 	} in_tstamp;				/* from last rcv'd beacon */
3943147Sxc151355 	uint16_t		in_intval;	/* beacon interval */
3953147Sxc151355 	uint16_t		in_capinfo;	/* capabilities */
3963147Sxc151355 	uint8_t			in_esslen;
3973147Sxc151355 	uint8_t			in_essid[IEEE80211_NWID_LEN];
3983147Sxc151355 	struct ieee80211_rateset in_rates;	/* negotiated rate set */
3993147Sxc151355 	struct ieee80211_channel *in_chan;	/* XXX multiple uses */
4003147Sxc151355 	enum ieee80211_phytype	in_phytype;
4013147Sxc151355 	uint16_t		in_fhdwell;	/* FH only */
4023147Sxc151355 	uint8_t			in_fhindex;	/* FH only */
4033147Sxc151355 	uint8_t			in_erp;		/* ERP from beacon/probe resp */
4043147Sxc151355 	uint16_t		in_tim_off;	/* byte offset to TIM ie */
4053147Sxc151355 	uint8_t			in_dtim_period;	/* DTIM period */
4063147Sxc151355 	uint8_t			in_dtim_count;	/* DTIM count for last bcn */
4073147Sxc151355 
4083147Sxc151355 	uint32_t		*in_challenge;	/* shared-key challenge */
4093147Sxc151355 	struct ieee80211_key	in_ucastkey;	/* unicast key */
4104126Szf162725 	uint8_t			*in_wpa_ie;	/* captured WPA/RSN ie */
41110266SQuaker.Fang@Sun.COM 	uint8_t			*in_wme_ie;	/* captured WME ie */
41210266SQuaker.Fang@Sun.COM 
41310266SQuaker.Fang@Sun.COM 	/* 11n state */
41410266SQuaker.Fang@Sun.COM 	uint8_t			*in_htcap_ie;	/* captured HTCAP ie */
41510266SQuaker.Fang@Sun.COM 	uint16_t		in_htcap;	/* HT capabilities */
41610266SQuaker.Fang@Sun.COM 	uint8_t			in_htparam;	/* HT params */
41710266SQuaker.Fang@Sun.COM 	uint8_t			in_htctlchan;	/* HT control channel */
41810266SQuaker.Fang@Sun.COM 	uint8_t			in_ht2ndchan;	/* HT 2nd channel */
41910266SQuaker.Fang@Sun.COM 	uint8_t			in_htopmode;	/* HT operating mode */
42010266SQuaker.Fang@Sun.COM 	uint8_t			in_htstbc;	/* HT */
42110266SQuaker.Fang@Sun.COM 	uint8_t			in_reqcw;	/* requested tx channel width */
42210266SQuaker.Fang@Sun.COM 	uint8_t			in_chw;		/* negotiated channel width */
42310266SQuaker.Fang@Sun.COM 	struct ieee80211_htrateset in_htrates;	/* negotiated ht rate set */
42410266SQuaker.Fang@Sun.COM 	struct ieee80211_tx_ampdu in_tx_ampdu[WME_NUM_AC];
42510266SQuaker.Fang@Sun.COM 	struct ieee80211_rx_ampdu in_rx_ampdu[WME_NUM_TID];
4263147Sxc151355 
4273147Sxc151355 	/* others */
4283147Sxc151355 	int32_t			in_fails;	/* failure count to associate */
4293147Sxc151355 	int16_t			in_inact;	/* inactivity mark count */
4303147Sxc151355 	int16_t			in_inact_reload; /* inactivity reload value */
43110266SQuaker.Fang@Sun.COM 	int32_t			in_txrate;	/* index to in_rates[] */
4323147Sxc151355 
4333147Sxc151355 	list_node_t		in_node;	/* element of nt->nt_node */
4343147Sxc151355 	list_node_t		in_hash;	/* element of nt->nt_hash */
4353147Sxc151355 };
4363147Sxc151355 
43710266SQuaker.Fang@Sun.COM /*
43810266SQuaker.Fang@Sun.COM  * WME/WMM support.
43910266SQuaker.Fang@Sun.COM  */
44010266SQuaker.Fang@Sun.COM struct wmeParams {
44110266SQuaker.Fang@Sun.COM 	uint8_t		wmep_acm;
44210266SQuaker.Fang@Sun.COM 	uint8_t		wmep_aifsn;
44310266SQuaker.Fang@Sun.COM 	uint8_t		wmep_logcwmin;		/* log2(cwmin) */
44410266SQuaker.Fang@Sun.COM 	uint8_t		wmep_logcwmax;		/* log2(cwmax) */
44510266SQuaker.Fang@Sun.COM 	uint8_t		wmep_txopLimit;
44610266SQuaker.Fang@Sun.COM 	uint8_t		wmep_noackPolicy;	/* 0 (ack), 1 (no ack) */
44710266SQuaker.Fang@Sun.COM };
44810266SQuaker.Fang@Sun.COM #define	IEEE80211_TXOP_TO_US(_txop)	((_txop)<<5)
44910266SQuaker.Fang@Sun.COM #define	IEEE80211_US_TO_TXOP(_us)	((_us)>>5)
45010266SQuaker.Fang@Sun.COM 
45110266SQuaker.Fang@Sun.COM struct chanAccParams {
45210266SQuaker.Fang@Sun.COM 	uint8_t		cap_info;		/* version of the current set */
45310266SQuaker.Fang@Sun.COM 	struct wmeParams cap_wmeParams[WME_NUM_AC];
45410266SQuaker.Fang@Sun.COM };
45510266SQuaker.Fang@Sun.COM 
45610266SQuaker.Fang@Sun.COM struct ieee80211_wme_state {
45710266SQuaker.Fang@Sun.COM 	uint_t	wme_flags;
45810266SQuaker.Fang@Sun.COM #define	WME_F_AGGRMODE	0x00000001	/* STATUS: WME agressive mode */
45910266SQuaker.Fang@Sun.COM 	uint_t	wme_hipri_traffic; /* VI/VO frames in beacon interval */
46010266SQuaker.Fang@Sun.COM 	uint_t	wme_hipri_switch_thresh; /* agressive mode switch thresh */
46110266SQuaker.Fang@Sun.COM 	uint_t	wme_hipri_switch_hysteresis;
46210266SQuaker.Fang@Sun.COM 					/* agressive mode switch hysteresis */
46310266SQuaker.Fang@Sun.COM 	struct wmeParams wme_params[4]; /* from assoc resp for each AC */
46410266SQuaker.Fang@Sun.COM 	struct chanAccParams wme_wmeChanParams; /* WME params applied to self */
46510266SQuaker.Fang@Sun.COM 	struct chanAccParams wme_wmeBssChanParams;
46610266SQuaker.Fang@Sun.COM 					/* WME params bcast to stations */
46710266SQuaker.Fang@Sun.COM 	struct chanAccParams wme_chanParams; /* params applied to self */
46810266SQuaker.Fang@Sun.COM 	struct chanAccParams wme_bssChanParams; /* params bcast to stations */
46910266SQuaker.Fang@Sun.COM 	int (*wme_update)(struct ieee80211com *);
47010266SQuaker.Fang@Sun.COM };
47110266SQuaker.Fang@Sun.COM 
4723147Sxc151355 struct ieee80211com {
4733147Sxc151355 	mac_handle_t		ic_mach;
4743147Sxc151355 
4753147Sxc151355 	/* Initialized by driver */
4763147Sxc151355 	uint8_t			ic_macaddr[IEEE80211_ADDR_LEN];
4773147Sxc151355 	uint32_t		ic_caps;	/* capabilities */
47810266SQuaker.Fang@Sun.COM 	uint32_t		ic_htcaps;	/* HT capabilities */
4793147Sxc151355 	enum ieee80211_phytype	ic_phytype;	/* XXX wrong for multi-mode */
4803147Sxc151355 	enum ieee80211_opmode	ic_opmode;	/* current operation mode */
4813147Sxc151355 	enum ieee80211_state	ic_state;	/* current 802.11 state */
4823147Sxc151355 	struct ieee80211_channel	ic_sup_channels[IEEE80211_CHAN_MAX+1];
4833147Sxc151355 	struct ieee80211_rateset	ic_sup_rates[IEEE80211_MODE_MAX];
4843147Sxc151355 	enum ieee80211_phymode		ic_curmode;  /* OPT current mode */
4853147Sxc151355 	struct ieee80211_channel	*ic_curchan; /* OPT current channel */
4863147Sxc151355 	struct ieee80211_channel	*ic_ibss_chan;	/* OPT bss channel */
4873147Sxc151355 	uint8_t				ic_maxrssi;  /* maximum hardware RSSI */
4883147Sxc151355 
4893147Sxc151355 	/* INITIALIZED by IEEE80211, used/overridden by driver */
4903147Sxc151355 	uint16_t		ic_modecaps;	/* set of mode capabilities */
4913147Sxc151355 	uint8_t			ic_chan_active[IEEE80211_CHAN_BYTES];
4923147Sxc151355 	enum ieee80211_protmode	ic_protmode;	/* 802.11g protection mode */
4933147Sxc151355 	uint16_t		ic_bintval;	/* beacon interval */
4943147Sxc151355 	uint16_t		ic_lintval;	/* listen interval */
4953147Sxc151355 	uint16_t		ic_txpowlimit;	/* global tx power limit */
4963147Sxc151355 	uint8_t			ic_bmissthreshold;
4973147Sxc151355 	uint16_t		ic_rtsthreshold;
4983147Sxc151355 	uint16_t		ic_fragthreshold;
4993147Sxc151355 	uint8_t			ic_fixed_rate;	/* value of fixed rate */
5003147Sxc151355 	int32_t			ic_des_esslen;	/* length of desired essid */
5013147Sxc151355 	uint8_t			ic_des_essid[IEEE80211_NWID_LEN];
5023147Sxc151355 	uint8_t			ic_des_bssid[IEEE80211_ADDR_LEN];
5033147Sxc151355 	struct ieee80211_channel	*ic_des_chan;	/* desired channel */
5043147Sxc151355 	void			*ic_opt_ie;	/* user-specified IE's */
5053147Sxc151355 	uint16_t		ic_opt_ie_len;	/* length of ic_opt_ie */
5063147Sxc151355 	uint8_t			ic_nickname[IEEE80211_NWID_LEN];
5073147Sxc151355 	uint16_t		ic_tim_len;	/* ic_tim_bitmap size (bytes) */
5083147Sxc151355 	uint8_t			*ic_tim_bitmap;	/* powersave stations w/ data */
5093147Sxc151355 	timeout_id_t		ic_watchdog_timer;	/* watchdog timer */
5103147Sxc151355 	/* Cipher state/configuration. */
5113147Sxc151355 	struct ieee80211_crypto_state	ic_crypto;
5124499Shx147065 	const struct ieee80211_cipher *ic_ciphers[IEEE80211_CIPHER_MAX];
5133147Sxc151355 
5144126Szf162725 	kmutex_t		ic_doorlock;
5154126Szf162725 	char			ic_wpadoor[MAX_IEEE80211STR];
5164126Szf162725 
5174126Szf162725 	wpa_event_type		ic_eventq[MAX_EVENT];
5184126Szf162725 	uint32_t		ic_evq_head, ic_evq_tail;
5194126Szf162725 
5203147Sxc151355 	/* Runtime states */
5213147Sxc151355 	uint32_t		ic_flags;	/* state/conf flags */
5223147Sxc151355 	uint32_t		ic_flags_ext;	/* extended state flags */
5233147Sxc151355 	struct ieee80211_node	*ic_bss;	/* information for this node */
5243147Sxc151355 	struct ieee80211_device_stats	ic_stats;
5253147Sxc151355 	struct ieee80211_node_table	ic_scan; /* STA: scan candidates */
5263147Sxc151355 	struct ieee80211_node_table	ic_sta; /* AP:stations/IBSS:neighbors */
5273147Sxc151355 
52810266SQuaker.Fang@Sun.COM 	struct ieee80211_wme_state ic_wme;	/* WME/WMM state */
52910266SQuaker.Fang@Sun.COM 
53010266SQuaker.Fang@Sun.COM 	int			ic_ampdu_rxmax;	/* A-MPDU rx limit (bytes) */
53110266SQuaker.Fang@Sun.COM 	int			ic_ampdu_density; /* A-MPDU density */
53210266SQuaker.Fang@Sun.COM 	int			ic_ampdu_limit;	/* A-MPDU tx limit (bytes) */
53310266SQuaker.Fang@Sun.COM 	int			ic_amsdu_limit;	/* A-MSDU tx limit (bytes) */
53410266SQuaker.Fang@Sun.COM 
53510266SQuaker.Fang@Sun.COM 	uint16_t		ic_sta_assoc;	/* stations associated */
53610266SQuaker.Fang@Sun.COM 	uint16_t		ic_ht_sta_assoc; /* HT stations associated */
53710266SQuaker.Fang@Sun.COM 	uint16_t		ic_ht40_sta_assoc; /* HT40 station associated */
53810266SQuaker.Fang@Sun.COM 	uint8_t			ic_curhtprotmode; /* HTINFO bss state */
53910266SQuaker.Fang@Sun.COM 	enum ieee80211_protmode	ic_htprotmode;	/* HT protection mode */
54010266SQuaker.Fang@Sun.COM 	int			ic_lastnonerp;	/* last time nonERP sta noted */
54110266SQuaker.Fang@Sun.COM 	int			ic_lastnonht;	/* last time non-HT sta noted */
54211224SQuaker.Fang@Sun.COM 	int			ic_beaconmiss;	/* beacon miss counter */
54310266SQuaker.Fang@Sun.COM 
54410266SQuaker.Fang@Sun.COM 
5453147Sxc151355 	/* callback functions */
5463147Sxc151355 	/*
5473147Sxc151355 	 * Functions initialized by driver before calling ieee80211_attach()
5483147Sxc151355 	 * Those must be initialized are marked with M(andatory)
5493147Sxc151355 	 *
5503147Sxc151355 	 *  ic_xmit		- [M] transmit a management or null data frame
5513147Sxc151355 	 *			return 0 on success, non-zero on error
5523147Sxc151355 	 *  ic_watchdog		- [O] periodic run function, enabled by
5533147Sxc151355 	 *			ieee80211_start_watchdog()
5543147Sxc151355 	 *  ic_set_tim		- [O] set/clear traffic indication map
5553147Sxc151355 	 *  ic_set_shortslot	- [O] enable/disable short slot timing
5563147Sxc151355 	 *  ic_node_newassoc	- [O] driver specific operation on a newly
5573147Sxc151355 	 *			associated or re-assoced node
5583147Sxc151355 	 */
5593147Sxc151355 	int			(*ic_xmit)(ieee80211com_t *, mblk_t *, uint8_t);
5603147Sxc151355 	void			(*ic_watchdog)(void *);
5613147Sxc151355 	void			(*ic_set_tim)(ieee80211com_t *,
5623147Sxc151355 					ieee80211_node_t *, int);
5633147Sxc151355 	void			(*ic_set_shortslot)(ieee80211com_t *, int);
5643147Sxc151355 	void			(*ic_node_newassoc)(ieee80211_node_t *, int);
5653147Sxc151355 	/*
5663147Sxc151355 	 * Functions initialized by ieee80211_attach(), driver could
5673147Sxc151355 	 * override these functions after calling ieee80211_attach()
5683147Sxc151355 	 *
5693147Sxc151355 	 *  ic_reset		- reset
5703147Sxc151355 	 *  ic_recv_mgmt	- handle received management frames
5713147Sxc151355 	 *  ic_send_mgmt	- construct and transmit management frames
5723147Sxc151355 	 *  ic_newstate		- handle state transition
5733147Sxc151355 	 *  ic_node_alloc	- allocate a new BSS info node
5743147Sxc151355 	 *  ic_node_cleanup	- cleanup or free memory spaces of a node
5753147Sxc151355 	 *  ic_node_free	- free a node
5763147Sxc151355 	 *  ic_node_getrssi	- get node's rssi
5773147Sxc151355 	 */
5783147Sxc151355 	int			(*ic_reset)(ieee80211com_t *);
5793147Sxc151355 	void			(*ic_recv_mgmt)(ieee80211com_t *,
5803147Sxc151355 					mblk_t *, ieee80211_node_t *,
5813147Sxc151355 					int, int, uint32_t);
5823147Sxc151355 	int			(*ic_send_mgmt)(ieee80211com_t *,
5833147Sxc151355 					ieee80211_node_t *, int, int);
5843147Sxc151355 	int			(*ic_newstate)(ieee80211com_t *,
5853147Sxc151355 					enum ieee80211_state, int);
5863147Sxc151355 	struct ieee80211_node	*(*ic_node_alloc)(ieee80211com_t *);
5873147Sxc151355 	void			(*ic_node_cleanup)(ieee80211_node_t *);
5883147Sxc151355 	void			(*ic_node_free)(ieee80211_node_t *);
5893147Sxc151355 	uint8_t			(*ic_node_getrssi)(const ieee80211_node_t *);
59010266SQuaker.Fang@Sun.COM 	void			(*ic_set_channel)(ieee80211com_t *);
59110266SQuaker.Fang@Sun.COM 
59210266SQuaker.Fang@Sun.COM 	/*
59310266SQuaker.Fang@Sun.COM 	 * 802.11n ADDBA support.  A simple/generic implementation
59410266SQuaker.Fang@Sun.COM 	 * of A-MPDU tx aggregation is provided; the driver may
59510266SQuaker.Fang@Sun.COM 	 * override these methods to provide their own support.
59610266SQuaker.Fang@Sun.COM 	 * A-MPDU rx re-ordering happens automatically if the
59710266SQuaker.Fang@Sun.COM 	 * driver passes out-of-order frames to ieee80211_input
59810266SQuaker.Fang@Sun.COM 	 * from an assocated HT station.
59910266SQuaker.Fang@Sun.COM 	 */
60010266SQuaker.Fang@Sun.COM 	void			(*ic_recv_action)(ieee80211_node_t *,
60110266SQuaker.Fang@Sun.COM 				    const uint8_t *, const uint8_t *);
60210266SQuaker.Fang@Sun.COM 	int			(*ic_send_action)(ieee80211_node_t *,
60310266SQuaker.Fang@Sun.COM 				    int, int, uint16_t[4]);
60410266SQuaker.Fang@Sun.COM 	/* start/stop doing A-MPDU tx aggregation for a station */
60510266SQuaker.Fang@Sun.COM 	int			(*ic_addba_request)(ieee80211_node_t *,
60610266SQuaker.Fang@Sun.COM 				    struct ieee80211_tx_ampdu *,
60710266SQuaker.Fang@Sun.COM 				    int, int, int);
60810266SQuaker.Fang@Sun.COM 	int			(*ic_addba_response)(ieee80211_node_t *,
60910266SQuaker.Fang@Sun.COM 				    struct ieee80211_tx_ampdu *,
61010266SQuaker.Fang@Sun.COM 				    int, int, int);
61110266SQuaker.Fang@Sun.COM 	void			(*ic_addba_stop)(ieee80211_node_t *,
61210266SQuaker.Fang@Sun.COM 				    struct ieee80211_tx_ampdu *);
6133147Sxc151355 
6143147Sxc151355 	kmutex_t		ic_genlock;
6153147Sxc151355 	void			*ic_private;	/* ieee80211 private data */
6163147Sxc151355 };
6173147Sxc151355 #define	ic_nw_keys		ic_crypto.cs_nw_keys
6183147Sxc151355 #define	ic_def_txkey		ic_crypto.cs_def_txkey
6193147Sxc151355 
6203147Sxc151355 extern	const char *ieee80211_state_name[IEEE80211_S_MAX];
62110266SQuaker.Fang@Sun.COM extern	const char *ieee80211_wme_acnames[];
6223147Sxc151355 
6233147Sxc151355 #define	IEEE80211_RATE(_ix)			\
6243147Sxc151355 	(in->in_rates.ir_rates[(_ix)] & IEEE80211_RATE_VAL)
6253147Sxc151355 
6263147Sxc151355 #define	ieee80211_new_state(_ic, _nstate, _arg)	\
6273147Sxc151355 	(((_ic)->ic_newstate)((_ic), (_nstate), (_arg)))
6283147Sxc151355 
6293147Sxc151355 #define	ieee80211_macaddr_sprintf(_addr)	\
6303147Sxc151355 	ether_sprintf((struct ether_addr *)(_addr))
6313147Sxc151355 
6323147Sxc151355 /*
6333147Sxc151355  * Node reference counting definitions.
6343147Sxc151355  *
6353147Sxc151355  * ieee80211_node_initref	initialize the reference count to 1
6363147Sxc151355  * ieee80211_node_incref	add a reference
6373147Sxc151355  * ieee80211_node_decref	remove a reference
6383147Sxc151355  * ieee80211_node_decref_nv	remove a reference and return new value
6393147Sxc151355  * ieee80211_node_refcnt	reference count for printing (only)
6403147Sxc151355  */
6413147Sxc151355 #include <sys/atomic.h>
6423147Sxc151355 #define	ieee80211_node_initref(_in)		\
6433147Sxc151355 	((_in)->in_refcnt = 1)
6443147Sxc151355 #define	ieee80211_node_incref(_in)		\
6453147Sxc151355 	atomic_inc_uint(&(_in)->in_refcnt)
6463147Sxc151355 #define	ieee80211_node_decref(_in)		\
6473147Sxc151355 	atomic_dec_uint(&(_in)->in_refcnt)
6483147Sxc151355 #define	ieee80211_node_decref_nv(_in)		\
6493147Sxc151355 	atomic_dec_uint_nv(&(_in)->in_refcnt)
6503147Sxc151355 #define	ieee80211_node_refcnt(_in)		\
6513147Sxc151355 	(_in)->in_refcnt
6523147Sxc151355 
6533147Sxc151355 typedef void ieee80211_iter_func(void *, ieee80211_node_t *);
6543147Sxc151355 
6553147Sxc151355 /* Initialization */
6563147Sxc151355 void ieee80211_attach(ieee80211com_t *);
6573147Sxc151355 void ieee80211_detach(ieee80211com_t *);
6583147Sxc151355 void ieee80211_media_init(ieee80211com_t *);
6593147Sxc151355 int ieee80211_ioctl(ieee80211com_t *, queue_t *, mblk_t *);
6605296Szf162725 void ieee80211_register_door(ieee80211com_t *, const char *, int);
6613147Sxc151355 
6623147Sxc151355 /* Protocol Processing */
6633147Sxc151355 int ieee80211_input(ieee80211com_t *, mblk_t *, ieee80211_node_t *,
6643147Sxc151355 	int32_t, uint32_t);
6653147Sxc151355 mblk_t *ieee80211_encap(ieee80211com_t *, mblk_t *, ieee80211_node_t *);
6663147Sxc151355 
6673147Sxc151355 mblk_t *ieee80211_beacon_alloc(ieee80211com_t *, ieee80211_node_t *,
6683147Sxc151355 	struct ieee80211_beacon_offsets *);
6693147Sxc151355 int ieee80211_beacon_update(ieee80211com_t *, ieee80211_node_t *,
6703147Sxc151355 	struct ieee80211_beacon_offsets *, mblk_t *, int);
6713147Sxc151355 void ieee80211_beacon_miss(ieee80211com_t *);
6723147Sxc151355 
6733147Sxc151355 void ieee80211_begin_scan(ieee80211com_t *, boolean_t);
6743147Sxc151355 void ieee80211_next_scan(ieee80211com_t *);
6753147Sxc151355 void ieee80211_end_scan(ieee80211com_t *);
6763147Sxc151355 void ieee80211_cancel_scan(ieee80211com_t *);
6773147Sxc151355 
6783147Sxc151355 void ieee80211_sta_join(ieee80211com_t *, ieee80211_node_t *);
6793147Sxc151355 void ieee80211_sta_leave(ieee80211com_t *, ieee80211_node_t *);
6803147Sxc151355 boolean_t ieee80211_ibss_merge(ieee80211_node_t *);
6813147Sxc151355 
6823147Sxc151355 /* Node Operation */
6833147Sxc151355 ieee80211_node_t *ieee80211_ref_node(ieee80211_node_t *);
6843147Sxc151355 void ieee80211_unref_node(ieee80211_node_t **);
6853147Sxc151355 void ieee80211_node_authorize(ieee80211_node_t *);
6863147Sxc151355 void ieee80211_node_unauthorize(ieee80211_node_t *);
6873147Sxc151355 ieee80211_node_t *ieee80211_alloc_node(ieee80211com_t *,
6883147Sxc151355 	ieee80211_node_table_t *, const uint8_t *);
6893147Sxc151355 void ieee80211_free_node(ieee80211_node_t *);
6903147Sxc151355 void ieee80211_node_table_reset(ieee80211_node_table_t *);
6913147Sxc151355 void ieee80211_iterate_nodes(ieee80211_node_table_t *, ieee80211_iter_func *,
6923147Sxc151355 	void *);
6933147Sxc151355 ieee80211_node_t *ieee80211_find_node(ieee80211_node_table_t *,
6943147Sxc151355 	const uint8_t *);
6954126Szf162725 ieee80211_node_t *ieee80211_find_node_with_ssid(ieee80211_node_table_t *,
6964126Szf162725 	const uint8_t *, uint32_t, const uint8_t *);
6973147Sxc151355 ieee80211_node_t *ieee80211_find_txnode(ieee80211com_t *,
6983147Sxc151355 	const uint8_t daddr[IEEE80211_ADDR_LEN]);
6993147Sxc151355 ieee80211_node_t *ieee80211_find_rxnode(ieee80211com_t *,
7003147Sxc151355 	const struct ieee80211_frame *);
7013147Sxc151355 
7023147Sxc151355 
7033147Sxc151355 /* Crypto */
7043147Sxc151355 extern struct ieee80211_key *ieee80211_crypto_encap(ieee80211com_t *, mblk_t *);
7053147Sxc151355 extern struct ieee80211_key *ieee80211_crypto_decap(ieee80211com_t *, mblk_t *,
7063147Sxc151355 	int);
7073147Sxc151355 extern int ieee80211_crypto_newkey(ieee80211com_t *, int, int,
7083147Sxc151355 	struct ieee80211_key *);
7093147Sxc151355 extern int ieee80211_crypto_delkey(ieee80211com_t *, struct ieee80211_key *);
7103147Sxc151355 extern int ieee80211_crypto_setkey(ieee80211com_t *, struct ieee80211_key *,
7113147Sxc151355 	const uint8_t macaddr[IEEE80211_ADDR_LEN]);
7123147Sxc151355 
7133147Sxc151355 /* Helper Functions */
7143147Sxc151355 int ieee80211_stat(ieee80211com_t *ic, uint_t stat, uint64_t *val);
7153147Sxc151355 uint32_t ieee80211_chan2ieee(ieee80211com_t *, struct ieee80211_channel *);
7163147Sxc151355 enum ieee80211_phymode ieee80211_chan2mode(ieee80211com_t *,
7173147Sxc151355 	struct ieee80211_channel *);
7183147Sxc151355 uint32_t ieee80211_ieee2mhz(uint32_t, uint32_t);
7193147Sxc151355 void ieee80211_reset_chan(ieee80211com_t *);
7203147Sxc151355 void ieee80211_dump_pkt(const uint8_t *, int32_t, int32_t, int32_t);
7213147Sxc151355 void ieee80211_watchdog(void *);
7223147Sxc151355 void ieee80211_start_watchdog(ieee80211com_t *, uint32_t);
7233147Sxc151355 void ieee80211_stop_watchdog(ieee80211com_t *);
72410266SQuaker.Fang@Sun.COM int ieee80211_classify(struct ieee80211com *, mblk_t *,
72510266SQuaker.Fang@Sun.COM     struct ieee80211_node *);
72610266SQuaker.Fang@Sun.COM int ieee80211_hdrsize(const void *);
72710266SQuaker.Fang@Sun.COM int ieee80211_hdrspace(ieee80211com_t *, const void *);
72810266SQuaker.Fang@Sun.COM int ieee80211_anyhdrsize(const void *);
72910266SQuaker.Fang@Sun.COM int ieee80211_anyhdrspace(ieee80211com_t *, const void *);
7303147Sxc151355 
7314126Szf162725 void *ieee80211_malloc(size_t);
7324126Szf162725 void ieee80211_free(void *);
7337663SSowmini.Varadhan@Sun.COM int ieee80211_setprop(void *, const char *, mac_prop_id_t, uint_t,
7347663SSowmini.Varadhan@Sun.COM     const void *);
735*11878SVenu.Iyer@Sun.COM int ieee80211_getprop(void *, const char *, mac_prop_id_t, uint_t, void *);
736*11878SVenu.Iyer@Sun.COM void ieee80211_propinfo(void *, const char *, mac_prop_id_t,
737*11878SVenu.Iyer@Sun.COM     mac_prop_info_handle_t);
738*11878SVenu.Iyer@Sun.COM 
7394126Szf162725 
74010266SQuaker.Fang@Sun.COM struct ieee80211_channel *ieee80211_find_channel(ieee80211com_t *, int, int);
74110266SQuaker.Fang@Sun.COM const struct ieee80211_rateset *ieee80211_get_suprates(ieee80211com_t *,
74210266SQuaker.Fang@Sun.COM     struct ieee80211_channel *);
74310266SQuaker.Fang@Sun.COM 
74410266SQuaker.Fang@Sun.COM /* HT */
74510266SQuaker.Fang@Sun.COM 
7463147Sxc151355 #ifdef	__cplusplus
7473147Sxc151355 }
7483147Sxc151355 #endif
7493147Sxc151355 
7503147Sxc151355 #endif	/* _SYS_NET80211_H */
751