PageRenderTime 54ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/bcm4329/wl_iw.h

https://github.com/getitnowmarketing/htc-kernel-msm7x30
C Header | 302 lines | 233 code | 44 blank | 25 comment | 1 complexity | f986b26a127bf95ee841a67b24347ee4 MD5 | raw file
  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.36.4.18 2011/02/10 19:33:12 Exp $
  25. */
  26. #ifndef _wl_iw_h_
  27. #define _wl_iw_h_
  28. #include <linux/wireless.h>
  29. #include <typedefs.h>
  30. #include <proto/ethernet.h>
  31. #include <wlioctl.h>
  32. #define WL_SCAN_PARAMS_SSID_MAX 10
  33. #define GET_SSID "SSID="
  34. #define GET_CHANNEL "CH="
  35. #define GET_NPROBE "NPROBE="
  36. #define GET_ACTIVE_ASSOC_DWELL "ACTIVE="
  37. #define GET_PASSIVE_ASSOC_DWELL "PASSIVE="
  38. #define GET_HOME_DWELL "HOME="
  39. #define GET_SCAN_TYPE "TYPE="
  40. #define BAND_GET_CMD "GETBAND"
  41. #define BAND_SET_CMD "SETBAND"
  42. #define DTIM_SKIP_GET_CMD "DTIMSKIPGET"
  43. #define DTIM_SKIP_SET_CMD "DTIMSKIPSET"
  44. #define SETSUSPEND_CMD "SETSUSPENDOPT"
  45. #define PNOSSIDCLR_SET_CMD "PNOSSIDCLR"
  46. #define PNOSETUP_SET_CMD "PNOSETUP "
  47. #define PNOENABLE_SET_CMD "PNOFORCE"
  48. #define PNODEBUG_SET_CMD "PNODEBUG"
  49. #define TXPOWER_SET_CMD "TXPOWER"
  50. #define RXFILTER_START_CMD "RXFILTER-START"
  51. #define RXFILTER_STOP_CMD "RXFILTER-STOP"
  52. #define RXFILTER_ADD_CMD "RXFILTER-ADD"
  53. #define RXFILTER_REMOVE_CMD "RXFILTER-REMOVE"
  54. #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
  55. #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
  56. typedef struct wl_iw_extra_params {
  57. int target_channel;
  58. } wl_iw_extra_params_t;
  59. #define WL_IW_RSSI_MINVAL -200
  60. #define WL_IW_RSSI_NO_SIGNAL -91
  61. #define WL_IW_RSSI_VERY_LOW -80
  62. #define WL_IW_RSSI_LOW -70
  63. #define WL_IW_RSSI_GOOD -68
  64. #define WL_IW_RSSI_VERY_GOOD -58
  65. #define WL_IW_RSSI_EXCELLENT -57
  66. #define WL_IW_RSSI_INVALID 0
  67. #define MAX_WX_STRING 80
  68. #define isprint(c) bcm_isprint(c)
  69. #define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1)
  70. #define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3)
  71. #define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5)
  72. #define WL_IW_GET_LINK_SPEED (SIOCIWFIRSTPRIV+7)
  73. #define WL_IW_GET_CURR_MACADDR (SIOCIWFIRSTPRIV+9)
  74. #define WL_IW_SET_STOP (SIOCIWFIRSTPRIV+11)
  75. #define WL_IW_SET_START (SIOCIWFIRSTPRIV+13)
  76. #define WL_SET_AP_CFG (SIOCIWFIRSTPRIV+15)
  77. #define WL_AP_STA_LIST (SIOCIWFIRSTPRIV+17)
  78. #define WL_AP_MAC_FLTR (SIOCIWFIRSTPRIV+19)
  79. #define WL_AP_BSS_START (SIOCIWFIRSTPRIV+21)
  80. #define AP_LPB_CMD (SIOCIWFIRSTPRIV+23)
  81. #define WL_AP_STOP (SIOCIWFIRSTPRIV+25)
  82. #define WL_FW_RELOAD (SIOCIWFIRSTPRIV+27)
  83. #define WL_AP_STA_DISASSOC (SIOCIWFIRSTPRIV+29)
  84. #define WL_COMBO_SCAN (SIOCIWFIRSTPRIV+31)
  85. #define G_SCAN_RESULTS (8*1024)
  86. #define WE_ADD_EVENT_FIX 0x80
  87. #define G_WLAN_SET_ON 0
  88. #define G_WLAN_SET_OFF 1
  89. #define CHECK_EXTRA_FOR_NULL(extra) \
  90. if (!extra) { \
  91. WL_ERROR(("%s: error : extra is null pointer\n", __FUNCTION__)); \
  92. return -EINVAL; \
  93. }
  94. typedef struct wl_iw {
  95. char nickname[IW_ESSID_MAX_SIZE];
  96. struct iw_statistics wstats;
  97. int spy_num;
  98. uint32 pwsec;
  99. uint32 gwsec;
  100. bool privacy_invoked;
  101. struct ether_addr spy_addr[IW_MAX_SPY];
  102. struct iw_quality spy_qual[IW_MAX_SPY];
  103. void *wlinfo;
  104. dhd_pub_t * pub;
  105. } wl_iw_t;
  106. #define WLC_IW_SS_CACHE_MAXLEN 2048
  107. #define WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN 32
  108. #define WLC_IW_BSS_INFO_MAXLEN \
  109. (WLC_IW_SS_CACHE_MAXLEN - WLC_IW_SS_CACHE_CTRL_FIELD_MAXLEN)
  110. typedef struct wl_iw_ss_cache {
  111. struct wl_iw_ss_cache *next;
  112. int dirty;
  113. uint32 buflen;
  114. uint32 version;
  115. uint32 count;
  116. wl_bss_info_t bss_info[1];
  117. } wl_iw_ss_cache_t;
  118. typedef struct wl_iw_ss_cache_ctrl {
  119. wl_iw_ss_cache_t *m_cache_head;
  120. int m_link_down;
  121. int m_timer_expired;
  122. char m_active_bssid[ETHER_ADDR_LEN];
  123. uint m_prev_scan_mode;
  124. uint m_cons_br_scan_cnt;
  125. struct timer_list *m_timer;
  126. } wl_iw_ss_cache_ctrl_t;
  127. typedef enum broadcast_first_scan {
  128. BROADCAST_SCAN_FIRST_IDLE = 0,
  129. BROADCAST_SCAN_FIRST_STARTED,
  130. BROADCAST_SCAN_FIRST_RESULT_READY,
  131. BROADCAST_SCAN_FIRST_RESULT_CONSUMED
  132. } broadcast_first_scan_t;
  133. #ifdef SOFTAP
  134. #define SSID_LEN 33
  135. #define SEC_LEN 16
  136. #define KEY_LEN 65
  137. #define PROFILE_OFFSET 32
  138. struct ap_profile {
  139. uint8 ssid[SSID_LEN];
  140. uint8 sec[SEC_LEN];
  141. uint8 key[KEY_LEN];
  142. uint32 channel;
  143. uint32 preamble;
  144. uint32 max_scb;
  145. uint32 closednet;
  146. char country_code[WLC_CNTRY_BUF_SZ];
  147. };
  148. #define MACLIST_MODE_DISABLED 0
  149. #define MACLIST_MODE_DENY 1
  150. #define MACLIST_MODE_ALLOW 2
  151. struct mflist {
  152. uint count;
  153. struct ether_addr ea[16];
  154. };
  155. struct mac_list_set {
  156. uint32 mode;
  157. struct mflist mac_list;
  158. };
  159. #endif
  160. #if WIRELESS_EXT > 12
  161. #include <net/iw_handler.h>
  162. extern const struct iw_handler_def wl_iw_handler_def;
  163. #endif
  164. extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
  165. extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data);
  166. extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats);
  167. int wl_iw_attach(struct net_device *dev, void * dhdp);
  168. void wl_iw_detach(void);
  169. int wl_control_wl_start(struct net_device *dev);
  170. extern int net_os_wake_lock(struct net_device *dev);
  171. extern int net_os_wake_unlock(struct net_device *dev);
  172. extern int net_os_wake_lock_timeout(struct net_device *dev);
  173. extern int net_os_wake_lock_timeout_enable(struct net_device *dev);
  174. extern int net_os_set_suspend_disable(struct net_device *dev, int val);
  175. extern int net_os_set_suspend(struct net_device *dev, int val);
  176. extern int net_os_set_dtim_skip(struct net_device *dev, int val);
  177. extern void dhd_bus_country_set(struct net_device *dev, char *country_code);
  178. extern char *dhd_bus_country_get(struct net_device *dev);
  179. extern int dhd_get_dtim_skip(dhd_pub_t *dhd);
  180. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
  181. #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
  182. iwe_stream_add_event(info, stream, ends, iwe, extra)
  183. #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
  184. iwe_stream_add_value(info, event, value, ends, iwe, event_len)
  185. #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
  186. iwe_stream_add_point(info, stream, ends, iwe, extra)
  187. #else
  188. #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
  189. iwe_stream_add_event(stream, ends, iwe, extra)
  190. #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
  191. iwe_stream_add_value(event, value, ends, iwe, event_len)
  192. #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
  193. iwe_stream_add_point(stream, ends, iwe, extra)
  194. #endif
  195. extern int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled);
  196. extern int dhd_pno_clean(dhd_pub_t *dhd);
  197. extern int dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t* ssids_local, int nssid, \
  198. ushort scan_fr, int pno_repeat, int pno_freq_expo_max);
  199. extern int dhd_pno_get_status(dhd_pub_t *dhd);
  200. extern int dhd_dev_pno_reset(struct net_device *dev);
  201. extern int dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t* ssids_local, \
  202. int nssid, ushort scan_fr, int pno_repeat, int pno_freq_expo_max);
  203. extern int dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled);
  204. extern int dhd_dev_get_pno_status(struct net_device *dev);
  205. #define PNO_TLV_PREFIX 'S'
  206. #define PNO_TLV_VERSION '1'
  207. #define PNO_TLV_SUBVERSION '2'
  208. #define PNO_TLV_RESERVED '0'
  209. #define PNO_TLV_TYPE_SSID_IE 'S'
  210. #define PNO_TLV_TYPE_TIME 'T'
  211. #define PNO_TLV_FREQ_REPEAT 'R'
  212. #define PNO_TLV_FREQ_EXPO_MAX 'M'
  213. #define PNO_EVENT_UP "PNO_EVENT"
  214. typedef struct cmd_tlv {
  215. char prefix;
  216. char version;
  217. char subver;
  218. char reserved;
  219. } cmd_tlv_t;
  220. #ifdef SOFTAP_TLV_CFG
  221. #define SOFTAP_SET_CMD "SOFTAPSET "
  222. #define SOFTAP_TLV_PREFIX 'A'
  223. #define SOFTAP_TLV_VERSION '1'
  224. #define SOFTAP_TLV_SUBVERSION '0'
  225. #define SOFTAP_TLV_RESERVED '0'
  226. #define TLV_TYPE_SSID 'S'
  227. #define TLV_TYPE_SECUR 'E'
  228. #define TLV_TYPE_KEY 'K'
  229. #define TLV_TYPE_CHANNEL 'C'
  230. #endif
  231. #if defined(CSCAN)
  232. typedef struct cscan_tlv {
  233. char prefix;
  234. char version;
  235. char subver;
  236. char reserved;
  237. } cscan_tlv_t;
  238. #define CSCAN_COMMAND "CSCAN "
  239. #define CSCAN_TLV_PREFIX 'S'
  240. #define CSCAN_TLV_VERSION 1
  241. #define CSCAN_TLV_SUBVERSION 0
  242. #define CSCAN_TLV_TYPE_SSID_IE 'S'
  243. #define CSCAN_TLV_TYPE_CHANNEL_IE 'C'
  244. #define CSCAN_TLV_TYPE_NPROBE_IE 'N'
  245. #define CSCAN_TLV_TYPE_ACTIVE_IE 'A'
  246. #define CSCAN_TLV_TYPE_PASSIVE_IE 'P'
  247. #define CSCAN_TLV_TYPE_HOME_IE 'H'
  248. #define CSCAN_TLV_TYPE_STYPE_IE 'T'
  249. extern int wl_iw_parse_channel_list_tlv(char** list_str, uint16* channel_list, \
  250. int channel_num, int *bytes_left);
  251. extern int wl_iw_parse_data_tlv(char** list_str, void *dst, int dst_size, \
  252. const char token, int input_size, int *bytes_left);
  253. extern int wl_iw_parse_ssid_list_tlv(char** list_str, wlc_ssid_t* ssid, \
  254. int max, int *bytes_left);
  255. extern int wl_iw_parse_ssid_list(char** list_str, wlc_ssid_t* ssid, int idx, int max);
  256. extern int wl_iw_parse_channel_list(char** list_str, uint16* channel_list, int channel_num);
  257. #endif
  258. #endif