diff options
author | Johannes Berg <johannes.berg@intel.com> | 2010-09-03 09:30:55 -0400 |
---|---|---|
committer | Wey-Yi Guy <wey-yi.w.guy@intel.com> | 2010-09-11 11:52:01 -0400 |
commit | ea196fdbb982150c19854f90773cb8b9bf331049 (patch) | |
tree | a5088223229900aca5edefec1ef175c2e61a09bf /drivers/net/wireless/iwlwifi/iwl-core.c | |
parent | f1f270b25c6ece9ff65f7ad970850338a198d52f (diff) |
iwlwifi: fix and describe iwl_adjust_beacon_interval
The iwl_adjust_beacon_interval function is a bit
of black magic, so add comments to it describing
what it does. Also, in the case when there's no
beacon interval set, program the default into
the device (instead of adjusting, which results
in the max) since using the max in that case
interacts badly with dual-mode/PAN parameters.
Also update the PAN parameters accordingly and
use the same constant as here.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-core.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index c393b20ae1c1..c9c523b2883f 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -491,8 +491,29 @@ EXPORT_SYMBOL(iwl_is_ht40_tx_allowed); | |||
491 | 491 | ||
492 | static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) | 492 | static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) |
493 | { | 493 | { |
494 | u16 new_val = 0; | 494 | u16 new_val; |
495 | u16 beacon_factor = 0; | 495 | u16 beacon_factor; |
496 | |||
497 | /* | ||
498 | * If mac80211 hasn't given us a beacon interval, program | ||
499 | * the default into the device (not checking this here | ||
500 | * would cause the adjustment below to return the maximum | ||
501 | * value, which may break PAN.) | ||
502 | */ | ||
503 | if (!beacon_val) | ||
504 | return DEFAULT_BEACON_INTERVAL; | ||
505 | |||
506 | /* | ||
507 | * If the beacon interval we obtained from the peer | ||
508 | * is too large, we'll have to wake up more often | ||
509 | * (and in IBSS case, we'll beacon too much) | ||
510 | * | ||
511 | * For example, if max_beacon_val is 4096, and the | ||
512 | * requested beacon interval is 7000, we'll have to | ||
513 | * use 3500 to be able to wake up on the beacons. | ||
514 | * | ||
515 | * This could badly influence beacon detection stats. | ||
516 | */ | ||
496 | 517 | ||
497 | beacon_factor = (beacon_val + max_beacon_val) / max_beacon_val; | 518 | beacon_factor = (beacon_val + max_beacon_val) / max_beacon_val; |
498 | new_val = beacon_val / beacon_factor; | 519 | new_val = beacon_val / beacon_factor; |