PageRenderTime 24ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/net/wireless/bcmdhd/wl_iw.h

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