aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c40
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c40
3 files changed, 40 insertions, 42 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index ec250b213528..ed201e7b2844 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -162,46 +162,6 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf)
162 _iwl_set_rxon_ht(priv, ht_conf, ctx); 162 _iwl_set_rxon_ht(priv, ht_conf, ctx);
163} 163}
164 164
165/* Return valid, unused, channel for a passive scan to reset the RF */
166u8 iwl_get_single_channel_number(struct iwl_priv *priv,
167 enum ieee80211_band band)
168{
169 const struct iwl_channel_info *ch_info;
170 int i;
171 u8 channel = 0;
172 u8 min, max;
173 struct iwl_rxon_context *ctx;
174
175 if (band == IEEE80211_BAND_5GHZ) {
176 min = 14;
177 max = priv->channel_count;
178 } else {
179 min = 0;
180 max = 14;
181 }
182
183 for (i = min; i < max; i++) {
184 bool busy = false;
185
186 for_each_context(priv, ctx) {
187 busy = priv->channel_info[i].channel ==
188 le16_to_cpu(ctx->staging.channel);
189 if (busy)
190 break;
191 }
192
193 if (busy)
194 continue;
195
196 channel = priv->channel_info[i].channel;
197 ch_info = iwl_get_channel_info(priv, band, channel);
198 if (is_channel_valid(ch_info))
199 break;
200 }
201
202 return channel;
203}
204
205/** 165/**
206 * iwl_set_rxon_channel - Set the band and channel values in staging RXON 166 * iwl_set_rxon_channel - Set the band and channel values in staging RXON
207 * @ch: requested channel as a pointer to struct ieee80211_channel 167 * @ch: requested channel as a pointer to struct ieee80211_channel
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 2488fc1c5cb6..7aa3060fc6b5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -99,8 +99,6 @@ void iwl_set_flags_for_band(struct iwl_priv *priv,
99 struct iwl_rxon_context *ctx, 99 struct iwl_rxon_context *ctx,
100 enum ieee80211_band band, 100 enum ieee80211_band band,
101 struct ieee80211_vif *vif); 101 struct ieee80211_vif *vif);
102u8 iwl_get_single_channel_number(struct iwl_priv *priv,
103 enum ieee80211_band band);
104void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf); 102void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_config *ht_conf);
105bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv, 103bool iwl_is_ht40_tx_allowed(struct iwl_priv *priv,
106 struct iwl_rxon_context *ctx, 104 struct iwl_rxon_context *ctx,
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index 4338d4942ed2..f3e5c2aba266 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -451,6 +451,46 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
451 return iwl_limit_dwell(priv, passive); 451 return iwl_limit_dwell(priv, passive);
452} 452}
453 453
454/* Return valid, unused, channel for a passive scan to reset the RF */
455static u8 iwl_get_single_channel_number(struct iwl_priv *priv,
456 enum ieee80211_band band)
457{
458 const struct iwl_channel_info *ch_info;
459 int i;
460 u8 channel = 0;
461 u8 min, max;
462 struct iwl_rxon_context *ctx;
463
464 if (band == IEEE80211_BAND_5GHZ) {
465 min = 14;
466 max = priv->channel_count;
467 } else {
468 min = 0;
469 max = 14;
470 }
471
472 for (i = min; i < max; i++) {
473 bool busy = false;
474
475 for_each_context(priv, ctx) {
476 busy = priv->channel_info[i].channel ==
477 le16_to_cpu(ctx->staging.channel);
478 if (busy)
479 break;
480 }
481
482 if (busy)
483 continue;
484
485 channel = priv->channel_info[i].channel;
486 ch_info = iwl_get_channel_info(priv, band, channel);
487 if (is_channel_valid(ch_info))
488 break;
489 }
490
491 return channel;
492}
493
454static int iwl_get_single_channel_for_scan(struct iwl_priv *priv, 494static int iwl_get_single_channel_for_scan(struct iwl_priv *priv,
455 struct ieee80211_vif *vif, 495 struct ieee80211_vif *vif,
456 enum ieee80211_band band, 496 enum ieee80211_band band,