Lines Matching refs:scan

17 static int cw1200_scan_start(struct cw1200_common *priv, struct wsm_scan *scan)  in cw1200_scan_start()  argument
31 scan->type, scan->num_channels, scan->flags); in cw1200_scan_start()
33 for (i = 0; i < scan->num_channels; ++i) in cw1200_scan_start()
34 tmo += scan->ch[i].max_chan_time + 10; in cw1200_scan_start()
37 atomic_set(&priv->scan.in_progress, 1); in cw1200_scan_start()
40 queue_delayed_work(priv->workqueue, &priv->scan.timeout, in cw1200_scan_start()
42 ret = wsm_scan(priv, scan); in cw1200_scan_start()
44 atomic_set(&priv->scan.in_progress, 0); in cw1200_scan_start()
45 cancel_delayed_work_sync(&priv->scan.timeout); in cw1200_scan_start()
87 down(&priv->scan.lock); in cw1200_hw_scan()
97 up(&priv->scan.lock); in cw1200_hw_scan()
104 BUG_ON(priv->scan.req); in cw1200_hw_scan()
105 priv->scan.req = req; in cw1200_hw_scan()
106 priv->scan.n_ssids = 0; in cw1200_hw_scan()
107 priv->scan.status = 0; in cw1200_hw_scan()
108 priv->scan.begin = &req->channels[0]; in cw1200_hw_scan()
109 priv->scan.curr = priv->scan.begin; in cw1200_hw_scan()
110 priv->scan.end = &req->channels[req->n_channels]; in cw1200_hw_scan()
111 priv->scan.output_power = priv->output_power; in cw1200_hw_scan()
114 struct wsm_ssid *dst = &priv->scan.ssids[priv->scan.n_ssids]; in cw1200_hw_scan()
117 ++priv->scan.n_ssids; in cw1200_hw_scan()
122 queue_work(priv->workqueue, &priv->scan.work); in cw1200_hw_scan()
129 scan.work); in cw1200_scan_work()
131 struct wsm_scan scan = { in cw1200_scan_work() local
135 bool first_run = (priv->scan.begin == priv->scan.curr && in cw1200_scan_work()
136 priv->scan.begin != priv->scan.end); in cw1200_scan_work()
164 if (!priv->scan.req || (priv->scan.curr == priv->scan.end)) { in cw1200_scan_work()
166 .aborted = priv->scan.status ? 1 : 0, in cw1200_scan_work()
169 if (priv->scan.output_power != priv->output_power) in cw1200_scan_work()
175 if (priv->scan.status < 0) in cw1200_scan_work()
178 priv->scan.status); in cw1200_scan_work()
179 else if (priv->scan.req) in cw1200_scan_work()
186 priv->scan.req = NULL; in cw1200_scan_work()
191 up(&priv->scan.lock); in cw1200_scan_work()
194 struct ieee80211_channel *first = *priv->scan.curr; in cw1200_scan_work()
195 for (it = priv->scan.curr + 1, i = 1; in cw1200_scan_work()
196 it != priv->scan.end && i < WSM_SCAN_MAX_NUM_OF_CHANNELS; in cw1200_scan_work()
207 scan.band = first->band; in cw1200_scan_work()
209 if (priv->scan.req->no_cck) in cw1200_scan_work()
210 scan.max_tx_rate = WSM_TRANSMIT_RATE_6; in cw1200_scan_work()
212 scan.max_tx_rate = WSM_TRANSMIT_RATE_1; in cw1200_scan_work()
213 scan.num_probes = in cw1200_scan_work()
215 scan.num_ssids = priv->scan.n_ssids; in cw1200_scan_work()
216 scan.ssids = &priv->scan.ssids[0]; in cw1200_scan_work()
217 scan.num_channels = it - priv->scan.curr; in cw1200_scan_work()
219 scan.probe_delay = 100; in cw1200_scan_work()
225 scan.type = WSM_SCAN_TYPE_BACKGROUND; in cw1200_scan_work()
226 scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND; in cw1200_scan_work()
228 scan.ch = kcalloc(it - priv->scan.curr, in cw1200_scan_work()
231 if (!scan.ch) { in cw1200_scan_work()
232 priv->scan.status = -ENOMEM; in cw1200_scan_work()
235 for (i = 0; i < scan.num_channels; ++i) { in cw1200_scan_work()
236 scan.ch[i].number = priv->scan.curr[i]->hw_value; in cw1200_scan_work()
237 if (priv->scan.curr[i]->flags & IEEE80211_CHAN_NO_IR) { in cw1200_scan_work()
238 scan.ch[i].min_chan_time = 50; in cw1200_scan_work()
239 scan.ch[i].max_chan_time = 100; in cw1200_scan_work()
241 scan.ch[i].min_chan_time = 10; in cw1200_scan_work()
242 scan.ch[i].max_chan_time = 25; in cw1200_scan_work()
246 priv->scan.output_power != first->max_power) { in cw1200_scan_work()
247 priv->scan.output_power = first->max_power; in cw1200_scan_work()
249 priv->scan.output_power * 10); in cw1200_scan_work()
251 priv->scan.status = cw1200_scan_start(priv, &scan); in cw1200_scan_work()
252 kfree(scan.ch); in cw1200_scan_work()
253 if (priv->scan.status) in cw1200_scan_work()
255 priv->scan.curr = it; in cw1200_scan_work()
261 priv->scan.curr = priv->scan.end; in cw1200_scan_work()
263 queue_work(priv->workqueue, &priv->scan.work); in cw1200_scan_work()
289 if (priv->scan.direct_probe) { in cw1200_scan_complete()
292 priv->scan.direct_probe = 0; in cw1200_scan_complete()
293 up(&priv->scan.lock); in cw1200_scan_complete()
296 cw1200_scan_work(&priv->scan.work); in cw1200_scan_complete()
306 if (cancel_delayed_work_sync(&priv->scan.timeout) > 0) { in cw1200_scan_failed_cb()
307 priv->scan.status = -EIO; in cw1200_scan_failed_cb()
308 queue_delayed_work(priv->workqueue, &priv->scan.timeout, 0); in cw1200_scan_failed_cb()
320 if (cancel_delayed_work_sync(&priv->scan.timeout) > 0) { in cw1200_scan_complete_cb()
321 priv->scan.status = 1; in cw1200_scan_complete_cb()
322 queue_delayed_work(priv->workqueue, &priv->scan.timeout, 0); in cw1200_scan_complete_cb()
337 container_of(work, struct cw1200_common, scan.timeout.work); in cw1200_scan_timeout()
338 if (atomic_xchg(&priv->scan.in_progress, 0)) { in cw1200_scan_timeout()
339 if (priv->scan.status > 0) { in cw1200_scan_timeout()
340 priv->scan.status = 0; in cw1200_scan_timeout()
341 } else if (!priv->scan.status) { in cw1200_scan_timeout()
344 priv->scan.status = -ETIMEDOUT; in cw1200_scan_timeout()
345 priv->scan.curr = priv->scan.end; in cw1200_scan_timeout()
355 container_of(work, struct cw1200_common, scan.probe_work.work); in cw1200_probe_work()
370 struct wsm_scan scan = { in cw1200_probe_work() local
385 if (down_trylock(&priv->scan.lock)) { in cw1200_probe_work()
388 queue_delayed_work(priv->workqueue, &priv->scan.probe_work, in cw1200_probe_work()
397 up(&priv->scan.lock); in cw1200_probe_work()
403 scan.max_tx_rate = wsm->max_tx_rate; in cw1200_probe_work()
404 scan.band = (priv->channel->band == NL80211_BAND_5GHZ) ? in cw1200_probe_work()
408 scan.type = WSM_SCAN_TYPE_BACKGROUND; in cw1200_probe_work()
409 scan.flags = WSM_SCAN_FLAG_FORCE_BACKGROUND; in cw1200_probe_work()
430 scan.num_ssids = 1; in cw1200_probe_work()
443 priv->scan.direct_probe = 1; in cw1200_probe_work()
446 ret = cw1200_scan_start(priv, &scan); in cw1200_probe_work()
456 priv->scan.direct_probe = 0; in cw1200_probe_work()
457 up(&priv->scan.lock); in cw1200_probe_work()