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 /*
225895Syz147064  * 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 #include <sys/types.h>
303871Syz147064 #include <inet/wifi_ioctl.h>
31*7663SSowmini.Varadhan@Sun.COM #include <sys/mac.h>
323871Syz147064 
333871Syz147064 /*
343871Syz147064  * Implementation-private data structures, macros, and constants.
353871Syz147064  */
363871Syz147064 
373871Syz147064 #ifdef	__cplusplus
383871Syz147064 extern "C" {
393871Syz147064 #endif
403871Syz147064 
413871Syz147064 /*
423871Syz147064  * Map a signal value from 0-15 into an enumerated strength.  Since there are
433871Syz147064  * 5 strengths but 16 values, by convention the "middle" strength gets the
443871Syz147064  * extra value.  Thus, the buckets are 0-2, 3-5, 6-9, 10-12, and 13-15.
453871Syz147064  */
463871Syz147064 #define	DLADM_WLAN_SIGNAL2STRENGTH(signal)			\
473871Syz147064 	    (((signal) > 12 ? DLADM_WLAN_STRENGTH_EXCELLENT :	\
483871Syz147064 	    ((signal) > 9 ? DLADM_WLAN_STRENGTH_VERY_GOOD : 	\
493871Syz147064 	    ((signal) > 5 ? DLADM_WLAN_STRENGTH_GOOD :		\
503871Syz147064 	    ((signal) > 2 ? DLADM_WLAN_STRENGTH_WEAK :		\
513871Syz147064 	    DLADM_WLAN_STRENGTH_VERY_WEAK)))))
523871Syz147064 
533871Syz147064 /*
543871Syz147064  * Convert between an OFDM MHz and a channel number.
553871Syz147064  */
563871Syz147064 #define	DLADM_WLAN_OFDM2CHAN(mhz)		(((mhz) - 5000) / 5)
573871Syz147064 
583871Syz147064 #define	DLADM_WLAN_CONNECT_POLLRATE		200 /* milliseconds */
593871Syz147064 
603871Syz147064 #define	DLADM_WLAN_MAX_RATES	4
615895Syz147064 typedef struct dladm_wlan_rates {
623871Syz147064 	uint8_t		wr_rates[DLADM_WLAN_MAX_RATES];
633871Syz147064 	int		wr_cnt;
643871Syz147064 } dladm_wlan_rates_t;
653871Syz147064 
663871Syz147064 typedef enum {
673871Syz147064 	DLADM_WLAN_RADIO_ON = 1,
683871Syz147064 	DLADM_WLAN_RADIO_OFF
693871Syz147064 } dladm_wlan_radio_t;
703871Syz147064 
715895Syz147064 typedef enum {
723871Syz147064 	DLADM_WLAN_PM_OFF = 1,
733871Syz147064 	DLADM_WLAN_PM_MAX,
743871Syz147064 	DLADM_WLAN_PM_FAST
753871Syz147064 } dladm_wlan_powermode_t;
763871Syz147064 
77*7663SSowmini.Varadhan@Sun.COM extern	dladm_status_t i_dladm_wlan_legacy_ioctl(datalink_id_t, wldp_t *,
78*7663SSowmini.Varadhan@Sun.COM 			    uint_t, size_t, uint_t, size_t);
79*7663SSowmini.Varadhan@Sun.COM extern dladm_status_t	i_dladm_wlan_param(datalink_id_t, void *,
80*7663SSowmini.Varadhan@Sun.COM 			    mac_prop_id_t, size_t, boolean_t);
815895Syz147064 extern boolean_t	i_dladm_wlan_convert_chan(wl_phy_conf_t *, uint32_t *);
825895Syz147064 
833871Syz147064 #ifdef	__cplusplus
843871Syz147064 }
853871Syz147064 #endif
863871Syz147064 
873871Syz147064 #endif	/* _LIBDLWLAN_IMPL_H */
88