summaryrefslogtreecommitdiff
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-22 16:44:37 (GMT)
committerJohn W. Linville <linville@tuxdriver.com>2009-04-22 20:57:20 (GMT)
commit04fe20372e70685d9f15966216cdffd3795fe590 (patch)
tree8de1ed35372e2f2bcfd9f36cb89647ce1507922d /net/mac80211/mlme.c
parent8e30bc55de98c000b0b836cb42525c82f605f191 (diff)
downloadlinux-04fe20372e70685d9f15966216cdffd3795fe590.tar.xz
mac80211: calculate maximum sleep interval
The maximum sleep interval, for powersave purposes, is determined by the DTIM period (it may not be larger) and the required networking latency (it must be small enough to fulfil those constraints). This makes mac80211 calculate the maximum sleep interval based on those constraints, and pass it to the driver. Then the driver should instruct the device to sleep at most that long. Note that the device is responsible for aligning the maximum sleep interval between DTIMs, we make sure it's not longer but it needs to make sure it's between them. Also, group some powersave documentation together and make it more explicit that we support managed mode only, and no IBSS powersaving (yet). Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index e819c02..df27c68 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -545,10 +545,19 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
beaconint_us = ieee80211_tu_to_usec(
found->vif.bss_conf.beacon_int);
- if (beaconint_us > latency)
+ if (beaconint_us > latency) {
local->ps_sdata = NULL;
- else
+ } else {
+ u8 dtimper = found->vif.bss_conf.dtim_period;
+ int maxslp = 1;
+
+ if (dtimper > 1)
+ maxslp = min_t(int, dtimper,
+ latency / beaconint_us);
+
+ local->hw.conf.max_sleep_interval = maxslp;
local->ps_sdata = found;
+ }
} else {
local->ps_sdata = NULL;
}
@@ -851,8 +860,11 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
ieee80211_bss_info_change_notify(sdata, bss_info_changed);
/* will be same as sdata */
- if (local->ps_sdata)
- ieee80211_enable_ps(local, sdata);
+ if (local->ps_sdata) {
+ mutex_lock(&local->iflist_mtx);
+ ieee80211_recalc_ps(local, -1);
+ mutex_unlock(&local->iflist_mtx);
+ }
netif_tx_start_all_queues(sdata->dev);
netif_carrier_on(sdata->dev);