xref: /onnv-gate/usr/src/uts/common/sys/mac_wifi.h (revision 10266:bbc5945eddd7)
13147Sxc151355 /*
23147Sxc151355  * CDDL HEADER START
33147Sxc151355  *
43147Sxc151355  * The contents of this file are subject to the terms of the
53147Sxc151355  * Common Development and Distribution License (the "License").
63147Sxc151355  * You may not use this file except in compliance with the License.
73147Sxc151355  *
83147Sxc151355  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93147Sxc151355  * or http://www.opensolaris.org/os/licensing.
103147Sxc151355  * See the License for the specific language governing permissions
113147Sxc151355  * and limitations under the License.
123147Sxc151355  *
133147Sxc151355  * When distributing Covered Code, include this CDDL HEADER in each
143147Sxc151355  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153147Sxc151355  * If applicable, add the following below this CDDL HEADER, with the
163147Sxc151355  * fields enclosed by brackets "[]" replaced with your own identifying
173147Sxc151355  * information: Portions Copyright [yyyy] [name of copyright owner]
183147Sxc151355  *
193147Sxc151355  * CDDL HEADER END
203147Sxc151355  */
213147Sxc151355 /*
22*10266SQuaker.Fang@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
233147Sxc151355  * Use is subject to license terms.
243147Sxc151355  */
253147Sxc151355 
263147Sxc151355 #ifndef	_SYS_MAC_WIFI_H
273147Sxc151355 #define	_SYS_MAC_WIFI_H
283147Sxc151355 
293147Sxc151355 /*
303147Sxc151355  * WiFi MAC-Type Plugin
313147Sxc151355  */
323147Sxc151355 
333147Sxc151355 #ifdef	__cplusplus
343147Sxc151355 extern "C" {
353147Sxc151355 #endif
363147Sxc151355 
373147Sxc151355 #include <sys/types.h>
383147Sxc151355 #include <sys/net80211_proto.h>
393147Sxc151355 
403147Sxc151355 #ifdef	_KERNEL
413147Sxc151355 
423147Sxc151355 #define	MAC_PLUGIN_IDENT_WIFI	"mac_wifi"
433147Sxc151355 
443147Sxc151355 /*
453147Sxc151355  * Maximum size of a WiFi header based on current implementation.
463147Sxc151355  * May change in the future as new features are added.
473147Sxc151355  */
48*10266SQuaker.Fang@Sun.COM #define	WIFI_HDRSIZE (sizeof (struct ieee80211_qosframe_addr4) + \
494126Szf162725     IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_EXTIVLEN + \
504126Szf162725     sizeof (struct ieee80211_llc))
513147Sxc151355 
523147Sxc151355 enum wifi_stat {
533147Sxc151355 	/* statistics described in ieee802.11(5) */
543147Sxc151355 	WIFI_STAT_TX_FRAGS = MACTYPE_STAT_MIN,
553147Sxc151355 	WIFI_STAT_MCAST_TX,
563147Sxc151355 	WIFI_STAT_TX_FAILED,
573147Sxc151355 	WIFI_STAT_TX_RETRANS,
583147Sxc151355 	WIFI_STAT_TX_RERETRANS,
593147Sxc151355 	WIFI_STAT_RTS_SUCCESS,
603147Sxc151355 	WIFI_STAT_RTS_FAILURE,
613147Sxc151355 	WIFI_STAT_ACK_FAILURE,
623147Sxc151355 	WIFI_STAT_RX_FRAGS,
633147Sxc151355 	WIFI_STAT_MCAST_RX,
643147Sxc151355 	WIFI_STAT_FCS_ERRORS,
653147Sxc151355 	WIFI_STAT_WEP_ERRORS,
663147Sxc151355 	WIFI_STAT_RX_DUPS
673147Sxc151355 };
683147Sxc151355 
693147Sxc151355 /*
703147Sxc151355  * WiFi security modes recognized by the plugin.
713147Sxc151355  */
723147Sxc151355 enum wifi_secmode {
733147Sxc151355 	WIFI_SEC_NONE,
744126Szf162725 	WIFI_SEC_WEP,
754126Szf162725 	WIFI_SEC_WPA
763147Sxc151355 };
773147Sxc151355 
783147Sxc151355 /*
793147Sxc151355  * WiFi data passed between the drivers and the plugin.
803147Sxc151355  *
813147Sxc151355  * Field definitions:
823147Sxc151355  *
833147Sxc151355  *	wd_opts		Currently set to 0. If new features require the
843147Sxc151355  * 			introduction of new wifi_data_t fields, then the
853147Sxc151355  *			presence of those fields must be indicated to the
863147Sxc151355  *			plugin via wd_opts flags.  This allows the drivers
873147Sxc151355  *			and the plugin to evolve independently.
883147Sxc151355  *
893147Sxc151355  *	wd_bssid	Current associated BSSID (or IBSSID), used when
903147Sxc151355  *			generating data packet headers for transmission.
913147Sxc151355  *
923147Sxc151355  *	wd_opmode	Current operation mode; any ieee80211_opmode is
933147Sxc151355  *			supported.
943147Sxc151355  *
953147Sxc151355  *	wd_secalloc	Current allocation policy for security-related
963147Sxc151355  *			WiFi headers, used when generating packets for
973147Sxc151355  *			transmission.  The plugin will allocate header
983147Sxc151355  *		        space for the security portion, and fill in any
993147Sxc151355  *			fixed-contents fields.
100*10266SQuaker.Fang@Sun.COM  *
101*10266SQuaker.Fang@Sun.COM  *	wd_qospad	Generally, QoS data field takes 2 bytes, but
102*10266SQuaker.Fang@Sun.COM  *			some special hardwares, such as Atheros, will need the
103*10266SQuaker.Fang@Sun.COM  *			802.11 header padded to a 32-bit boundary for 4-address
104*10266SQuaker.Fang@Sun.COM  *			and QoS frames, at this time, it's 4 bytes.
1053147Sxc151355  */
1063147Sxc151355 typedef struct wifi_data {
1073147Sxc151355 	uint_t			wd_opts;
1083147Sxc151355 	uint8_t			wd_bssid[IEEE80211_ADDR_LEN];
1093147Sxc151355 	enum ieee80211_opmode	wd_opmode;
1103147Sxc151355 	enum wifi_secmode	wd_secalloc;
111*10266SQuaker.Fang@Sun.COM 	uint_t			wd_qospad;
1123147Sxc151355 } wifi_data_t;
1133147Sxc151355 
1143147Sxc151355 extern uint8_t wifi_bcastaddr[];
1153147Sxc151355 
1163147Sxc151355 #endif	/* _KERNEL */
1173147Sxc151355 
1183147Sxc151355 #ifdef	__cplusplus
1193147Sxc151355 }
1203147Sxc151355 #endif
1213147Sxc151355 
1223147Sxc151355 #endif /* _SYS_MAC_WIFI_H */
123