scan.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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, const u8 *ssid, size_t ssid_len,
  27. struct cfg80211_scan_request *req);
  28. int wl1271_scan_build_probe_req(struct wl1271 *wl,
  29. const u8 *ssid, size_t ssid_len,
  30. const u8 *ie, size_t ie_len, u8 band);
  31. void wl1271_scan_stm(struct wl1271 *wl);
  32. void wl1271_scan_complete_work(struct work_struct *work);
  33. int wl1271_scan_sched_scan_config(struct wl1271 *wl,
  34. struct cfg80211_sched_scan_request *req,
  35. struct ieee80211_sched_scan_ies *ies);
  36. int wl1271_scan_sched_scan_start(struct wl1271 *wl);
  37. void wl1271_scan_sched_scan_stop(struct wl1271 *wl);
  38. void wl1271_scan_sched_scan_results(struct wl1271 *wl);
  39. #define WL1271_SCAN_MAX_CHANNELS 24
  40. #define WL1271_SCAN_DEFAULT_TAG 1
  41. #define WL1271_SCAN_CURRENT_TX_PWR 0
  42. #define WL1271_SCAN_OPT_ACTIVE 0
  43. #define WL1271_SCAN_OPT_PASSIVE 1
  44. #define WL1271_SCAN_OPT_PRIORITY_HIGH 4
  45. #define WL1271_SCAN_BAND_2_4_GHZ 0
  46. #define WL1271_SCAN_BAND_5_GHZ 1
  47. #define WL1271_SCAN_TIMEOUT 10000 /* msec */
  48. enum {
  49. WL1271_SCAN_STATE_IDLE,
  50. WL1271_SCAN_STATE_2GHZ_ACTIVE,
  51. WL1271_SCAN_STATE_2GHZ_PASSIVE,
  52. WL1271_SCAN_STATE_5GHZ_ACTIVE,
  53. WL1271_SCAN_STATE_5GHZ_PASSIVE,
  54. WL1271_SCAN_STATE_DONE
  55. };
  56. struct basic_scan_params {
  57. __le32 rx_config_options;
  58. __le32 rx_filter_options;
  59. /* Scan option flags (WL1271_SCAN_OPT_*) */
  60. __le16 scan_options;
  61. /* Number of scan channels in the list (maximum 30) */
  62. u8 n_ch;
  63. /* This field indicates the number of probe requests to send
  64. per channel for an active scan */
  65. u8 n_probe_reqs;
  66. /* Rate bit field for sending the probes */
  67. __le32 tx_rate;
  68. u8 tid_trigger;
  69. u8 ssid_len;
  70. /* in order to align */
  71. u8 padding1[2];
  72. u8 ssid[IW_ESSID_MAX_SIZE];
  73. /* Band to scan */
  74. u8 band;
  75. u8 use_ssid_list;
  76. u8 scan_tag;
  77. u8 padding2;
  78. } __packed;
  79. struct basic_scan_channel_params {
  80. /* Duration in TU to wait for frames on a channel for active scan */
  81. __le32 min_duration;
  82. __le32 max_duration;
  83. __le32 bssid_lsb;
  84. __le16 bssid_msb;
  85. u8 early_termination;
  86. u8 tx_power_att;
  87. u8 channel;
  88. /* FW internal use only! */
  89. u8 dfs_candidate;
  90. u8 activity_detected;
  91. u8 pad;
  92. } __packed;
  93. struct wl1271_cmd_scan {
  94. struct wl1271_cmd_header header;
  95. struct basic_scan_params params;
  96. struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
  97. } __packed;
  98. struct wl1271_cmd_trigger_scan_to {
  99. struct wl1271_cmd_header header;
  100. __le32 timeout;
  101. } __packed;
  102. #define MAX_CHANNELS_ALL_BANDS 41
  103. #define SCAN_MAX_CYCLE_INTERVALS 16
  104. #define SCAN_MAX_BANDS 3
  105. enum {
  106. SCAN_CHANNEL_TYPE_2GHZ_PASSIVE,
  107. SCAN_CHANNEL_TYPE_2GHZ_ACTIVE,
  108. SCAN_CHANNEL_TYPE_5GHZ_PASSIVE,
  109. SCAN_CHANNEL_TYPE_5GHZ_ACTIVE,
  110. SCAN_CHANNEL_TYPE_5GHZ_DFS,
  111. };
  112. enum {
  113. SCAN_SSID_FILTER_ANY = 0,
  114. SCAN_SSID_FILTER_SPECIFIC = 1,
  115. SCAN_SSID_FILTER_LIST = 2,
  116. SCAN_SSID_FILTER_DISABLED = 3
  117. };
  118. enum {
  119. SCAN_BSS_TYPE_INDEPENDENT,
  120. SCAN_BSS_TYPE_INFRASTRUCTURE,
  121. SCAN_BSS_TYPE_ANY,
  122. };
  123. #define SCAN_CHANNEL_FLAGS_DFS BIT(0)
  124. #define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1)
  125. struct conn_scan_ch_params {
  126. __le16 min_duration;
  127. __le16 max_duration;
  128. __le16 passive_duration;
  129. u8 channel;
  130. u8 tx_power_att;
  131. /* bit 0: DFS channel; bit 1: DFS enabled */
  132. u8 flags;
  133. u8 padding[3];
  134. } __packed;
  135. struct wl1271_cmd_sched_scan_config {
  136. struct wl1271_cmd_header header;
  137. __le32 intervals[SCAN_MAX_CYCLE_INTERVALS];
  138. s8 rssi_threshold; /* for filtering (in dBm) */
  139. s8 snr_threshold; /* for filtering (in dB) */
  140. u8 cycles; /* maximum number of scan cycles */
  141. u8 report_after; /* report when this number of results are received */
  142. u8 terminate; /* stop scanning after reporting */
  143. u8 tag;
  144. u8 bss_type; /* for filtering */
  145. u8 filter_type;
  146. u8 ssid_len; /* For SCAN_SSID_FILTER_SPECIFIC */
  147. u8 ssid[IW_ESSID_MAX_SIZE];
  148. u8 n_probe_reqs; /* Number of probes requests per channel */
  149. u8 passive[SCAN_MAX_BANDS];
  150. u8 active[SCAN_MAX_BANDS];
  151. u8 dfs;
  152. u8 padding[3];
  153. struct conn_scan_ch_params channels[MAX_CHANNELS_ALL_BANDS];
  154. } __packed;
  155. #define SCHED_SCAN_MAX_SSIDS 8
  156. enum {
  157. SCAN_SSID_TYPE_PUBLIC = 0,
  158. SCAN_SSID_TYPE_HIDDEN = 1,
  159. };
  160. struct wl1271_ssid {
  161. u8 type;
  162. u8 len;
  163. u8 ssid[IW_ESSID_MAX_SIZE];
  164. /* u8 padding[2]; */
  165. } __packed;
  166. struct wl1271_cmd_sched_scan_ssid_list {
  167. struct wl1271_cmd_header header;
  168. u8 n_ssids;
  169. struct wl1271_ssid ssids[SCHED_SCAN_MAX_SSIDS];
  170. u8 padding[3];
  171. } __packed;
  172. struct wl1271_cmd_sched_scan_start {
  173. struct wl1271_cmd_header header;
  174. u8 tag;
  175. u8 padding[3];
  176. } __packed;
  177. struct wl1271_cmd_sched_scan_stop {
  178. struct wl1271_cmd_header header;
  179. u8 tag;
  180. u8 padding[3];
  181. } __packed;
  182. #endif /* __WL1271_SCAN_H__ */