aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-04-06 07:12:37 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-04-16 16:46:38 -0400
commit00700ee007cf842ef2eb20201080ceddcfdaf9ad (patch)
tree7bfe01fc98ddf7f8326b68aa2d19ca5652dd127a /drivers
parent3a23d69582fa4bfcb443631bcd3d0d2afcc19208 (diff)
iwlwifi: remove scan_bands logic
Since mac80211 will now never request scanning multiple bands, we can remove all the associated logic and scan a single band only in each scan. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c59
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c16
3 files changed, 25 insertions, 52 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index b2d94c7c6457..ee4cb028e138 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1054,7 +1054,7 @@ struct iwl_priv {
1054 unsigned long scan_pass_start; 1054 unsigned long scan_pass_start;
1055 unsigned long scan_start_tsf; 1055 unsigned long scan_start_tsf;
1056 void *scan; 1056 void *scan;
1057 int scan_bands; 1057 enum ieee80211_band scan_band;
1058 struct cfg80211_scan_request *scan_request; 1058 struct cfg80211_scan_request *scan_request;
1059 bool is_internal_short_scan; 1059 bool is_internal_short_scan;
1060 u8 scan_tx_ant[IEEE80211_NUM_BANDS]; 1060 u8 scan_tx_ant[IEEE80211_NUM_BANDS];
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index c3b06c4b6f3e..3904bb45ca61 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -223,29 +223,16 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
223 clear_bit(STATUS_SCAN_HW, &priv->status); 223 clear_bit(STATUS_SCAN_HW, &priv->status);
224 224
225 IWL_DEBUG_INFO(priv, "Scan pass on %sGHz took %dms\n", 225 IWL_DEBUG_INFO(priv, "Scan pass on %sGHz took %dms\n",
226 (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ? 226 (priv->scan_band == IEEE80211_BAND_2GHZ) ? "2.4" : "5.2",
227 "2.4" : "5.2",
228 jiffies_to_msecs(elapsed_jiffies 227 jiffies_to_msecs(elapsed_jiffies
229 (priv->scan_pass_start, jiffies))); 228 (priv->scan_pass_start, jiffies)));
230 229
231 /* Remove this scanned band from the list of pending
232 * bands to scan, band G precedes A in order of scanning
233 * as seen in iwl_bg_request_scan */
234 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ))
235 priv->scan_bands &= ~BIT(IEEE80211_BAND_2GHZ);
236 else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ))
237 priv->scan_bands &= ~BIT(IEEE80211_BAND_5GHZ);
238
239 /* If a request to abort was given, or the scan did not succeed 230 /* If a request to abort was given, or the scan did not succeed
240 * then we reset the scan state machine and terminate, 231 * then we reset the scan state machine and terminate,
241 * re-queuing another scan if one has been requested */ 232 * re-queuing another scan if one has been requested */
242 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) { 233 if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
243 IWL_DEBUG_INFO(priv, "Aborted scan completed.\n"); 234 IWL_DEBUG_INFO(priv, "Aborted scan completed.\n");
244 clear_bit(STATUS_SCAN_ABORTING, &priv->status); 235 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
245 } else {
246 /* If there are more bands on this scan pass reschedule */
247 if (priv->scan_bands)
248 goto reschedule;
249 } 236 }
250 237
251 if (!priv->is_internal_short_scan) 238 if (!priv->is_internal_short_scan)
@@ -259,12 +246,6 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
259 jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies))); 246 jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies)));
260 247
261 queue_work(priv->workqueue, &priv->scan_completed); 248 queue_work(priv->workqueue, &priv->scan_completed);
262
263 return;
264
265reschedule:
266 priv->scan_pass_start = jiffies;
267 queue_work(priv->workqueue, &priv->request_scan);
268} 249}
269 250
270void iwl_setup_rx_scan_handlers(struct iwl_priv *priv) 251void iwl_setup_rx_scan_handlers(struct iwl_priv *priv)
@@ -489,10 +470,13 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
489{ 470{
490 unsigned long flags; 471 unsigned long flags;
491 struct iwl_priv *priv = hw->priv; 472 struct iwl_priv *priv = hw->priv;
492 int ret, i; 473 int ret;
493 474
494 IWL_DEBUG_MAC80211(priv, "enter\n"); 475 IWL_DEBUG_MAC80211(priv, "enter\n");
495 476
477 if (req->n_channels == 0)
478 return -EINVAL;
479
496 mutex_lock(&priv->mutex); 480 mutex_lock(&priv->mutex);
497 spin_lock_irqsave(&priv->lock, flags); 481 spin_lock_irqsave(&priv->lock, flags);
498 482
@@ -526,10 +510,8 @@ int iwl_mac_hw_scan(struct ieee80211_hw *hw,
526 goto out_unlock; 510 goto out_unlock;
527 } 511 }
528 512
529 priv->scan_bands = 0; 513 /* mac80211 will only ask for one band at a time */
530 for (i = 0; i < req->n_channels; i++) 514 priv->scan_band = req->channels[0]->band;
531 priv->scan_bands |= BIT(req->channels[i]->band);
532
533 priv->scan_request = req; 515 priv->scan_request = req;
534 516
535 ret = iwl_scan_initiate(priv); 517 ret = iwl_scan_initiate(priv);
@@ -575,11 +557,7 @@ static void iwl_bg_start_internal_scan(struct work_struct *work)
575 goto unlock; 557 goto unlock;
576 } 558 }
577 559
578 priv->scan_bands = 0; 560 priv->scan_band = priv->band;
579 if (priv->band == IEEE80211_BAND_5GHZ)
580 priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
581 else
582 priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
583 561
584 IWL_DEBUG_SCAN(priv, "Start internal short scan...\n"); 562 IWL_DEBUG_SCAN(priv, "Start internal short scan...\n");
585 set_bit(STATUS_SCANNING, &priv->status); 563 set_bit(STATUS_SCANNING, &priv->status);
@@ -727,11 +705,6 @@ static void iwl_bg_request_scan(struct work_struct *data)
727 goto done; 705 goto done;
728 } 706 }
729 707
730 if (!priv->scan_bands) {
731 IWL_DEBUG_HC(priv, "Aborting scan due to no requested bands\n");
732 goto done;
733 }
734
735 if (!priv->scan) { 708 if (!priv->scan) {
736 priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) + 709 priv->scan = kmalloc(sizeof(struct iwl_scan_cmd) +
737 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 710 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
@@ -798,9 +771,8 @@ static void iwl_bg_request_scan(struct work_struct *data)
798 scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id; 771 scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id;
799 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 772 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
800 773
801 774 switch (priv->scan_band) {
802 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) { 775 case IEEE80211_BAND_2GHZ:
803 band = IEEE80211_BAND_2GHZ;
804 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 776 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
805 chan_mod = le32_to_cpu(priv->active_rxon.flags & RXON_FLG_CHANNEL_MODE_MSK) 777 chan_mod = le32_to_cpu(priv->active_rxon.flags & RXON_FLG_CHANNEL_MODE_MSK)
806 >> RXON_FLG_CHANNEL_MODE_POS; 778 >> RXON_FLG_CHANNEL_MODE_POS;
@@ -811,8 +783,8 @@ static void iwl_bg_request_scan(struct work_struct *data)
811 rate_flags = RATE_MCS_CCK_MSK; 783 rate_flags = RATE_MCS_CCK_MSK;
812 } 784 }
813 scan->good_CRC_th = 0; 785 scan->good_CRC_th = 0;
814 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { 786 break;
815 band = IEEE80211_BAND_5GHZ; 787 case IEEE80211_BAND_5GHZ:
816 rate = IWL_RATE_6M_PLCP; 788 rate = IWL_RATE_6M_PLCP;
817 /* 789 /*
818 * If active scaning is requested but a certain channel 790 * If active scaning is requested but a certain channel
@@ -827,13 +799,16 @@ static void iwl_bg_request_scan(struct work_struct *data)
827 */ 799 */
828 if (priv->cfg->off_channel_workaround) 800 if (priv->cfg->off_channel_workaround)
829 rx_ant = ANT_BC; 801 rx_ant = ANT_BC;
830 } else { 802 break;
803 default:
831 IWL_WARN(priv, "Invalid scan band count\n"); 804 IWL_WARN(priv, "Invalid scan band count\n");
832 goto done; 805 goto done;
833 } 806 }
834 807
808 band = priv->scan_band;
809
835 priv->scan_tx_ant[band] = 810 priv->scan_tx_ant[band] =
836 iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band]); 811 iwl_toggle_tx_ant(priv, priv->scan_tx_ant[band]);
837 rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]); 812 rate_flags |= iwl_ant_idx_to_flags(priv->scan_tx_ant[band]);
838 scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags); 813 scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags);
839 814
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 24e969440b31..e26669558fc2 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2852,11 +2852,6 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2852 goto done; 2852 goto done;
2853 } 2853 }
2854 2854
2855 if (!priv->scan_bands) {
2856 IWL_DEBUG_HC(priv, "Aborting scan due to no requested bands\n");
2857 goto done;
2858 }
2859
2860 if (!priv->scan) { 2855 if (!priv->scan) {
2861 priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) + 2856 priv->scan = kmalloc(sizeof(struct iwl3945_scan_cmd) +
2862 IWL_MAX_SCAN_SIZE, GFP_KERNEL); 2857 IWL_MAX_SCAN_SIZE, GFP_KERNEL);
@@ -2934,12 +2929,14 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2934 2929
2935 /* flags + rate selection */ 2930 /* flags + rate selection */
2936 2931
2937 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) { 2932 switch (priv->scan_band) {
2933 case IEEE80211_BAND_2GHZ:
2938 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 2934 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
2939 scan->tx_cmd.rate = IWL_RATE_1M_PLCP; 2935 scan->tx_cmd.rate = IWL_RATE_1M_PLCP;
2940 scan->good_CRC_th = 0; 2936 scan->good_CRC_th = 0;
2941 band = IEEE80211_BAND_2GHZ; 2937 band = IEEE80211_BAND_2GHZ;
2942 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { 2938 break;
2939 case IEEE80211_BAND_5GHZ:
2943 scan->tx_cmd.rate = IWL_RATE_6M_PLCP; 2940 scan->tx_cmd.rate = IWL_RATE_6M_PLCP;
2944 /* 2941 /*
2945 * If active scaning is requested but a certain channel 2942 * If active scaning is requested but a certain channel
@@ -2948,8 +2945,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
2948 */ 2945 */
2949 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0; 2946 scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH : 0;
2950 band = IEEE80211_BAND_5GHZ; 2947 band = IEEE80211_BAND_5GHZ;
2951 } else { 2948 break;
2952 IWL_WARN(priv, "Invalid scan band count\n"); 2949 default:
2950 IWL_WARN(priv, "Invalid scan band\n");
2953 goto done; 2951 goto done;
2954 } 2952 }
2955 2953