xref: /onnv-gate/usr/src/uts/common/io/simnet/simnet_impl.h (revision 10616:3be00c4a6835)
19815SRishi.Srivatsavai@Sun.COM /*
29815SRishi.Srivatsavai@Sun.COM  * CDDL HEADER START
39815SRishi.Srivatsavai@Sun.COM  *
49815SRishi.Srivatsavai@Sun.COM  * The contents of this file are subject to the terms of the
59815SRishi.Srivatsavai@Sun.COM  * Common Development and Distribution License (the "License").
69815SRishi.Srivatsavai@Sun.COM  * You may not use this file except in compliance with the License.
79815SRishi.Srivatsavai@Sun.COM  *
89815SRishi.Srivatsavai@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
99815SRishi.Srivatsavai@Sun.COM  * or http://www.opensolaris.org/os/licensing.
109815SRishi.Srivatsavai@Sun.COM  * See the License for the specific language governing permissions
119815SRishi.Srivatsavai@Sun.COM  * and limitations under the License.
129815SRishi.Srivatsavai@Sun.COM  *
139815SRishi.Srivatsavai@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
149815SRishi.Srivatsavai@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
159815SRishi.Srivatsavai@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
169815SRishi.Srivatsavai@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
179815SRishi.Srivatsavai@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
189815SRishi.Srivatsavai@Sun.COM  *
199815SRishi.Srivatsavai@Sun.COM  * CDDL HEADER END
209815SRishi.Srivatsavai@Sun.COM  */
219815SRishi.Srivatsavai@Sun.COM /*
229815SRishi.Srivatsavai@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
239815SRishi.Srivatsavai@Sun.COM  * Use is subject to license terms.
249815SRishi.Srivatsavai@Sun.COM  */
259815SRishi.Srivatsavai@Sun.COM 
269815SRishi.Srivatsavai@Sun.COM #ifndef	_SYS_SIMNET_IMPL_H
279815SRishi.Srivatsavai@Sun.COM #define	_SYS_SIMNET_IMPL_H
289815SRishi.Srivatsavai@Sun.COM 
29*10616SSebastien.Roy@Sun.COM #include <sys/types.h>
309815SRishi.Srivatsavai@Sun.COM #include <sys/list.h>
319815SRishi.Srivatsavai@Sun.COM #include <sys/mutex.h>
329815SRishi.Srivatsavai@Sun.COM #include <sys/mac.h>
339815SRishi.Srivatsavai@Sun.COM #include <sys/net80211.h>
349815SRishi.Srivatsavai@Sun.COM #include <inet/wifi_ioctl.h>
359815SRishi.Srivatsavai@Sun.COM 
369815SRishi.Srivatsavai@Sun.COM #ifdef	__cplusplus
379815SRishi.Srivatsavai@Sun.COM extern "C" {
389815SRishi.Srivatsavai@Sun.COM #endif
399815SRishi.Srivatsavai@Sun.COM 
409815SRishi.Srivatsavai@Sun.COM #define	MAX_SIMNET_ESSCONF	25	/* Max num of WiFi scan results */
419815SRishi.Srivatsavai@Sun.COM #define	MAX_ESSLIST_ARGS	10	/* Max num of ESS list arguments */
429815SRishi.Srivatsavai@Sun.COM #define	MAX_ESSLIST_ARGLEN	50	/* Max ESS list argument len */
439815SRishi.Srivatsavai@Sun.COM 
449815SRishi.Srivatsavai@Sun.COM struct simnet_dev;
459815SRishi.Srivatsavai@Sun.COM 
469815SRishi.Srivatsavai@Sun.COM typedef struct simnet_wifidev {
479815SRishi.Srivatsavai@Sun.COM 	struct simnet_dev	*swd_sdev;
489815SRishi.Srivatsavai@Sun.COM 	wl_essid_t		swd_essid;
499815SRishi.Srivatsavai@Sun.COM 	wl_bssid_t		swd_bssid;
509815SRishi.Srivatsavai@Sun.COM 	wl_rssi_t		swd_rssi; /* signal strength */
519815SRishi.Srivatsavai@Sun.COM 	wl_linkstatus_t		swd_linkstatus;
529815SRishi.Srivatsavai@Sun.COM 	int			swd_esslist_num;
539815SRishi.Srivatsavai@Sun.COM 	wl_ess_conf_t		*swd_esslist[MAX_SIMNET_ESSCONF];
549815SRishi.Srivatsavai@Sun.COM } simnet_wifidev_t;
559815SRishi.Srivatsavai@Sun.COM 
569815SRishi.Srivatsavai@Sun.COM typedef struct simnet_stats {
579815SRishi.Srivatsavai@Sun.COM 	uint64_t		rbytes;
589815SRishi.Srivatsavai@Sun.COM 	uint64_t		obytes;
599815SRishi.Srivatsavai@Sun.COM 	uint64_t		xmit_errors;
609815SRishi.Srivatsavai@Sun.COM 	uint64_t		xmit_count;
619815SRishi.Srivatsavai@Sun.COM 	uint64_t		recv_count;
629815SRishi.Srivatsavai@Sun.COM 	uint64_t		recv_errors;
639815SRishi.Srivatsavai@Sun.COM } simnet_stats_t;
649815SRishi.Srivatsavai@Sun.COM 
659815SRishi.Srivatsavai@Sun.COM typedef struct simnet_dev {
669815SRishi.Srivatsavai@Sun.COM 	list_node_t		sd_listnode;
679815SRishi.Srivatsavai@Sun.COM 	uint_t			sd_type;	/* WiFi, Ethernet etc. */
689815SRishi.Srivatsavai@Sun.COM 	datalink_id_t		sd_link_id;
69*10616SSebastien.Roy@Sun.COM 	zoneid_t		sd_zoneid;	/* zone where created */
709815SRishi.Srivatsavai@Sun.COM 	struct simnet_dev	*sd_peer_dev;	/* Attached peer, if any */
719815SRishi.Srivatsavai@Sun.COM 	uint_t			sd_flags;	/* Device flags SDF_* */
729815SRishi.Srivatsavai@Sun.COM 	uint_t			sd_refcount;
739815SRishi.Srivatsavai@Sun.COM 	/* Num of active threads using the device */
749815SRishi.Srivatsavai@Sun.COM 	uint_t			sd_threadcount;
759815SRishi.Srivatsavai@Sun.COM 	kcondvar_t		sd_threadwait;
769815SRishi.Srivatsavai@Sun.COM 	mac_handle_t		sd_mh;
779815SRishi.Srivatsavai@Sun.COM 	simnet_wifidev_t	*sd_wifidev;
789815SRishi.Srivatsavai@Sun.COM 	boolean_t		sd_promisc;
799815SRishi.Srivatsavai@Sun.COM 	kmutex_t		sd_instlock;
809815SRishi.Srivatsavai@Sun.COM 	/* Num of multicast addresses stored in sd_mcastaddrs */
819815SRishi.Srivatsavai@Sun.COM 	uint_t			sd_mcastaddr_count;
829815SRishi.Srivatsavai@Sun.COM 	/* Multicast address list stored in single buffer */
839815SRishi.Srivatsavai@Sun.COM 	uint8_t			*sd_mcastaddrs;
849815SRishi.Srivatsavai@Sun.COM 	uint_t			sd_mac_len;
859815SRishi.Srivatsavai@Sun.COM 	uchar_t			sd_mac_addr[MAXMACADDRLEN];
869815SRishi.Srivatsavai@Sun.COM 	simnet_stats_t		sd_stats;
879815SRishi.Srivatsavai@Sun.COM } simnet_dev_t;
889815SRishi.Srivatsavai@Sun.COM 
899815SRishi.Srivatsavai@Sun.COM /* Simnet device flags */
909815SRishi.Srivatsavai@Sun.COM #define	SDF_SHUTDOWN	0x00000001	/* Device shutdown, no new ops */
919815SRishi.Srivatsavai@Sun.COM #define	SDF_STARTED	0x00000002	/* Device started, allow ops */
929815SRishi.Srivatsavai@Sun.COM 
939815SRishi.Srivatsavai@Sun.COM #define	SIMNET_MAX_MTU	9000		/* Max MTU supported by simnet driver */
949815SRishi.Srivatsavai@Sun.COM 
959815SRishi.Srivatsavai@Sun.COM #ifdef	__cplusplus
969815SRishi.Srivatsavai@Sun.COM }
979815SRishi.Srivatsavai@Sun.COM #endif
989815SRishi.Srivatsavai@Sun.COM 
999815SRishi.Srivatsavai@Sun.COM #endif /* _SYS_SIMNET_IMPL_H */
100