Commit 4e05c234 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

iwlwifi: scan requested channels only

When userspace requests only certain channels to be scanned,
we currently ignore that request entirely.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 45af8195
...@@ -384,7 +384,6 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags) ...@@ -384,7 +384,6 @@ static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags)
void iwl_init_scan_params(struct iwl_priv *priv); void iwl_init_scan_params(struct iwl_priv *priv);
int iwl_scan_cancel(struct iwl_priv *priv); int iwl_scan_cancel(struct iwl_priv *priv);
int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms); int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms);
int iwl_scan_initiate(struct iwl_priv *priv);
int iwl_mac_hw_scan(struct ieee80211_hw *hw, struct cfg80211_scan_request *req); int iwl_mac_hw_scan(struct ieee80211_hw *hw, struct cfg80211_scan_request *req);
u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame, u16 iwl_fill_probe_req(struct iwl_priv *priv, struct ieee80211_mgmt *frame,
const u8 *ie, int ie_len, int left); const u8 *ie, int ie_len, int left);
...@@ -398,7 +397,6 @@ void iwl_bg_scan_check(struct work_struct *data); ...@@ -398,7 +397,6 @@ void iwl_bg_scan_check(struct work_struct *data);
void iwl_bg_abort_scan(struct work_struct *work); void iwl_bg_abort_scan(struct work_struct *work);
void iwl_bg_scan_completed(struct work_struct *work); void iwl_bg_scan_completed(struct work_struct *work);
void iwl_setup_scan_deferred_work(struct iwl_priv *priv); void iwl_setup_scan_deferred_work(struct iwl_priv *priv);
int iwl_send_scan_abort(struct iwl_priv *priv);
/* For faster active scanning, scan will move to the next channel if fewer than /* For faster active scanning, scan will move to the next channel if fewer than
* PLCP_QUIET_THRESH packets are heard on this channel within * PLCP_QUIET_THRESH packets are heard on this channel within
......
...@@ -109,7 +109,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms) ...@@ -109,7 +109,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
} }
EXPORT_SYMBOL(iwl_scan_cancel_timeout); EXPORT_SYMBOL(iwl_scan_cancel_timeout);
int iwl_send_scan_abort(struct iwl_priv *priv) static int iwl_send_scan_abort(struct iwl_priv *priv)
{ {
int ret = 0; int ret = 0;
struct iwl_rx_packet *res; struct iwl_rx_packet *res;
...@@ -150,7 +150,6 @@ int iwl_send_scan_abort(struct iwl_priv *priv) ...@@ -150,7 +150,6 @@ int iwl_send_scan_abort(struct iwl_priv *priv)
return ret; return ret;
} }
EXPORT_SYMBOL(iwl_send_scan_abort);
/* Service response to REPLY_SCAN_CMD (0x80) */ /* Service response to REPLY_SCAN_CMD (0x80) */
static void iwl_rx_reply_scan(struct iwl_priv *priv, static void iwl_rx_reply_scan(struct iwl_priv *priv,
...@@ -322,7 +321,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, ...@@ -322,7 +321,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
u8 is_active, u8 n_probes, u8 is_active, u8 n_probes,
struct iwl_scan_channel *scan_ch) struct iwl_scan_channel *scan_ch)
{ {
const struct ieee80211_channel *channels = NULL; struct ieee80211_channel *chan;
const struct ieee80211_supported_band *sband; const struct ieee80211_supported_band *sband;
const struct iwl_channel_info *ch_info; const struct iwl_channel_info *ch_info;
u16 passive_dwell = 0; u16 passive_dwell = 0;
...@@ -334,20 +333,19 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, ...@@ -334,20 +333,19 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
if (!sband) if (!sband)
return 0; return 0;
channels = sband->channels;
active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); active_dwell = iwl_get_active_dwell_time(priv, band, n_probes);
passive_dwell = iwl_get_passive_dwell_time(priv, band); passive_dwell = iwl_get_passive_dwell_time(priv, band);
if (passive_dwell <= active_dwell) if (passive_dwell <= active_dwell)
passive_dwell = active_dwell + 1; passive_dwell = active_dwell + 1;
for (i = 0, added = 0; i < sband->n_channels; i++) { for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) {
if (channels[i].flags & IEEE80211_CHAN_DISABLED) chan = priv->scan_request->channels[i];
if (chan->band != band)
continue; continue;
channel = channel = ieee80211_frequency_to_channel(chan->center_freq);
ieee80211_frequency_to_channel(channels[i].center_freq);
scan_ch->channel = cpu_to_le16(channel); scan_ch->channel = cpu_to_le16(channel);
ch_info = iwl_get_channel_info(priv, band, channel); ch_info = iwl_get_channel_info(priv, band, channel);
...@@ -358,7 +356,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv, ...@@ -358,7 +356,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
} }
if (!is_active || is_channel_passive(ch_info) || if (!is_active || is_channel_passive(ch_info) ||
(channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN))
scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
else else
scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
...@@ -405,7 +403,7 @@ void iwl_init_scan_params(struct iwl_priv *priv) ...@@ -405,7 +403,7 @@ void iwl_init_scan_params(struct iwl_priv *priv)
priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
} }
int iwl_scan_initiate(struct iwl_priv *priv) static int iwl_scan_initiate(struct iwl_priv *priv)
{ {
if (!iwl_is_ready_rf(priv)) { if (!iwl_is_ready_rf(priv)) {
IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n"); IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n");
...@@ -423,10 +421,6 @@ int iwl_scan_initiate(struct iwl_priv *priv) ...@@ -423,10 +421,6 @@ int iwl_scan_initiate(struct iwl_priv *priv)
} }
IWL_DEBUG_INFO(priv, "Starting scan...\n"); IWL_DEBUG_INFO(priv, "Starting scan...\n");
if (priv->cfg->sku & IWL_SKU_G)
priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
if (priv->cfg->sku & IWL_SKU_A)
priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
set_bit(STATUS_SCANNING, &priv->status); set_bit(STATUS_SCANNING, &priv->status);
priv->scan_start = jiffies; priv->scan_start = jiffies;
priv->scan_pass_start = priv->scan_start; priv->scan_pass_start = priv->scan_start;
...@@ -435,7 +429,6 @@ int iwl_scan_initiate(struct iwl_priv *priv) ...@@ -435,7 +429,6 @@ int iwl_scan_initiate(struct iwl_priv *priv)
return 0; return 0;
} }
EXPORT_SYMBOL(iwl_scan_initiate);
#define IWL_DELAY_NEXT_SCAN (HZ*2) #define IWL_DELAY_NEXT_SCAN (HZ*2)
...@@ -444,7 +437,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw, ...@@ -444,7 +437,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
{ {
unsigned long flags; unsigned long flags;
struct iwl_priv *priv = hw->priv; struct iwl_priv *priv = hw->priv;
int ret; int ret, i;
IWL_DEBUG_MAC80211(priv, "enter\n"); IWL_DEBUG_MAC80211(priv, "enter\n");
...@@ -478,6 +471,10 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw, ...@@ -478,6 +471,10 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
goto out_unlock; goto out_unlock;
} }
priv->scan_bands = 0;
for (i = 0; i < req->n_channels; i++)
priv->scan_bands |= BIT(req->channels[i]->band);
priv->scan_request = req; priv->scan_request = req;
ret = iwl_scan_initiate(priv); ret = iwl_scan_initiate(priv);
......
...@@ -1844,7 +1844,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, ...@@ -1844,7 +1844,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
u8 is_active, u8 n_probes, u8 is_active, u8 n_probes,
struct iwl3945_scan_channel *scan_ch) struct iwl3945_scan_channel *scan_ch)
{ {
const struct ieee80211_channel *channels = NULL; struct ieee80211_channel *chan;
const struct ieee80211_supported_band *sband; const struct ieee80211_supported_band *sband;
const struct iwl_channel_info *ch_info; const struct iwl_channel_info *ch_info;
u16 passive_dwell = 0; u16 passive_dwell = 0;
...@@ -1855,19 +1855,19 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, ...@@ -1855,19 +1855,19 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
if (!sband) if (!sband)
return 0; return 0;
channels = sband->channels;
active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); active_dwell = iwl_get_active_dwell_time(priv, band, n_probes);
passive_dwell = iwl_get_passive_dwell_time(priv, band); passive_dwell = iwl_get_passive_dwell_time(priv, band);
if (passive_dwell <= active_dwell) if (passive_dwell <= active_dwell)
passive_dwell = active_dwell + 1; passive_dwell = active_dwell + 1;
for (i = 0, added = 0; i < sband->n_channels; i++) { for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) {
if (channels[i].flags & IEEE80211_CHAN_DISABLED) chan = priv->scan_request->channels[i];
if (chan->band != band)
continue; continue;
scan_ch->channel = channels[i].hw_value; scan_ch->channel = chan->hw_value;
ch_info = iwl_get_channel_info(priv, band, scan_ch->channel); ch_info = iwl_get_channel_info(priv, band, scan_ch->channel);
if (!is_channel_valid(ch_info)) { if (!is_channel_valid(ch_info)) {
...@@ -1882,7 +1882,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, ...@@ -1882,7 +1882,7 @@ static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
* and use long active_dwell time. * and use long active_dwell time.
*/ */
if (!is_active || is_channel_passive(ch_info) || if (!is_active || is_channel_passive(ch_info) ||
(channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) { (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN)) {
scan_ch->type = 0; /* passive */ scan_ch->type = 0; /* passive */
if (IWL_UCODE_API(priv->ucode_ver) == 1) if (IWL_UCODE_API(priv->ucode_ver) == 1)
scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1); scan_ch->active_dwell = cpu_to_le16(passive_dwell - 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment