xref: /titanic_41/usr/src/uts/common/io/simnet/simnet_impl.h (revision 2b24ab6b3865caeede9eeb9db6b83e1d89dcd1ea)
1b509e89bSRishi Srivatsavai /*
2b509e89bSRishi Srivatsavai  * CDDL HEADER START
3b509e89bSRishi Srivatsavai  *
4b509e89bSRishi Srivatsavai  * The contents of this file are subject to the terms of the
5b509e89bSRishi Srivatsavai  * Common Development and Distribution License (the "License").
6b509e89bSRishi Srivatsavai  * You may not use this file except in compliance with the License.
7b509e89bSRishi Srivatsavai  *
8b509e89bSRishi Srivatsavai  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9b509e89bSRishi Srivatsavai  * or http://www.opensolaris.org/os/licensing.
10b509e89bSRishi Srivatsavai  * See the License for the specific language governing permissions
11b509e89bSRishi Srivatsavai  * and limitations under the License.
12b509e89bSRishi Srivatsavai  *
13b509e89bSRishi Srivatsavai  * When distributing Covered Code, include this CDDL HEADER in each
14b509e89bSRishi Srivatsavai  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15b509e89bSRishi Srivatsavai  * If applicable, add the following below this CDDL HEADER, with the
16b509e89bSRishi Srivatsavai  * fields enclosed by brackets "[]" replaced with your own identifying
17b509e89bSRishi Srivatsavai  * information: Portions Copyright [yyyy] [name of copyright owner]
18b509e89bSRishi Srivatsavai  *
19b509e89bSRishi Srivatsavai  * CDDL HEADER END
20b509e89bSRishi Srivatsavai  */
21b509e89bSRishi Srivatsavai /*
22b509e89bSRishi Srivatsavai  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23b509e89bSRishi Srivatsavai  * Use is subject to license terms.
24b509e89bSRishi Srivatsavai  */
25b509e89bSRishi Srivatsavai 
26b509e89bSRishi Srivatsavai #ifndef	_SYS_SIMNET_IMPL_H
27b509e89bSRishi Srivatsavai #define	_SYS_SIMNET_IMPL_H
28b509e89bSRishi Srivatsavai 
29*2b24ab6bSSebastien Roy #include <sys/types.h>
30b509e89bSRishi Srivatsavai #include <sys/list.h>
31b509e89bSRishi Srivatsavai #include <sys/mutex.h>
32b509e89bSRishi Srivatsavai #include <sys/mac.h>
33b509e89bSRishi Srivatsavai #include <sys/net80211.h>
34b509e89bSRishi Srivatsavai #include <inet/wifi_ioctl.h>
35b509e89bSRishi Srivatsavai 
36b509e89bSRishi Srivatsavai #ifdef	__cplusplus
37b509e89bSRishi Srivatsavai extern "C" {
38b509e89bSRishi Srivatsavai #endif
39b509e89bSRishi Srivatsavai 
40b509e89bSRishi Srivatsavai #define	MAX_SIMNET_ESSCONF	25	/* Max num of WiFi scan results */
41b509e89bSRishi Srivatsavai #define	MAX_ESSLIST_ARGS	10	/* Max num of ESS list arguments */
42b509e89bSRishi Srivatsavai #define	MAX_ESSLIST_ARGLEN	50	/* Max ESS list argument len */
43b509e89bSRishi Srivatsavai 
44b509e89bSRishi Srivatsavai struct simnet_dev;
45b509e89bSRishi Srivatsavai 
46b509e89bSRishi Srivatsavai typedef struct simnet_wifidev {
47b509e89bSRishi Srivatsavai 	struct simnet_dev	*swd_sdev;
48b509e89bSRishi Srivatsavai 	wl_essid_t		swd_essid;
49b509e89bSRishi Srivatsavai 	wl_bssid_t		swd_bssid;
50b509e89bSRishi Srivatsavai 	wl_rssi_t		swd_rssi; /* signal strength */
51b509e89bSRishi Srivatsavai 	wl_linkstatus_t		swd_linkstatus;
52b509e89bSRishi Srivatsavai 	int			swd_esslist_num;
53b509e89bSRishi Srivatsavai 	wl_ess_conf_t		*swd_esslist[MAX_SIMNET_ESSCONF];
54b509e89bSRishi Srivatsavai } simnet_wifidev_t;
55b509e89bSRishi Srivatsavai 
56b509e89bSRishi Srivatsavai typedef struct simnet_stats {
57b509e89bSRishi Srivatsavai 	uint64_t		rbytes;
58b509e89bSRishi Srivatsavai 	uint64_t		obytes;
59b509e89bSRishi Srivatsavai 	uint64_t		xmit_errors;
60b509e89bSRishi Srivatsavai 	uint64_t		xmit_count;
61b509e89bSRishi Srivatsavai 	uint64_t		recv_count;
62b509e89bSRishi Srivatsavai 	uint64_t		recv_errors;
63b509e89bSRishi Srivatsavai } simnet_stats_t;
64b509e89bSRishi Srivatsavai 
65b509e89bSRishi Srivatsavai typedef struct simnet_dev {
66b509e89bSRishi Srivatsavai 	list_node_t		sd_listnode;
67b509e89bSRishi Srivatsavai 	uint_t			sd_type;	/* WiFi, Ethernet etc. */
68b509e89bSRishi Srivatsavai 	datalink_id_t		sd_link_id;
69*2b24ab6bSSebastien Roy 	zoneid_t		sd_zoneid;	/* zone where created */
70b509e89bSRishi Srivatsavai 	struct simnet_dev	*sd_peer_dev;	/* Attached peer, if any */
71b509e89bSRishi Srivatsavai 	uint_t			sd_flags;	/* Device flags SDF_* */
72b509e89bSRishi Srivatsavai 	uint_t			sd_refcount;
73b509e89bSRishi Srivatsavai 	/* Num of active threads using the device */
74b509e89bSRishi Srivatsavai 	uint_t			sd_threadcount;
75b509e89bSRishi Srivatsavai 	kcondvar_t		sd_threadwait;
76b509e89bSRishi Srivatsavai 	mac_handle_t		sd_mh;
77b509e89bSRishi Srivatsavai 	simnet_wifidev_t	*sd_wifidev;
78b509e89bSRishi Srivatsavai 	boolean_t		sd_promisc;
79b509e89bSRishi Srivatsavai 	kmutex_t		sd_instlock;
80b509e89bSRishi Srivatsavai 	/* Num of multicast addresses stored in sd_mcastaddrs */
81b509e89bSRishi Srivatsavai 	uint_t			sd_mcastaddr_count;
82b509e89bSRishi Srivatsavai 	/* Multicast address list stored in single buffer */
83b509e89bSRishi Srivatsavai 	uint8_t			*sd_mcastaddrs;
84b509e89bSRishi Srivatsavai 	uint_t			sd_mac_len;
85b509e89bSRishi Srivatsavai 	uchar_t			sd_mac_addr[MAXMACADDRLEN];
86b509e89bSRishi Srivatsavai 	simnet_stats_t		sd_stats;
87b509e89bSRishi Srivatsavai } simnet_dev_t;
88b509e89bSRishi Srivatsavai 
89b509e89bSRishi Srivatsavai /* Simnet device flags */
90b509e89bSRishi Srivatsavai #define	SDF_SHUTDOWN	0x00000001	/* Device shutdown, no new ops */
91b509e89bSRishi Srivatsavai #define	SDF_STARTED	0x00000002	/* Device started, allow ops */
92b509e89bSRishi Srivatsavai 
93b509e89bSRishi Srivatsavai #define	SIMNET_MAX_MTU	9000		/* Max MTU supported by simnet driver */
94b509e89bSRishi Srivatsavai 
95b509e89bSRishi Srivatsavai #ifdef	__cplusplus
96b509e89bSRishi Srivatsavai }
97b509e89bSRishi Srivatsavai #endif
98b509e89bSRishi Srivatsavai 
99b509e89bSRishi Srivatsavai #endif /* _SYS_SIMNET_IMPL_H */
100