From patchwork Wed Apr 21 10:43:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 426159 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF77C433B4 for ; Wed, 21 Apr 2021 10:44:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA3AA61440 for ; Wed, 21 Apr 2021 10:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235062AbhDUKoh (ORCPT ); Wed, 21 Apr 2021 06:44:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:42394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234175AbhDUKoh (ORCPT ); Wed, 21 Apr 2021 06:44:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4885961447; Wed, 21 Apr 2021 10:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619001844; bh=4F/mdA+8KiAVNOjwmzy4t0tGyd6Otl8pt7KMdgaZ5D8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhvs+Q8H9wOv9aq2XTZuwiogfW6IVzlrQTKTN0jMcWtGpPVrLFxBliJWg8IZJyBzl Wkhz8RVW/9Xz4EUzs1AOszI2rKY/QMkO1vtsXQJgEwKbYqWBl7ptc7LHXnC8bp4k95 Ulik+o0fjDPn0qumvj5tkDJ69xNV+rcMAcQKUE19zh7DT7117sdnF6AyE0u/BIWl2m Al6cmUtotP/MHugvueBTUohEOPvoCeTu19Kn9mB5Ro7YSW/X7CBPZVi78SFg2myv+4 Pn2LKnYrxMRD4zPU6ilFwUvi/Ms6EpFAeX0UlZtcigCUqvuixXadLU2KeqYprjKqYj aruAj6qPCdU7Q== From: Lorenzo Bianconi To: nbd@nbd.name Cc: linux-wireless@vger.kernel.org, lorenzo.bianconi@redhat.com, sean.wang@mediatek.com Subject: [PATCH 3/4] mt76: connac: unschedule mac_work before going to sleep Date: Wed, 21 Apr 2021 12:43:50 +0200 Message-Id: <18ad0bd853e0ff135d5eef10e4e9fd192d5535bf.1619001617.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In order to wake the device less frequently and so reduce power consumpation, unschedule mac_work before going to sleep Signed-off-by: Lorenzo Bianconi --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index d11375661875..f81a17d56008 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -1912,6 +1912,8 @@ void mt7615_pm_wake_work(struct work_struct *work) napi_schedule(&dev->mt76.napi[i]); mt76_connac_pm_dequeue_skbs(mphy, &dev->pm); mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], false); + ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, + MT7615_WATCHDOG_TIME); } ieee80211_wake_queues(mphy->hw); diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c index 66f1667481e6..b32f26c1f8b3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c @@ -42,8 +42,10 @@ void mt76_connac_power_save_sched(struct mt76_phy *phy, pm->last_activity = jiffies; - if (!test_bit(MT76_STATE_PM, &phy->state)) + if (!test_bit(MT76_STATE_PM, &phy->state)) { + cancel_delayed_work(&phy->mac_work); queue_delayed_work(dev->wq, &pm->ps_work, pm->idle_timeout); + } } EXPORT_SYMBOL_GPL(mt76_connac_power_save_sched); diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 72d04b229e6b..09f60a68ac73 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -1492,6 +1492,8 @@ void mt7921_pm_wake_work(struct work_struct *work) napi_schedule(&dev->mt76.napi[i]); mt76_connac_pm_dequeue_skbs(mphy, &dev->pm); mt7921_tx_cleanup(dev); + ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work, + MT7921_WATCHDOG_TIME); } ieee80211_wake_queues(mphy->hw);