Skip to contentSkip to conversation

mac80211: when receiving DTIM disable power-save mode only if it was enabled

PATCH In review Ronald Wahl 2 participants 2 messages Mar 19, 2012 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: when receiving DTIM disable power-save mode only if it was enabled

When receiving DTIM we currently disable power save mode in the hardware unconditionally, i.e. also when the hardware was not sleeping. This causes trouble with at least one wireless chipset (Ralink RT3572). When the hardware is not sleeping and we send a wakeup command (e.g. this happens after a scan) then a significant decrease of the link quality or a disconnect may occur.
Disabling power save mode only when it was enabled prevents this issue.

---

net/mac80211/mlme.c +5 -3
Index: linux/net/mac80211/mlme.c
===================================================================
@@ -1922,9 +1922,11 @@
 	if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) {
 		if (directed_tim) {
 			if (local->hw.conf.dynamic_ps_timeout > 0) {
-				local->hw.conf.flags &= ~IEEE80211_CONF_PS;
-				ieee80211_hw_config(local,
-						    IEEE80211_CONF_CHANGE_PS);
+				if (local->hw.conf.flags & IEEE80211_CONF_PS) {
+					local->hw.conf.flags &= ~IEEE80211_CONF_PS;
+					ieee80211_hw_config(local,
+							    IEEE80211_CONF_CHANGE_PS);
+				}
 				ieee80211_send_nullfunc(local, sdata, 0);
 			} else {
 				local->pspolling = true;
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ronald Wahl

When receiving DTIM we currently disable power save mode in the hardware unconditionally, i.e. also when the hardware was not sleeping. This causes trouble with at least one wireless chipset (Ralink RT3572). When the hardware is not sleeping and we send a wakeup command (e.g. this happens after a scan) then a significant decrease of the link quality or a disconnect may occur.
Disabling power save mode only when it was enabled prevents this issue.

Obviously rt2x00 is the only one that seems to need this, but simply replicating maintaining the PS state inside rt2x00 while mac80211 already does this doesn't seem right to me.

Quoted 24 lines

---
Index: linux/net/mac80211/mlme.c
===================================================================

net/mac80211/mlme.c (working copy) renamed from net/mac80211/mlme.c (revision 213137) +5 -4
@@ -1922,9 +1922,11 @@
   if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) {
       if (directed_tim) {
           if (local->hw.conf.dynamic_ps_timeout > 0) {
-                local->hw.conf.flags &= ~IEEE80211_CONF_PS;
-                ieee80211_hw_config(local,
-                            IEEE80211_CONF_CHANGE_PS);
+                if (local->hw.conf.flags & IEEE80211_CONF_PS) {
+                    local->hw.conf.flags &= ~IEEE80211_CONF_PS;
+                    ieee80211_hw_config(local,
+                                IEEE80211_CONF_CHANGE_PS);
+                }
               ieee80211_send_nullfunc(local, sdata, 0);
           } else {
               local->pspolling = true;
--

To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html