* [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos @ 2010-04-21 11:47 Juuso Oikarinen 2010-04-21 11:47 ` [RFC PATCHv4 1/2] mac80211: Determine dynamic PS timeout based on ps-qos network latency Juuso Oikarinen ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Juuso Oikarinen @ 2010-04-21 11:47 UTC (permalink / raw) To: linux-wireless These patches propose a way to adjust the dynamic ps timeout in the mac80211 based on the pm-qos network latency value. This allows user space to influence the level of power saving performed by the mac80211. v4 of these patches change the way pm qos network latency ranges converted to dynamic ps timeout values a little bit saner. Unlike the previous set of patches, now the latancy values make sense in a wider scope than this ps timeout thing only. I hope this makes them somewhat more future-proof. As wext still has an interface to adjust the dynamic ps timeout from userspace, the wext configuration will override the above, to remain backwards compatible. Comments are appreciated. Juuso Oikarinen (2): mac80211: Determine dynamic PS timeout based on ps-qos network latency cfg80211: Remove default dynamic PS timeout value include/net/cfg80211.h | 2 ++ include/net/mac80211.h | 5 ++++- net/mac80211/cfg.c | 4 ++-- net/mac80211/main.c | 2 ++ net/mac80211/mlme.c | 21 +++++++++++++++++++++ net/wireless/core.c | 3 ++- 6 files changed, 33 insertions(+), 4 deletions(-) ^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFC PATCHv4 1/2] mac80211: Determine dynamic PS timeout based on ps-qos network latency 2010-04-21 11:47 [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos Juuso Oikarinen @ 2010-04-21 11:47 ` Juuso Oikarinen 2010-04-21 11:47 ` [RFC PATCHv4 2/2] cfg80211: Remove default dynamic PS timeout value Juuso Oikarinen 2010-04-29 13:45 ` [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos Kalle Valo 2 siblings, 0 replies; 6+ messages in thread From: Juuso Oikarinen @ 2010-04-21 11:47 UTC (permalink / raw) To: linux-wireless 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> --- include/net/mac80211.h | 5 ++++- net/mac80211/cfg.c | 4 ++-- net/mac80211/main.c | 2 ++ net/mac80211/mlme.c | 21 +++++++++++++++++++++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index dcf3c5f..243e4ab 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -661,6 +661,9 @@ enum ieee80211_smps_mode { * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the * powersave documentation below. This variable is valid only when * the CONF_PS flag is set. + * @dynamic_ps_forced_timeout: The dynamic powersave timeout (in ms) configured + * by cfg80211 (essentially, wext) If set, this value overrules the value + * chosen by mac80211 based on ps qos network latency. * * @power_level: requested transmit power (in dBm) * @@ -680,7 +683,7 @@ enum ieee80211_smps_mode { */ struct ieee80211_conf { u32 flags; - int power_level, dynamic_ps_timeout; + int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout; int max_sleep_period; u16 listen_interval; diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 7dd7cda..9a1a91c 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -1388,11 +1388,11 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, return -EOPNOTSUPP; if (enabled == sdata->u.mgd.powersave && - timeout == conf->dynamic_ps_timeout) + timeout == conf->dynamic_ps_forced_timeout) return 0; sdata->u.mgd.powersave = enabled; - conf->dynamic_ps_timeout = timeout; + conf->dynamic_ps_forced_timeout = timeout; /* no change, but if automatic follow powersave */ mutex_lock(&sdata->u.mgd.mtx); diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 4afe851..ebcca0e 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -569,6 +569,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) local->hw.conf.listen_interval = local->hw.max_listen_interval; + local->hw.conf.dynamic_ps_forced_timeout = -1; + result = sta_info_start(local); if (result < 0) goto fail_sta_info; diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 35d8502..7e6d0ab 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -476,6 +476,7 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) { struct ieee80211_sub_if_data *sdata, *found = NULL; int count = 0; + int timeout; if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) { local->ps_sdata = NULL; @@ -509,6 +510,26 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency) beaconint_us = ieee80211_tu_to_usec( found->vif.bss_conf.beacon_int); + timeout = local->hw.conf.dynamic_ps_forced_timeout; + if (timeout < 0) { + /* + * The 2 second value is there for compatibility until + * the PM_QOS_NETWORK_LATENCY is configured with real + * values. + */ + if (latency == 2000000000) + timeout = 100; + else if (latency <= 50000) + timeout = 300; + else if (latency <= 100000) + timeout = 100; + else if (latency <= 500000) + timeout = 50; + else + timeout = 0; + } + local->hw.conf.dynamic_ps_timeout = timeout; + if (beaconint_us > latency) { local->ps_sdata = NULL; } else { -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCHv4 2/2] cfg80211: Remove default dynamic PS timeout value 2010-04-21 11:47 [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos Juuso Oikarinen 2010-04-21 11:47 ` [RFC PATCHv4 1/2] mac80211: Determine dynamic PS timeout based on ps-qos network latency Juuso Oikarinen @ 2010-04-21 11:47 ` Juuso Oikarinen 2010-04-29 13:45 ` [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos Kalle Valo 2 siblings, 0 replies; 6+ messages in thread From: Juuso Oikarinen @ 2010-04-21 11:47 UTC (permalink / raw) To: linux-wireless Now that the mac80211 is choosing dynamic ps timeouts based on the ps-qos network latency configuration, configure a default value of -1 as the dynamic ps timeout in cfg80211. This value allows the mac80211 to determine the value to be used. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> --- include/net/cfg80211.h | 2 ++ net/wireless/core.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 37cebd3..873edf9 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1018,6 +1018,8 @@ struct cfg80211_pmksa { * RSN IE. It allows for faster roaming between WPA2 BSSIDs. * @del_pmksa: Delete a cached PMKID. * @flush_pmksa: Flush all cached PMKIDs. + * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 + * allows the driver to adjust the dynamic ps timeout value. * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. * */ diff --git a/net/wireless/core.c b/net/wireless/core.c index 6ac70c1..37d0e0a 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -705,7 +705,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb, wdev->ps = true; else wdev->ps = false; - wdev->ps_timeout = 100; + /* allow mac80211 to determine the timeout */ + wdev->ps_timeout = -1; if (rdev->ops->set_power_mgmt) if (rdev->ops->set_power_mgmt(wdev->wiphy, dev, wdev->ps, -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos 2010-04-21 11:47 [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos Juuso Oikarinen 2010-04-21 11:47 ` [RFC PATCHv4 1/2] mac80211: Determine dynamic PS timeout based on ps-qos network latency Juuso Oikarinen 2010-04-21 11:47 ` [RFC PATCHv4 2/2] cfg80211: Remove default dynamic PS timeout value Juuso Oikarinen @ 2010-04-29 13:45 ` Kalle Valo 2010-05-03 22:44 ` Luis R. Rodriguez 2 siblings, 1 reply; 6+ messages in thread From: Kalle Valo @ 2010-04-29 13:45 UTC (permalink / raw) To: Juuso Oikarinen; +Cc: linux-wireless Juuso Oikarinen <juuso.oikarinen@nokia.com> writes: > These patches propose a way to adjust the dynamic ps timeout in the > mac80211 based on the pm-qos network latency value. This allows user > space to influence the level of power saving performed by the > mac80211. > > v4 of these patches change the way pm qos network latency ranges > converted to dynamic ps timeout values a little bit saner. Unlike > the previous set of patches, now the latancy values make sense in a > wider scope than this ps timeout thing only. I hope this makes them > somewhat more future-proof. This looks very good now. Bonus points for adding the comment about the two second value! Thank you for implementing this. -- Kalle Valo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos 2010-04-29 13:45 ` [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos Kalle Valo @ 2010-05-03 22:44 ` Luis R. Rodriguez 2010-05-04 5:25 ` Juuso Oikarinen 0 siblings, 1 reply; 6+ messages in thread From: Luis R. Rodriguez @ 2010-05-03 22:44 UTC (permalink / raw) To: Kalle Valo; +Cc: Juuso Oikarinen, linux-wireless On Thu, Apr 29, 2010 at 6:45 AM, Kalle Valo <kvalo@adurom.com> wrote: > Juuso Oikarinen <juuso.oikarinen@nokia.com> writes: > >> These patches propose a way to adjust the dynamic ps timeout in the >> mac80211 based on the pm-qos network latency value. This allows user >> space to influence the level of power saving performed by the >> mac80211. >> >> v4 of these patches change the way pm qos network latency ranges >> converted to dynamic ps timeout values a little bit saner. Unlike >> the previous set of patches, now the latancy values make sense in a >> wider scope than this ps timeout thing only. I hope this makes them >> somewhat more future-proof. > > This looks very good now. Bonus points for adding the comment about > the two second value! > > Thank you for implementing this. Even more bonus points (if this was a video game you'd get an extra life) if you add the new changes on the documentation here: http://wireless.kernel.org/en/developers/Documentation/pm-qos Luis ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos 2010-05-03 22:44 ` Luis R. Rodriguez @ 2010-05-04 5:25 ` Juuso Oikarinen 0 siblings, 0 replies; 6+ messages in thread From: Juuso Oikarinen @ 2010-05-04 5:25 UTC (permalink / raw) To: ext Luis R. Rodriguez; +Cc: Kalle Valo, linux-wireless On Tue, 2010-05-04 at 00:44 +0200, ext Luis R. Rodriguez wrote: > On Thu, Apr 29, 2010 at 6:45 AM, Kalle Valo <kvalo@adurom.com> wrote: > > Juuso Oikarinen <juuso.oikarinen@nokia.com> writes: > > > >> These patches propose a way to adjust the dynamic ps timeout in the > >> mac80211 based on the pm-qos network latency value. This allows user > >> space to influence the level of power saving performed by the > >> mac80211. > >> > >> v4 of these patches change the way pm qos network latency ranges > >> converted to dynamic ps timeout values a little bit saner. Unlike > >> the previous set of patches, now the latancy values make sense in a > >> wider scope than this ps timeout thing only. I hope this makes them > >> somewhat more future-proof. > > > > This looks very good now. Bonus points for adding the comment about > > the two second value! > > > > Thank you for implementing this. > > Even more bonus points (if this was a video game you'd get an extra > life) if you add the new changes on the documentation here: > > http://wireless.kernel.org/en/developers/Documentation/pm-qos > Can't resist a new life! Yes, I will add the changes. Honestly, I was planning to, and almost remembered ;) -Juuso > Luis ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-05-04 5:23 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-04-21 11:47 [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos Juuso Oikarinen 2010-04-21 11:47 ` [RFC PATCHv4 1/2] mac80211: Determine dynamic PS timeout based on ps-qos network latency Juuso Oikarinen 2010-04-21 11:47 ` [RFC PATCHv4 2/2] cfg80211: Remove default dynamic PS timeout value Juuso Oikarinen 2010-04-29 13:45 ` [RFC PATCHv4 0/2] mac80211: cfg80211: dynamic ps timeout based on pm-qos Kalle Valo 2010-05-03 22:44 ` Luis R. Rodriguez 2010-05-04 5:25 ` Juuso Oikarinen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).