From patchwork Mon Jun 1 17:14:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Chaitanya X-Patchwork-Id: 6523851 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 318159F1CC for ; Mon, 1 Jun 2015 17:15:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57705204E7 for ; Mon, 1 Jun 2015 17:15:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B6DA204E3 for ; Mon, 1 Jun 2015 17:15:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752719AbbFARPx (ORCPT ); Mon, 1 Jun 2015 13:15:53 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:35994 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751910AbbFARPv (ORCPT ); Mon, 1 Jun 2015 13:15:51 -0400 Received: by wgbgq6 with SMTP id gq6so120327655wgb.3 for ; Mon, 01 Jun 2015 10:15:50 -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=tFjhhc4RG5U3kUYzyvOjo0pr9o8ezV2A4qI2c4f2Nik=; b=Df8P0/ukPO60QnQcRX2S+n3MSiw1FzpYtAuNjNnyiCODzN4bYR0dsu6+rpXw8mci1b UA4wQNOF8IdxBXHolIxJ0jyksVC8yIpzrtIt1kdXFxUIu8lIl4UPRLODWylDw4Qm9DEj w407g1D1JrFQ9hyyONV1ZiKXBKWs3Q9AlYazmtO/qEpBweusagzNfnH2qnxcrVbJVX2l agKzaNT6tkN+oEtrQXnb+CrPx28NL8SmlVO6in+0lXvJmKUubK/5MjD1mymjc5vIt3yT 8CHKUrr5oP7nbxQbocg7NAtH7Qa+iTj5OQ2RhEjb8aszZMDdDK4GZ5nyPSf7QC8EvjoG hwrw== X-Received: by 10.194.109.229 with SMTP id hv5mr43847839wjb.119.1433178950391; Mon, 01 Jun 2015 10:15:50 -0700 (PDT) Received: from rocky.hb.imgtec.org ([115.112.122.66]) by mx.google.com with ESMTPSA id d3sm4765108wic.1.2015.06.01.10.15.46 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Jun 2015 10:15:49 -0700 (PDT) From: Chaitanya T K To: linux-wireless , Johannes Berg Cc: Chaitanya T K Subject: [PATCH V2] mac80211: Fix power save state stuck in ACTIVE caused by race between suspend and Tx packet. Date: Mon, 1 Jun 2015 22:44:45 +0530 Message-Id: <1433178885-8787-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 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 high power consumption of chipset during (or) after resuming also. Signed-off-by: Chaitanya T K --- V2: Updated Comment and Commit log. --- net/mac80211/pm.c | 15 +++++++++++++++ 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..cc311be 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); + /* If suspended during TX in progress, 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);