aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-06-09 02:51:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-06-15 16:00:48 -0400
commitff61638105db6f5832ef8700436ba6aa6d3a2fda (patch)
treeff55ef6186cd46d87ca4e54efbbe82f5ecc68f1e
parent685429623f88d84f98bd5daffc3c427c408740d4 (diff)
mac80211: Fix ps-qos network latency handling
The ps-qos latency handling is broken. It uses predetermined latency values to select specific dynamic PS timeouts. With common AP configurations, these values overlap with beacon interval and are therefore essentially useless (for network latencies less than the beacon interval, PSM is disabled.) This patch remedies the problem by replacing the predetermined network latency values with one high value (1900ms) which is used to go trigger full psm. For backwards compatibility, the value 2000ms is still mapped to a dynamic ps timeout of 100ms. Currently also the mac80211 internal value for storing user space configured dynamic PSM values is incorrectly in the driver visible ieee80211_conf struct. Move it to the ieee80211_local struct. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--include/net/mac80211.h5
-rw-r--r--net/mac80211/cfg.c5
-rw-r--r--net/mac80211/ieee80211_i.h6
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/mlme.c16
5 files changed, 16 insertions, 18 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 3a47877f4965..fe1a3a603375 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -695,9 +695,6 @@ enum ieee80211_smps_mode {
695 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the 695 * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
696 * powersave documentation below. This variable is valid only when 696 * powersave documentation below. This variable is valid only when
697 * the CONF_PS flag is set. 697 * the CONF_PS flag is set.
698 * @dynamic_ps_forced_timeout: The dynamic powersave timeout (in ms) configured
699 * by cfg80211 (essentially, wext) If set, this value overrules the value
700 * chosen by mac80211 based on ps qos network latency.
701 * 698 *
702 * @power_level: requested transmit power (in dBm) 699 * @power_level: requested transmit power (in dBm)
703 * 700 *
@@ -717,7 +714,7 @@ enum ieee80211_smps_mode {
717 */ 714 */
718struct ieee80211_conf { 715struct ieee80211_conf {
719 u32 flags; 716 u32 flags;
720 int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout; 717 int power_level, dynamic_ps_timeout;
721 int max_sleep_period; 718 int max_sleep_period;
722 719
723 u16 listen_interval; 720 u16 listen_interval;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 59f597d0c6a0..003b6addf5fa 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1446,7 +1446,6 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
1446{ 1446{
1447 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1447 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1448 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1448 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1449 struct ieee80211_conf *conf = &local->hw.conf;
1450 1449
1451 if (sdata->vif.type != NL80211_IFTYPE_STATION) 1450 if (sdata->vif.type != NL80211_IFTYPE_STATION)
1452 return -EOPNOTSUPP; 1451 return -EOPNOTSUPP;
@@ -1455,11 +1454,11 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
1455 return -EOPNOTSUPP; 1454 return -EOPNOTSUPP;
1456 1455
1457 if (enabled == sdata->u.mgd.powersave && 1456 if (enabled == sdata->u.mgd.powersave &&
1458 timeout == conf->dynamic_ps_forced_timeout) 1457 timeout == local->dynamic_ps_forced_timeout)
1459 return 0; 1458 return 0;
1460 1459
1461 sdata->u.mgd.powersave = enabled; 1460 sdata->u.mgd.powersave = enabled;
1462 conf->dynamic_ps_forced_timeout = timeout; 1461 local->dynamic_ps_forced_timeout = timeout;
1463 1462
1464 /* no change, but if automatic follow powersave */ 1463 /* no change, but if automatic follow powersave */
1465 mutex_lock(&sdata->u.mgd.mtx); 1464 mutex_lock(&sdata->u.mgd.mtx);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 9b3c3f971d28..fb5430188e87 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -850,6 +850,12 @@ struct ieee80211_local {
850 struct notifier_block network_latency_notifier; 850 struct notifier_block network_latency_notifier;
851 struct notifier_block ifa_notifier; 851 struct notifier_block ifa_notifier;
852 852
853 /*
854 * The dynamic ps timeout configured from user space via WEXT -
855 * this will override whatever chosen by mac80211 internally.
856 */
857 int dynamic_ps_forced_timeout;
858
853 int user_power_level; /* in dBm */ 859 int user_power_level; /* in dBm */
854 int power_constr_level; /* in dBm */ 860 int power_constr_level; /* in dBm */
855 861
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index a1bf46c64b93..edf7aff93268 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -630,7 +630,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
630 630
631 local->hw.conf.listen_interval = local->hw.max_listen_interval; 631 local->hw.conf.listen_interval = local->hw.max_listen_interval;
632 632
633 local->hw.conf.dynamic_ps_forced_timeout = -1; 633 local->dynamic_ps_forced_timeout = -1;
634 634
635 result = sta_info_start(local); 635 result = sta_info_start(local);
636 if (result < 0) 636 if (result < 0)
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 74479c2d12d4..1c0d8fce08dd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -561,23 +561,19 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
561 beaconint_us = ieee80211_tu_to_usec( 561 beaconint_us = ieee80211_tu_to_usec(
562 found->vif.bss_conf.beacon_int); 562 found->vif.bss_conf.beacon_int);
563 563
564 timeout = local->hw.conf.dynamic_ps_forced_timeout; 564 timeout = local->dynamic_ps_forced_timeout;
565 if (timeout < 0) { 565 if (timeout < 0) {
566 /* 566 /*
567 * Go to full PSM if the user configures a very low
568 * latency requirement.
567 * The 2 second value is there for compatibility until 569 * The 2 second value is there for compatibility until
568 * the PM_QOS_NETWORK_LATENCY is configured with real 570 * the PM_QOS_NETWORK_LATENCY is configured with real
569 * values. 571 * values.
570 */ 572 */
571 if (latency == 2000000000) 573 if (latency > 1900000000 && latency != 2000000000)
572 timeout = 100;
573 else if (latency <= 50000)
574 timeout = 300;
575 else if (latency <= 100000)
576 timeout = 100;
577 else if (latency <= 500000)
578 timeout = 50;
579 else
580 timeout = 0; 574 timeout = 0;
575 else
576 timeout = 100;
581 } 577 }
582 local->hw.conf.dynamic_ps_timeout = timeout; 578 local->hw.conf.dynamic_ps_timeout = timeout;
583 579