linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
[parent not found: <1431602181-17700-1-git-send-email-chaitanya.mgit@gmail.com>]
* [PATCH] mac80211: Fix power save state stuck in ACTIVE caused by race between suspend and Tx packet.
@ 2015-05-31 10:22 Chaitanya T K
  2015-05-31 10:23 ` Krishna Chaitanya
  2015-06-01 14:45 ` Johannes Berg
  0 siblings, 2 replies; 11+ messages in thread
From: Chaitanya T K @ 2015-05-31 10:22 UTC (permalink / raw)
  To: linux-wireless; +Cc: Chaitanya T K

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

If we receive suspend after TX path has executed
dynamic ps disable work, the driver will be in 
ACTIVE state during suspend and even after it 
resumes. 

As before suspend all data packets are flushed
it is safe to put the driver in to sleep for
optimal power during suspend or up on resume.

Signed-off-by: Chaitanya T K <chaitanya.mgit@gmail.com>
---
 net/mac80211/pm.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
index ac6ad62..c9d71c2 100644
--- a/net/mac80211/pm.c
+++ b/net/mac80211/pm.c
@@ -76,6 +76,21 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
 			if (sdata->vif.type != NL80211_IFTYPE_STATION)
 				continue;
 			ieee80211_mgd_quiesce(sdata);
+			/* This is to handle a race where suspend
+			 * is invoked after dynamic ps work disables
+			 * power save due to TX. This causes the driver
+			 * to be stuck in ACTIVE during suspend and
+			 * after resume unless there is another TX,
+			 * after which the dynamic ps puts driver
+			 * back to 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] 11+ messages in thread

end of thread, other threads:[~2015-06-01 14:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1431939609-7261-1-git-send-email-chaitanya.mgit@gmail.com>
2015-05-18  9:05 ` [PATCH] mac80211: Fix power save state stuck in ACTIVE caused by race between suspend and Tx packet Johannes Berg
2015-05-18  9:19   ` Krishna Chaitanya
2015-05-18  9:24     ` Johannes Berg
2015-05-18  9:28       ` Krishna Chaitanya
     [not found] <1431602181-17700-1-git-send-email-chaitanya.mgit@gmail.com>
2015-05-19  7:31 ` Johannes Berg
2015-05-19  8:23   ` Krishna Chaitanya
2015-05-20 13:41     ` Johannes Berg
2015-05-20 13:57       ` Krishna Chaitanya
2015-05-31 10:22 Chaitanya T K
2015-05-31 10:23 ` Krishna Chaitanya
2015-06-01 14:45 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).