Home | History | Annotate | Download | only in sys
      1 /*
      2  * Linux Wireless Extensions support
      3  *
      4  * Copyright (C) 1999-2010, 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.16 2010/04/19 21:32:10 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 
     57 #define WL_SET_AP_CFG           (SIOCIWFIRSTPRIV+15)
     58 #define WL_AP_STA_LIST          (SIOCIWFIRSTPRIV+17)
     59 #define WL_AP_MAC_FLTR	        (SIOCIWFIRSTPRIV+19)
     60 #define WL_AP_BSS_START         (SIOCIWFIRSTPRIV+21)
     61 #define AP_LPB_CMD              (SIOCIWFIRSTPRIV+23)
     62 #define WL_AP_STOP              (SIOCIWFIRSTPRIV+25)
     63 #define WL_FW_RELOAD            (SIOCIWFIRSTPRIV+27)
     64 #define WL_AP_SPARE2            (SIOCIWFIRSTPRIV+29)
     65 #define WL_AP_SPARE3            (SIOCIWFIRSTPRIV+31)
     66 #define G_SCAN_RESULTS		(8*1024)
     67 #define WE_ADD_EVENT_FIX	0x80
     68 #define G_WLAN_SET_ON		0
     69 #define G_WLAN_SET_OFF		1
     70 
     71 #define CHECK_EXTRA_FOR_NULL(extra) \
     72 if (!extra) { \
     73 	WL_ERROR(("%s: error : extra is null pointer\n", __FUNCTION__)); \
     74 	return -EINVAL; \
     75 }
     76 
     77 typedef struct wl_iw {
     78 	char nickname[IW_ESSID_MAX_SIZE];
     79 
     80 	struct iw_statistics wstats;
     81 
     82 	int spy_num;
     83 	uint32 pwsec;
     84 	uint32 gwsec;
     85 	bool privacy_invoked;
     86 
     87 	struct ether_addr spy_addr[IW_MAX_SPY];
     88 	struct iw_quality spy_qual[IW_MAX_SPY];
     89 	void  *wlinfo;
     90 	dhd_pub_t * pub;
     91 } wl_iw_t;
     92 
     93 #define WLC_IW_SS_CACHE_MAXLEN				512
     94 #define WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN	32
     95 #define WLC_IW_BSS_INFO_MAXLEN 				\
     96 	(WLC_IW_SS_CACHE_MAXLEN - WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN)
     97 
     98 typedef struct wl_iw_ss_cache{
     99 	uint32 buflen;
    100 	uint32 version;
    101 	uint32 count;
    102 	wl_bss_info_t bss_info[1];
    103 	char dummy[WLC_IW_BSS_INFO_MAXLEN - sizeof(wl_bss_info_t)];
    104 	int dirty;
    105 	struct wl_iw_ss_cache *next;
    106 } wl_iw_ss_cache_t;
    107 
    108 typedef struct wl_iw_ss_cache_ctrl {
    109 	wl_iw_ss_cache_t *m_cache_head;
    110 	int m_link_down;
    111 	int m_timer_expired;
    112 	char m_active_bssid[ETHER_ADDR_LEN];
    113 	uint m_prev_scan_mode;
    114 	uint m_cons_br_scan_cnt;
    115 	struct timer_list *m_timer;
    116 } wl_iw_ss_cache_ctrl_t;
    117 typedef enum broadcast_first_scan {
    118 	BROADCAST_SCAN_FIRST_IDLE = 0,
    119 	BROADCAST_SCAN_FIRST_STARTED,
    120 	BROADCAST_SCAN_FIRST_RESULT_READY,
    121 	BROADCAST_SCAN_FIRST_RESULT_CONSUMED
    122 } broadcast_first_scan_t;
    123 #ifdef SOFTAP
    124 #define SSID_LEN	33
    125 #define SEC_LEN		16
    126 #define KEY_LEN		65
    127 #define PROFILE_OFFSET	32
    128 struct ap_profile {
    129 	uint8	ssid[SSID_LEN];
    130 	uint8	sec[SEC_LEN];
    131 	uint8	key[KEY_LEN];
    132 	uint32	channel;
    133 	uint32	preamble;
    134 	uint32	max_scb;
    135 };
    136 
    137 
    138 #define MACLIST_MODE_DISABLED	0
    139 #define MACLIST_MODE_ENABLED	1
    140 #define MACLIST_MODE_ALLOW	2
    141 struct mflist {
    142 	uint count;
    143 	struct ether_addr ea[16];
    144 };
    145 
    146 struct mac_list_set {
    147 	uint32	mode;
    148 	struct mflist white_list;
    149 	struct mflist black_list;
    150 };
    151 #endif
    152 
    153 #if WIRELESS_EXT > 12
    154 #include <net/iw_handler.h>
    155 extern const struct iw_handler_def wl_iw_handler_def;
    156 #endif
    157 
    158 extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
    159 extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data);
    160 extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats);
    161 int wl_iw_attach(struct net_device *dev, void * dhdp);
    162 void wl_iw_detach(void);
    163 int wl_control_wl_start(struct net_device *dev);
    164 
    165 extern int net_os_wake_lock(struct net_device *dev);
    166 extern int net_os_wake_unlock(struct net_device *dev);
    167 extern int net_os_wake_lock_timeout(struct net_device *dev);
    168 extern int net_os_wake_lock_timeout_enable(struct net_device *dev);
    169 
    170 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
    171 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
    172 	iwe_stream_add_event(info, stream, ends, iwe, extra)
    173 #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
    174 	iwe_stream_add_value(info, event, value, ends, iwe, event_len)
    175 #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
    176 	iwe_stream_add_point(info, stream, ends, iwe, extra)
    177 #else
    178 #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
    179 	iwe_stream_add_event(stream, ends, iwe, extra)
    180 #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
    181 	iwe_stream_add_value(event, value, ends, iwe, event_len)
    182 #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
    183 	iwe_stream_add_point(stream, ends, iwe, extra)
    184 #endif
    185 
    186 #endif
    187