diff options
author | Abhijeet Kolekar <abhijeet.kolekar@intel.com> | 2010-06-03 00:15:10 -0400 |
---|---|---|
committer | Reinette Chatre <reinette.chatre@intel.com> | 2010-06-06 02:01:55 -0400 |
commit | 1402364162afbaac1b8a74ee21aeb013e817ac7d (patch) | |
tree | 4c75f24ce84ae40d14ab1ec6df79345045b3710d /drivers | |
parent | a6866ac93e6cb68091326e80b4fa4619a5957644 (diff) |
iwl3945: fix internal scan
Port of internal scan to iwl3945 missed introduction
of iwl3945_get_single_channel_for_scan.
Fix the following bug by introducing the iwl3945_get_single_channel_for_scan
http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2208
Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 30 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 39 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 56 |
4 files changed, 96 insertions, 31 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 1004cfc403b1..0f292a210ed9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -1119,10 +1119,9 @@ static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | |||
1119 | struct iwl_scan_channel *scan_ch) | 1119 | struct iwl_scan_channel *scan_ch) |
1120 | { | 1120 | { |
1121 | const struct ieee80211_supported_band *sband; | 1121 | const struct ieee80211_supported_band *sband; |
1122 | const struct iwl_channel_info *ch_info; | ||
1123 | u16 passive_dwell = 0; | 1122 | u16 passive_dwell = 0; |
1124 | u16 active_dwell = 0; | 1123 | u16 active_dwell = 0; |
1125 | int i, added = 0; | 1124 | int added = 0; |
1126 | u16 channel = 0; | 1125 | u16 channel = 0; |
1127 | 1126 | ||
1128 | sband = iwl_get_hw_mode(priv, band); | 1127 | sband = iwl_get_hw_mode(priv, band); |
@@ -1137,32 +1136,7 @@ static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, | |||
1137 | if (passive_dwell <= active_dwell) | 1136 | if (passive_dwell <= active_dwell) |
1138 | passive_dwell = active_dwell + 1; | 1137 | passive_dwell = active_dwell + 1; |
1139 | 1138 | ||
1140 | /* only scan single channel, good enough to reset the RF */ | 1139 | channel = iwl_get_single_channel_number(priv, band); |
1141 | /* pick the first valid not in-use channel */ | ||
1142 | if (band == IEEE80211_BAND_5GHZ) { | ||
1143 | for (i = 14; i < priv->channel_count; i++) { | ||
1144 | if (priv->channel_info[i].channel != | ||
1145 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
1146 | channel = priv->channel_info[i].channel; | ||
1147 | ch_info = iwl_get_channel_info(priv, | ||
1148 | band, channel); | ||
1149 | if (is_channel_valid(ch_info)) | ||
1150 | break; | ||
1151 | } | ||
1152 | } | ||
1153 | } else { | ||
1154 | for (i = 0; i < 14; i++) { | ||
1155 | if (priv->channel_info[i].channel != | ||
1156 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
1157 | channel = | ||
1158 | priv->channel_info[i].channel; | ||
1159 | ch_info = iwl_get_channel_info(priv, | ||
1160 | band, channel); | ||
1161 | if (is_channel_valid(ch_info)) | ||
1162 | break; | ||
1163 | } | ||
1164 | } | ||
1165 | } | ||
1166 | if (channel) { | 1140 | if (channel) { |
1167 | scan_ch->channel = cpu_to_le16(channel); | 1141 | scan_ch->channel = cpu_to_le16(channel); |
1168 | scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; | 1142 | scan_ch->type = SCAN_CHANNEL_TYPE_PASSIVE; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 5a7eca8fb789..426e95567de3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -854,6 +854,45 @@ void iwl_set_rxon_chain(struct iwl_priv *priv) | |||
854 | } | 854 | } |
855 | EXPORT_SYMBOL(iwl_set_rxon_chain); | 855 | EXPORT_SYMBOL(iwl_set_rxon_chain); |
856 | 856 | ||
857 | /* Return valid channel */ | ||
858 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, | ||
859 | enum ieee80211_band band) | ||
860 | { | ||
861 | const struct iwl_channel_info *ch_info; | ||
862 | int i; | ||
863 | u8 channel = 0; | ||
864 | |||
865 | /* only scan single channel, good enough to reset the RF */ | ||
866 | /* pick the first valid not in-use channel */ | ||
867 | if (band == IEEE80211_BAND_5GHZ) { | ||
868 | for (i = 14; i < priv->channel_count; i++) { | ||
869 | if (priv->channel_info[i].channel != | ||
870 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
871 | channel = priv->channel_info[i].channel; | ||
872 | ch_info = iwl_get_channel_info(priv, | ||
873 | band, channel); | ||
874 | if (is_channel_valid(ch_info)) | ||
875 | break; | ||
876 | } | ||
877 | } | ||
878 | } else { | ||
879 | for (i = 0; i < 14; i++) { | ||
880 | if (priv->channel_info[i].channel != | ||
881 | le16_to_cpu(priv->staging_rxon.channel)) { | ||
882 | channel = | ||
883 | priv->channel_info[i].channel; | ||
884 | ch_info = iwl_get_channel_info(priv, | ||
885 | band, channel); | ||
886 | if (is_channel_valid(ch_info)) | ||
887 | break; | ||
888 | } | ||
889 | } | ||
890 | } | ||
891 | |||
892 | return channel; | ||
893 | } | ||
894 | EXPORT_SYMBOL(iwl_get_single_channel_number); | ||
895 | |||
857 | /** | 896 | /** |
858 | * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON | 897 | * iwl_set_rxon_channel - Set the phymode and channel values in staging RXON |
859 | * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz | 898 | * @phymode: MODE_IEEE80211A sets to 5.2GHz; all else set to 2.4GHz |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 7e5a5ba41fd2..31775bd9c361 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -343,6 +343,8 @@ int iwl_check_rxon_cmd(struct iwl_priv *priv); | |||
343 | int iwl_full_rxon_required(struct iwl_priv *priv); | 343 | int iwl_full_rxon_required(struct iwl_priv *priv); |
344 | void iwl_set_rxon_chain(struct iwl_priv *priv); | 344 | void iwl_set_rxon_chain(struct iwl_priv *priv); |
345 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); | 345 | int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch); |
346 | u8 iwl_get_single_channel_number(struct iwl_priv *priv, | ||
347 | enum ieee80211_band band); | ||
346 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); | 348 | void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); |
347 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, | 349 | u8 iwl_is_ht40_tx_allowed(struct iwl_priv *priv, |
348 | struct ieee80211_sta_ht_cap *sta_ht_inf); | 350 | struct ieee80211_sta_ht_cap *sta_ht_inf); |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 3e5bffb6034f..6c353cacc8d6 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -1844,6 +1844,49 @@ static void iwl3945_irq_tasklet(struct iwl_priv *priv) | |||
1844 | #endif | 1844 | #endif |
1845 | } | 1845 | } |
1846 | 1846 | ||
1847 | static int iwl3945_get_single_channel_for_scan(struct iwl_priv *priv, | ||
1848 | struct ieee80211_vif *vif, | ||
1849 | enum ieee80211_band band, | ||
1850 | struct iwl3945_scan_channel *scan_ch) | ||
1851 | { | ||
1852 | const struct ieee80211_supported_band *sband; | ||
1853 | u16 passive_dwell = 0; | ||
1854 | u16 active_dwell = 0; | ||
1855 | int added = 0; | ||
1856 | u8 channel = 0; | ||
1857 | |||
1858 | sband = iwl_get_hw_mode(priv, band); | ||
1859 | if (!sband) { | ||
1860 | IWL_ERR(priv, "invalid band\n"); | ||
1861 | return added; | ||
1862 | } | ||
1863 | |||
1864 | active_dwell = iwl_get_active_dwell_time(priv, band, 0); | ||
1865 | passive_dwell = iwl_get_passive_dwell_time(priv, band, vif); | ||
1866 | |||
1867 | if (passive_dwell <= active_dwell) | ||
1868 | passive_dwell = active_dwell + 1; | ||
1869 | |||
1870 | |||
1871 | channel = iwl_get_single_channel_number(priv, band); | ||
1872 | |||
1873 | if (channel) { | ||
1874 | scan_ch->channel = channel; | ||
1875 | scan_ch->type = 0; /* passive */ | ||
1876 | scan_ch->active_dwell = cpu_to_le16(active_dwell); | ||
1877 | scan_ch->passive_dwell = cpu_to_le16(passive_dwell); | ||
1878 | /* Set txpower levels to defaults */ | ||
1879 | scan_ch->tpc.dsp_atten = 110; | ||
1880 | if (band == IEEE80211_BAND_5GHZ) | ||
1881 | scan_ch->tpc.tx_gain = ((1 << 5) | (3 << 3)) | 3; | ||
1882 | else | ||
1883 | scan_ch->tpc.tx_gain = ((1 << 5) | (5 << 3)); | ||
1884 | added++; | ||
1885 | } else | ||
1886 | IWL_ERR(priv, "no valid channel found\n"); | ||
1887 | return added; | ||
1888 | } | ||
1889 | |||
1847 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, | 1890 | static int iwl3945_get_channels_for_scan(struct iwl_priv *priv, |
1848 | enum ieee80211_band band, | 1891 | enum ieee80211_band band, |
1849 | u8 is_active, u8 n_probes, | 1892 | u8 is_active, u8 n_probes, |
@@ -2992,9 +3035,16 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
2992 | /* select Rx antennas */ | 3035 | /* select Rx antennas */ |
2993 | scan->flags |= iwl3945_get_antenna_flags(priv); | 3036 | scan->flags |= iwl3945_get_antenna_flags(priv); |
2994 | 3037 | ||
2995 | scan->channel_count = | 3038 | if (priv->is_internal_short_scan) { |
2996 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | 3039 | scan->channel_count = |
2997 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); | 3040 | iwl3945_get_single_channel_for_scan(priv, vif, band, |
3041 | (void *)&scan->data[le16_to_cpu( | ||
3042 | scan->tx_cmd.len)]); | ||
3043 | } else { | ||
3044 | scan->channel_count = | ||
3045 | iwl3945_get_channels_for_scan(priv, band, is_active, n_probes, | ||
3046 | (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)], vif); | ||
3047 | } | ||
2998 | 3048 | ||
2999 | if (scan->channel_count == 0) { | 3049 | if (scan->channel_count == 0) { |
3000 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); | 3050 | IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count); |