aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-09-03 09:30:55 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2010-09-11 11:52:01 -0400
commitea196fdbb982150c19854f90773cb8b9bf331049 (patch)
treea5088223229900aca5edefec1ef175c2e61a09bf /drivers/net
parentf1f270b25c6ece9ff65f7ad970850338a198d52f (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')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c25
2 files changed, 25 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
index a63582f060f1..d86902b83630 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd.c
@@ -321,7 +321,7 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv)
321 bcnint = max_t(int, bcnint, 321 bcnint = max_t(int, bcnint,
322 ctx_bss->vif->bss_conf.beacon_int); 322 ctx_bss->vif->bss_conf.beacon_int);
323 if (!bcnint) 323 if (!bcnint)
324 bcnint = 100; 324 bcnint = DEFAULT_BEACON_INTERVAL;
325 slot0 = bcnint / 2; 325 slot0 = bcnint / 2;
326 slot1 = bcnint - slot0; 326 slot1 = bcnint - slot0;
327 327
@@ -339,7 +339,7 @@ static int iwlagn_set_pan_params(struct iwl_priv *priv)
339 slot0 = 0; 339 slot0 = 0;
340 slot1 = max_t(int, 1, ctx_pan->vif->bss_conf.dtim_period) * 340 slot1 = max_t(int, 1, ctx_pan->vif->bss_conf.dtim_period) *
341 ctx_pan->vif->bss_conf.beacon_int; 341 ctx_pan->vif->bss_conf.beacon_int;
342 slot1 = max_t(int, 100, slot1); 342 slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);
343 343
344 if (test_bit(STATUS_SCAN_HW, &priv->status)) { 344 if (test_bit(STATUS_SCAN_HW, &priv->status)) {
345 slot0 = slot1 * 3 - 20; 345 slot0 = slot1 * 3 - 20;
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
492static u16 iwl_adjust_beacon_interval(u16 beacon_val, u16 max_beacon_val) 492static 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;