scan.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /*
  2. * This file is part of wl1271
  3. *
  4. * Copyright (C) 2009-2010 Nokia Corporation
  5. *
  6. * Contact: Luciano Coelho <luciano.coelho@nokia.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * version 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA
  21. *
  22. */
  23. #ifndef __SCAN_H__
  24. #define __SCAN_H__
  25. #include "wl12xx.h"
  26. int wl1271_scan(struct wl1271 *wl, struct ieee80211_vif *vif,
  27. const u8 *ssid, size_t ssid_len,
  28. struct cfg80211_scan_request *req);
  29. int wl1271_scan_stop(struct wl1271 *wl);
  30. int wl1271_scan_build_probe_req(struct wl1271 *wl,
  31. const u8 *ssid, size_t ssid_len,
  32. const u8 *ie, size_t ie_len, u8 band);
  33. void wl1271_scan_stm(struct wl1271 *wl, struct ieee80211_vif *vif);
  34. void wl1271_scan_complete_work(struct work_struct *work);
  35. int wl1271_scan_sched_scan_config(struct wl1271 *wl,
  36. struct wl12xx_vif *wlvif,
  37. struct cfg80211_sched_scan_request *req,
  38. struct ieee80211_sched_scan_ies *ies);
  39. int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif);
  40. void wl1271_scan_sched_scan_stop(struct wl1271 *wl);
  41. void wl1271_scan_sched_scan_results(struct wl1271 *wl);
  42. #define WL1271_SCAN_MAX_CHANNELS 24
  43. #define WL1271_SCAN_DEFAULT_TAG 1
  44. #define WL1271_SCAN_CURRENT_TX_PWR 0
  45. #define WL1271_SCAN_OPT_ACTIVE 0
  46. #define WL1271_SCAN_OPT_PASSIVE 1
  47. #define WL1271_SCAN_OPT_SPLIT_SCAN 2
  48. #define WL1271_SCAN_OPT_PRIORITY_HIGH 4
  49. /* scan even if we fail to enter psm */
  50. #define WL1271_SCAN_OPT_FORCE 8
  51. #define WL1271_SCAN_BAND_2_4_GHZ 0
  52. #define WL1271_SCAN_BAND_5_GHZ 1
  53. #define WL1271_SCAN_TIMEOUT 10000 /* msec */
  54. enum {
  55. WL1271_SCAN_STATE_IDLE,
  56. WL1271_SCAN_STATE_2GHZ_ACTIVE,
  57. WL1271_SCAN_STATE_2GHZ_PASSIVE,
  58. WL1271_SCAN_STATE_5GHZ_ACTIVE,
  59. WL1271_SCAN_STATE_5GHZ_PASSIVE,
  60. WL1271_SCAN_STATE_DONE
  61. };
  62. struct basic_scan_params {
  63. /* Scan option flags (WL1271_SCAN_OPT_*) */
  64. __le16 scan_options;
  65. u8 role_id;
  66. /* Number of scan channels in the list (maximum 30) */
  67. u8 n_ch;
  68. /* This field indicates the number of probe requests to send
  69. per channel for an active scan */
  70. u8 n_probe_reqs;
  71. u8 tid_trigger;
  72. u8 ssid_len;
  73. u8 use_ssid_list;
  74. /* Rate bit field for sending the probes */
  75. __le32 tx_rate;
  76. u8 ssid[IEEE80211_MAX_SSID_LEN];
  77. /* Band to scan */
  78. u8 band;
  79. u8 scan_tag;
  80. u8 padding2[2];
  81. } __packed;
  82. struct basic_scan_channel_params {
  83. /* Duration in TU to wait for frames on a channel for active scan */
  84. __le32 min_duration;
  85. __le32 max_duration;
  86. __le32 bssid_lsb;
  87. __le16 bssid_msb;
  88. u8 early_termination;
  89. u8 tx_power_att;
  90. u8 channel;
  91. /* FW internal use only! */
  92. u8 dfs_candidate;
  93. u8 activity_detected;
  94. u8 pad;
  95. } __packed;
  96. struct wl1271_cmd_scan {
  97. struct wl1271_cmd_header header;
  98. struct basic_scan_params params;
  99. struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
  100. /* src mac address */
  101. u8 addr[ETH_ALEN];
  102. u8 padding[2];
  103. } __packed;
  104. struct wl1271_cmd_trigger_scan_to {
  105. struct wl1271_cmd_header header;
  106. __le32 timeout;
  107. } __packed;
  108. #define MAX_CHANNELS_2GHZ 14
  109. #define MAX_CHANNELS_5GHZ 23
  110. #define MAX_CHANNELS_4GHZ 4
  111. #define SCAN_MAX_CYCLE_INTERVALS 16
  112. #define SCAN_MAX_BANDS 3
  113. enum {
  114. SCAN_SSID_FILTER_ANY = 0,
  115. SCAN_SSID_FILTER_SPECIFIC = 1,
  116. SCAN_SSID_FILTER_LIST = 2,
  117. SCAN_SSID_FILTER_DISABLED = 3
  118. };
  119. enum {
  120. SCAN_BSS_TYPE_INDEPENDENT,
  121. SCAN_BSS_TYPE_INFRASTRUCTURE,
  122. SCAN_BSS_TYPE_ANY,
  123. };
  124. #define SCAN_CHANNEL_FLAGS_DFS BIT(0)
  125. #define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1)
  126. struct conn_scan_ch_params {
  127. __le16 min_duration;
  128. __le16 max_duration;
  129. __le16 passive_duration;
  130. u8 channel;
  131. u8 tx_power_att;
  132. /* bit 0: DFS channel; bit 1: DFS enabled */
  133. u8 flags;
  134. u8 padding[3];
  135. } __packed;
  136. struct wl1271_cmd_sched_scan_config {
  137. struct wl1271_cmd_header header;
  138. __le32 intervals[SCAN_MAX_CYCLE_INTERVALS];
  139. s8 rssi_threshold; /* for filtering (in dBm) */
  140. s8 snr_threshold; /* for filtering (in dB) */
  141. u8 cycles; /* maximum number of scan cycles */
  142. u8 report_after; /* report when this number of results are received */
  143. u8 terminate; /* stop scanning after reporting */
  144. u8 tag;
  145. u8 bss_type; /* for filtering */
  146. u8 filter_type;
  147. u8 ssid_len; /* For SCAN_SSID_FILTER_SPECIFIC */
  148. u8 ssid[IEEE80211_MAX_SSID_LEN];
  149. u8 n_probe_reqs; /* Number of probes requests per channel */
  150. u8 passive[SCAN_MAX_BANDS];
  151. u8 active[SCAN_MAX_BANDS];
  152. u8 dfs;
  153. u8 padding[3];
  154. struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
  155. struct conn_scan_ch_params channels_5[MAX_CHANNELS_5GHZ];
  156. struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
  157. } __packed;
  158. #define SCHED_SCAN_MAX_SSIDS 16
  159. enum {
  160. SCAN_SSID_TYPE_PUBLIC = 0,
  161. SCAN_SSID_TYPE_HIDDEN = 1,
  162. };
  163. struct wl1271_ssid {
  164. u8 type;
  165. u8 len;
  166. u8 ssid[IEEE80211_MAX_SSID_LEN];
  167. /* u8 padding[2]; */
  168. } __packed;
  169. struct wl1271_cmd_sched_scan_ssid_list {
  170. struct wl1271_cmd_header header;
  171. u8 n_ssids;
  172. struct wl1271_ssid ssids[SCHED_SCAN_MAX_SSIDS];
  173. u8 padding[3];
  174. } __packed;
  175. struct wl1271_cmd_sched_scan_start {
  176. struct wl1271_cmd_header header;
  177. u8 tag;
  178. u8 padding[3];
  179. } __packed;
  180. struct wl1271_cmd_sched_scan_stop {
  181. struct wl1271_cmd_header header;
  182. u8 tag;
  183. u8 padding[3];
  184. } __packed;
  185. #endif /* __WL1271_SCAN_H__ */