PageRenderTime 38ms CodeModel.GetById 28ms app.highlight 7ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/bcmdhd_29/wl_iw.h

https://bitbucket.org/cyanogenmod/android_kernel_asus_tf300t
C Header | 319 lines | 241 code | 53 blank | 25 comment | 1 complexity | 831c806f951da3d43d1c1a40671d4500 MD5 | raw file
Possible License(s): LGPL-2.0, AGPL-1.0, GPL-2.0
  1/*
  2 * Linux Wireless Extensions support
  3 *
  4 * Copyright (C) 1999-2011, 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.15.80.6 2010-12-23 01:13:23 $
 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#define WL_SCAN_PARAMS_SSID_MAX 	10
 38#define GET_SSID			"SSID="
 39#define GET_CHANNEL			"CH="
 40#define GET_NPROBE 			"NPROBE="
 41#define GET_ACTIVE_ASSOC_DWELL  	"ACTIVE="
 42#define GET_PASSIVE_ASSOC_DWELL  	"PASSIVE="
 43#define GET_HOME_DWELL  		"HOME="
 44#define GET_SCAN_TYPE			"TYPE="
 45
 46#define BAND_GET_CMD				"GETBAND"
 47#define BAND_SET_CMD				"SETBAND"
 48#define DTIM_SKIP_GET_CMD			"DTIMSKIPGET"
 49#define DTIM_SKIP_SET_CMD			"DTIMSKIPSET"
 50#define SETSUSPENDOPT_CMD			"SETSUSPENDOPT"
 51#define SETSUSPENDMODE_CMD			"SETSUSPENDMODE"
 52#define PNOSSIDCLR_SET_CMD			"PNOSSIDCLR"
 53
 54#define PNOSETUP_SET_CMD			"PNOSETUP " 
 55#define PNOSETADD_SET_CMD			"PNOSETADD"
 56#define PNOENABLE_SET_CMD			"PNOFORCE"
 57#define PNODEBUG_SET_CMD			"PNODEBUG"
 58#define TXPOWER_SET_CMD				"TXPOWER"
 59
 60#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
 61#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
 62
 63
 64typedef struct wl_iw_extra_params {
 65	int 	target_channel; 
 66} wl_iw_extra_params_t;
 67
 68struct cntry_locales_custom {
 69	char iso_abbrev[WLC_CNTRY_BUF_SZ];	
 70	char custom_locale[WLC_CNTRY_BUF_SZ];	
 71	int32 custom_locale_rev;		
 72};
 73
 74
 75#define	WL_IW_RSSI_MINVAL		-200	
 76#define	WL_IW_RSSI_NO_SIGNAL	-91	
 77#define	WL_IW_RSSI_VERY_LOW	-80	
 78#define	WL_IW_RSSI_LOW		-70	
 79#define	WL_IW_RSSI_GOOD		-68	
 80#define	WL_IW_RSSI_VERY_GOOD	-58	
 81#define	WL_IW_RSSI_EXCELLENT	-57	
 82#define	WL_IW_RSSI_INVALID	 0	
 83#define MAX_WX_STRING 80
 84#define isprint(c) bcm_isprint(c)
 85#define WL_IW_SET_ACTIVE_SCAN	(SIOCIWFIRSTPRIV+1)
 86#define WL_IW_GET_RSSI			(SIOCIWFIRSTPRIV+3)
 87#define WL_IW_SET_PASSIVE_SCAN	(SIOCIWFIRSTPRIV+5)
 88#define WL_IW_GET_LINK_SPEED	(SIOCIWFIRSTPRIV+7)
 89#define WL_IW_GET_CURR_MACADDR	(SIOCIWFIRSTPRIV+9)
 90#define WL_IW_SET_STOP				(SIOCIWFIRSTPRIV+11)
 91#define WL_IW_SET_START			(SIOCIWFIRSTPRIV+13)
 92
 93
 94#define WL_SET_AP_CFG           (SIOCIWFIRSTPRIV+15)
 95#define WL_AP_STA_LIST          (SIOCIWFIRSTPRIV+17)
 96#define WL_AP_MAC_FLTR	        (SIOCIWFIRSTPRIV+19)
 97#define WL_AP_BSS_START         (SIOCIWFIRSTPRIV+21)
 98#define AP_LPB_CMD              (SIOCIWFIRSTPRIV+23)
 99#define WL_AP_STOP              (SIOCIWFIRSTPRIV+25)
100#define WL_FW_RELOAD            (SIOCIWFIRSTPRIV+27)
101#define WL_AP_STA_DISASSOC		(SIOCIWFIRSTPRIV+29)
102#define WL_COMBO_SCAN           (SIOCIWFIRSTPRIV+31)
103
104
105#define			G_SCAN_RESULTS 8*1024
106#define 		WE_ADD_EVENT_FIX	0x80
107#define          G_WLAN_SET_ON	0
108#define          G_WLAN_SET_OFF	1
109
110#define CHECK_EXTRA_FOR_NULL(extra) \
111if (!extra) { \
112	WL_ERROR(("%s: error : extra is null pointer\n", __FUNCTION__)); \
113	return -EINVAL; \
114}
115
116typedef struct wl_iw {
117	char nickname[IW_ESSID_MAX_SIZE];
118
119	struct iw_statistics wstats;
120
121	int spy_num;
122	int wpaversion;			
123	int pcipher;			
124	int gcipher;			
125	int privacy_invoked; 		
126
127	struct ether_addr spy_addr[IW_MAX_SPY];
128	struct iw_quality spy_qual[IW_MAX_SPY];
129	void  *wlinfo;
130	dhd_pub_t * pub;
131} wl_iw_t;
132
133int	 wl_control_wl_start(struct net_device *dev);
134#define WLC_IW_SS_CACHE_MAXLEN				2048
135#define WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN	32
136#define WLC_IW_BSS_INFO_MAXLEN 				\
137	(WLC_IW_SS_CACHE_MAXLEN - WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN)
138
139typedef struct wl_iw_ss_cache {
140	struct wl_iw_ss_cache *next;
141	int dirty;
142	uint32 buflen;
143	uint32 version;
144	uint32 count;
145	wl_bss_info_t bss_info[1];
146} wl_iw_ss_cache_t;
147
148typedef struct wl_iw_ss_cache_ctrl {
149	wl_iw_ss_cache_t *m_cache_head;	
150	int m_link_down;		
151	int m_timer_expired;		
152	char m_active_bssid[ETHER_ADDR_LEN];	
153	uint m_prev_scan_mode;	
154	uint m_cons_br_scan_cnt;	
155	struct timer_list *m_timer;	
156} wl_iw_ss_cache_ctrl_t;
157
158typedef enum broadcast_first_scan {
159	BROADCAST_SCAN_FIRST_IDLE = 0,
160	BROADCAST_SCAN_FIRST_STARTED,
161	BROADCAST_SCAN_FIRST_RESULT_READY,
162	BROADCAST_SCAN_FIRST_RESULT_CONSUMED
163} broadcast_first_scan_t;
164#ifdef SOFTAP
165#define SSID_LEN	33
166#define SEC_LEN		16
167#define KEY_LEN		65
168#define PROFILE_OFFSET	32
169struct ap_profile {
170	uint8	ssid[SSID_LEN];
171	uint8	sec[SEC_LEN];
172	uint8	key[KEY_LEN];
173	uint32	channel; 
174	uint32	preamble;
175	uint32	max_scb;	
176	uint32  closednet;  
177	char country_code[WLC_CNTRY_BUF_SZ];
178};
179
180
181#define MACLIST_MODE_DISABLED	0
182#define MACLIST_MODE_DENY		1
183#define MACLIST_MODE_ALLOW		2
184struct mflist {
185	uint count;
186	struct ether_addr ea[16];
187};
188struct mac_list_set {
189	uint32	mode;
190	struct mflist mac_list;
191};
192#endif   
193
194#if WIRELESS_EXT > 12
195#include <net/iw_handler.h>
196extern const struct iw_handler_def wl_iw_handler_def;
197#endif 
198
199extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
200extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data);
201extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats);
202int wl_iw_attach(struct net_device *dev, void * dhdp);
203void wl_iw_detach(void);
204
205extern int net_os_wake_lock(struct net_device *dev);
206extern int net_os_wake_unlock(struct net_device *dev);
207extern int net_os_wake_lock_timeout(struct net_device *dev);
208extern int  net_os_wake_lock_ctrl_timeout_enable(struct net_device *dev, int val);
209extern int net_os_set_suspend_disable(struct net_device *dev, int val);
210extern int net_os_set_suspend(struct net_device *dev, int val, int force);
211extern int net_os_set_dtim_skip(struct net_device *dev, int val);
212extern void get_customized_country_code(char *country_iso_code, wl_country_t *cspec);
213
214#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
215#define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
216	iwe_stream_add_event(info, stream, ends, iwe, extra)
217#define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
218	iwe_stream_add_value(info, event, value, ends, iwe, event_len)
219#define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
220	iwe_stream_add_point(info, stream, ends, iwe, extra)
221#else
222#define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
223	iwe_stream_add_event(stream, ends, iwe, extra)
224#define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
225	iwe_stream_add_value(event, value, ends, iwe, event_len)
226#define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
227	iwe_stream_add_point(stream, ends, iwe, extra)
228#endif
229
230extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled);
231extern int dhd_pno_clean(dhd_pub_t *dhd);
232extern int dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid,
233                       ushort  scan_fr, int pno_repeat, int pno_freq_expo_max);
234extern int dhd_pno_get_status(dhd_pub_t *dhd);
235extern int dhd_dev_pno_reset(struct net_device *dev);
236extern int dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t* ssids_local,
237                           int nssid, ushort  scan_fr, int pno_repeat, int pno_freq_expo_max);
238extern int dhd_dev_pno_enable(struct net_device *dev,  int pfn_enabled);
239extern int dhd_dev_get_pno_status(struct net_device *dev);
240extern int dhd_get_dtim_skip(dhd_pub_t *dhd);
241
242void	dhd_bus_country_set(struct net_device *dev, wl_country_t *cspec);
243
244#define PNO_TLV_PREFIX			'S'
245#define PNO_TLV_VERSION			'1'
246#define PNO_TLV_SUBVERSION 		'2'
247#define PNO_TLV_RESERVED		'0'
248#define PNO_TLV_TYPE_SSID_IE		'S'
249#define PNO_TLV_TYPE_TIME		'T'
250#define PNO_TLV_FREQ_REPEAT		'R'
251#define PNO_TLV_FREQ_EXPO_MAX	'M'
252#define  PNO_EVENT_UP			"PNO_EVENT"
253
254typedef struct cmd_tlv {
255	char prefix;
256	char version;
257	char subver;
258	char reserved;
259} cmd_tlv_t;
260
261
262
263
264typedef struct cscan_tlv {
265	char prefix;
266	char version;
267	char subver;
268	char reserved;
269} cscan_tlv_t;
270
271#define CSCAN_COMMAND				"CSCAN "
272#define CSCAN_TLV_PREFIX 			'S'
273#define CSCAN_TLV_VERSION			1
274#define CSCAN_TLV_SUBVERSION			0
275#define CSCAN_TLV_TYPE_SSID_IE          'S'
276#define CSCAN_TLV_TYPE_CHANNEL_IE   'C'
277#define CSCAN_TLV_TYPE_NPROBE_IE     'N'
278#define CSCAN_TLV_TYPE_ACTIVE_IE      'A'
279#define CSCAN_TLV_TYPE_PASSIVE_IE    'P'
280#define CSCAN_TLV_TYPE_HOME_IE         'H'
281#define CSCAN_TLV_TYPE_STYPE_IE        'T'
282
283#ifdef SOFTAP_TLV_CFG
284
285#define SOFTAP_SET_CMD				"SOFTAPSET "
286#define SOFTAP_TLV_PREFIX			'A'
287#define SOFTAP_TLV_VERSION			'1'
288#define SOFTAP_TLV_SUBVERSION		'0'
289#define SOFTAP_TLV_RESERVED		'0'
290
291#define TLV_TYPE_SSID				'S'
292#define TLV_TYPE_SECUR				'E'
293#define TLV_TYPE_KEY				'K'
294#define TLV_TYPE_CHANNEL			'C'
295#endif 
296
297extern int wl_iw_parse_channel_list_tlv(char** list_str, uint16* channel_list,
298	int channel_num, int *bytes_left);
299
300extern int wl_iw_parse_data_tlv(char** list_str, void  *dst, int dst_size,
301                                const char token, int input_size, int *bytes_left);
302
303extern int wl_iw_parse_ssid_list_tlv(char** list_str, wlc_ssid_t* ssid,
304                                     int max, int *bytes_left);
305
306extern int wl_iw_parse_ssid_list(char** list_str, wlc_ssid_t* ssid, int idx, int max);
307
308extern int wl_iw_parse_channel_list(char** list_str, uint16* channel_list, int channel_num);
309
310
311#define NETDEV_PRIV(dev)	(*(wl_iw_t **)netdev_priv(dev))
312
313#ifdef CONFIG_WPS2
314#define WPS_ADD_PROBE_REQ_IE_CMD "ADD_WPS_PROBE_REQ_IE "
315#define WPS_DEL_PROBE_REQ_IE_CMD "DEL_WPS_PROBE_REQ_IE "
316#define WPS_PROBE_REQ_IE_CMD_LENGTH 21
317#endif
318
319#endif