From patchwork Sun May 31 10:22:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya X-Patchwork-Id: 6515681 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 19597C0020 for ; Sun, 31 May 2015 10:22:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 34C2E20630 for ; Sun, 31 May 2015 10:22:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4907820621 for ; Sun, 31 May 2015 10:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757868AbbEaKW1 (ORCPT ); Sun, 31 May 2015 06:22:27 -0400 Received: from mail-wg0-f51.google.com ([74.125.82.51]:35797 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751424AbbEaKWZ (ORCPT ); Sun, 31 May 2015 06:22:25 -0400 Received: by wgme6 with SMTP id e6so92945641wgm.2 for ; Sun, 31 May 2015 03:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Any3yg2mXPUjZa4oc6kRVlJhZHYebQFf8bW885pvChE=; b=dLBk99BAjPqcejwpHuKgyx9LNgFPyIsqcY0oTJ0wTcFEAujO6QdFpEIQfYr7ta8jKd btCXADeyEUmSW4RWNpsP8CVhRnp7+GZrGYB2yWQfdrRFvifGXCBGPUkjv+uJXHS++uf5 pj+mFp4Xnm6XiUnB2OMpOYx/7rtIugZqbJFvvQ9oIuysJX0CuguhgY8A2nH6LIQRBji4 kupR4aHOFBg914iirQ2At2uwcVh99fkrI536TuRHH3IdlRtO67DBITG1MN8LKuZWasZn QxaIXGSUAxmquBDKCg0hcog6dj3upMdnzeR5c/8JNI0SagqKWWLpOxKuJP8togPB4MVW xROg== X-Received: by 10.180.86.234 with SMTP id s10mr11057567wiz.50.1433067744152; Sun, 31 May 2015 03:22:24 -0700 (PDT) Received: from rocky.hb.imgtec.org ([115.112.122.66]) by mx.google.com with ESMTPSA id l6sm11325541wib.18.2015.05.31.03.22.21 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 31 May 2015 03:22:23 -0700 (PDT) From: Chaitanya T K To: linux-wireless Cc: Chaitanya T K Subject: [PATCH] mac80211: Fix power save state stuck in ACTIVE caused by race between suspend and Tx packet. Date: Sun, 31 May 2015 15:52:11 +0530 Message-Id: <1433067731-20114-1-git-send-email-chaitanya.mgit@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chaitanya T K 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 --- net/mac80211/pm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);