diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfp.c | 86 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/join.c | 9 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 9 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/scan.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/sta_ioctl.c | 13 |
5 files changed, 46 insertions, 82 deletions
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c index 1782a77f15dc..7541d9a4a6ed 100644 --- a/drivers/net/wireless/mwifiex/cfp.c +++ b/drivers/net/wireless/mwifiex/cfp.c | |||
@@ -169,59 +169,18 @@ u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, u8 *rates) | |||
169 | 169 | ||
170 | /* | 170 | /* |
171 | * This function locates the Channel-Frequency-Power triplet based upon | 171 | * This function locates the Channel-Frequency-Power triplet based upon |
172 | * band and channel parameters. | 172 | * band and channel/frequency parameters. |
173 | */ | 173 | */ |
174 | struct mwifiex_chan_freq_power * | 174 | struct mwifiex_chan_freq_power * |
175 | mwifiex_get_cfp_by_band_and_channel_from_cfg80211(struct mwifiex_private | 175 | mwifiex_get_cfp(struct mwifiex_private *priv, u8 band, u16 channel, u32 freq) |
176 | *priv, u8 band, u16 channel) | ||
177 | { | 176 | { |
178 | struct mwifiex_chan_freq_power *cfp = NULL; | 177 | struct mwifiex_chan_freq_power *cfp = NULL; |
179 | struct ieee80211_supported_band *sband; | 178 | struct ieee80211_supported_band *sband; |
180 | struct ieee80211_channel *ch; | 179 | struct ieee80211_channel *ch = NULL; |
181 | int i; | 180 | int i; |
182 | 181 | ||
183 | if (mwifiex_band_to_radio_type(band) == HostCmd_SCAN_RADIO_TYPE_BG) | 182 | if (!channel && !freq) |
184 | sband = priv->wdev->wiphy->bands[IEEE80211_BAND_2GHZ]; | ||
185 | else | ||
186 | sband = priv->wdev->wiphy->bands[IEEE80211_BAND_5GHZ]; | ||
187 | |||
188 | if (!sband) { | ||
189 | dev_err(priv->adapter->dev, "%s: cannot find cfp by band %d" | ||
190 | " & channel %d\n", __func__, band, channel); | ||
191 | return cfp; | 183 | return cfp; |
192 | } | ||
193 | |||
194 | for (i = 0; i < sband->n_channels; i++) { | ||
195 | ch = &sband->channels[i]; | ||
196 | if (((ch->hw_value == channel) || | ||
197 | (channel == FIRST_VALID_CHANNEL)) | ||
198 | && !(ch->flags & IEEE80211_CHAN_DISABLED)) { | ||
199 | priv->cfp.channel = channel; | ||
200 | priv->cfp.freq = ch->center_freq; | ||
201 | priv->cfp.max_tx_power = ch->max_power; | ||
202 | cfp = &priv->cfp; | ||
203 | break; | ||
204 | } | ||
205 | } | ||
206 | if (i == sband->n_channels) | ||
207 | dev_err(priv->adapter->dev, "%s: cannot find cfp by band %d" | ||
208 | " & channel %d\n", __func__, band, channel); | ||
209 | |||
210 | return cfp; | ||
211 | } | ||
212 | |||
213 | /* | ||
214 | * This function locates the Channel-Frequency-Power triplet based upon | ||
215 | * band and frequency parameters. | ||
216 | */ | ||
217 | struct mwifiex_chan_freq_power * | ||
218 | mwifiex_get_cfp_by_band_and_freq_from_cfg80211(struct mwifiex_private *priv, | ||
219 | u8 band, u32 freq) | ||
220 | { | ||
221 | struct mwifiex_chan_freq_power *cfp = NULL; | ||
222 | struct ieee80211_supported_band *sband; | ||
223 | struct ieee80211_channel *ch; | ||
224 | int i; | ||
225 | 184 | ||
226 | if (mwifiex_band_to_radio_type(band) == HostCmd_SCAN_RADIO_TYPE_BG) | 185 | if (mwifiex_band_to_radio_type(band) == HostCmd_SCAN_RADIO_TYPE_BG) |
227 | sband = priv->wdev->wiphy->bands[IEEE80211_BAND_2GHZ]; | 186 | sband = priv->wdev->wiphy->bands[IEEE80211_BAND_2GHZ]; |
@@ -229,25 +188,40 @@ mwifiex_get_cfp_by_band_and_freq_from_cfg80211(struct mwifiex_private *priv, | |||
229 | sband = priv->wdev->wiphy->bands[IEEE80211_BAND_5GHZ]; | 188 | sband = priv->wdev->wiphy->bands[IEEE80211_BAND_5GHZ]; |
230 | 189 | ||
231 | if (!sband) { | 190 | if (!sband) { |
232 | dev_err(priv->adapter->dev, "%s: cannot find cfp by band %d" | 191 | dev_err(priv->adapter->dev, "%s: cannot find cfp by band %d\n", |
233 | " & freq %d\n", __func__, band, freq); | 192 | __func__, band); |
234 | return cfp; | 193 | return cfp; |
235 | } | 194 | } |
236 | 195 | ||
237 | for (i = 0; i < sband->n_channels; i++) { | 196 | for (i = 0; i < sband->n_channels; i++) { |
238 | ch = &sband->channels[i]; | 197 | ch = &sband->channels[i]; |
239 | if ((ch->center_freq == freq) && | 198 | |
240 | !(ch->flags & IEEE80211_CHAN_DISABLED)) { | 199 | if (ch->flags & IEEE80211_CHAN_DISABLED) |
241 | priv->cfp.channel = ch->hw_value; | 200 | continue; |
242 | priv->cfp.freq = freq; | 201 | |
243 | priv->cfp.max_tx_power = ch->max_power; | 202 | if (freq) { |
244 | cfp = &priv->cfp; | 203 | if (ch->center_freq == freq) |
245 | break; | 204 | break; |
205 | } else { | ||
206 | /* find by valid channel*/ | ||
207 | if (ch->hw_value == channel || | ||
208 | channel == FIRST_VALID_CHANNEL) | ||
209 | break; | ||
246 | } | 210 | } |
247 | } | 211 | } |
248 | if (i == sband->n_channels) | 212 | if (i == sband->n_channels) { |
249 | dev_err(priv->adapter->dev, "%s: cannot find cfp by band %d" | 213 | dev_err(priv->adapter->dev, "%s: cannot find cfp by band %d" |
250 | " & freq %d\n", __func__, band, freq); | 214 | " & channel=%d freq=%d\n", __func__, band, channel, |
215 | freq); | ||
216 | } else { | ||
217 | if (!ch) | ||
218 | return cfp; | ||
219 | |||
220 | priv->cfp.channel = ch->hw_value; | ||
221 | priv->cfp.freq = ch->center_freq; | ||
222 | priv->cfp.max_tx_power = ch->max_power; | ||
223 | cfp = &priv->cfp; | ||
224 | } | ||
251 | 225 | ||
252 | return cfp; | 226 | return cfp; |
253 | } | 227 | } |
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c index bce9991612c8..803275f58c78 100644 --- a/drivers/net/wireless/mwifiex/join.c +++ b/drivers/net/wireless/mwifiex/join.c | |||
@@ -777,12 +777,11 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, | |||
777 | adhoc_start->phy_param_set.ds_param_set.element_id = DS_PARA_IE_ID; | 777 | adhoc_start->phy_param_set.ds_param_set.element_id = DS_PARA_IE_ID; |
778 | adhoc_start->phy_param_set.ds_param_set.len = DS_PARA_IE_LEN; | 778 | adhoc_start->phy_param_set.ds_param_set.len = DS_PARA_IE_LEN; |
779 | 779 | ||
780 | if (!mwifiex_get_cfp_by_band_and_channel_from_cfg80211 | 780 | if (!mwifiex_get_cfp(priv, adapter->adhoc_start_band, |
781 | (priv, adapter->adhoc_start_band, (u16) | 781 | (u16) priv->adhoc_channel, 0)) { |
782 | priv->adhoc_channel)) { | ||
783 | struct mwifiex_chan_freq_power *cfp; | 782 | struct mwifiex_chan_freq_power *cfp; |
784 | cfp = mwifiex_get_cfp_by_band_and_channel_from_cfg80211(priv, | 783 | cfp = mwifiex_get_cfp(priv, adapter->adhoc_start_band, |
785 | adapter->adhoc_start_band, FIRST_VALID_CHANNEL); | 784 | FIRST_VALID_CHANNEL, 0); |
786 | if (cfp) | 785 | if (cfp) |
787 | priv->adhoc_channel = (u8) cfp->channel; | 786 | priv->adhoc_channel = (u8) cfp->channel; |
788 | } | 787 | } |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index 58748b143609..c0df48f63e11 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -771,13 +771,8 @@ int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, | |||
771 | int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, | 771 | int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, |
772 | struct host_cmd_ds_command *resp); | 772 | struct host_cmd_ds_command *resp); |
773 | int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd); | 773 | int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd); |
774 | struct mwifiex_chan_freq_power * | 774 | struct mwifiex_chan_freq_power *mwifiex_get_cfp(struct mwifiex_private *priv, |
775 | mwifiex_get_cfp_by_band_and_channel_from_cfg80211( | 775 | u8 band, u16 channel, u32 freq); |
776 | struct mwifiex_private *priv, | ||
777 | u8 band, u16 channel); | ||
778 | struct mwifiex_chan_freq_power *mwifiex_get_cfp_by_band_and_freq_from_cfg80211( | ||
779 | struct mwifiex_private *priv, | ||
780 | u8 band, u32 freq); | ||
781 | u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, u8 index, | 776 | u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, u8 index, |
782 | u8 ht_info); | 777 | u8 ht_info); |
783 | u32 mwifiex_find_freq_from_band_chan(u8, u8); | 778 | u32 mwifiex_find_freq_from_band_chan(u8, u8); |
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c index fd0302fe5bd8..0a0c2890adfa 100644 --- a/drivers/net/wireless/mwifiex/scan.c +++ b/drivers/net/wireless/mwifiex/scan.c | |||
@@ -1434,8 +1434,8 @@ int mwifiex_check_network_compatibility(struct mwifiex_private *priv, | |||
1434 | if (!bss_desc) | 1434 | if (!bss_desc) |
1435 | return -1; | 1435 | return -1; |
1436 | 1436 | ||
1437 | if ((mwifiex_get_cfp_by_band_and_channel_from_cfg80211(priv, | 1437 | if ((mwifiex_get_cfp(priv, (u8) bss_desc->bss_band, |
1438 | (u8) bss_desc->bss_band, (u16) bss_desc->channel))) { | 1438 | (u16) bss_desc->channel, 0))) { |
1439 | switch (priv->bss_mode) { | 1439 | switch (priv->bss_mode) { |
1440 | case NL80211_IFTYPE_STATION: | 1440 | case NL80211_IFTYPE_STATION: |
1441 | case NL80211_IFTYPE_ADHOC: | 1441 | case NL80211_IFTYPE_ADHOC: |
@@ -1625,7 +1625,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
1625 | s32 rssi; | 1625 | s32 rssi; |
1626 | const u8 *ie_buf; | 1626 | const u8 *ie_buf; |
1627 | size_t ie_len; | 1627 | size_t ie_len; |
1628 | int channel = -1; | 1628 | u16 channel = 0; |
1629 | u64 network_tsf = 0; | 1629 | u64 network_tsf = 0; |
1630 | u16 beacon_size = 0; | 1630 | u16 beacon_size = 0; |
1631 | u32 curr_bcn_bytes; | 1631 | u32 curr_bcn_bytes; |
@@ -1723,7 +1723,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
1723 | &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE], | 1723 | &tsf_tlv->tsf_data[idx * TSF_DATA_SIZE], |
1724 | sizeof(network_tsf)); | 1724 | sizeof(network_tsf)); |
1725 | 1725 | ||
1726 | if (channel != -1) { | 1726 | if (channel) { |
1727 | struct ieee80211_channel *chan; | 1727 | struct ieee80211_channel *chan; |
1728 | u8 band; | 1728 | u8 band; |
1729 | 1729 | ||
@@ -1736,8 +1736,7 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
1736 | & (BIT(0) | BIT(1))); | 1736 | & (BIT(0) | BIT(1))); |
1737 | } | 1737 | } |
1738 | 1738 | ||
1739 | cfp = mwifiex_get_cfp_by_band_and_channel_from_cfg80211( | 1739 | cfp = mwifiex_get_cfp(priv, band, channel, 0); |
1740 | priv, (u8)band, (u16)channel); | ||
1741 | 1740 | ||
1742 | freq = cfp ? cfp->freq : 0; | 1741 | freq = cfp ? cfp->freq : 0; |
1743 | 1742 | ||
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c index 0ae1209646c1..a3d79f4a6192 100644 --- a/drivers/net/wireless/mwifiex/sta_ioctl.c +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | |||
@@ -529,11 +529,10 @@ int mwifiex_bss_set_channel(struct mwifiex_private *priv, | |||
529 | adapter->adhoc_start_band = BAND_G | BAND_B; | 529 | adapter->adhoc_start_band = BAND_G | BAND_B; |
530 | if (chan->channel) { | 530 | if (chan->channel) { |
531 | if (chan->channel <= MAX_CHANNEL_BAND_BG) | 531 | if (chan->channel <= MAX_CHANNEL_BAND_BG) |
532 | cfp = mwifiex_get_cfp_by_band_and_channel_from_cfg80211 | 532 | cfp = mwifiex_get_cfp(priv, 0, (u16) chan->channel, 0); |
533 | (priv, 0, (u16) chan->channel); | ||
534 | if (!cfp) { | 533 | if (!cfp) { |
535 | cfp = mwifiex_get_cfp_by_band_and_channel_from_cfg80211 | 534 | cfp = mwifiex_get_cfp(priv, BAND_A, |
536 | (priv, BAND_A, (u16) chan->channel); | 535 | (u16) chan->channel, 0); |
537 | if (cfp) { | 536 | if (cfp) { |
538 | if (adapter->adhoc_11n_enabled) | 537 | if (adapter->adhoc_11n_enabled) |
539 | adapter->adhoc_start_band = BAND_A | 538 | adapter->adhoc_start_band = BAND_A |
@@ -544,11 +543,9 @@ int mwifiex_bss_set_channel(struct mwifiex_private *priv, | |||
544 | } | 543 | } |
545 | } else { | 544 | } else { |
546 | if (chan->freq <= MAX_FREQUENCY_BAND_BG) | 545 | if (chan->freq <= MAX_FREQUENCY_BAND_BG) |
547 | cfp = mwifiex_get_cfp_by_band_and_freq_from_cfg80211( | 546 | cfp = mwifiex_get_cfp(priv, 0, 0, chan->freq); |
548 | priv, 0, chan->freq); | ||
549 | if (!cfp) { | 547 | if (!cfp) { |
550 | cfp = mwifiex_get_cfp_by_band_and_freq_from_cfg80211 | 548 | cfp = mwifiex_get_cfp(priv, BAND_A, 0, chan->freq); |
551 | (priv, BAND_A, chan->freq); | ||
552 | if (cfp) { | 549 | if (cfp) { |
553 | if (adapter->adhoc_11n_enabled) | 550 | if (adapter->adhoc_11n_enabled) |
554 | adapter->adhoc_start_band = BAND_A | 551 | adapter->adhoc_start_band = BAND_A |