diff options
author | Ron Rindjunsky <ron.rindjunsky@intel.com> | 2008-06-25 04:46:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-06-25 10:57:03 -0400 |
commit | 66b5004d85164a6439d3ba1e7757734472ee2cac (patch) | |
tree | 7305f0430e161543230dd9e45256829fb12d50e4 | |
parent | 99ade2597e3f7f0ad463c489aaccd6cc605e242c (diff) |
iwlwifi: improve scanning band selection management
This patch modifies the band selection management when scanning, so
bands are now scanned according to HW band support.
Signed-off-by: Ron Rindjunsky <ron.rindjunsky@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 39 |
2 files changed, 39 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 13925b627e3b..b1b3c523185d 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -2227,7 +2227,10 @@ static int iwl3945_scan_initiate(struct iwl3945_priv *priv) | |||
2227 | } | 2227 | } |
2228 | 2228 | ||
2229 | IWL_DEBUG_INFO("Starting scan...\n"); | 2229 | IWL_DEBUG_INFO("Starting scan...\n"); |
2230 | priv->scan_bands = 2; | 2230 | if (priv->cfg->sku & IWL_SKU_G) |
2231 | priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ); | ||
2232 | if (priv->cfg->sku & IWL_SKU_A) | ||
2233 | priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ); | ||
2231 | set_bit(STATUS_SCANNING, &priv->status); | 2234 | set_bit(STATUS_SCANNING, &priv->status); |
2232 | priv->scan_start = jiffies; | 2235 | priv->scan_start = jiffies; |
2233 | priv->scan_pass_start = priv->scan_start; | 2236 | priv->scan_pass_start = priv->scan_start; |
@@ -3352,13 +3355,18 @@ static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv, | |||
3352 | cancel_delayed_work(&priv->scan_check); | 3355 | cancel_delayed_work(&priv->scan_check); |
3353 | 3356 | ||
3354 | IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", | 3357 | IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", |
3355 | (priv->scan_bands == 2) ? "2.4" : "5.2", | 3358 | (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ? |
3359 | "2.4" : "5.2", | ||
3356 | jiffies_to_msecs(elapsed_jiffies | 3360 | jiffies_to_msecs(elapsed_jiffies |
3357 | (priv->scan_pass_start, jiffies))); | 3361 | (priv->scan_pass_start, jiffies))); |
3358 | 3362 | ||
3359 | /* Remove this scanned band from the list | 3363 | /* Remove this scanned band from the list of pending |
3360 | * of pending bands to scan */ | 3364 | * bands to scan, band G precedes A in order of scanning |
3361 | priv->scan_bands--; | 3365 | * as seen in iwl3945_bg_request_scan */ |
3366 | if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) | ||
3367 | priv->scan_bands &= ~BIT(IEEE80211_BAND_2GHZ); | ||
3368 | else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) | ||
3369 | priv->scan_bands &= ~BIT(IEEE80211_BAND_5GHZ); | ||
3362 | 3370 | ||
3363 | /* If a request to abort was given, or the scan did not succeed | 3371 | /* If a request to abort was given, or the scan did not succeed |
3364 | * then we reset the scan state machine and terminate, | 3372 | * then we reset the scan state machine and terminate, |
@@ -4972,7 +4980,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, | |||
4972 | 4980 | ||
4973 | ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel); | 4981 | ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel); |
4974 | if (!is_channel_valid(ch_info)) { | 4982 | if (!is_channel_valid(ch_info)) { |
4975 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", | 4983 | IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n", |
4976 | scan_ch->channel); | 4984 | scan_ch->channel); |
4977 | continue; | 4985 | continue; |
4978 | } | 4986 | } |
@@ -6315,21 +6323,16 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6315 | 6323 | ||
6316 | /* flags + rate selection */ | 6324 | /* flags + rate selection */ |
6317 | 6325 | ||
6318 | switch (priv->scan_bands) { | 6326 | if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) { |
6319 | case 2: | ||
6320 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | 6327 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; |
6321 | scan->tx_cmd.rate = IWL_RATE_1M_PLCP; | 6328 | scan->tx_cmd.rate = IWL_RATE_1M_PLCP; |
6322 | scan->good_CRC_th = 0; | 6329 | scan->good_CRC_th = 0; |
6323 | band = IEEE80211_BAND_2GHZ; | 6330 | band = IEEE80211_BAND_2GHZ; |
6324 | break; | 6331 | } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { |
6325 | |||
6326 | case 1: | ||
6327 | scan->tx_cmd.rate = IWL_RATE_6M_PLCP; | 6332 | scan->tx_cmd.rate = IWL_RATE_6M_PLCP; |
6328 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | 6333 | scan->good_CRC_th = IWL_GOOD_CRC_TH; |
6329 | band = IEEE80211_BAND_5GHZ; | 6334 | band = IEEE80211_BAND_5GHZ; |
6330 | break; | 6335 | } else { |
6331 | |||
6332 | default: | ||
6333 | IWL_WARNING("Invalid scan band count\n"); | 6336 | IWL_WARNING("Invalid scan band count\n"); |
6334 | goto done; | 6337 | goto done; |
6335 | } | 6338 | } |
@@ -6770,7 +6773,7 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co | |||
6770 | ch_info = iwl3945_get_channel_info(priv, conf->channel->band, | 6773 | ch_info = iwl3945_get_channel_info(priv, conf->channel->band, |
6771 | conf->channel->hw_value); | 6774 | conf->channel->hw_value); |
6772 | if (!is_channel_valid(ch_info)) { | 6775 | if (!is_channel_valid(ch_info)) { |
6773 | IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", | 6776 | IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this band.\n", |
6774 | conf->channel->hw_value, conf->channel->band); | 6777 | conf->channel->hw_value, conf->channel->band); |
6775 | IWL_DEBUG_MAC80211("leave - invalid channel\n"); | 6778 | IWL_DEBUG_MAC80211("leave - invalid channel\n"); |
6776 | spin_unlock_irqrestore(&priv->lock, flags); | 6779 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 883b42f7e998..5ed16ce78468 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -1774,7 +1774,10 @@ static int iwl4965_scan_initiate(struct iwl_priv *priv) | |||
1774 | } | 1774 | } |
1775 | 1775 | ||
1776 | IWL_DEBUG_INFO("Starting scan...\n"); | 1776 | IWL_DEBUG_INFO("Starting scan...\n"); |
1777 | priv->scan_bands = 2; | 1777 | if (priv->cfg->sku & IWL_SKU_G) |
1778 | priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ); | ||
1779 | if (priv->cfg->sku & IWL_SKU_A) | ||
1780 | priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ); | ||
1778 | set_bit(STATUS_SCANNING, &priv->status); | 1781 | set_bit(STATUS_SCANNING, &priv->status); |
1779 | priv->scan_start = jiffies; | 1782 | priv->scan_start = jiffies; |
1780 | priv->scan_pass_start = priv->scan_start; | 1783 | priv->scan_pass_start = priv->scan_start; |
@@ -3023,8 +3026,9 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv, | |||
3023 | 3026 | ||
3024 | IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); | 3027 | IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); |
3025 | if (index != -1) { | 3028 | if (index != -1) { |
3026 | int freed = iwl4965_tx_queue_reclaim(priv, txq_id, index); | ||
3027 | #ifdef CONFIG_IWL4965_HT | 3029 | #ifdef CONFIG_IWL4965_HT |
3030 | int freed = iwl4965_tx_queue_reclaim(priv, txq_id, index); | ||
3031 | |||
3028 | if (tid != MAX_TID_COUNT) | 3032 | if (tid != MAX_TID_COUNT) |
3029 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; | 3033 | priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; |
3030 | if (iwl4965_queue_space(&txq->q) > txq->q.low_mark && | 3034 | if (iwl4965_queue_space(&txq->q) > txq->q.low_mark && |
@@ -3276,13 +3280,18 @@ static void iwl4965_rx_scan_complete_notif(struct iwl_priv *priv, | |||
3276 | cancel_delayed_work(&priv->scan_check); | 3280 | cancel_delayed_work(&priv->scan_check); |
3277 | 3281 | ||
3278 | IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", | 3282 | IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", |
3279 | (priv->scan_bands == 2) ? "2.4" : "5.2", | 3283 | (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ? |
3284 | "2.4" : "5.2", | ||
3280 | jiffies_to_msecs(elapsed_jiffies | 3285 | jiffies_to_msecs(elapsed_jiffies |
3281 | (priv->scan_pass_start, jiffies))); | 3286 | (priv->scan_pass_start, jiffies))); |
3282 | 3287 | ||
3283 | /* Remove this scanned band from the list | 3288 | /* Remove this scanned band from the list of pending |
3284 | * of pending bands to scan */ | 3289 | * bands to scan, band G precedes A in order of scanning |
3285 | priv->scan_bands--; | 3290 | * as seen in iwl_bg_request_scan */ |
3291 | if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) | ||
3292 | priv->scan_bands &= ~BIT(IEEE80211_BAND_2GHZ); | ||
3293 | else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) | ||
3294 | priv->scan_bands &= ~BIT(IEEE80211_BAND_5GHZ); | ||
3286 | 3295 | ||
3287 | /* If a request to abort was given, or the scan did not succeed | 3296 | /* If a request to abort was given, or the scan did not succeed |
3288 | * then we reset the scan state machine and terminate, | 3297 | * then we reset the scan state machine and terminate, |
@@ -3292,7 +3301,7 @@ static void iwl4965_rx_scan_complete_notif(struct iwl_priv *priv, | |||
3292 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); | 3301 | clear_bit(STATUS_SCAN_ABORTING, &priv->status); |
3293 | } else { | 3302 | } else { |
3294 | /* If there are more bands on this scan pass reschedule */ | 3303 | /* If there are more bands on this scan pass reschedule */ |
3295 | if (priv->scan_bands > 0) | 3304 | if (priv->scan_bands) |
3296 | goto reschedule; | 3305 | goto reschedule; |
3297 | } | 3306 | } |
3298 | 3307 | ||
@@ -4635,10 +4644,9 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv, | |||
4635 | 4644 | ||
4636 | scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq); | 4645 | scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq); |
4637 | 4646 | ||
4638 | ch_info = iwl_get_channel_info(priv, band, | 4647 | ch_info = iwl_get_channel_info(priv, band, scan_ch->channel); |
4639 | scan_ch->channel); | ||
4640 | if (!is_channel_valid(ch_info)) { | 4648 | if (!is_channel_valid(ch_info)) { |
4641 | IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", | 4649 | IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n", |
4642 | scan_ch->channel); | 4650 | scan_ch->channel); |
4643 | continue; | 4651 | continue; |
4644 | } | 4652 | } |
@@ -5830,8 +5838,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
5830 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | 5838 | scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; |
5831 | 5839 | ||
5832 | 5840 | ||
5833 | switch (priv->scan_bands) { | 5841 | if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) { |
5834 | case 2: | ||
5835 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; | 5842 | scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; |
5836 | scan->tx_cmd.rate_n_flags = | 5843 | scan->tx_cmd.rate_n_flags = |
5837 | iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, | 5844 | iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, |
@@ -5839,17 +5846,13 @@ static void iwl4965_bg_request_scan(struct work_struct *data) | |||
5839 | 5846 | ||
5840 | scan->good_CRC_th = 0; | 5847 | scan->good_CRC_th = 0; |
5841 | band = IEEE80211_BAND_2GHZ; | 5848 | band = IEEE80211_BAND_2GHZ; |
5842 | break; | 5849 | } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) { |
5843 | |||
5844 | case 1: | ||
5845 | scan->tx_cmd.rate_n_flags = | 5850 | scan->tx_cmd.rate_n_flags = |
5846 | iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, | 5851 | iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, |
5847 | RATE_MCS_ANT_B_MSK); | 5852 | RATE_MCS_ANT_B_MSK); |
5848 | scan->good_CRC_th = IWL_GOOD_CRC_TH; | 5853 | scan->good_CRC_th = IWL_GOOD_CRC_TH; |
5849 | band = IEEE80211_BAND_5GHZ; | 5854 | band = IEEE80211_BAND_5GHZ; |
5850 | break; | 5855 | } else { |
5851 | |||
5852 | default: | ||
5853 | IWL_WARNING("Invalid scan band count\n"); | 5856 | IWL_WARNING("Invalid scan band count\n"); |
5854 | goto done; | 5857 | goto done; |
5855 | } | 5858 | } |