diff options
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-scan.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c index fe4cb57c3a1c..556dcaaa0efe 100644 --- a/drivers/net/wireless/iwlwifi/iwl-scan.c +++ b/drivers/net/wireless/iwlwifi/iwl-scan.c | |||
@@ -286,19 +286,28 @@ u16 iwl_get_passive_dwell_time(struct iwl_priv *priv, | |||
286 | enum ieee80211_band band, | 286 | enum ieee80211_band band, |
287 | struct ieee80211_vif *vif) | 287 | struct ieee80211_vif *vif) |
288 | { | 288 | { |
289 | struct iwl_rxon_context *ctx; | ||
289 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? | 290 | u16 passive = (band == IEEE80211_BAND_2GHZ) ? |
290 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : | 291 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 : |
291 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; | 292 | IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52; |
292 | 293 | ||
293 | if (iwl_is_any_associated(priv)) { | 294 | if (iwl_is_any_associated(priv)) { |
294 | /* TODO: should use minimum of all contexts */ | 295 | /* |
295 | /* If we're associated, we clamp the maximum passive | 296 | * If we're associated, we clamp the maximum passive |
296 | * dwell time to be 98% of the beacon interval (minus | 297 | * dwell time to be 98% of the smallest beacon interval |
297 | * 2 * channel tune time) */ | 298 | * (minus 2 * channel tune time) |
298 | passive = vif ? vif->bss_conf.beacon_int : 0; | 299 | */ |
299 | if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive) | 300 | for_each_context(priv, ctx) { |
300 | passive = IWL_PASSIVE_DWELL_BASE; | 301 | u16 value; |
301 | passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | 302 | |
303 | if (!iwl_is_associated_ctx(ctx)) | ||
304 | continue; | ||
305 | value = ctx->vif ? ctx->vif->bss_conf.beacon_int : 0; | ||
306 | if ((value > IWL_PASSIVE_DWELL_BASE) || !value) | ||
307 | value = IWL_PASSIVE_DWELL_BASE; | ||
308 | value = (value * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2; | ||
309 | passive = min(value, passive); | ||
310 | } | ||
302 | } | 311 | } |
303 | 312 | ||
304 | return passive; | 313 | return passive; |