From patchwork Wed Jun 10 13:42:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya X-Patchwork-Id: 6580191 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 78EC19F1C1 for ; Wed, 10 Jun 2015 13:45:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97074205F9 for ; Wed, 10 Jun 2015 13:45:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99C88205EA for ; Wed, 10 Jun 2015 13:45:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754246AbbFJNpn (ORCPT ); Wed, 10 Jun 2015 09:45:43 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:33340 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754266AbbFJNmq (ORCPT ); Wed, 10 Jun 2015 09:42:46 -0400 Received: by wiwd19 with SMTP id d19so48941824wiw.0 for ; Wed, 10 Jun 2015 06:42:45 -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=NElC6UNqYFxNOTrKUUEEIa8C1kaPYCUz1KyTjDJlDCY=; b=VvBhKyTB2bs0Hr5YINZXXdi75xUqp/lzTp+G9YzPXQZ8RP0vz/9djjwSx8uF+97gU4 /3G8HJm2T7S5VQRYUGscBnSqbeL/BTlHuWR3vH7eOtkbp9b7ufzgtdQ7Jm0rZB7OS8C7 Ud4GcDYIAPoSljiiNe9EBTBGrd+EoUAY3BvvttUareaStySMC+2lw7h+G4Vz8QDE4NDB kY/hGtydP+av/0y8AO/+h1RAG4NdmY7P0/UUBUmZLGUXZ3OHGD/PfG714Fpv6YCqeLNW dKetMCMn97jWRFaXTUAwwemTgfS1bELeDq00VlwK+9W03XC2qP5gHHc2Tpq1ivXSUW+B F7Rw== X-Received: by 10.194.103.2 with SMTP id fs2mr6424363wjb.151.1433943765076; Wed, 10 Jun 2015 06:42:45 -0700 (PDT) Received: from rocky.hb.imgtec.org ([115.112.122.66]) by mx.google.com with ESMTPSA id be3sm8022801wib.21.2015.06.10.06.42.41 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Jun 2015 06:42:44 -0700 (PDT) From: Chaitanya T K To: linux-wireless , Johannes Berg Cc: Chaitanya T K Subject: [PATCH V3] mac80211: wowlan: suspend: Fix power save state stuck in ACTIVE caused by race between suspend and Tx packet. Date: Wed, 10 Jun 2015 19:12:31 +0530 Message-Id: <1433943751-11221-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 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 --- V2: Updated Comment and Commit log. --- net/mac80211/pm.c | 16 +++++++++++++++ 1 file changed, 16 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..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);