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