diff options
author | Abhijeet Kolekar <abhijeet.kolekar@intel.com> | 2008-09-02 23:26:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-09-08 14:23:21 -0400 |
commit | f93405206557077d6508682b624117ec68ea48f6 (patch) | |
tree | 8f130c0f793a9c6f6e33d2c46007ea86470fb99f /drivers/net/wireless/iwlwifi/iwl3945-base.c | |
parent | 05ecc2c1033677e6324965831af1ba6cefbdfa76 (diff) |
iwl3945: enable active scanning on active channels
This patch enables active scanning on active channels.
Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index e3be7f4c648f..cbbe73a12887 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -4782,8 +4782,11 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv) | |||
4782 | /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after | 4782 | /* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after |
4783 | * sending probe req. This should be set long enough to hear probe responses | 4783 | * sending probe req. This should be set long enough to hear probe responses |
4784 | * from more than one AP. */ | 4784 | * from more than one AP. */ |
4785 | #define IWL_ACTIVE_DWELL_TIME_24 (20) /* all times in msec */ | 4785 | #define IWL_ACTIVE_DWELL_TIME_24 (30) /* all times in msec */ |
4786 | #define IWL_ACTIVE_DWELL_TIME_52 (10) | 4786 | #define IWL_ACTIVE_DWELL_TIME_52 (20) |
4787 | |||
4788 | #define IWL_ACTIVE_DWELL_FACTOR_24GHZ (3) | ||
4789 | #define IWL_ACTIVE_DWELL_FACTOR_52GHZ (2) | ||
4787 | 4790 | ||
4788 | /* For faster active scanning, scan will move to the next channel if fewer than | 4791 | /* For faster active scanning, scan will move to the next channel if fewer than |
4789 | * PLCP_QUIET_THRESH packets are heard on this channel within | 4792 | * PLCP_QUIET_THRESH packets are heard on this channel within |
@@ -4792,7 +4795,7 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv) | |||
4792 | * no other traffic). | 4795 | * no other traffic). |
4793 | * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ | 4796 | * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */ |
4794 | #define IWL_PLCP_QUIET_THRESH __constant_cpu_to_le16(1) /* packets */ | 4797 | #define IWL_PLCP_QUIET_THRESH __constant_cpu_to_le16(1) /* packets */ |
4795 | #define IWL_ACTIVE_QUIET_TIME __constant_cpu_to_le16(5) /* msec */ | 4798 | #define IWL_ACTIVE_QUIET_TIME __constant_cpu_to_le16(10) /* msec */ |
4796 | 4799 | ||
4797 | /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. | 4800 | /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel. |
4798 | * Must be set longer than active dwell time. | 4801 | * Must be set longer than active dwell time. |
@@ -4802,13 +4805,18 @@ static void iwl3945_free_channel_map(struct iwl3945_priv *priv) | |||
4802 | #define IWL_PASSIVE_DWELL_BASE (100) | 4805 | #define IWL_PASSIVE_DWELL_BASE (100) |
4803 | #define IWL_CHANNEL_TUNE_TIME 5 | 4806 | #define IWL_CHANNEL_TUNE_TIME 5 |
4804 | 4807 | ||
4808 | #define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1)))) | ||
4809 | |||
4805 | static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, | 4810 | static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv, |
4806 | enum ieee80211_band band) | 4811 | enum ieee80211_band band, |
4812 | u8 n_probes) | ||
4807 | { | 4813 | { |
4808 | if (band == IEEE80211_BAND_5GHZ) | 4814 | if (band == IEEE80211_BAND_5GHZ) |
4809 | return IWL_ACTIVE_DWELL_TIME_52; | 4815 | return IWL_ACTIVE_DWELL_TIME_52 + |
4816 | IWL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1); | ||
4810 | else | 4817 | else |
4811 | return IWL_ACTIVE_DWELL_TIME_24; | 4818 | return IWL_ACTIVE_DWELL_TIME_24 + |
4819 | IWL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1); | ||
4812 | } | 4820 | } |
4813 | 4821 | ||
4814 | static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, | 4822 | static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, |
@@ -4833,7 +4841,7 @@ static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv, | |||
4833 | 4841 | ||
4834 | static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, | 4842 | static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, |
4835 | enum ieee80211_band band, | 4843 | enum ieee80211_band band, |
4836 | u8 is_active, u8 direct_mask, | 4844 | u8 is_active, u8 n_probes, |
4837 | struct iwl3945_scan_channel *scan_ch) | 4845 | struct iwl3945_scan_channel *scan_ch) |
4838 | { | 4846 | { |
4839 | const struct ieee80211_channel *channels = NULL; | 4847 | const struct ieee80211_channel *channels = NULL; |
@@ -4849,7 +4857,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, | |||
4849 | 4857 | ||
4850 | channels = sband->channels; | 4858 | channels = sband->channels; |
4851 | 4859 | ||
4852 | active_dwell = iwl3945_get_active_dwell_time(priv, band); | 4860 | active_dwell = iwl3945_get_active_dwell_time(priv, band, n_probes); |
4853 | passive_dwell = iwl3945_get_passive_dwell_time(priv, band); | 4861 | passive_dwell = iwl3945_get_passive_dwell_time(priv, band); |
4854 | 4862 | ||
4855 | if (passive_dwell <= active_dwell) | 4863 | if (passive_dwell <= active_dwell) |
@@ -4874,8 +4882,8 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv, | |||
4874 | else | 4882 | else |
4875 | scan_ch->type = 1; /* active */ | 4883 | scan_ch->type = 1; /* active */ |
4876 | 4884 | ||
4877 | if (scan_ch->type & 1) | 4885 | if ((scan_ch->type & 1) && n_probes) |
4878 | scan_ch->type |= (direct_mask << 1); | 4886 | scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes); |
4879 | 4887 | ||
4880 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | 4888 | scan_ch->active_dwell = cpu_to_le16(active_dwell); |
4881 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | 4889 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); |
@@ -6092,7 +6100,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6092 | int rc = 0; | 6100 | int rc = 0; |
6093 | struct iwl3945_scan_cmd *scan; | 6101 | struct iwl3945_scan_cmd *scan; |
6094 | struct ieee80211_conf *conf = NULL; | 6102 | struct ieee80211_conf *conf = NULL; |
6095 | u8 direct_mask; | 6103 | u8 n_probes = 2; |
6096 | enum ieee80211_band band; | 6104 | enum ieee80211_band band; |
6097 | 6105 | ||
6098 | conf = ieee80211_get_hw_conf(priv->hw); | 6106 | conf = ieee80211_get_hw_conf(priv->hw); |
@@ -6200,7 +6208,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6200 | scan->direct_scan[0].len = priv->direct_ssid_len; | 6208 | scan->direct_scan[0].len = priv->direct_ssid_len; |
6201 | memcpy(scan->direct_scan[0].ssid, | 6209 | memcpy(scan->direct_scan[0].ssid, |
6202 | priv->direct_ssid, priv->direct_ssid_len); | 6210 | priv->direct_ssid, priv->direct_ssid_len); |
6203 | direct_mask = 1; | 6211 | n_probes++; |
6204 | } else if (!iwl3945_is_associated(priv) && priv->essid_len) { | 6212 | } else if (!iwl3945_is_associated(priv) && priv->essid_len) { |
6205 | IWL_DEBUG_SCAN | 6213 | IWL_DEBUG_SCAN |
6206 | ("Kicking off one direct scan for '%s' when not associated\n", | 6214 | ("Kicking off one direct scan for '%s' when not associated\n", |
@@ -6208,11 +6216,9 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6208 | scan->direct_scan[0].id = WLAN_EID_SSID; | 6216 | scan->direct_scan[0].id = WLAN_EID_SSID; |
6209 | scan->direct_scan[0].len = priv->essid_len; | 6217 | scan->direct_scan[0].len = priv->essid_len; |
6210 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); | 6218 | memcpy(scan->direct_scan[0].ssid, priv->essid, priv->essid_len); |
6211 | direct_mask = 1; | 6219 | n_probes++; |
6212 | } else { | 6220 | } else |
6213 | IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); | 6221 | IWL_DEBUG_SCAN("Kicking off one indirect scan.\n"); |
6214 | direct_mask = 0; | ||
6215 | } | ||
6216 | 6222 | ||
6217 | /* We don't build a direct scan probe request; the uCode will do | 6223 | /* We don't build a direct scan probe request; the uCode will do |
6218 | * that based on the direct_mask added to each channel entry */ | 6224 | * that based on the direct_mask added to each channel entry */ |
@@ -6245,18 +6251,10 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
6245 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) | 6251 | if (priv->iw_mode == IEEE80211_IF_TYPE_MNTR) |
6246 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; | 6252 | scan->filter_flags = RXON_FILTER_PROMISC_MSK; |
6247 | 6253 | ||
6248 | if (direct_mask) | 6254 | scan->channel_count = |
6249 | scan->channel_count = | 6255 | iwl3945_get_channels_for_scan(priv, band, 1, /* active */ |
6250 | iwl3945_get_channels_for_scan( | 6256 | n_probes, |
6251 | priv, band, 1, /* active */ | 6257 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); |
6252 | direct_mask, | ||
6253 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | ||
6254 | else | ||
6255 | scan->channel_count = | ||
6256 | iwl3945_get_channels_for_scan( | ||
6257 | priv, band, 0, /* passive */ | ||
6258 | direct_mask, | ||
6259 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]); | ||
6260 | 6258 | ||
6261 | cmd.len += le16_to_cpu(scan->tx_cmd.len) + | 6259 | cmd.len += le16_to_cpu(scan->tx_cmd.len) + |
6262 | scan->channel_count * sizeof(struct iwl3945_scan_channel); | 6260 | scan->channel_count * sizeof(struct iwl3945_scan_channel); |