Lines Matching +full:in +full:- +full:band +full:- +full:status

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved.
18 #define IWL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */
27 #define IWL_PASSIVE_DWELL_TIME_24 (20) /* all times in msec */
43 __le32 *status; in iwl_send_scan_abort() local
48 if (!test_bit(STATUS_READY, &priv->status) || in iwl_send_scan_abort()
49 !test_bit(STATUS_SCAN_HW, &priv->status) || in iwl_send_scan_abort()
50 test_bit(STATUS_FW_ERROR, &priv->status)) in iwl_send_scan_abort()
51 return -EIO; in iwl_send_scan_abort()
57 status = (void *)cmd.resp_pkt->data; in iwl_send_scan_abort()
58 if (*status != CAN_ABORT_STATUS) { in iwl_send_scan_abort()
61 * due to simply not being in an active scan which in iwl_send_scan_abort()
66 le32_to_cpu(*status)); in iwl_send_scan_abort()
67 ret = -EIO; in iwl_send_scan_abort()
81 if (priv->scan_request) { in iwl_complete_scan()
82 IWL_DEBUG_SCAN(priv, "Complete scan in mac80211\n"); in iwl_complete_scan()
83 ieee80211_scan_completed(priv->hw, &info); in iwl_complete_scan()
86 priv->scan_type = IWL_SCAN_NORMAL; in iwl_complete_scan()
87 priv->scan_vif = NULL; in iwl_complete_scan()
88 priv->scan_request = NULL; in iwl_complete_scan()
95 lockdep_assert_held(&priv->mutex); in iwl_process_scan_complete()
97 if (!test_and_clear_bit(STATUS_SCAN_COMPLETE, &priv->status)) in iwl_process_scan_complete()
102 cancel_delayed_work(&priv->scan_check); in iwl_process_scan_complete()
104 aborted = test_and_clear_bit(STATUS_SCAN_ABORTING, &priv->status); in iwl_process_scan_complete()
108 if (!test_and_clear_bit(STATUS_SCANNING, &priv->status)) { in iwl_process_scan_complete()
113 if (priv->scan_type != IWL_SCAN_NORMAL && !aborted) { in iwl_process_scan_complete()
117 if (priv->scan_request == NULL) in iwl_process_scan_complete()
121 err = iwl_scan_initiate(priv, priv->scan_vif, IWL_SCAN_NORMAL, in iwl_process_scan_complete()
122 priv->scan_request->channels[0]->band); in iwl_process_scan_complete()
146 lockdep_assert_held(&priv->mutex); in iwl_force_scan_end()
148 if (!test_bit(STATUS_SCANNING, &priv->status)) { in iwl_force_scan_end()
154 clear_bit(STATUS_SCANNING, &priv->status); in iwl_force_scan_end()
155 clear_bit(STATUS_SCAN_HW, &priv->status); in iwl_force_scan_end()
156 clear_bit(STATUS_SCAN_ABORTING, &priv->status); in iwl_force_scan_end()
157 clear_bit(STATUS_SCAN_COMPLETE, &priv->status); in iwl_force_scan_end()
165 lockdep_assert_held(&priv->mutex); in iwl_do_scan_abort()
167 if (!test_bit(STATUS_SCANNING, &priv->status)) { in iwl_do_scan_abort()
172 if (test_and_set_bit(STATUS_SCAN_ABORTING, &priv->status)) { in iwl_do_scan_abort()
173 IWL_DEBUG_SCAN(priv, "Scan abort in progress\n"); in iwl_do_scan_abort()
186 * iwl_scan_cancel - Cancel any currently executing HW scan
191 queue_work(priv->workqueue, &priv->abort_scan); in iwl_scan_cancel()
196 * iwl_scan_cancel_timeout - Cancel any currently executing HW scan
197 * @ms: amount of time to wait (in milliseconds) for scan to abort
203 lockdep_assert_held(&priv->mutex); in iwl_scan_cancel_timeout()
210 if (!test_bit(STATUS_SCAN_HW, &priv->status)) in iwl_scan_cancel_timeout()
237 struct iwl_scanreq_notification *notif = (void *)pkt->data; in iwl_rx_reply_scan()
239 IWL_DEBUG_SCAN(priv, "Scan request status = 0x%x\n", notif->status); in iwl_rx_reply_scan()
248 struct iwl_scanstart_notification *notif = (void *)pkt->data; in iwl_rx_scan_start_notif()
250 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); in iwl_rx_scan_start_notif()
253 "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n", in iwl_rx_scan_start_notif()
254 notif->channel, in iwl_rx_scan_start_notif()
255 notif->band ? "bg" : "a", in iwl_rx_scan_start_notif()
256 le32_to_cpu(notif->tsf_high), in iwl_rx_scan_start_notif()
257 le32_to_cpu(notif->tsf_low), in iwl_rx_scan_start_notif()
258 notif->status, notif->beacon_timer); in iwl_rx_scan_start_notif()
267 struct iwl_scanresults_notification *notif = (void *)pkt->data; in iwl_rx_scan_results_notif()
271 "probe status: %u:%u " in iwl_rx_scan_results_notif()
272 "(TSF: 0x%08X:%08X) - %d " in iwl_rx_scan_results_notif()
274 notif->channel, in iwl_rx_scan_results_notif()
275 notif->band ? "bg" : "a", in iwl_rx_scan_results_notif()
276 notif->probe_status, notif->num_probe_not_sent, in iwl_rx_scan_results_notif()
277 le32_to_cpu(notif->tsf_high), in iwl_rx_scan_results_notif()
278 le32_to_cpu(notif->tsf_low), in iwl_rx_scan_results_notif()
279 le32_to_cpu(notif->statistics[0]), in iwl_rx_scan_results_notif()
280 le32_to_cpu(notif->tsf_low) - priv->scan_start_tsf); in iwl_rx_scan_results_notif()
289 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->data; in iwl_rx_scan_complete_notif()
291 IWL_DEBUG_SCAN(priv, "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", in iwl_rx_scan_complete_notif()
292 scan_notif->scanned_channels, in iwl_rx_scan_complete_notif()
293 scan_notif->tsf_low, in iwl_rx_scan_complete_notif()
294 scan_notif->tsf_high, scan_notif->status); in iwl_rx_scan_complete_notif()
297 (priv->scan_band == NL80211_BAND_2GHZ) ? "2.4" : "5.2", in iwl_rx_scan_complete_notif()
298 jiffies_to_msecs(jiffies - priv->scan_start)); in iwl_rx_scan_complete_notif()
308 set_bit(STATUS_SCAN_COMPLETE, &priv->status); in iwl_rx_scan_complete_notif()
309 clear_bit(STATUS_SCAN_HW, &priv->status); in iwl_rx_scan_complete_notif()
310 queue_work(priv->workqueue, &priv->scan_completed); in iwl_rx_scan_complete_notif()
312 if (priv->iw_mode != NL80211_IFTYPE_ADHOC && in iwl_rx_scan_complete_notif()
314 priv->bt_status != scan_notif->bt_status) { in iwl_rx_scan_complete_notif()
315 if (scan_notif->bt_status) { in iwl_rx_scan_complete_notif()
317 if (!priv->bt_ch_announce) in iwl_rx_scan_complete_notif()
318 priv->bt_traffic_load = in iwl_rx_scan_complete_notif()
326 priv->bt_traffic_load = in iwl_rx_scan_complete_notif()
329 priv->bt_status = scan_notif->bt_status; in iwl_rx_scan_complete_notif()
330 queue_work(priv->workqueue, in iwl_rx_scan_complete_notif()
331 &priv->bt_traffic_change_work); in iwl_rx_scan_complete_notif()
338 priv->rx_handlers[REPLY_SCAN_CMD] = iwl_rx_reply_scan; in iwl_setup_rx_scan_handlers()
339 priv->rx_handlers[SCAN_START_NOTIFICATION] = iwl_rx_scan_start_notif; in iwl_setup_rx_scan_handlers()
340 priv->rx_handlers[SCAN_RESULTS_NOTIFICATION] = in iwl_setup_rx_scan_handlers()
342 priv->rx_handlers[SCAN_COMPLETE_NOTIFICATION] = in iwl_setup_rx_scan_handlers()
347 enum nl80211_band band, u8 n_probes) in iwl_get_active_dwell_time() argument
349 if (band == NL80211_BAND_5GHZ) in iwl_get_active_dwell_time()
370 * 1/2 of the minimum of them, because they might be in in iwl_limit_dwell()
371 * lock-step with the time inbetween only half of what in iwl_limit_dwell()
372 * time we'd have in each of them. in iwl_limit_dwell()
375 switch (ctx->staging.dev_type) { in iwl_limit_dwell()
389 * active in uCode even when not associated yet. in iwl_limit_dwell()
394 limits[n_active++] = ctx->beacon_int ?: IWL_PASSIVE_DWELL_BASE; in iwl_limit_dwell()
401 limit = (limits[1] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; in iwl_limit_dwell()
406 limit = (limits[0] * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; in iwl_limit_dwell()
416 enum nl80211_band band) in iwl_get_passive_dwell_time() argument
418 u16 passive = (band == NL80211_BAND_2GHZ) ? in iwl_get_passive_dwell_time()
427 enum nl80211_band band) in iwl_get_single_channel_number() argument
429 struct ieee80211_supported_band *sband = priv->hw->wiphy->bands[band]; in iwl_get_single_channel_number()
433 for (i = 0; i < sband->n_channels; i++) { in iwl_get_single_channel_number()
437 busy = sband->channels[i].hw_value == in iwl_get_single_channel_number()
438 le16_to_cpu(ctx->staging.channel); in iwl_get_single_channel_number()
446 if (!(sband->channels[i].flags & IEEE80211_CHAN_DISABLED)) in iwl_get_single_channel_number()
447 return sband->channels[i].hw_value; in iwl_get_single_channel_number()
455 enum nl80211_band band, in iwl_get_channel_for_reset_scan() argument
461 sband = iwl_get_hw_mode(priv, band); in iwl_get_channel_for_reset_scan()
463 IWL_ERR(priv, "invalid band\n"); in iwl_get_channel_for_reset_scan()
467 channel = iwl_get_single_channel_number(priv, band); in iwl_get_channel_for_reset_scan()
469 scan_ch->channel = cpu_to_le16(channel); in iwl_get_channel_for_reset_scan()
470 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; in iwl_get_channel_for_reset_scan()
471 scan_ch->active_dwell = in iwl_get_channel_for_reset_scan()
473 scan_ch->passive_dwell = in iwl_get_channel_for_reset_scan()
476 scan_ch->dsp_atten = 110; in iwl_get_channel_for_reset_scan()
477 if (band == NL80211_BAND_5GHZ) in iwl_get_channel_for_reset_scan()
478 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; in iwl_get_channel_for_reset_scan()
480 scan_ch->tx_gain = ((1 << 5) | (5 << 3)); in iwl_get_channel_for_reset_scan()
490 enum nl80211_band band, in iwl_get_channels_for_scan() argument
501 sband = iwl_get_hw_mode(priv, band); in iwl_get_channels_for_scan()
505 active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); in iwl_get_channels_for_scan()
506 passive_dwell = iwl_get_passive_dwell_time(priv, band); in iwl_get_channels_for_scan()
511 for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) { in iwl_get_channels_for_scan()
512 chan = priv->scan_request->channels[i]; in iwl_get_channels_for_scan()
514 if (chan->band != band) in iwl_get_channels_for_scan()
517 channel = chan->hw_value; in iwl_get_channels_for_scan()
518 scan_ch->channel = cpu_to_le16(channel); in iwl_get_channels_for_scan()
520 if (!is_active || (chan->flags & IEEE80211_CHAN_NO_IR)) in iwl_get_channels_for_scan()
521 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; in iwl_get_channels_for_scan()
523 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; in iwl_get_channels_for_scan()
526 scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); in iwl_get_channels_for_scan()
528 scan_ch->active_dwell = cpu_to_le16(active_dwell); in iwl_get_channels_for_scan()
529 scan_ch->passive_dwell = cpu_to_le16(passive_dwell); in iwl_get_channels_for_scan()
532 scan_ch->dsp_atten = 110; in iwl_get_channels_for_scan()
536 * scan_ch->tx_gain = ((1 << 5) | (2 << 3)) | 3; in iwl_get_channels_for_scan()
538 if (band == NL80211_BAND_5GHZ) in iwl_get_channels_for_scan()
539 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; in iwl_get_channels_for_scan()
541 scan_ch->tx_gain = ((1 << 5) | (5 << 3)); in iwl_get_channels_for_scan()
544 channel, le32_to_cpu(scan_ch->type), in iwl_get_channels_for_scan()
545 (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ? in iwl_get_channels_for_scan()
547 (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ? in iwl_get_channels_for_scan()
559 * iwl_fill_probe_req - fill in all required fields and IE for probe request
570 left -= 24; in iwl_fill_probe_req()
574 frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); in iwl_fill_probe_req()
575 eth_broadcast_addr(frame->da); in iwl_fill_probe_req()
576 memcpy(frame->sa, ta, ETH_ALEN); in iwl_fill_probe_req()
577 eth_broadcast_addr(frame->bssid); in iwl_fill_probe_req()
578 frame->seq_ctrl = 0; in iwl_fill_probe_req()
583 pos = &frame->u.probe_req.variable[0]; in iwl_fill_probe_req()
585 /* fill in our SSID IE */ in iwl_fill_probe_req()
586 left -= ssid_len + 2; in iwl_fill_probe_req()
616 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; in iwlagn_request_scan()
620 enum nl80211_band band; in iwlagn_request_scan() local
622 u8 rx_ant = priv->nvm_data->valid_rx_ant; in iwlagn_request_scan()
627 u8 scan_tx_antennas = priv->nvm_data->valid_tx_ant; in iwlagn_request_scan()
631 priv->fw->ucode_capa.max_probe_length; in iwlagn_request_scan()
635 if (WARN_ON(priv->scan_type == IWL_SCAN_NORMAL && in iwlagn_request_scan()
636 (!priv->scan_request || in iwlagn_request_scan()
637 priv->scan_request->n_channels > MAX_SCAN_CHANNEL))) in iwlagn_request_scan()
638 return -EINVAL; in iwlagn_request_scan()
640 lockdep_assert_held(&priv->mutex); in iwlagn_request_scan()
645 if (!priv->scan_cmd) { in iwlagn_request_scan()
646 priv->scan_cmd = kmalloc(scan_cmd_size, GFP_KERNEL); in iwlagn_request_scan()
647 if (!priv->scan_cmd) { in iwlagn_request_scan()
650 return -ENOMEM; in iwlagn_request_scan()
652 priv->scan_cmd_size = scan_cmd_size; in iwlagn_request_scan()
654 if (priv->scan_cmd_size < scan_cmd_size) { in iwlagn_request_scan()
657 return -ENOMEM; in iwlagn_request_scan()
659 scan = priv->scan_cmd; in iwlagn_request_scan()
660 memset(scan, 0, priv->scan_cmd_size); in iwlagn_request_scan()
662 scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH; in iwlagn_request_scan()
663 scan->quiet_time = IWL_ACTIVE_QUIET_TIME; in iwlagn_request_scan()
672 switch (priv->scan_type) { in iwlagn_request_scan()
677 interval = vif->bss_conf.beacon_int; in iwlagn_request_scan()
681 scan->suspend_time = 0; in iwlagn_request_scan()
682 scan->max_out_time = cpu_to_le32(200 * 1024); in iwlagn_request_scan()
689 scan->suspend_time = cpu_to_le32(scan_suspend_time); in iwlagn_request_scan()
694 switch (priv->scan_type) { in iwlagn_request_scan()
702 scan->quiet_time = cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME); in iwlagn_request_scan()
705 if (priv->scan_request->n_ssids) { in iwlagn_request_scan()
712 ssid_len = priv->scan_request->ssids[0].ssid_len; in iwlagn_request_scan()
713 ssid = priv->scan_request->ssids[0].ssid; in iwlagn_request_scan()
719 for (i = priv->scan_request->n_ssids - 1; i >= 1; i--) { in iwlagn_request_scan()
720 scan->direct_scan[p].id = WLAN_EID_SSID; in iwlagn_request_scan()
721 scan->direct_scan[p].len = in iwlagn_request_scan()
722 priv->scan_request->ssids[i].ssid_len; in iwlagn_request_scan()
723 memcpy(scan->direct_scan[p].ssid, in iwlagn_request_scan()
724 priv->scan_request->ssids[i].ssid, in iwlagn_request_scan()
725 priv->scan_request->ssids[i].ssid_len); in iwlagn_request_scan()
735 scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK; in iwlagn_request_scan()
736 scan->tx_cmd.sta_id = ctx->bcast_sta_id; in iwlagn_request_scan()
737 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; in iwlagn_request_scan()
739 switch (priv->scan_band) { in iwlagn_request_scan()
741 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; in iwlagn_request_scan()
743 priv->contexts[IWL_RXON_CTX_BSS].active.flags & in iwlagn_request_scan()
746 if ((priv->scan_request && priv->scan_request->no_cck) || in iwlagn_request_scan()
757 if (priv->lib->bt_params && in iwlagn_request_scan()
758 priv->lib->bt_params->advanced_bt_coexist) in iwlagn_request_scan()
759 scan->tx_cmd.tx_flags |= TX_CMD_FLG_IGNORE_BT; in iwlagn_request_scan()
765 IWL_WARN(priv, "Invalid scan band\n"); in iwlagn_request_scan()
766 return -EIO; in iwlagn_request_scan()
781 * sending out probes -- setting this to a huge value will in iwlagn_request_scan()
786 * This was fixed in later versions along with some other in iwlagn_request_scan()
787 * scan changes, and the threshold behaves as a flag in those in iwlagn_request_scan()
790 if (priv->new_scan_threshold_behaviour) in iwlagn_request_scan()
791 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : in iwlagn_request_scan()
794 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT : in iwlagn_request_scan()
797 band = priv->scan_band; in iwlagn_request_scan()
799 if (band == NL80211_BAND_2GHZ && in iwlagn_request_scan()
800 priv->lib->bt_params && in iwlagn_request_scan()
801 priv->lib->bt_params->advanced_bt_coexist) { in iwlagn_request_scan()
806 priv->scan_tx_ant[band] = iwl_toggle_tx_ant(priv, in iwlagn_request_scan()
807 priv->scan_tx_ant[band], in iwlagn_request_scan()
809 rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]); in iwlagn_request_scan()
810 scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags); in iwlagn_request_scan()
813 * In power save mode while associated use one chain, in iwlagn_request_scan()
816 if (test_bit(STATUS_POWER_PMI, &priv->status) && in iwlagn_request_scan()
817 !(priv->hw->conf.flags & IEEE80211_CONF_IDLE)) { in iwlagn_request_scan()
820 ((u8)(priv->chain_noise_data.active_chains)); in iwlagn_request_scan()
825 priv->chain_noise_data.active_chains); in iwlagn_request_scan()
829 if (priv->lib->bt_params && in iwlagn_request_scan()
830 priv->lib->bt_params->advanced_bt_coexist && in iwlagn_request_scan()
831 priv->bt_full_concurrent) { in iwlagn_request_scan()
832 /* operated as 1x1 in full concurrency mode */ in iwlagn_request_scan()
838 priv->nvm_data->valid_rx_ant << RXON_RX_CHAIN_VALID_POS; in iwlagn_request_scan()
842 scan->rx_chain = cpu_to_le16(rx_chain); in iwlagn_request_scan()
843 switch (priv->scan_type) { in iwlagn_request_scan()
846 (struct ieee80211_mgmt *)scan->data, in iwlagn_request_scan()
847 vif->addr, in iwlagn_request_scan()
848 priv->scan_request->ie, in iwlagn_request_scan()
849 priv->scan_request->ie_len, in iwlagn_request_scan()
851 scan_cmd_size - sizeof(*scan)); in iwlagn_request_scan()
856 (struct ieee80211_mgmt *)scan->data, in iwlagn_request_scan()
859 scan_cmd_size - sizeof(*scan)); in iwlagn_request_scan()
864 scan->tx_cmd.len = cpu_to_le16(cmd_len); in iwlagn_request_scan()
866 scan->filter_flags |= (RXON_FILTER_ACCEPT_GRP_MSK | in iwlagn_request_scan()
869 switch (priv->scan_type) { in iwlagn_request_scan()
871 scan->channel_count = in iwlagn_request_scan()
872 iwl_get_channel_for_reset_scan(priv, vif, band, in iwlagn_request_scan()
873 (void *)&scan->data[cmd_len]); in iwlagn_request_scan()
876 scan->channel_count = in iwlagn_request_scan()
877 iwl_get_channels_for_scan(priv, vif, band, in iwlagn_request_scan()
879 (void *)&scan->data[cmd_len]); in iwlagn_request_scan()
883 if (scan->channel_count == 0) { in iwlagn_request_scan()
884 IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); in iwlagn_request_scan()
885 return -EIO; in iwlagn_request_scan()
888 cmd.len[0] += le16_to_cpu(scan->tx_cmd.len) + in iwlagn_request_scan()
889 scan->channel_count * sizeof(struct iwl_scan_channel); in iwlagn_request_scan()
892 scan->len = cpu_to_le16(cmd.len[0]); in iwlagn_request_scan()
895 set_bit(STATUS_SCAN_HW, &priv->status); in iwlagn_request_scan()
899 clear_bit(STATUS_SCAN_HW, &priv->status); in iwlagn_request_scan()
905 clear_bit(STATUS_SCAN_HW, &priv->status); in iwlagn_request_scan()
914 u8 ant_idx = fls(priv->nvm_data->valid_tx_ant) - 1; in iwl_init_scan_params()
915 if (!priv->scan_tx_ant[NL80211_BAND_5GHZ]) in iwl_init_scan_params()
916 priv->scan_tx_ant[NL80211_BAND_5GHZ] = ant_idx; in iwl_init_scan_params()
917 if (!priv->scan_tx_ant[NL80211_BAND_2GHZ]) in iwl_init_scan_params()
918 priv->scan_tx_ant[NL80211_BAND_2GHZ] = ant_idx; in iwl_init_scan_params()
924 enum nl80211_band band) in iwl_scan_initiate() argument
928 lockdep_assert_held(&priv->mutex); in iwl_scan_initiate()
930 cancel_delayed_work(&priv->scan_check); in iwl_scan_initiate()
934 return -EIO; in iwl_scan_initiate()
937 if (test_bit(STATUS_SCAN_HW, &priv->status)) { in iwl_scan_initiate()
939 "Multiple concurrent scan requests in parallel.\n"); in iwl_scan_initiate()
940 return -EBUSY; in iwl_scan_initiate()
943 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { in iwl_scan_initiate()
945 return -EBUSY; in iwl_scan_initiate()
952 set_bit(STATUS_SCANNING, &priv->status); in iwl_scan_initiate()
953 priv->scan_type = scan_type; in iwl_scan_initiate()
954 priv->scan_start = jiffies; in iwl_scan_initiate()
955 priv->scan_band = band; in iwl_scan_initiate()
959 clear_bit(STATUS_SCANNING, &priv->status); in iwl_scan_initiate()
960 priv->scan_type = IWL_SCAN_NORMAL; in iwl_scan_initiate()
964 queue_delayed_work(priv->workqueue, &priv->scan_check, in iwl_scan_initiate()
977 queue_work(priv->workqueue, &priv->start_internal_scan); in iwl_internal_short_hw_scan()
987 mutex_lock(&priv->mutex); in iwl_bg_start_internal_scan()
989 if (priv->scan_type == IWL_SCAN_RADIO_RESET) { in iwl_bg_start_internal_scan()
990 IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n"); in iwl_bg_start_internal_scan()
994 if (test_bit(STATUS_SCANNING, &priv->status)) { in iwl_bg_start_internal_scan()
995 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); in iwl_bg_start_internal_scan()
999 if (iwl_scan_initiate(priv, NULL, IWL_SCAN_RADIO_RESET, priv->band)) in iwl_bg_start_internal_scan()
1002 mutex_unlock(&priv->mutex); in iwl_bg_start_internal_scan()
1013 * most likely is in bad shape, so we don't bother to in iwl_bg_scan_check()
1015 mutex_lock(&priv->mutex); in iwl_bg_scan_check()
1017 mutex_unlock(&priv->mutex); in iwl_bg_scan_check()
1026 /* We keep scan_check work queued in case when firmware will not in iwl_bg_abort_scan()
1028 mutex_lock(&priv->mutex); in iwl_bg_abort_scan()
1030 mutex_unlock(&priv->mutex); in iwl_bg_abort_scan()
1038 mutex_lock(&priv->mutex); in iwl_bg_scan_completed()
1040 mutex_unlock(&priv->mutex); in iwl_bg_scan_completed()
1045 INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed); in iwl_setup_scan_deferred_work()
1046 INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan); in iwl_setup_scan_deferred_work()
1047 INIT_WORK(&priv->start_internal_scan, iwl_bg_start_internal_scan); in iwl_setup_scan_deferred_work()
1048 INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check); in iwl_setup_scan_deferred_work()
1053 cancel_work_sync(&priv->start_internal_scan); in iwl_cancel_scan_deferred_work()
1054 cancel_work_sync(&priv->abort_scan); in iwl_cancel_scan_deferred_work()
1055 cancel_work_sync(&priv->scan_completed); in iwl_cancel_scan_deferred_work()
1057 if (cancel_delayed_work_sync(&priv->scan_check)) { in iwl_cancel_scan_deferred_work()
1058 mutex_lock(&priv->mutex); in iwl_cancel_scan_deferred_work()
1060 mutex_unlock(&priv->mutex); in iwl_cancel_scan_deferred_work()