aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-scan.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index e26875dbe859..00398d973a07 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -109,7 +109,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
109} 109}
110EXPORT_SYMBOL(iwl_scan_cancel_timeout); 110EXPORT_SYMBOL(iwl_scan_cancel_timeout);
111 111
112int iwl_send_scan_abort(struct iwl_priv *priv) 112static int iwl_send_scan_abort(struct iwl_priv *priv)
113{ 113{
114 int ret = 0; 114 int ret = 0;
115 struct iwl_rx_packet *res; 115 struct iwl_rx_packet *res;
@@ -150,7 +150,6 @@ int iwl_send_scan_abort(struct iwl_priv *priv)
150 150
151 return ret; 151 return ret;
152} 152}
153EXPORT_SYMBOL(iwl_send_scan_abort);
154 153
155/* Service response to REPLY_SCAN_CMD (0x80) */ 154/* Service response to REPLY_SCAN_CMD (0x80) */
156static void iwl_rx_reply_scan(struct iwl_priv *priv, 155static 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 u8 is_active, u8 n_probes, 321 u8 is_active, u8 n_probes,
323 struct iwl_scan_channel *scan_ch) 322 struct iwl_scan_channel *scan_ch)
324{ 323{
325 const struct ieee80211_channel *channels = NULL; 324 struct ieee80211_channel *chan;
326 const struct ieee80211_supported_band *sband; 325 const struct ieee80211_supported_band *sband;
327 const struct iwl_channel_info *ch_info; 326 const struct iwl_channel_info *ch_info;
328 u16 passive_dwell = 0; 327 u16 passive_dwell = 0;
@@ -334,20 +333,19 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
334 if (!sband) 333 if (!sband)
335 return 0; 334 return 0;
336 335
337 channels = sband->channels;
338
339 active_dwell = iwl_get_active_dwell_time(priv, band, n_probes); 336 active_dwell = iwl_get_active_dwell_time(priv, band, n_probes);
340 passive_dwell = iwl_get_passive_dwell_time(priv, band); 337 passive_dwell = iwl_get_passive_dwell_time(priv, band);
341 338
342 if (passive_dwell <= active_dwell) 339 if (passive_dwell <= active_dwell)
343 passive_dwell = active_dwell + 1; 340 passive_dwell = active_dwell + 1;
344 341
345 for (i = 0, added = 0; i < sband->n_channels; i++) { 342 for (i = 0, added = 0; i < priv->scan_request->n_channels; i++) {
346 if (channels[i].flags & IEEE80211_CHAN_DISABLED) 343 chan = priv->scan_request->channels[i];
344
345 if (chan->band != band)
347 continue; 346 continue;
348 347
349 channel = 348 channel = ieee80211_frequency_to_channel(chan->center_freq);
350 ieee80211_frequency_to_channel(channels[i].center_freq);
351 scan_ch->channel = cpu_to_le16(channel); 349 scan_ch->channel = cpu_to_le16(channel);
352 350
353 ch_info = iwl_get_channel_info(priv, band, channel); 351 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 } 356 }
359 357
360 if (!is_active || is_channel_passive(ch_info) || 358 if (!is_active || is_channel_passive(ch_info) ||
361 (channels[i].flags & IEEE80211_CHAN_PASSIVE_SCAN)) 359 (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN))
362 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; 360 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
363 else 361 else
364 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE; 362 scan_ch->type = SCAN_CHANNEL_TYPE_ACTIVE;
@@ -405,7 +403,7 @@ void iwl_init_scan_params(struct iwl_priv *priv)
405 priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; 403 priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
406} 404}
407 405
408int iwl_scan_initiate(struct iwl_priv *priv) 406static int iwl_scan_initiate(struct iwl_priv *priv)
409{ 407{
410 if (!iwl_is_ready_rf(priv)) { 408 if (!iwl_is_ready_rf(priv)) {
411 IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n"); 409 IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n");
@@ -423,10 +421,6 @@ int iwl_scan_initiate(struct iwl_priv *priv)
423 } 421 }
424 422
425 IWL_DEBUG_INFO(priv, "Starting scan...\n"); 423 IWL_DEBUG_INFO(priv, "Starting scan...\n");
426 if (priv->cfg->sku & IWL_SKU_G)
427 priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
428 if (priv->cfg->sku & IWL_SKU_A)
429 priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
430 set_bit(STATUS_SCANNING, &priv->status); 424 set_bit(STATUS_SCANNING, &priv->status);
431 priv->scan_start = jiffies; 425 priv->scan_start = jiffies;
432 priv->scan_pass_start = priv->scan_start; 426 priv->scan_pass_start = priv->scan_start;
@@ -435,7 +429,6 @@ int iwl_scan_initiate(struct iwl_priv *priv)
435 429
436 return 0; 430 return 0;
437} 431}
438EXPORT_SYMBOL(iwl_scan_initiate);
439 432
440#define IWL_DELAY_NEXT_SCAN (HZ*2) 433#define IWL_DELAY_NEXT_SCAN (HZ*2)
441 434
@@ -444,7 +437,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
444{ 437{
445 unsigned long flags; 438 unsigned long flags;
446 struct iwl_priv *priv = hw->priv; 439 struct iwl_priv *priv = hw->priv;
447 int ret; 440 int ret, i;
448 441
449 IWL_DEBUG_MAC80211(priv, "enter\n"); 442 IWL_DEBUG_MAC80211(priv, "enter\n");
450 443
@@ -478,6 +471,10 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
478 goto out_unlock; 471 goto out_unlock;
479 } 472 }
480 473
474 priv->scan_bands = 0;
475 for (i = 0; i < req->n_channels; i++)
476 priv->scan_bands |= BIT(req->channels[i]->band);
477
481 priv->scan_request = req; 478 priv->scan_request = req;
482 479
483 ret = iwl_scan_initiate(priv); 480 ret = iwl_scan_initiate(priv);