wl12xx: increase scan timeout to 30s
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / net / wireless / wl12xx / scan.h
CommitLineData
34dd2aaa
LC
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
00d20100
SL
24#ifndef __SCAN_H__
25#define __SCAN_H__
34dd2aaa 26
00d20100 27#include "wl12xx.h"
34dd2aaa 28
784f694d
EP
29int wl1271_scan(struct wl1271 *wl, struct ieee80211_vif *vif,
30 const u8 *ssid, size_t ssid_len,
08688d6b 31 struct cfg80211_scan_request *req);
2aa01597 32int wl1271_scan_stop(struct wl1271 *wl);
34dd2aaa
LC
33int wl1271_scan_build_probe_req(struct wl1271 *wl,
34 const u8 *ssid, size_t ssid_len,
35 const u8 *ie, size_t ie_len, u8 band);
784f694d 36void wl1271_scan_stm(struct wl1271 *wl, struct ieee80211_vif *vif);
c454f1d9 37void wl1271_scan_complete_work(struct work_struct *work);
95feadca 38int wl1271_scan_sched_scan_config(struct wl1271 *wl,
536129c8 39 struct wl12xx_vif *wlvif,
95feadca
LC
40 struct cfg80211_sched_scan_request *req,
41 struct ieee80211_sched_scan_ies *ies);
536129c8 42int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif);
95feadca
LC
43void wl1271_scan_sched_scan_stop(struct wl1271 *wl);
44void wl1271_scan_sched_scan_results(struct wl1271 *wl);
34dd2aaa
LC
45
46#define WL1271_SCAN_MAX_CHANNELS 24
47#define WL1271_SCAN_DEFAULT_TAG 1
48#define WL1271_SCAN_CURRENT_TX_PWR 0
49#define WL1271_SCAN_OPT_ACTIVE 0
50#define WL1271_SCAN_OPT_PASSIVE 1
d647f2dd 51#define WL1271_SCAN_OPT_SPLIT_SCAN 2
34dd2aaa 52#define WL1271_SCAN_OPT_PRIORITY_HIGH 4
a4e02f33
EP
53/* scan even if we fail to enter psm */
54#define WL1271_SCAN_OPT_FORCE 8
34dd2aaa
LC
55#define WL1271_SCAN_BAND_2_4_GHZ 0
56#define WL1271_SCAN_BAND_5_GHZ 1
08688d6b 57
16f3eb53 58#define WL1271_SCAN_TIMEOUT 30000 /* msec */
78abd320 59
08688d6b
LC
60enum {
61 WL1271_SCAN_STATE_IDLE,
62 WL1271_SCAN_STATE_2GHZ_ACTIVE,
63 WL1271_SCAN_STATE_2GHZ_PASSIVE,
64 WL1271_SCAN_STATE_5GHZ_ACTIVE,
65 WL1271_SCAN_STATE_5GHZ_PASSIVE,
66 WL1271_SCAN_STATE_DONE
67};
34dd2aaa
LC
68
69struct basic_scan_params {
34dd2aaa
LC
70 /* Scan option flags (WL1271_SCAN_OPT_*) */
71 __le16 scan_options;
a4e02f33 72 u8 role_id;
34dd2aaa 73 /* Number of scan channels in the list (maximum 30) */
08688d6b 74 u8 n_ch;
34dd2aaa
LC
75 /* This field indicates the number of probe requests to send
76 per channel for an active scan */
08688d6b 77 u8 n_probe_reqs;
34dd2aaa
LC
78 u8 tid_trigger;
79 u8 ssid_len;
a4e02f33
EP
80 u8 use_ssid_list;
81
82 /* Rate bit field for sending the probes */
83 __le32 tx_rate;
84
3b40c040 85 u8 ssid[IEEE80211_MAX_SSID_LEN];
34dd2aaa
LC
86 /* Band to scan */
87 u8 band;
a4e02f33 88
34dd2aaa 89 u8 scan_tag;
a4e02f33 90 u8 padding2[2];
72e93e91 91} __packed;
34dd2aaa
LC
92
93struct basic_scan_channel_params {
94 /* Duration in TU to wait for frames on a channel for active scan */
95 __le32 min_duration;
96 __le32 max_duration;
97 __le32 bssid_lsb;
98 __le16 bssid_msb;
99 u8 early_termination;
100 u8 tx_power_att;
101 u8 channel;
102 /* FW internal use only! */
103 u8 dfs_candidate;
104 u8 activity_detected;
105 u8 pad;
72e93e91 106} __packed;
34dd2aaa
LC
107
108struct wl1271_cmd_scan {
109 struct wl1271_cmd_header header;
110
111 struct basic_scan_params params;
112 struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
a4e02f33
EP
113
114 /* src mac address */
115 u8 addr[ETH_ALEN];
116 u8 padding[2];
72e93e91 117} __packed;
34dd2aaa
LC
118
119struct wl1271_cmd_trigger_scan_to {
120 struct wl1271_cmd_header header;
121
122 __le32 timeout;
72e93e91 123} __packed;
34dd2aaa 124
d2c2bb9f
LC
125#define MAX_CHANNELS_2GHZ 14
126#define MAX_CHANNELS_5GHZ 23
127#define MAX_CHANNELS_4GHZ 4
128
95feadca
LC
129#define SCAN_MAX_CYCLE_INTERVALS 16
130#define SCAN_MAX_BANDS 3
131
95feadca
LC
132enum {
133 SCAN_SSID_FILTER_ANY = 0,
134 SCAN_SSID_FILTER_SPECIFIC = 1,
135 SCAN_SSID_FILTER_LIST = 2,
136 SCAN_SSID_FILTER_DISABLED = 3
137};
138
139enum {
140 SCAN_BSS_TYPE_INDEPENDENT,
141 SCAN_BSS_TYPE_INFRASTRUCTURE,
142 SCAN_BSS_TYPE_ANY,
143};
144
2497a246
LC
145#define SCAN_CHANNEL_FLAGS_DFS BIT(0)
146#define SCAN_CHANNEL_FLAGS_DFS_ENABLED BIT(1)
147
95feadca
LC
148struct conn_scan_ch_params {
149 __le16 min_duration;
150 __le16 max_duration;
151 __le16 passive_duration;
152
153 u8 channel;
154 u8 tx_power_att;
155
156 /* bit 0: DFS channel; bit 1: DFS enabled */
157 u8 flags;
158
159 u8 padding[3];
160} __packed;
161
162struct wl1271_cmd_sched_scan_config {
163 struct wl1271_cmd_header header;
164
165 __le32 intervals[SCAN_MAX_CYCLE_INTERVALS];
166
167 s8 rssi_threshold; /* for filtering (in dBm) */
168 s8 snr_threshold; /* for filtering (in dB) */
169
170 u8 cycles; /* maximum number of scan cycles */
171 u8 report_after; /* report when this number of results are received */
172 u8 terminate; /* stop scanning after reporting */
173
174 u8 tag;
175 u8 bss_type; /* for filtering */
176 u8 filter_type;
177
178 u8 ssid_len; /* For SCAN_SSID_FILTER_SPECIFIC */
3b40c040 179 u8 ssid[IEEE80211_MAX_SSID_LEN];
95feadca
LC
180
181 u8 n_probe_reqs; /* Number of probes requests per channel */
182
183 u8 passive[SCAN_MAX_BANDS];
184 u8 active[SCAN_MAX_BANDS];
185
186 u8 dfs;
187
188 u8 padding[3];
189
d2c2bb9f
LC
190 struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
191 struct conn_scan_ch_params channels_5[MAX_CHANNELS_5GHZ];
192 struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
95feadca
LC
193} __packed;
194
195
a4e02f33 196#define SCHED_SCAN_MAX_SSIDS 16
95feadca
LC
197
198enum {
199 SCAN_SSID_TYPE_PUBLIC = 0,
200 SCAN_SSID_TYPE_HIDDEN = 1,
201};
202
203struct wl1271_ssid {
204 u8 type;
205 u8 len;
3b40c040 206 u8 ssid[IEEE80211_MAX_SSID_LEN];
95feadca
LC
207 /* u8 padding[2]; */
208} __packed;
209
210struct wl1271_cmd_sched_scan_ssid_list {
211 struct wl1271_cmd_header header;
212
213 u8 n_ssids;
214 struct wl1271_ssid ssids[SCHED_SCAN_MAX_SSIDS];
215 u8 padding[3];
216} __packed;
217
218struct wl1271_cmd_sched_scan_start {
219 struct wl1271_cmd_header header;
220
221 u8 tag;
222 u8 padding[3];
223} __packed;
224
225struct wl1271_cmd_sched_scan_stop {
226 struct wl1271_cmd_header header;
227
228 u8 tag;
229 u8 padding[3];
230} __packed;
231
232
34dd2aaa 233#endif /* __WL1271_SCAN_H__ */