xref: /titanic_52/usr/src/lib/libdladm/common/libdlwlan_impl.h (revision 4ac67f0276a8313b5cefec38af347b94b7bfb526)
1f595a68aSyz147064 /*
2f595a68aSyz147064  * CDDL HEADER START
3f595a68aSyz147064  *
4f595a68aSyz147064  * The contents of this file are subject to the terms of the
5f595a68aSyz147064  * Common Development and Distribution License (the "License").
6f595a68aSyz147064  * You may not use this file except in compliance with the License.
7f595a68aSyz147064  *
8f595a68aSyz147064  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9f595a68aSyz147064  * or http://www.opensolaris.org/os/licensing.
10f595a68aSyz147064  * See the License for the specific language governing permissions
11f595a68aSyz147064  * and limitations under the License.
12f595a68aSyz147064  *
13f595a68aSyz147064  * When distributing Covered Code, include this CDDL HEADER in each
14f595a68aSyz147064  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15f595a68aSyz147064  * If applicable, add the following below this CDDL HEADER, with the
16f595a68aSyz147064  * fields enclosed by brackets "[]" replaced with your own identifying
17f595a68aSyz147064  * information: Portions Copyright [yyyy] [name of copyright owner]
18f595a68aSyz147064  *
19f595a68aSyz147064  * CDDL HEADER END
20f595a68aSyz147064  */
21f595a68aSyz147064 /*
22d62bc4baSyz147064  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23f595a68aSyz147064  * Use is subject to license terms.
24f595a68aSyz147064  */
25f595a68aSyz147064 
26f595a68aSyz147064 #ifndef _LIBDLWLAN_IMPL_H
27f595a68aSyz147064 #define	_LIBDLWLAN_IMPL_H
28f595a68aSyz147064 
29f595a68aSyz147064 #include <sys/types.h>
30f595a68aSyz147064 #include <inet/wifi_ioctl.h>
31bcb5c89dSSowmini Varadhan #include <sys/mac.h>
32f595a68aSyz147064 
33f595a68aSyz147064 /*
34f595a68aSyz147064  * Implementation-private data structures, macros, and constants.
35f595a68aSyz147064  */
36f595a68aSyz147064 
37f595a68aSyz147064 #ifdef	__cplusplus
38f595a68aSyz147064 extern "C" {
39f595a68aSyz147064 #endif
40f595a68aSyz147064 
41f595a68aSyz147064 /*
42f595a68aSyz147064  * Map a signal value from 0-15 into an enumerated strength.  Since there are
43f595a68aSyz147064  * 5 strengths but 16 values, by convention the "middle" strength gets the
44f595a68aSyz147064  * extra value.  Thus, the buckets are 0-2, 3-5, 6-9, 10-12, and 13-15.
45f595a68aSyz147064  */
46f595a68aSyz147064 #define	DLADM_WLAN_SIGNAL2STRENGTH(signal)			\
47f595a68aSyz147064 	    (((signal) > 12 ? DLADM_WLAN_STRENGTH_EXCELLENT :	\
48f595a68aSyz147064 	    ((signal) > 9 ? DLADM_WLAN_STRENGTH_VERY_GOOD : 	\
49f595a68aSyz147064 	    ((signal) > 5 ? DLADM_WLAN_STRENGTH_GOOD :		\
50f595a68aSyz147064 	    ((signal) > 2 ? DLADM_WLAN_STRENGTH_WEAK :		\
51f595a68aSyz147064 	    DLADM_WLAN_STRENGTH_VERY_WEAK)))))
52f595a68aSyz147064 
53f595a68aSyz147064 /*
54f595a68aSyz147064  * Convert between an OFDM MHz and a channel number.
55f595a68aSyz147064  */
56f595a68aSyz147064 #define	DLADM_WLAN_OFDM2CHAN(mhz)		(((mhz) - 5000) / 5)
57f595a68aSyz147064 
58f595a68aSyz147064 #define	DLADM_WLAN_CONNECT_POLLRATE		200 /* milliseconds */
59f595a68aSyz147064 
60f595a68aSyz147064 #define	DLADM_WLAN_MAX_RATES	4
61f595a68aSyz147064 typedef struct dladm_wlan_rates {
62f595a68aSyz147064 	uint8_t		wr_rates[DLADM_WLAN_MAX_RATES];
63f595a68aSyz147064 	int		wr_cnt;
64f595a68aSyz147064 } dladm_wlan_rates_t;
65f595a68aSyz147064 
66f595a68aSyz147064 typedef enum {
67f595a68aSyz147064 	DLADM_WLAN_RADIO_ON = 1,
68f595a68aSyz147064 	DLADM_WLAN_RADIO_OFF
69f595a68aSyz147064 } dladm_wlan_radio_t;
70f595a68aSyz147064 
71f595a68aSyz147064 typedef enum {
72f595a68aSyz147064 	DLADM_WLAN_PM_OFF = 1,
73f595a68aSyz147064 	DLADM_WLAN_PM_MAX,
74f595a68aSyz147064 	DLADM_WLAN_PM_FAST
75f595a68aSyz147064 } dladm_wlan_powermode_t;
76f595a68aSyz147064 
77*4ac67f02SAnurag S. Maskey extern	dladm_status_t i_dladm_wlan_legacy_ioctl(dladm_handle_t,
78*4ac67f02SAnurag S. Maskey 			    datalink_id_t, wldp_t *, uint_t, size_t, uint_t,
79*4ac67f02SAnurag S. Maskey 			    size_t);
80*4ac67f02SAnurag S. Maskey extern dladm_status_t	i_dladm_wlan_param(dladm_handle_t, datalink_id_t,
81*4ac67f02SAnurag S. Maskey 			    void *, mac_prop_id_t, size_t, boolean_t);
82d62bc4baSyz147064 extern boolean_t	i_dladm_wlan_convert_chan(wl_phy_conf_t *, uint32_t *);
83d62bc4baSyz147064 
84f595a68aSyz147064 #ifdef	__cplusplus
85f595a68aSyz147064 }
86f595a68aSyz147064 #endif
87f595a68aSyz147064 
88f595a68aSyz147064 #endif	/* _LIBDLWLAN_IMPL_H */
89