When a station goes to PS mode to scan, it will then send
probe requests without the PS bit set. mac80211 will take
that as indication that the station woke up, but it didn't.
This patch changes mac80211 to only consider doze->wake
transitions on data frames to to fix that issue.
Signed-off-by: Johannes Berg <[email protected]>
Cc: Jouni Malinen <[email protected]>
---
net/mac80211/rx.c | 28 ++++++++++++++++++++--------
1 file changed, 20 insertions(+), 8 deletions(-)
--- everything.orig/net/mac80211/rx.c 2008-11-23 14:58:21.000000000 +0100
+++ everything/net/mac80211/rx.c 2008-11-23 15:04:47.000000000 +0100
@@ -744,17 +744,29 @@ ieee80211_rx_h_sta_process(struct ieee80
sta->last_qual = rx->status->qual;
sta->last_noise = rx->status->noise;
+ /*
+ * Change STA power saving mode only at the end of a frame
+ * exchange sequence.
+ */
if (!ieee80211_has_morefrags(hdr->frame_control) &&
(rx->sdata->vif.type == NL80211_IFTYPE_AP ||
rx->sdata->vif.type == NL80211_IFTYPE_AP_VLAN)) {
- /* Change STA power saving mode only in the end of a frame
- * exchange sequence */
- if (test_sta_flags(sta, WLAN_STA_PS) &&
- !ieee80211_has_pm(hdr->frame_control))
- rx->sent_ps_buffered += ap_sta_ps_end(sta);
- else if (!test_sta_flags(sta, WLAN_STA_PS) &&
- ieee80211_has_pm(hdr->frame_control))
- ap_sta_ps_start(sta);
+ if (test_sta_flags(sta, WLAN_STA_PS)) {
+ /*
+ * Ignore doze->wake transitions that are
+ * indicated by non-data frames, the standard
+ * is unclear here, but for example going to
+ * PS mode and then scanning would cause a
+ * doze->wake transition for the probe request,
+ * and that is clearly undesirable.
+ */
+ if (ieee80211_is_data(hdr->frame_control) &&
+ !ieee80211_has_pm(hdr->frame_control))
+ rx->sent_ps_buffered += ap_sta_ps_end(sta);
+ } else {
+ if (ieee80211_has_pm(hdr->frame_control))
+ ap_sta_ps_start(sta);
+ }
}
/* Drop data::nullfunc frames silently, since they are used only to
On Wed, Nov 26, 2008 at 03:02:58PM +0100, Johannes Berg wrote:
> When a station goes to PS mode to scan, it will then send
> probe requests without the PS bit set. mac80211 will take
> that as indication that the station woke up, but it didn't.
> This patch changes mac80211 to only consider doze->wake
> transitions on data frames to to fix that issue.
IEEE Std 802.11-2007 is indeed quite unclear on number of power save
related topics. This is being worked on in IEEE 802.11 TGmb, but well,
nothing final from that is going to come out for years, so we better
follow common sense here.
It looks like this change is the best option we have for processing
doze->wake transition. The standard actually has text that mandates that
management frames shall not have Power Management field set to one and
as such, the STA sending Probe Request frames does need to remain awake
to receive the Probe Response, but if it also happens to be associated
at the same time, the AP that it is associated with should probably not
think that the STA is going to remain awake after having received the
Probe Response frame. This patch seems to take care of this corner case.
Based on what happens with the discussions at TGmb, this area may need
to be changed again. For example, I could think of Action frames being
handled like Data frames here, but well, that can happen once we get
some more thought out comments about proposed changes to the standard.
--
Jouni Malinen PGP id EFC895FA