All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3] mac80211: wowlan: suspend: Fix power save state stuck in ACTIVE caused by race between suspend and Tx packet.
@ 2015-06-10 13:42 Chaitanya T K
  2015-06-17  8:47 ` Johannes Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Chaitanya T K @ 2015-06-10 13:42 UTC (permalink / raw)
  To: linux-wireless, Johannes Berg; +Cc: Chaitanya T K

From: Chaitanya T K <chaitanya.mgit@gmail.com>

Background: When wowlan is enabled, the chipset stays in low
power state maintaining the connection as per the
mac80211 power save state.

If suspended during TX in progress, there can be 
race where the driver is put of of power-save due
to TX and during suspend dynamic_ps_time is cancelled
and TX packet is flushed, leaving the driver in ACTIVE
even after resuming until dynamic_ps_time puts 
driver back in DOZE. (Which only happens if there
is another TX).

This can lead to high power consumption of chipset 
during (or) after resuming.

Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
---
V2: Updated Comment and Commit log.
---
 net/mac80211/pm.c |   16 +++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index ac6ad62..8149a3d 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -76,6 +76,22 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
 			if (sdata->vif.type != NL80211_IFTYPE_STATION)
 				continue;
 			ieee80211_mgd_quiesce(sdata);
+			/* If suspended during TX in progress, and wowlan
+			 * is enabled (connection will be active) there
+			 * can be a race where the driver is put out
+			 * of power-save due to TX and during suspend
+			 * dynamic_ps_timer is cancelled and TX packet
+			 * is flushed, leaving the driver in ACTIVE even
+			 * after resuming until dynamic_ps_timer puts
+			 * driver back in DOZE.
+			 */
+			if (sdata->u.mgd.associated &&
+			    sdata->u.mgd.powersave &&
+			     !(local->hw.conf.flags & IEEE80211_CONF_PS)) {
+				local->hw.conf.flags |= IEEE80211_CONF_PS;
+				ieee80211_hw_config(local,
+						    IEEE80211_CONF_CHANGE_PS);
+			}
 		}
 
 		err = drv_suspend(local, wowlan);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-07-17  9:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 13:42 [PATCH V3] mac80211: wowlan: suspend: Fix power save state stuck in ACTIVE caused by race between suspend and Tx packet Chaitanya T K
2015-06-17  8:47 ` Johannes Berg
2015-06-17 10:22   ` Krishna Chaitanya
2015-06-17 11:01     ` Johannes Berg
2015-06-17 11:35       ` Krishna Chaitanya
2015-06-17 11:37         ` Johannes Berg
2015-06-17 12:15           ` Krishna Chaitanya
2015-07-17  9:16             ` Johannes Berg
2015-07-17  9:33               ` Krishna Chaitanya

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.