scan.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 "wlcore.h"
  26. int wlcore_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_build_probe_req(struct wl1271 *wl,
  30. const u8 *ssid, size_t ssid_len,
  31. const u8 *ie, size_t ie_len, u8 band);
  32. void wl1271_scan_stm(struct wl1271 *wl, struct wl12xx_vif *wlvif);
  33. void wl1271_scan_complete_work(struct work_struct *work);
  34. int wl1271_scan_sched_scan_config(struct wl1271 *wl,
  35. struct wl12xx_vif *wlvif,
  36. struct cfg80211_sched_scan_request *req,
  37. struct ieee80211_sched_scan_ies *ies);
  38. int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif);
  39. void wlcore_scan_sched_scan_results(struct wl1271 *wl);
  40. #define WL1271_SCAN_MAX_CHANNELS 24
  41. #define WL1271_SCAN_DEFAULT_TAG 1
  42. #define WL1271_SCAN_CURRENT_TX_PWR 0
  43. #define WL1271_SCAN_OPT_ACTIVE 0
  44. #define WL1271_SCAN_OPT_PASSIVE 1
  45. #define WL1271_SCAN_OPT_SPLIT_SCAN 2
  46. #define WL1271_SCAN_OPT_PRIORITY_HIGH 4
  47. /* scan even if we fail to enter psm */
  48. #define WL1271_SCAN_OPT_FORCE 8
  49. #define WL1271_SCAN_BAND_2_4_GHZ 0
  50. #define WL1271_SCAN_BAND_5_GHZ 1
  51. #define WL1271_SCAN_TIMEOUT 30000 /* msec */
  52. enum {
  53. WL1271_SCAN_STATE_IDLE,
  54. WL1271_SCAN_STATE_2GHZ_ACTIVE,
  55. WL1271_SCAN_STATE_2GHZ_PASSIVE,
  56. WL1271_SCAN_STATE_5GHZ_ACTIVE,
  57. WL1271_SCAN_STATE_5GHZ_PASSIVE,
  58. WL1271_SCAN_STATE_DONE
  59. };
  60. struct wl1271_cmd_trigger_scan_to {
  61. struct wl1271_cmd_header header;
  62. __le32 timeout;
  63. } __packed;
  64. #define MAX_CHANNELS_2GHZ 14
  65. #define MAX_CHANNELS_4GHZ 4
  66. /*
  67. * This max value here is used only for the struct definition of
  68. * wlcore_scan_channels. This struct is used by both 12xx
  69. * and 18xx (which have different max 5ghz channels value).
  70. * In order to make sure this is large enough, just use the
  71. * max possible 5ghz channels.
  72. */
  73. #define MAX_CHANNELS_5GHZ 42
  74. #define SCAN_MAX_CYCLE_INTERVALS 16
  75. #define SCAN_MAX_BANDS 3
  76. enum {
  77. SCAN_SSID_FILTER_ANY = 0,
  78. SCAN_SSID_FILTER_SPECIFIC = 1,
  79. SCAN_SSID_FILTER_LIST = 2,
  80. SCAN_SSID_FILTER_DISABLED = 3
  81. };
  82. enum {
  83. SCAN_BSS_TYPE_INDEPENDENT,
  84. SCAN_BSS_TYPE_INFRASTRUCTURE,
  85. SCAN_BSS_TYPE_ANY,
  86. };
  87. #define SCAN_CHANNEL_FLAGS_DFS BIT(0) /* channel is passive until an
  88. activity is detected on it */
  89. #define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1)
  90. struct conn_scan_ch_params {
  91. __le16 min_duration;
  92. __le16 max_duration;
  93. __le16 passive_duration;
  94. u8 channel;
  95. u8 tx_power_att;
  96. /* bit 0: DFS channel; bit 1: DFS enabled */
  97. u8 flags;
  98. u8 padding[3];
  99. } __packed;
  100. #define SCHED_SCAN_MAX_SSIDS 16
  101. enum {
  102. SCAN_SSID_TYPE_PUBLIC = 0,
  103. SCAN_SSID_TYPE_HIDDEN = 1,
  104. };
  105. struct wl1271_ssid {
  106. u8 type;
  107. u8 len;
  108. u8 ssid[IEEE80211_MAX_SSID_LEN];
  109. /* u8 padding[2]; */
  110. } __packed;
  111. struct wl1271_cmd_sched_scan_ssid_list {
  112. struct wl1271_cmd_header header;
  113. u8 n_ssids;
  114. struct wl1271_ssid ssids[SCHED_SCAN_MAX_SSIDS];
  115. u8 role_id;
  116. u8 padding[2];
  117. } __packed;
  118. struct wlcore_scan_channels {
  119. u8 passive[SCAN_MAX_BANDS]; /* number of passive scan channels */
  120. u8 active[SCAN_MAX_BANDS]; /* number of active scan channels */
  121. u8 dfs; /* number of dfs channels in 5ghz */
  122. u8 passive_active; /* number of passive before active channels 2.4ghz */
  123. struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
  124. struct conn_scan_ch_params channels_5[MAX_CHANNELS_5GHZ];
  125. struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
  126. };
  127. enum {
  128. SCAN_TYPE_SEARCH = 0,
  129. SCAN_TYPE_PERIODIC = 1,
  130. SCAN_TYPE_TRACKING = 2,
  131. };
  132. bool
  133. wlcore_set_scan_chan_params(struct wl1271 *wl,
  134. struct wlcore_scan_channels *cfg,
  135. struct ieee80211_channel *channels[],
  136. u32 n_channels,
  137. u32 n_ssids,
  138. int scan_type);
  139. int
  140. wlcore_scan_sched_scan_ssid_list(struct wl1271 *wl,
  141. struct wl12xx_vif *wlvif,
  142. struct cfg80211_sched_scan_request *req);
  143. #endif /* __WL1271_SCAN_H__ */