Lines Matching refs:priv
15 static void cw1200_scan_restart_delayed(struct cw1200_common *priv);
17 static int cw1200_scan_start(struct cw1200_common *priv, struct wsm_scan *scan) in cw1200_scan_start() argument
22 switch (priv->join_status) { in cw1200_scan_start()
30 wiphy_dbg(priv->hw->wiphy, "[SCAN] hw req, type %d, %d channels, flags: 0x%x.\n", in cw1200_scan_start()
36 cancel_delayed_work_sync(&priv->clear_recent_scan_work); in cw1200_scan_start()
37 atomic_set(&priv->scan.in_progress, 1); in cw1200_scan_start()
38 atomic_set(&priv->recent_scan, 1); in cw1200_scan_start()
39 cw1200_pm_stay_awake(&priv->pm_state, msecs_to_jiffies(tmo)); 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()
46 cw1200_scan_restart_delayed(priv); in cw1200_scan_start()
55 struct cw1200_common *priv = hw->priv; in cw1200_hw_scan() local
62 if (!priv->vif) in cw1200_hw_scan()
66 if (priv->join_status == CW1200_JOIN_STATUS_AP) in cw1200_hw_scan()
78 frame.skb = ieee80211_probereq_get(hw, priv->vif->addr, NULL, 0, in cw1200_hw_scan()
87 down(&priv->scan.lock); in cw1200_hw_scan()
88 mutex_lock(&priv->conf_mutex); in cw1200_hw_scan()
90 ret = wsm_set_template_frame(priv, &frame); in cw1200_hw_scan()
93 ret = wsm_set_probe_responder(priv, true); in cw1200_hw_scan()
96 mutex_unlock(&priv->conf_mutex); in cw1200_hw_scan()
97 up(&priv->scan.lock); in cw1200_hw_scan()
102 wsm_lock_tx(priv); 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()
120 mutex_unlock(&priv->conf_mutex); in cw1200_hw_scan()
122 queue_work(priv->workqueue, &priv->scan.work); in cw1200_hw_scan()
128 struct cw1200_common *priv = container_of(work, struct cw1200_common, 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()
144 if (cancel_delayed_work_sync(&priv->join_timeout) > 0) in cw1200_scan_work()
145 cw1200_join_timeout(&priv->join_timeout.work); in cw1200_scan_work()
148 mutex_lock(&priv->conf_mutex); in cw1200_scan_work()
151 if (priv->join_status == CW1200_JOIN_STATUS_STA && in cw1200_scan_work()
152 !(priv->powersave_mode.mode & WSM_PSM_PS)) { in cw1200_scan_work()
153 struct wsm_set_pm pm = priv->powersave_mode; in cw1200_scan_work()
155 cw1200_set_pm(priv, &pm); in cw1200_scan_work()
156 } else if (priv->join_status == CW1200_JOIN_STATUS_MONITOR) { in cw1200_scan_work()
160 cw1200_disable_listening(priv); 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()
170 wsm_set_output_power(priv, priv->output_power * 10); in cw1200_scan_work()
171 if (priv->join_status == CW1200_JOIN_STATUS_STA && in cw1200_scan_work()
172 !(priv->powersave_mode.mode & WSM_PSM_PS)) in cw1200_scan_work()
173 cw1200_set_pm(priv, &priv->powersave_mode); in cw1200_scan_work()
175 if (priv->scan.status < 0) in cw1200_scan_work()
176 wiphy_warn(priv->hw->wiphy, in cw1200_scan_work()
178 priv->scan.status); in cw1200_scan_work()
179 else if (priv->scan.req) in cw1200_scan_work()
180 wiphy_dbg(priv->hw->wiphy, in cw1200_scan_work()
183 wiphy_dbg(priv->hw->wiphy, in cw1200_scan_work()
186 priv->scan.req = NULL; in cw1200_scan_work()
187 cw1200_scan_restart_delayed(priv); in cw1200_scan_work()
188 wsm_unlock_tx(priv); in cw1200_scan_work()
189 mutex_unlock(&priv->conf_mutex); in cw1200_scan_work()
190 ieee80211_scan_completed(priv->hw, &info); 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()
209 if (priv->scan.req->no_cck) 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()
224 if (priv->join_status == CW1200_JOIN_STATUS_STA) { in cw1200_scan_work()
228 scan.ch = kcalloc(it - priv->scan.curr, in cw1200_scan_work()
232 priv->scan.status = -ENOMEM; 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()
246 priv->scan.output_power != first->max_power) { in cw1200_scan_work()
247 priv->scan.output_power = first->max_power; in cw1200_scan_work()
248 wsm_set_output_power(priv, 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()
253 if (priv->scan.status) in cw1200_scan_work()
255 priv->scan.curr = it; in cw1200_scan_work()
257 mutex_unlock(&priv->conf_mutex); in cw1200_scan_work()
261 priv->scan.curr = priv->scan.end; in cw1200_scan_work()
262 mutex_unlock(&priv->conf_mutex); in cw1200_scan_work()
263 queue_work(priv->workqueue, &priv->scan.work); in cw1200_scan_work()
267 static void cw1200_scan_restart_delayed(struct cw1200_common *priv) in cw1200_scan_restart_delayed() argument
270 if (priv->join_status == CW1200_JOIN_STATUS_MONITOR) { in cw1200_scan_restart_delayed()
271 cw1200_enable_listening(priv); in cw1200_scan_restart_delayed()
272 cw1200_update_filtering(priv); in cw1200_scan_restart_delayed()
275 if (priv->delayed_unjoin) { in cw1200_scan_restart_delayed()
276 priv->delayed_unjoin = false; in cw1200_scan_restart_delayed()
277 if (queue_work(priv->workqueue, &priv->unjoin_work) <= 0) in cw1200_scan_restart_delayed()
278 wsm_unlock_tx(priv); in cw1200_scan_restart_delayed()
279 } else if (priv->delayed_link_loss) { in cw1200_scan_restart_delayed()
280 wiphy_dbg(priv->hw->wiphy, "[CQM] Requeue BSS loss.\n"); in cw1200_scan_restart_delayed()
281 priv->delayed_link_loss = 0; in cw1200_scan_restart_delayed()
282 cw1200_cqm_bssloss_sm(priv, 1, 0, 0); in cw1200_scan_restart_delayed()
286 static void cw1200_scan_complete(struct cw1200_common *priv) in cw1200_scan_complete() argument
288 queue_delayed_work(priv->workqueue, &priv->clear_recent_scan_work, HZ); in cw1200_scan_complete()
289 if (priv->scan.direct_probe) { in cw1200_scan_complete()
290 wiphy_dbg(priv->hw->wiphy, "[SCAN] Direct probe complete.\n"); in cw1200_scan_complete()
291 cw1200_scan_restart_delayed(priv); in cw1200_scan_complete()
292 priv->scan.direct_probe = 0; in cw1200_scan_complete()
293 up(&priv->scan.lock); in cw1200_scan_complete()
294 wsm_unlock_tx(priv); in cw1200_scan_complete()
296 cw1200_scan_work(&priv->scan.work); in cw1200_scan_complete()
300 void cw1200_scan_failed_cb(struct cw1200_common *priv) in cw1200_scan_failed_cb() argument
302 if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) in cw1200_scan_failed_cb()
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()
313 void cw1200_scan_complete_cb(struct cw1200_common *priv, in cw1200_scan_complete_cb() argument
316 if (priv->mode == NL80211_IFTYPE_UNSPECIFIED) in cw1200_scan_complete_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()
328 struct cw1200_common *priv = in cw1200_clear_recent_scan_work() local
331 atomic_xchg(&priv->recent_scan, 0); in cw1200_clear_recent_scan_work()
336 struct cw1200_common *priv = in cw1200_scan_timeout() local
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()
342 wiphy_warn(priv->hw->wiphy, in cw1200_scan_timeout()
344 priv->scan.status = -ETIMEDOUT; in cw1200_scan_timeout()
345 priv->scan.curr = priv->scan.end; in cw1200_scan_timeout()
346 wsm_stop_scan(priv); in cw1200_scan_timeout()
348 cw1200_scan_complete(priv); in cw1200_scan_timeout()
354 struct cw1200_common *priv = in cw1200_probe_work() local
356 u8 queue_id = cw1200_queue_get_queue_id(priv->pending_frame_id); in cw1200_probe_work()
357 struct cw1200_queue *queue = &priv->tx_queue[queue_id]; in cw1200_probe_work()
382 wiphy_dbg(priv->hw->wiphy, "[SCAN] Direct probe work.\n"); in cw1200_probe_work()
384 mutex_lock(&priv->conf_mutex); in cw1200_probe_work()
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()
390 mutex_unlock(&priv->conf_mutex); in cw1200_probe_work()
395 if (cw1200_queue_get_skb(queue, priv->pending_frame_id, in cw1200_probe_work()
397 up(&priv->scan.lock); in cw1200_probe_work()
398 mutex_unlock(&priv->conf_mutex); in cw1200_probe_work()
399 wsm_unlock_tx(priv); in cw1200_probe_work()
404 scan.band = (priv->channel->band == NL80211_BAND_5GHZ) ? in cw1200_probe_work()
406 if (priv->join_status == CW1200_JOIN_STATUS_STA || in cw1200_probe_work()
407 priv->join_status == CW1200_JOIN_STATUS_IBSS) { in cw1200_probe_work()
411 ch[0].number = priv->channel->hw_value; in cw1200_probe_work()
440 if (priv->join_status == CW1200_JOIN_STATUS_MONITOR) in cw1200_probe_work()
441 cw1200_disable_listening(priv); in cw1200_probe_work()
442 ret = wsm_set_template_frame(priv, &frame); in cw1200_probe_work()
443 priv->scan.direct_probe = 1; in cw1200_probe_work()
445 wsm_flush_tx(priv); in cw1200_probe_work()
446 ret = cw1200_scan_start(priv, &scan); in cw1200_probe_work()
448 mutex_unlock(&priv->conf_mutex); in cw1200_probe_work()
453 BUG_ON(cw1200_queue_remove(queue, priv->pending_frame_id)); in cw1200_probe_work()
456 priv->scan.direct_probe = 0; in cw1200_probe_work()
457 up(&priv->scan.lock); in cw1200_probe_work()
458 wsm_unlock_tx(priv); in cw1200_probe_work()