xref: /titanic_51/usr/src/uts/common/sys/mac_wifi.h (revision e2cf88ac9d753a00c17aa235f6afdc76574fe3a6)
10ba2cbe9Sxc151355 /*
20ba2cbe9Sxc151355  * CDDL HEADER START
30ba2cbe9Sxc151355  *
40ba2cbe9Sxc151355  * The contents of this file are subject to the terms of the
50ba2cbe9Sxc151355  * Common Development and Distribution License (the "License").
60ba2cbe9Sxc151355  * You may not use this file except in compliance with the License.
70ba2cbe9Sxc151355  *
80ba2cbe9Sxc151355  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90ba2cbe9Sxc151355  * or http://www.opensolaris.org/os/licensing.
100ba2cbe9Sxc151355  * See the License for the specific language governing permissions
110ba2cbe9Sxc151355  * and limitations under the License.
120ba2cbe9Sxc151355  *
130ba2cbe9Sxc151355  * When distributing Covered Code, include this CDDL HEADER in each
140ba2cbe9Sxc151355  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150ba2cbe9Sxc151355  * If applicable, add the following below this CDDL HEADER, with the
160ba2cbe9Sxc151355  * fields enclosed by brackets "[]" replaced with your own identifying
170ba2cbe9Sxc151355  * information: Portions Copyright [yyyy] [name of copyright owner]
180ba2cbe9Sxc151355  *
190ba2cbe9Sxc151355  * CDDL HEADER END
200ba2cbe9Sxc151355  */
210ba2cbe9Sxc151355 /*
22*e2cf88acSQuaker Fang  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230ba2cbe9Sxc151355  * Use is subject to license terms.
240ba2cbe9Sxc151355  */
250ba2cbe9Sxc151355 
260ba2cbe9Sxc151355 #ifndef	_SYS_MAC_WIFI_H
270ba2cbe9Sxc151355 #define	_SYS_MAC_WIFI_H
280ba2cbe9Sxc151355 
290ba2cbe9Sxc151355 /*
300ba2cbe9Sxc151355  * WiFi MAC-Type Plugin
310ba2cbe9Sxc151355  */
320ba2cbe9Sxc151355 
330ba2cbe9Sxc151355 #ifdef	__cplusplus
340ba2cbe9Sxc151355 extern "C" {
350ba2cbe9Sxc151355 #endif
360ba2cbe9Sxc151355 
370ba2cbe9Sxc151355 #include <sys/types.h>
380ba2cbe9Sxc151355 #include <sys/net80211_proto.h>
390ba2cbe9Sxc151355 
400ba2cbe9Sxc151355 #ifdef	_KERNEL
410ba2cbe9Sxc151355 
420ba2cbe9Sxc151355 #define	MAC_PLUGIN_IDENT_WIFI	"mac_wifi"
430ba2cbe9Sxc151355 
440ba2cbe9Sxc151355 /*
450ba2cbe9Sxc151355  * Maximum size of a WiFi header based on current implementation.
460ba2cbe9Sxc151355  * May change in the future as new features are added.
470ba2cbe9Sxc151355  */
48*e2cf88acSQuaker Fang #define	WIFI_HDRSIZE (sizeof (struct ieee80211_qosframe_addr4) + \
49a399b765Szf162725     IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_EXTIVLEN + \
50a399b765Szf162725     sizeof (struct ieee80211_llc))
510ba2cbe9Sxc151355 
520ba2cbe9Sxc151355 enum wifi_stat {
530ba2cbe9Sxc151355 	/* statistics described in ieee802.11(5) */
540ba2cbe9Sxc151355 	WIFI_STAT_TX_FRAGS = MACTYPE_STAT_MIN,
550ba2cbe9Sxc151355 	WIFI_STAT_MCAST_TX,
560ba2cbe9Sxc151355 	WIFI_STAT_TX_FAILED,
570ba2cbe9Sxc151355 	WIFI_STAT_TX_RETRANS,
580ba2cbe9Sxc151355 	WIFI_STAT_TX_RERETRANS,
590ba2cbe9Sxc151355 	WIFI_STAT_RTS_SUCCESS,
600ba2cbe9Sxc151355 	WIFI_STAT_RTS_FAILURE,
610ba2cbe9Sxc151355 	WIFI_STAT_ACK_FAILURE,
620ba2cbe9Sxc151355 	WIFI_STAT_RX_FRAGS,
630ba2cbe9Sxc151355 	WIFI_STAT_MCAST_RX,
640ba2cbe9Sxc151355 	WIFI_STAT_FCS_ERRORS,
650ba2cbe9Sxc151355 	WIFI_STAT_WEP_ERRORS,
660ba2cbe9Sxc151355 	WIFI_STAT_RX_DUPS
670ba2cbe9Sxc151355 };
680ba2cbe9Sxc151355 
690ba2cbe9Sxc151355 /*
700ba2cbe9Sxc151355  * WiFi security modes recognized by the plugin.
710ba2cbe9Sxc151355  */
720ba2cbe9Sxc151355 enum wifi_secmode {
730ba2cbe9Sxc151355 	WIFI_SEC_NONE,
74a399b765Szf162725 	WIFI_SEC_WEP,
75a399b765Szf162725 	WIFI_SEC_WPA
760ba2cbe9Sxc151355 };
770ba2cbe9Sxc151355 
780ba2cbe9Sxc151355 /*
790ba2cbe9Sxc151355  * WiFi data passed between the drivers and the plugin.
800ba2cbe9Sxc151355  *
810ba2cbe9Sxc151355  * Field definitions:
820ba2cbe9Sxc151355  *
830ba2cbe9Sxc151355  *	wd_opts		Currently set to 0. If new features require the
840ba2cbe9Sxc151355  * 			introduction of new wifi_data_t fields, then the
850ba2cbe9Sxc151355  *			presence of those fields must be indicated to the
860ba2cbe9Sxc151355  *			plugin via wd_opts flags.  This allows the drivers
870ba2cbe9Sxc151355  *			and the plugin to evolve independently.
880ba2cbe9Sxc151355  *
890ba2cbe9Sxc151355  *	wd_bssid	Current associated BSSID (or IBSSID), used when
900ba2cbe9Sxc151355  *			generating data packet headers for transmission.
910ba2cbe9Sxc151355  *
920ba2cbe9Sxc151355  *	wd_opmode	Current operation mode; any ieee80211_opmode is
930ba2cbe9Sxc151355  *			supported.
940ba2cbe9Sxc151355  *
950ba2cbe9Sxc151355  *	wd_secalloc	Current allocation policy for security-related
960ba2cbe9Sxc151355  *			WiFi headers, used when generating packets for
970ba2cbe9Sxc151355  *			transmission.  The plugin will allocate header
980ba2cbe9Sxc151355  *		        space for the security portion, and fill in any
990ba2cbe9Sxc151355  *			fixed-contents fields.
100*e2cf88acSQuaker Fang  *
101*e2cf88acSQuaker Fang  *	wd_qospad	Generally, QoS data field takes 2 bytes, but
102*e2cf88acSQuaker Fang  *			some special hardwares, such as Atheros, will need the
103*e2cf88acSQuaker Fang  *			802.11 header padded to a 32-bit boundary for 4-address
104*e2cf88acSQuaker Fang  *			and QoS frames, at this time, it's 4 bytes.
1050ba2cbe9Sxc151355  */
1060ba2cbe9Sxc151355 typedef struct wifi_data {
1070ba2cbe9Sxc151355 	uint_t			wd_opts;
1080ba2cbe9Sxc151355 	uint8_t			wd_bssid[IEEE80211_ADDR_LEN];
1090ba2cbe9Sxc151355 	enum ieee80211_opmode	wd_opmode;
1100ba2cbe9Sxc151355 	enum wifi_secmode	wd_secalloc;
111*e2cf88acSQuaker Fang 	uint_t			wd_qospad;
1120ba2cbe9Sxc151355 } wifi_data_t;
1130ba2cbe9Sxc151355 
1140ba2cbe9Sxc151355 extern uint8_t wifi_bcastaddr[];
1150ba2cbe9Sxc151355 
1160ba2cbe9Sxc151355 #endif	/* _KERNEL */
1170ba2cbe9Sxc151355 
1180ba2cbe9Sxc151355 #ifdef	__cplusplus
1190ba2cbe9Sxc151355 }
1200ba2cbe9Sxc151355 #endif
1210ba2cbe9Sxc151355 
1220ba2cbe9Sxc151355 #endif /* _SYS_MAC_WIFI_H */
123