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>
This commit is contained in:
committed by
John W. Linville
parent
3a37495268
commit
195e294d21
@@ -668,6 +668,9 @@ enum ieee80211_smps_mode {
|
|||||||
* @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
|
* @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
|
||||||
* powersave documentation below. This variable is valid only when
|
* powersave documentation below. This variable is valid only when
|
||||||
* the CONF_PS flag is set.
|
* 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)
|
* @power_level: requested transmit power (in dBm)
|
||||||
*
|
*
|
||||||
@@ -687,7 +690,7 @@ enum ieee80211_smps_mode {
|
|||||||
*/
|
*/
|
||||||
struct ieee80211_conf {
|
struct ieee80211_conf {
|
||||||
u32 flags;
|
u32 flags;
|
||||||
int power_level, dynamic_ps_timeout;
|
int power_level, dynamic_ps_timeout, dynamic_ps_forced_timeout;
|
||||||
int max_sleep_period;
|
int max_sleep_period;
|
||||||
|
|
||||||
u16 listen_interval;
|
u16 listen_interval;
|
||||||
|
@@ -1404,11 +1404,11 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
|
|||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
|
|
||||||
if (enabled == sdata->u.mgd.powersave &&
|
if (enabled == sdata->u.mgd.powersave &&
|
||||||
timeout == conf->dynamic_ps_timeout)
|
timeout == conf->dynamic_ps_forced_timeout)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sdata->u.mgd.powersave = enabled;
|
sdata->u.mgd.powersave = enabled;
|
||||||
conf->dynamic_ps_timeout = timeout;
|
conf->dynamic_ps_forced_timeout = timeout;
|
||||||
|
|
||||||
/* no change, but if automatic follow powersave */
|
/* no change, but if automatic follow powersave */
|
||||||
mutex_lock(&sdata->u.mgd.mtx);
|
mutex_lock(&sdata->u.mgd.mtx);
|
||||||
|
@@ -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.listen_interval = local->hw.max_listen_interval;
|
||||||
|
|
||||||
|
local->hw.conf.dynamic_ps_forced_timeout = -1;
|
||||||
|
|
||||||
result = sta_info_start(local);
|
result = sta_info_start(local);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
goto fail_sta_info;
|
goto fail_sta_info;
|
||||||
|
@@ -475,6 +475,7 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
|
|||||||
{
|
{
|
||||||
struct ieee80211_sub_if_data *sdata, *found = NULL;
|
struct ieee80211_sub_if_data *sdata, *found = NULL;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
int timeout;
|
||||||
|
|
||||||
if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) {
|
if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) {
|
||||||
local->ps_sdata = NULL;
|
local->ps_sdata = NULL;
|
||||||
@@ -508,6 +509,26 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
|
|||||||
beaconint_us = ieee80211_tu_to_usec(
|
beaconint_us = ieee80211_tu_to_usec(
|
||||||
found->vif.bss_conf.beacon_int);
|
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) {
|
if (beaconint_us > latency) {
|
||||||
local->ps_sdata = NULL;
|
local->ps_sdata = NULL;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user