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.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index faa6d34cb658..3a4d9e6b0421 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -101,7 +101,7 @@ static void iwl_complete_scan(struct iwl_priv *priv, bool aborted)
101 ieee80211_scan_completed(priv->hw, aborted); 101 ieee80211_scan_completed(priv->hw, aborted);
102 } 102 }
103 103
104 priv->is_internal_short_scan = false; 104 priv->scan_type = IWL_SCAN_NORMAL;
105 priv->scan_vif = NULL; 105 priv->scan_vif = NULL;
106 priv->scan_request = NULL; 106 priv->scan_request = NULL;
107} 107}
@@ -339,10 +339,10 @@ void iwl_init_scan_params(struct iwl_priv *priv)
339 priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx; 339 priv->scan_tx_ant[IEEE80211_BAND_2GHZ] = ant_idx;
340} 340}
341 341
342static int __must_check iwl_scan_initiate(struct iwl_priv *priv, 342int __must_check iwl_scan_initiate(struct iwl_priv *priv,
343 struct ieee80211_vif *vif, 343 struct ieee80211_vif *vif,
344 bool internal, 344 enum iwl_scan_type scan_type,
345 enum ieee80211_band band) 345 enum ieee80211_band band)
346{ 346{
347 int ret; 347 int ret;
348 348
@@ -370,17 +370,19 @@ static int __must_check iwl_scan_initiate(struct iwl_priv *priv,
370 } 370 }
371 371
372 IWL_DEBUG_SCAN(priv, "Starting %sscan...\n", 372 IWL_DEBUG_SCAN(priv, "Starting %sscan...\n",
373 internal ? "internal short " : ""); 373 scan_type == IWL_SCAN_NORMAL ? "" :
374 scan_type == IWL_SCAN_OFFCH_TX ? "offchan TX " :
375 "internal short ");
374 376
375 set_bit(STATUS_SCANNING, &priv->status); 377 set_bit(STATUS_SCANNING, &priv->status);
376 priv->is_internal_short_scan = internal; 378 priv->scan_type = scan_type;
377 priv->scan_start = jiffies; 379 priv->scan_start = jiffies;
378 priv->scan_band = band; 380 priv->scan_band = band;
379 381
380 ret = priv->cfg->ops->utils->request_scan(priv, vif); 382 ret = priv->cfg->ops->utils->request_scan(priv, vif);
381 if (ret) { 383 if (ret) {
382 clear_bit(STATUS_SCANNING, &priv->status); 384 clear_bit(STATUS_SCANNING, &priv->status);
383 priv->is_internal_short_scan = false; 385 priv->scan_type = IWL_SCAN_NORMAL;
384 return ret; 386 return ret;
385 } 387 }
386 388
@@ -405,7 +407,7 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
405 mutex_lock(&priv->mutex); 407 mutex_lock(&priv->mutex);
406 408
407 if (test_bit(STATUS_SCANNING, &priv->status) && 409 if (test_bit(STATUS_SCANNING, &priv->status) &&
408 !priv->is_internal_short_scan) { 410 priv->scan_type != IWL_SCAN_NORMAL) {
409 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n"); 411 IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
410 ret = -EAGAIN; 412 ret = -EAGAIN;
411 goto out_unlock; 413 goto out_unlock;
@@ -419,11 +421,11 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
419 * If an internal scan is in progress, just set 421 * If an internal scan is in progress, just set
420 * up the scan_request as per above. 422 * up the scan_request as per above.
421 */ 423 */
422 if (priv->is_internal_short_scan) { 424 if (priv->scan_type != IWL_SCAN_NORMAL) {
423 IWL_DEBUG_SCAN(priv, "SCAN request during internal scan\n"); 425 IWL_DEBUG_SCAN(priv, "SCAN request during internal scan\n");
424 ret = 0; 426 ret = 0;
425 } else 427 } else
426 ret = iwl_scan_initiate(priv, vif, false, 428 ret = iwl_scan_initiate(priv, vif, IWL_SCAN_NORMAL,
427 req->channels[0]->band); 429 req->channels[0]->band);
428 430
429 IWL_DEBUG_MAC80211(priv, "leave\n"); 431 IWL_DEBUG_MAC80211(priv, "leave\n");
@@ -452,7 +454,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work)
452 454
453 mutex_lock(&priv->mutex); 455 mutex_lock(&priv->mutex);
454 456
455 if (priv->is_internal_short_scan == true) { 457 if (priv->scan_type == IWL_SCAN_RADIO_RESET) {
456 IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n"); 458 IWL_DEBUG_SCAN(priv, "Internal scan already in progress\n");
457 goto unlock; 459 goto unlock;
458 } 460 }
@@ -462,7 +464,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work)
462 goto unlock; 464 goto unlock;
463 } 465 }
464 466
465 if (iwl_scan_initiate(priv, NULL, true, priv->band)) 467 if (iwl_scan_initiate(priv, NULL, IWL_SCAN_RADIO_RESET, priv->band))
466 IWL_DEBUG_SCAN(priv, "failed to start internal short scan\n"); 468 IWL_DEBUG_SCAN(priv, "failed to start internal short scan\n");
467 unlock: 469 unlock:
468 mutex_unlock(&priv->mutex); 470 mutex_unlock(&priv->mutex);
@@ -549,8 +551,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
549 container_of(work, struct iwl_priv, scan_completed); 551 container_of(work, struct iwl_priv, scan_completed);
550 bool aborted; 552 bool aborted;
551 553
552 IWL_DEBUG_SCAN(priv, "Completed %sscan.\n", 554 IWL_DEBUG_SCAN(priv, "Completed scan.\n");
553 priv->is_internal_short_scan ? "internal short " : "");
554 555
555 cancel_delayed_work(&priv->scan_check); 556 cancel_delayed_work(&priv->scan_check);
556 557
@@ -565,7 +566,13 @@ static void iwl_bg_scan_completed(struct work_struct *work)
565 goto out_settings; 566 goto out_settings;
566 } 567 }
567 568
568 if (priv->is_internal_short_scan && !aborted) { 569 if (priv->scan_type == IWL_SCAN_OFFCH_TX && priv->_agn.offchan_tx_skb) {
570 ieee80211_tx_status_irqsafe(priv->hw,
571 priv->_agn.offchan_tx_skb);
572 priv->_agn.offchan_tx_skb = NULL;
573 }
574
575 if (priv->scan_type != IWL_SCAN_NORMAL && !aborted) {
569 int err; 576 int err;
570 577
571 /* Check if mac80211 requested scan during our internal scan */ 578 /* Check if mac80211 requested scan during our internal scan */
@@ -573,7 +580,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
573 goto out_complete; 580 goto out_complete;
574 581
575 /* If so request a new scan */ 582 /* If so request a new scan */
576 err = iwl_scan_initiate(priv, priv->scan_vif, false, 583 err = iwl_scan_initiate(priv, priv->scan_vif, IWL_SCAN_NORMAL,
577 priv->scan_request->channels[0]->band); 584 priv->scan_request->channels[0]->band);
578 if (err) { 585 if (err) {
579 IWL_DEBUG_SCAN(priv, 586 IWL_DEBUG_SCAN(priv,