13871Syz147064 /*
23871Syz147064  * CDDL HEADER START
33871Syz147064  *
43871Syz147064  * The contents of this file are subject to the terms of the
53871Syz147064  * Common Development and Distribution License (the "License").
63871Syz147064  * You may not use this file except in compliance with the License.
73871Syz147064  *
83871Syz147064  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93871Syz147064  * or http://www.opensolaris.org/os/licensing.
103871Syz147064  * See the License for the specific language governing permissions
113871Syz147064  * and limitations under the License.
123871Syz147064  *
133871Syz147064  * When distributing Covered Code, include this CDDL HEADER in each
143871Syz147064  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153871Syz147064  * If applicable, add the following below this CDDL HEADER, with the
163871Syz147064  * fields enclosed by brackets "[]" replaced with your own identifying
173871Syz147064  * information: Portions Copyright [yyyy] [name of copyright owner]
183871Syz147064  *
193871Syz147064  * CDDL HEADER END
203871Syz147064  */
213871Syz147064 /*
22*5895Syz147064  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
233871Syz147064  * Use is subject to license terms.
243871Syz147064  */
253871Syz147064 
263871Syz147064 #ifndef _LIBDLWLAN_IMPL_H
273871Syz147064 #define	_LIBDLWLAN_IMPL_H
283871Syz147064 
293871Syz147064 #pragma ident	"%Z%%M%	%I%	%E% SMI"
303871Syz147064 
313871Syz147064 #include <sys/types.h>
323871Syz147064 #include <inet/wifi_ioctl.h>
333871Syz147064 
343871Syz147064 /*
353871Syz147064  * Implementation-private data structures, macros, and constants.
363871Syz147064  */
373871Syz147064 
383871Syz147064 #ifdef	__cplusplus
393871Syz147064 extern "C" {
403871Syz147064 #endif
413871Syz147064 
423871Syz147064 /*
433871Syz147064  * Map a signal value from 0-15 into an enumerated strength.  Since there are
443871Syz147064  * 5 strengths but 16 values, by convention the "middle" strength gets the
453871Syz147064  * extra value.  Thus, the buckets are 0-2, 3-5, 6-9, 10-12, and 13-15.
463871Syz147064  */
473871Syz147064 #define	DLADM_WLAN_SIGNAL2STRENGTH(signal)			\
483871Syz147064 	    (((signal) > 12 ? DLADM_WLAN_STRENGTH_EXCELLENT :	\
493871Syz147064 	    ((signal) > 9 ? DLADM_WLAN_STRENGTH_VERY_GOOD : 	\
503871Syz147064 	    ((signal) > 5 ? DLADM_WLAN_STRENGTH_GOOD :		\
513871Syz147064 	    ((signal) > 2 ? DLADM_WLAN_STRENGTH_WEAK :		\
523871Syz147064 	    DLADM_WLAN_STRENGTH_VERY_WEAK)))))
533871Syz147064 
543871Syz147064 /*
553871Syz147064  * Convert between an OFDM MHz and a channel number.
563871Syz147064  */
573871Syz147064 #define	DLADM_WLAN_OFDM2CHAN(mhz)		(((mhz) - 5000) / 5)
583871Syz147064 
593871Syz147064 #define	DLADM_WLAN_CONNECT_POLLRATE		200 /* milliseconds */
603871Syz147064 
613871Syz147064 #define	DLADM_WLAN_MAX_RATES	4
62*5895Syz147064 typedef struct dladm_wlan_rates {
633871Syz147064 	uint8_t		wr_rates[DLADM_WLAN_MAX_RATES];
643871Syz147064 	int		wr_cnt;
653871Syz147064 } dladm_wlan_rates_t;
663871Syz147064 
673871Syz147064 typedef enum {
683871Syz147064 	DLADM_WLAN_RADIO_ON = 1,
693871Syz147064 	DLADM_WLAN_RADIO_OFF
703871Syz147064 } dladm_wlan_radio_t;
713871Syz147064 
72*5895Syz147064 typedef enum {
733871Syz147064 	DLADM_WLAN_PM_OFF = 1,
743871Syz147064 	DLADM_WLAN_PM_MAX,
753871Syz147064 	DLADM_WLAN_PM_FAST
763871Syz147064 } dladm_wlan_powermode_t;
773871Syz147064 
78*5895Syz147064 extern dladm_status_t	i_dladm_wlan_get_ioctl(datalink_id_t, wldp_t *,
79*5895Syz147064 			    uint_t);
80*5895Syz147064 extern dladm_status_t	i_dladm_wlan_set_ioctl(datalink_id_t, uint_t,
81*5895Syz147064 			    void *, uint_t);
82*5895Syz147064 extern dladm_status_t	i_dladm_wlan_ioctl(datalink_id_t, wldp_t *, uint_t,
83*5895Syz147064 			    size_t, uint_t, size_t);
84*5895Syz147064 extern boolean_t	i_dladm_wlan_convert_chan(wl_phy_conf_t *, uint32_t *);
85*5895Syz147064 
863871Syz147064 #ifdef	__cplusplus
873871Syz147064 }
883871Syz147064 #endif
893871Syz147064 
903871Syz147064 #endif	/* _LIBDLWLAN_IMPL_H */
91