diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/scan.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/scan.c | 65 |
1 files changed, 19 insertions, 46 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index 4b6c7d4bd199..eac2b424f6a0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -588,9 +588,7 @@ static void iwl_build_scan_cmd(struct iwl_mvm *mvm, | |||
588 | struct iwl_scan_offload_cmd *scan, | 588 | struct iwl_scan_offload_cmd *scan, |
589 | struct iwl_mvm_scan_params *params) | 589 | struct iwl_mvm_scan_params *params) |
590 | { | 590 | { |
591 | scan->channel_count = | 591 | scan->channel_count = req->n_channels; |
592 | mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels + | ||
593 | mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; | ||
594 | scan->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME); | 592 | scan->quiet_time = cpu_to_le16(IWL_ACTIVE_QUIET_TIME); |
595 | scan->quiet_plcp_th = cpu_to_le16(IWL_PLCP_QUIET_THRESH); | 593 | scan->quiet_plcp_th = cpu_to_le16(IWL_PLCP_QUIET_THRESH); |
596 | scan->good_CRC_th = IWL_GOOD_CRC_TH_DEFAULT; | 594 | scan->good_CRC_th = IWL_GOOD_CRC_TH_DEFAULT; |
@@ -669,61 +667,37 @@ static void iwl_build_channel_cfg(struct iwl_mvm *mvm, | |||
669 | struct cfg80211_sched_scan_request *req, | 667 | struct cfg80211_sched_scan_request *req, |
670 | struct iwl_scan_channel_cfg *channels, | 668 | struct iwl_scan_channel_cfg *channels, |
671 | enum ieee80211_band band, | 669 | enum ieee80211_band band, |
672 | int *head, int *tail, | 670 | int *head, |
673 | u32 ssid_bitmap, | 671 | u32 ssid_bitmap, |
674 | struct iwl_mvm_scan_params *params) | 672 | struct iwl_mvm_scan_params *params) |
675 | { | 673 | { |
676 | struct ieee80211_supported_band *s_band; | 674 | int i, index = 0; |
677 | int n_channels = req->n_channels; | ||
678 | int i, j, index = 0; | ||
679 | bool partial; | ||
680 | 675 | ||
681 | /* | 676 | for (i = 0; i < req->n_channels; i++) { |
682 | * We have to configure all supported channels, even if we don't want to | 677 | struct ieee80211_channel *chan = req->channels[i]; |
683 | * scan on them, but we have to send channels in the order that we want | 678 | |
684 | * to scan. So add requested channels to head of the list and others to | 679 | if (chan->band != band) |
685 | * the end. | 680 | continue; |
686 | */ | 681 | |
687 | s_band = &mvm->nvm_data->bands[band]; | 682 | index = *head; |
688 | 683 | (*head)++; | |
689 | for (i = 0; i < s_band->n_channels && *head <= *tail; i++) { | 684 | |
690 | partial = false; | 685 | channels->channel_number[index] = cpu_to_le16(chan->hw_value); |
691 | for (j = 0; j < n_channels; j++) | ||
692 | if (s_band->channels[i].center_freq == | ||
693 | req->channels[j]->center_freq) { | ||
694 | index = *head; | ||
695 | (*head)++; | ||
696 | /* | ||
697 | * Channels that came with the request will be | ||
698 | * in partial scan . | ||
699 | */ | ||
700 | partial = true; | ||
701 | break; | ||
702 | } | ||
703 | if (!partial) { | ||
704 | index = *tail; | ||
705 | (*tail)--; | ||
706 | } | ||
707 | channels->channel_number[index] = | ||
708 | cpu_to_le16(ieee80211_frequency_to_channel( | ||
709 | s_band->channels[i].center_freq)); | ||
710 | channels->dwell_time[index][0] = params->dwell[band].active; | 686 | channels->dwell_time[index][0] = params->dwell[band].active; |
711 | channels->dwell_time[index][1] = params->dwell[band].passive; | 687 | channels->dwell_time[index][1] = params->dwell[band].passive; |
712 | 688 | ||
713 | channels->iter_count[index] = cpu_to_le16(1); | 689 | channels->iter_count[index] = cpu_to_le16(1); |
714 | channels->iter_interval[index] = 0; | 690 | channels->iter_interval[index] = 0; |
715 | 691 | ||
716 | if (!(s_band->channels[i].flags & IEEE80211_CHAN_NO_IR)) | 692 | if (!(chan->flags & IEEE80211_CHAN_NO_IR)) |
717 | channels->type[index] |= | 693 | channels->type[index] |= |
718 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE); | 694 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE); |
719 | 695 | ||
720 | channels->type[index] |= | 696 | channels->type[index] |= |
721 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_FULL); | 697 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_FULL | |
722 | if (partial) | 698 | IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL); |
723 | channels->type[index] |= | ||
724 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL); | ||
725 | 699 | ||
726 | if (s_band->channels[i].flags & IEEE80211_CHAN_NO_HT40) | 700 | if (chan->flags & IEEE80211_CHAN_NO_HT40) |
727 | channels->type[index] |= | 701 | channels->type[index] |= |
728 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_NARROW); | 702 | cpu_to_le32(IWL_SCAN_OFFLOAD_CHANNEL_NARROW); |
729 | 703 | ||
@@ -740,7 +714,6 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
740 | int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels; | 714 | int band_2ghz = mvm->nvm_data->bands[IEEE80211_BAND_2GHZ].n_channels; |
741 | int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; | 715 | int band_5ghz = mvm->nvm_data->bands[IEEE80211_BAND_5GHZ].n_channels; |
742 | int head = 0; | 716 | int head = 0; |
743 | int tail = band_2ghz + band_5ghz - 1; | ||
744 | u32 ssid_bitmap; | 717 | u32 ssid_bitmap; |
745 | int cmd_len; | 718 | int cmd_len; |
746 | int ret; | 719 | int ret; |
@@ -772,7 +745,7 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
772 | &scan_cfg->scan_cmd.tx_cmd[0], | 745 | &scan_cfg->scan_cmd.tx_cmd[0], |
773 | scan_cfg->data); | 746 | scan_cfg->data); |
774 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, | 747 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, |
775 | IEEE80211_BAND_2GHZ, &head, &tail, | 748 | IEEE80211_BAND_2GHZ, &head, |
776 | ssid_bitmap, ¶ms); | 749 | ssid_bitmap, ¶ms); |
777 | } | 750 | } |
778 | if (band_5ghz) { | 751 | if (band_5ghz) { |
@@ -782,7 +755,7 @@ int iwl_mvm_config_sched_scan(struct iwl_mvm *mvm, | |||
782 | scan_cfg->data + | 755 | scan_cfg->data + |
783 | SCAN_OFFLOAD_PROBE_REQ_SIZE); | 756 | SCAN_OFFLOAD_PROBE_REQ_SIZE); |
784 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, | 757 | iwl_build_channel_cfg(mvm, req, &scan_cfg->channel_cfg, |
785 | IEEE80211_BAND_5GHZ, &head, &tail, | 758 | IEEE80211_BAND_5GHZ, &head, |
786 | ssid_bitmap, ¶ms); | 759 | ssid_bitmap, ¶ms); |
787 | } | 760 | } |
788 | 761 | ||