diff options
author | Juuso Oikarinen <juuso.oikarinen@nokia.com> | 2010-04-27 05:47:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-04-27 16:09:22 -0400 |
commit | 195e294d21e88af879da4f88db2ceeb4ec28a755 (patch) | |
tree | 22a75db60cc8743888054460db85eb9a76b0cecb /net/mac80211 | |
parent | 3a37495268ab45507b4cab9d4cb18c5496ab7a10 (diff) |
mac80211: Determine dynamic PS timeout based on ps-qos network latency
Determine the dynamic PS timeout based on the configured ps-qos network
latency. For backwards wext compatibility, allow the dynamic PS timeout
configured by the cfg80211 to overrule the automatically determined value.
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/cfg.c | 4 | ||||
-rw-r--r-- | net/mac80211/main.c | 2 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 21 |
3 files changed, 25 insertions, 2 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index e13fb3a62239..b575a5066219 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1404,11 +1404,11 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
1404 | return -EOPNOTSUPP; | 1404 | return -EOPNOTSUPP; |
1405 | 1405 | ||
1406 | if (enabled == sdata->u.mgd.powersave && | 1406 | if (enabled == sdata->u.mgd.powersave && |
1407 | timeout == conf->dynamic_ps_timeout) | 1407 | timeout == conf->dynamic_ps_forced_timeout) |
1408 | return 0; | 1408 | return 0; |
1409 | 1409 | ||
1410 | sdata->u.mgd.powersave = enabled; | 1410 | sdata->u.mgd.powersave = enabled; |
1411 | conf->dynamic_ps_timeout = timeout; | 1411 | conf->dynamic_ps_forced_timeout = timeout; |
1412 | 1412 | ||
1413 | /* no change, but if automatic follow powersave */ | 1413 | /* no change, but if automatic follow powersave */ |
1414 | mutex_lock(&sdata->u.mgd.mtx); | 1414 | mutex_lock(&sdata->u.mgd.mtx); |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 4afe851cf8dc..ebcca0eaf1dc 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -569,6 +569,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) | |||
569 | 569 | ||
570 | local->hw.conf.listen_interval = local->hw.max_listen_interval; | 570 | local->hw.conf.listen_interval = local->hw.max_listen_interval; |
571 | 571 | ||
572 | local->hw.conf.dynamic_ps_forced_timeout = -1; | ||
573 | |||
572 | result = sta_info_start(local); | 574 | result = sta_info_start(local); |
573 | if (result < 0) | 575 | if (result < 0) |
574 | goto fail_sta_info; | 576 | goto fail_sta_info; |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index d811e3fa1d75..2d1a2bef366d 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -475,6 +475,7 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) | |||
475 | { | 475 | { |
476 | struct ieee80211_sub_if_data *sdata, *found = NULL; | 476 | struct ieee80211_sub_if_data *sdata, *found = NULL; |
477 | int count = 0; | 477 | int count = 0; |
478 | int timeout; | ||
478 | 479 | ||
479 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) { | 480 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) { |
480 | local->ps_sdata = NULL; | 481 | local->ps_sdata = NULL; |
@@ -508,6 +509,26 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) | |||
508 | beaconint_us = ieee80211_tu_to_usec( | 509 | beaconint_us = ieee80211_tu_to_usec( |
509 | found->vif.bss_conf.beacon_int); | 510 | found->vif.bss_conf.beacon_int); |
510 | 511 | ||
512 | timeout = local->hw.conf.dynamic_ps_forced_timeout; | ||
513 | if (timeout < 0) { | ||
514 | /* | ||
515 | * The 2 second value is there for compatibility until | ||
516 | * the PM_QOS_NETWORK_LATENCY is configured with real | ||
517 | * values. | ||
518 | */ | ||
519 | if (latency == 2000000000) | ||
520 | timeout = 100; | ||
521 | else if (latency <= 50000) | ||
522 | timeout = 300; | ||
523 | else if (latency <= 100000) | ||
524 | timeout = 100; | ||
525 | else if (latency <= 500000) | ||
526 | timeout = 50; | ||
527 | else | ||
528 | timeout = 0; | ||
529 | } | ||
530 | local->hw.conf.dynamic_ps_timeout = timeout; | ||
531 | |||
511 | if (beaconint_us > latency) { | 532 | if (beaconint_us > latency) { |
512 | local->ps_sdata = NULL; | 533 | local->ps_sdata = NULL; |
513 | } else { | 534 | } else { |