xref: /titanic_41/usr/src/uts/common/sys/mac_wifi.h (revision 9ea11b96f9f71eef4f1bd2062ea054451a32a216)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_MAC_WIFI_H
27 #define	_SYS_MAC_WIFI_H
28 
29 /*
30  * WiFi MAC-Type Plugin
31  */
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #include <sys/types.h>
38 #include <sys/net80211_proto.h>
39 
40 #ifdef	_KERNEL
41 
42 #define	MAC_PLUGIN_IDENT_WIFI	"mac_wifi"
43 
44 /*
45  * Maximum size of a WiFi header based on current implementation.
46  * May change in the future as new features are added.
47  */
48 #define	WIFI_HDRSIZE (sizeof (struct ieee80211_qosframe_addr4) + \
49     IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_EXTIVLEN + \
50     sizeof (struct ieee80211_llc))
51 
52 enum wifi_stat {
53 	/* statistics described in ieee802.11(5) */
54 	WIFI_STAT_TX_FRAGS = MACTYPE_STAT_MIN,
55 	WIFI_STAT_MCAST_TX,
56 	WIFI_STAT_TX_FAILED,
57 	WIFI_STAT_TX_RETRANS,
58 	WIFI_STAT_TX_RERETRANS,
59 	WIFI_STAT_RTS_SUCCESS,
60 	WIFI_STAT_RTS_FAILURE,
61 	WIFI_STAT_ACK_FAILURE,
62 	WIFI_STAT_RX_FRAGS,
63 	WIFI_STAT_MCAST_RX,
64 	WIFI_STAT_FCS_ERRORS,
65 	WIFI_STAT_WEP_ERRORS,
66 	WIFI_STAT_RX_DUPS
67 };
68 
69 /*
70  * WiFi security modes recognized by the plugin.
71  */
72 enum wifi_secmode {
73 	WIFI_SEC_NONE,
74 	WIFI_SEC_WEP,
75 	WIFI_SEC_WPA
76 };
77 
78 /*
79  * WiFi data passed between the drivers and the plugin.
80  *
81  * Field definitions:
82  *
83  *	wd_opts		Currently set to 0. If new features require the
84  * 			introduction of new wifi_data_t fields, then the
85  *			presence of those fields must be indicated to the
86  *			plugin via wd_opts flags.  This allows the drivers
87  *			and the plugin to evolve independently.
88  *
89  *	wd_bssid	Current associated BSSID (or IBSSID), used when
90  *			generating data packet headers for transmission.
91  *
92  *	wd_opmode	Current operation mode; any ieee80211_opmode is
93  *			supported.
94  *
95  *	wd_secalloc	Current allocation policy for security-related
96  *			WiFi headers, used when generating packets for
97  *			transmission.  The plugin will allocate header
98  *		        space for the security portion, and fill in any
99  *			fixed-contents fields.
100  *
101  *	wd_qospad	Generally, QoS data field takes 2 bytes, but
102  *			some special hardwares, such as Atheros, will need the
103  *			802.11 header padded to a 32-bit boundary for 4-address
104  *			and QoS frames, at this time, it's 4 bytes.
105  */
106 typedef struct wifi_data {
107 	uint_t			wd_opts;
108 	uint8_t			wd_bssid[IEEE80211_ADDR_LEN];
109 	enum ieee80211_opmode	wd_opmode;
110 	enum wifi_secmode	wd_secalloc;
111 	uint_t			wd_qospad;
112 } wifi_data_t;
113 
114 extern uint8_t wifi_bcastaddr[];
115 
116 #endif	/* _KERNEL */
117 
118 #ifdef	__cplusplus
119 }
120 #endif
121 
122 #endif /* _SYS_MAC_WIFI_H */
123