aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/dvm/scan.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-06-18 04:17:12 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-06-20 02:41:58 -0400
commit0d4e07726ea468c0f9bb7f84b02a9f1bfd16b69e (patch)
tree4817bf6546c152636eb020692f937b2f75289ef2 /drivers/net/wireless/iwlwifi/dvm/scan.c
parent63d76dc0b97230e012a128a898f56a55e763d91a (diff)
iwlwifi: use minimal time for radio reset scan
The effect of using a short single-channel scan to reset the radio is that scanning a channel that isn't in use needs to re-tune the radio. This means that the dwell time is irrelevant, so use a shorter time. While at it, clean up the code for this a bit. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/dvm/scan.c')
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/scan.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/dvm/scan.c b/drivers/net/wireless/iwlwifi/dvm/scan.c
index 2f271c96ed39..f5b1452a60b3 100644
--- a/drivers/net/wireless/iwlwifi/dvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/dvm/scan.c
@@ -51,6 +51,9 @@
51#define IWL_CHANNEL_TUNE_TIME 5 51#define IWL_CHANNEL_TUNE_TIME 5
52#define MAX_SCAN_CHANNEL 50 52#define MAX_SCAN_CHANNEL 50
53 53
54/* For reset radio, need minimal dwell time only */
55#define IWL_RADIO_RESET_DWELL_TIME 5
56
54static int iwl_send_scan_abort(struct iwl_priv *priv) 57static int iwl_send_scan_abort(struct iwl_priv *priv)
55{ 58{
56 int ret; 59 int ret;
@@ -469,45 +472,39 @@ static u8 iwl_get_single_channel_number(struct iwl_priv *priv,
469 return 0; 472 return 0;
470} 473}
471 474
472static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, 475static int iwl_get_channel_for_reset_scan(struct iwl_priv *priv,
473 struct ieee80211_vif *vif, 476 struct ieee80211_vif *vif,
474 enum ieee80211_band band, 477 enum ieee80211_band band,
475 struct iwl_scan_channel *scan_ch) 478 struct iwl_scan_channel *scan_ch)
476{ 479{
477 const struct ieee80211_supported_band *sband; 480 const struct ieee80211_supported_band *sband;
478 u16 passive_dwell = 0; 481 u16 channel;
479 u16 active_dwell = 0;
480 int added = 0;
481 u16 channel = 0;
482 482
483 sband = iwl_get_hw_mode(priv, band); 483 sband = iwl_get_hw_mode(priv, band);
484 if (!sband) { 484 if (!sband) {
485 IWL_ERR(priv, "invalid band\n"); 485 IWL_ERR(priv, "invalid band\n");
486 return added; 486 return 0;
487 } 487 }
488 488
489 active_dwell = iwl_get_active_dwell_time(priv, band, 0);
490 passive_dwell = iwl_get_passive_dwell_time(priv, band);
491
492 if (passive_dwell <= active_dwell)
493 passive_dwell = active_dwell + 1;
494
495 channel = iwl_get_single_channel_number(priv, band); 489 channel = iwl_get_single_channel_number(priv, band);
496 if (channel) { 490 if (channel) {
497 scan_ch->channel = cpu_to_le16(channel); 491 scan_ch->channel = cpu_to_le16(channel);
498 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; 492 scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE;
499 scan_ch->active_dwell = cpu_to_le16(active_dwell); 493 scan_ch->active_dwell =
500 scan_ch->passive_dwell = cpu_to_le16(passive_dwell); 494 cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME);
495 scan_ch->passive_dwell =
496 cpu_to_le16(IWL_RADIO_RESET_DWELL_TIME);
501 /* Set txpower levels to defaults */ 497 /* Set txpower levels to defaults */
502 scan_ch->dsp_atten = 110; 498 scan_ch->dsp_atten = 110;
503 if (band == IEEE80211_BAND_5GHZ) 499 if (band == IEEE80211_BAND_5GHZ)
504 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3; 500 scan_ch->tx_gain = ((1 << 5) | (3 << 3)) | 3;
505 else 501 else
506 scan_ch->tx_gain = ((1 << 5) | (5 << 3)); 502 scan_ch->tx_gain = ((1 << 5) | (5 << 3));
507 added++; 503 return 1;
508 } else 504 }
509 IWL_ERR(priv, "no valid channel found\n"); 505
510 return added; 506 IWL_ERR(priv, "no valid channel found\n");
507 return 0;
511} 508}
512 509
513static int iwl_get_channels_for_scan(struct iwl_priv *priv, 510static int iwl_get_channels_for_scan(struct iwl_priv *priv,
@@ -896,7 +893,7 @@ static int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
896 switch (priv->scan_type) { 893 switch (priv->scan_type) {
897 case IWL_SCAN_RADIO_RESET: 894 case IWL_SCAN_RADIO_RESET:
898 scan->channel_count = 895 scan->channel_count =
899 iwl_get_single_channel_for_scan(priv, vif, band, 896 iwl_get_channel_for_reset_scan(priv, vif, band,
900 (void *)&scan->data[cmd_len]); 897 (void *)&scan->data[cmd_len]);
901 break; 898 break;
902 case IWL_SCAN_NORMAL: 899 case IWL_SCAN_NORMAL: