xref: /titanic_52/usr/src/uts/common/sys/mac_wifi.h (revision 79777a7dd0179283917bda2ba98999c382d31c2c)
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 2007 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * WiFi MAC-Type Plugin
33  */
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #include <sys/types.h>
40 #include <sys/net80211_proto.h>
41 
42 #ifdef	_KERNEL
43 
44 #define	MAC_PLUGIN_IDENT_WIFI	"mac_wifi"
45 
46 /*
47  * Maximum size of a WiFi header based on current implementation.
48  * May change in the future as new features are added.
49  */
50 #define	WIFI_HDRSIZE (sizeof (struct ieee80211_frame) + \
51     IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_EXTIVLEN + \
52     sizeof (struct ieee80211_llc))
53 
54 enum wifi_stat {
55 	/* statistics described in ieee802.11(5) */
56 	WIFI_STAT_TX_FRAGS = MACTYPE_STAT_MIN,
57 	WIFI_STAT_MCAST_TX,
58 	WIFI_STAT_TX_FAILED,
59 	WIFI_STAT_TX_RETRANS,
60 	WIFI_STAT_TX_RERETRANS,
61 	WIFI_STAT_RTS_SUCCESS,
62 	WIFI_STAT_RTS_FAILURE,
63 	WIFI_STAT_ACK_FAILURE,
64 	WIFI_STAT_RX_FRAGS,
65 	WIFI_STAT_MCAST_RX,
66 	WIFI_STAT_FCS_ERRORS,
67 	WIFI_STAT_WEP_ERRORS,
68 	WIFI_STAT_RX_DUPS
69 };
70 
71 /*
72  * WiFi security modes recognized by the plugin.
73  */
74 enum wifi_secmode {
75 	WIFI_SEC_NONE,
76 	WIFI_SEC_WEP,
77 	WIFI_SEC_WPA
78 };
79 
80 /*
81  * WiFi data passed between the drivers and the plugin.
82  *
83  * Field definitions:
84  *
85  *	wd_opts		Currently set to 0. If new features require the
86  * 			introduction of new wifi_data_t fields, then the
87  *			presence of those fields must be indicated to the
88  *			plugin via wd_opts flags.  This allows the drivers
89  *			and the plugin to evolve independently.
90  *
91  *	wd_bssid	Current associated BSSID (or IBSSID), used when
92  *			generating data packet headers for transmission.
93  *
94  *	wd_opmode	Current operation mode; any ieee80211_opmode is
95  *			supported.
96  *
97  *	wd_secalloc	Current allocation policy for security-related
98  *			WiFi headers, used when generating packets for
99  *			transmission.  The plugin will allocate header
100  *		        space for the security portion, and fill in any
101  *			fixed-contents fields.
102  */
103 typedef struct wifi_data {
104 	uint_t			wd_opts;
105 	uint8_t			wd_bssid[IEEE80211_ADDR_LEN];
106 	enum ieee80211_opmode	wd_opmode;
107 	enum wifi_secmode	wd_secalloc;
108 } wifi_data_t;
109 
110 extern uint8_t wifi_bcastaddr[];
111 
112 #endif	/* _KERNEL */
113 
114 #ifdef	__cplusplus
115 }
116 #endif
117 
118 #endif /* _SYS_MAC_WIFI_H */
119