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 /*
22d62bc4baSyz  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230ba2cbe9Sxc  * Use is subject to license terms.
240ba2cbe9Sxc  */
250ba2cbe9Sxc 
26f595a68aSyz #ifndef _LIBDLWLAN_IMPL_H
27f595a68aSyz #define	_LIBDLWLAN_IMPL_H
280ba2cbe9Sxc 
290ba2cbe9Sxc #include <sys/types.h>
300ba2cbe9Sxc #include <inet/wifi_ioctl.h>
31bcb5c89dSSowmini Varadhan #include <sys/mac.h>
320ba2cbe9Sxc 
330ba2cbe9Sxc /*
340ba2cbe9Sxc  * Implementation-private data structures, macros, and constants.
350ba2cbe9Sxc  */
360ba2cbe9Sxc 
370ba2cbe9Sxc #ifdef	__cplusplus
380ba2cbe9Sxc extern "C" {
390ba2cbe9Sxc #endif
400ba2cbe9Sxc 
410ba2cbe9Sxc /*
420ba2cbe9Sxc  * Map a signal value from 0-15 into an enumerated strength.  Since there are
430ba2cbe9Sxc  * 5 strengths but 16 values, by convention the "middle" strength gets the
440ba2cbe9Sxc  * extra value.  Thus, the buckets are 0-2, 3-5, 6-9, 10-12, and 13-15.
450ba2cbe9Sxc  */
46f595a68aSyz #define	DLADM_WLAN_SIGNAL2STRENGTH(signal)			\
47f595a68aSyz 	    (((signal) > 12 ? DLADM_WLAN_STRENGTH_EXCELLENT :	\
48f595a68aSyz 	    ((signal) > 9 ? DLADM_WLAN_STRENGTH_VERY_GOOD : 	\
49f595a68aSyz 	    ((signal) > 5 ? DLADM_WLAN_STRENGTH_GOOD :		\
50f595a68aSyz 	    ((signal) > 2 ? DLADM_WLAN_STRENGTH_WEAK :		\
51f595a68aSyz 	    DLADM_WLAN_STRENGTH_VERY_WEAK)))))
520ba2cbe9Sxc 
530ba2cbe9Sxc /*
540ba2cbe9Sxc  * Convert between an OFDM MHz and a channel number.
550ba2cbe9Sxc  */
56f595a68aSyz #define	DLADM_WLAN_OFDM2CHAN(mhz)		(((mhz) - 5000) / 5)
570ba2cbe9Sxc 
58f595a68aSyz #define	DLADM_WLAN_CONNECT_POLLRATE		200 /* milliseconds */
590ba2cbe9Sxc 
60f595a68aSyz #define	DLADM_WLAN_MAX_RATES	4
61d62bc4baSyz typedef struct dladm_wlan_rates {
62f595a68aSyz 	uint8_t		wr_rates[DLADM_WLAN_MAX_RATES];
630ba2cbe9Sxc 	int		wr_cnt;
64f595a68aSyz } dladm_wlan_rates_t;
650ba2cbe9Sxc 
660ba2cbe9Sxc typedef enum {
67f595a68aSyz 	DLADM_WLAN_RADIO_ON = 1,
68f595a68aSyz 	DLADM_WLAN_RADIO_OFF
69f595a68aSyz } dladm_wlan_radio_t;
700ba2cbe9Sxc 
71d62bc4baSyz typedef enum {
72f595a68aSyz 	DLADM_WLAN_PM_OFF = 1,
73f595a68aSyz 	DLADM_WLAN_PM_MAX,
74f595a68aSyz 	DLADM_WLAN_PM_FAST
75f595a68aSyz } dladm_wlan_powermode_t;
760ba2cbe9Sxc 
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);
82d62bc4baSyz extern boolean_t	i_dladm_wlan_convert_chan(wl_phy_conf_t *, uint32_t *);
83d62bc4baSyz 
840ba2cbe9Sxc #ifdef	__cplusplus
850ba2cbe9Sxc }
860ba2cbe9Sxc #endif
870ba2cbe9Sxc 
88f595a68aSyz #endif	/* _LIBDLWLAN_IMPL_H */
89