• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Linux Wireless Extensions support
3  *
4  * Copyright (C) 1999-2009, Broadcom Corporation
5  *
6  *      Unless you and Broadcom execute a separate written software license
7  * agreement governing use of this software, this software is licensed to you
8  * under the terms of the GNU General Public License version 2 (the "GPL"),
9  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10  * following added to such license:
11  *
12  *      As a special exception, the copyright holders of this software give you
13  * permission to link this software with independent modules, and to copy and
14  * distribute the resulting executable under terms of your choice, provided that
15  * you also meet, for each linked independent module, the terms and conditions of
16  * the license of that module.  An independent module is a module which is not
17  * derived from this software.  The special exception does not apply to any
18  * modifications of the software.
19  *
20  *      Notwithstanding the above, under no circumstances may you combine this
21  * software in any way with any other Broadcom software provided under a license
22  * other than the GPL, without Broadcom's express prior written consent.
23  *
24  * $Id: wl_iw.h,v 1.5.34.1.6.9 2009/10/14 04:27:31 Exp $
25  */
26 
27 
28 #ifndef _wl_iw_h_
29 #define _wl_iw_h_
30 
31 #include <linux/wireless.h>
32 
33 #include <typedefs.h>
34 #include <proto/ethernet.h>
35 #include <wlioctl.h>
36 
37 
38 #define	WL_IW_RSSI_MINVAL		-200
39 #define	WL_IW_RSSI_NO_SIGNAL	-91
40 #define	WL_IW_RSSI_VERY_LOW	-80
41 #define	WL_IW_RSSI_LOW		-70
42 #define	WL_IW_RSSI_GOOD		-68
43 #define	WL_IW_RSSI_VERY_GOOD	-58
44 #define	WL_IW_RSSI_EXCELLENT	-57
45 #define	WL_IW_RSSI_INVALID	 0
46 #define MAX_WX_STRING 80
47 #define isprint(c) bcm_isprint(c)
48 #define WL_IW_SET_ACTIVE_SCAN	(SIOCIWFIRSTPRIV+1)
49 #define WL_IW_GET_RSSI			(SIOCIWFIRSTPRIV+3)
50 #define WL_IW_SET_PASSIVE_SCAN	(SIOCIWFIRSTPRIV+5)
51 #define WL_IW_GET_LINK_SPEED	(SIOCIWFIRSTPRIV+7)
52 #define WL_IW_GET_CURR_MACADDR	(SIOCIWFIRSTPRIV+9)
53 #define WL_IW_SET_STOP				(SIOCIWFIRSTPRIV+11)
54 #define WL_IW_SET_START			(SIOCIWFIRSTPRIV+13)
55 
56 #define 		G_SCAN_RESULTS 8*1024
57 #define 		WE_ADD_EVENT_FIX	0x80
58 #define          G_WLAN_SET_ON	0
59 #define          G_WLAN_SET_OFF	1
60 
61 
62 typedef struct wl_iw {
63 	char nickname[IW_ESSID_MAX_SIZE];
64 
65 	struct iw_statistics wstats;
66 
67 	int spy_num;
68 	uint32 pwsec;
69 	uint32 gwsec;
70 
71 	struct ether_addr spy_addr[IW_MAX_SPY];
72 	struct iw_quality spy_qual[IW_MAX_SPY];
73 	void  *wlinfo;
74 	dhd_pub_t * pub;
75 } wl_iw_t;
76 
77 struct wl_ctrl {
78 	struct timer_list *timer;
79 	struct net_device *dev;
80 	long sysioc_pid;
81 	struct semaphore timer_sem;
82 	struct completion sysioc_exited;
83 };
84 
85 #define WLC_IW_SS_CACHE_MAXLEN				512
86 #define WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN	32
87 #define WLC_IW_BSS_INFO_MAXLEN 				\
88 	(WLC_IW_SS_CACHE_MAXLEN - WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN)
89 
90 typedef struct wl_iw_ss_cache{
91 	uint32 buflen;
92 	uint32 version;
93 	uint32 count;
94 	wl_bss_info_t bss_info[1];
95 	char dummy[WLC_IW_BSS_INFO_MAXLEN - sizeof(wl_bss_info_t)];
96 	int dirty;
97 	struct wl_iw_ss_cache *next;
98 } wl_iw_ss_cache_t;
99 
100 typedef struct wl_iw_ss_cache_ctrl {
101 	wl_iw_ss_cache_t *m_cache_head;
102 	int m_link_down;
103 	int m_timer_expired;
104 	char m_active_bssid[ETHER_ADDR_LEN];
105 	uint m_prev_scan_mode;
106 	uint m_cons_br_scan_cnt;
107 	struct timer_list *m_timer;
108 } wl_iw_ss_cache_ctrl_t;
109 
110 
111 #if WIRELESS_EXT > 12
112 #include <net/iw_handler.h>
113 extern const struct iw_handler_def wl_iw_handler_def;
114 #endif
115 
116 extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
117 extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data);
118 extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats);
119 int wl_iw_attach(struct net_device *dev, void * dhdp);
120 void wl_iw_detach(void);
121 int wl_control_wl_start(struct net_device *dev);
122 
123 extern int net_os_wake_lock(struct net_device *dev);
124 extern int net_os_wake_unlock(struct net_device *dev);
125 extern int net_os_wake_lock_timeout(struct net_device *dev);
126 extern int net_os_wake_lock_timeout_enable(struct net_device *dev);
127 
128 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
129 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
130 	iwe_stream_add_event(info, stream, ends, iwe, extra)
131 #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
132 	iwe_stream_add_value(info, event, value, ends, iwe, event_len)
133 #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
134 	iwe_stream_add_point(info, stream, ends, iwe, extra)
135 #else
136 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
137 	iwe_stream_add_event(stream, ends, iwe, extra)
138 #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
139 	iwe_stream_add_value(event, value, ends, iwe, event_len)
140 #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
141 	iwe_stream_add_point(stream, ends, iwe, extra)
142 #endif
143 
144 #endif
145