PageRenderTime 27ms CodeModel.GetById 33ms RepoModel.GetById 0ms app.codeStats 0ms

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

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