From patchwork Fri May 28 14:00:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 12287071 X-Patchwork-Delegate: nbd@nbd.name 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.4 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 3A9E6C2B9F7 for ; Fri, 28 May 2021 14:00:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EC4061355 for ; Fri, 28 May 2021 14:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232936AbhE1OCL (ORCPT ); Fri, 28 May 2021 10:02:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:40868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbhE1OCG (ORCPT ); Fri, 28 May 2021 10:02:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB27F613E5; Fri, 28 May 2021 14:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622210431; bh=aHpj0S40WZjNmUCQ1UjIWj1fO3zMpnDa4X2A/IsOfPQ=; h=From:To:Cc:Subject:Date:From; b=qIPB9jaSP5DQ3OV1s2YffJ1JT88dYr3oOkU1yM2ssUvr/mvsgCFGZgGz38lK2FJFa tAAq5RsAMy6i6J+tw+7BE1kE5r3wi14PhFtWaUARlAoHvBl+kJzyq6Fa2H097Sab77 VZRaLAbxu1IAv/wK4OOLmUKb1JtNp4pZ/jL5o/njaUdzS+S7sAvfE0XrZrFiQ/I1PL B6w0+UUoIaZplr1HNcF1NIYxcQOOrXtT+P+MD76Ocoz2bume7m6Ua4mX79btJ9ICfL 0JQg23mm2ArAZq1LcT77RHz/IIrrXhEF3hAu/+DZS7Is0c/a1066Zq99IBfyu5MK2N JhJea4Sxz9wqQ== From: Lorenzo Bianconi To: nbd@nbd.name Cc: lorenzo.bianconi@redhat.com, linux-wireless@vger.kernel.org Subject: [PATCH v2] mt76: mt7921: set MT76_RESET during mac reset Date: Fri, 28 May 2021 16:00:24 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Set MT76_RESET during mt7921_mac_reset in order to avoid packet transmissions. Move tx scheduling at the end of reset routine. Signed-off-by: Lorenzo Bianconi --- Changes since v1: - move tx scheduling at the end of reset routine --- .../net/wireless/mediatek/mt76/mt7921/mac.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 4d1050ae9f39..baaca4eb715e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -1255,6 +1255,7 @@ mt7921_mac_reset(struct mt7921_dev *dev) mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0); mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0); + set_bit(MT76_RESET, &dev->mphy.state); set_bit(MT76_MCU_RESET, &dev->mphy.state); wake_up(&dev->mt76.mcu.wait); skb_queue_purge(&dev->mt76.mcu.res_q); @@ -1274,17 +1275,13 @@ mt7921_mac_reset(struct mt7921_dev *dev) if (err) return err; + clear_bit(MT76_MCU_RESET, &dev->mphy.state); + mt76_for_each_q_rx(&dev->mt76, i) { napi_enable(&dev->mt76.napi[i]); napi_schedule(&dev->mt76.napi[i]); } - napi_enable(&dev->mt76.tx_napi); - napi_schedule(&dev->mt76.tx_napi); - mt76_worker_enable(&dev->mt76.tx_worker); - - clear_bit(MT76_MCU_RESET, &dev->mphy.state); - mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL | MT_INT_MCU_CMD); @@ -1302,7 +1299,16 @@ mt7921_mac_reset(struct mt7921_dev *dev) if (err) return err; - return __mt7921_start(&dev->phy); + err = __mt7921_start(&dev->phy); + if (err) + return err; + + clear_bit(MT76_RESET, &dev->mphy.state); + napi_enable(&dev->mt76.tx_napi); + napi_schedule(&dev->mt76.tx_napi); + mt76_worker_enable(&dev->mt76.tx_worker); + + return 0; } /* system error recovery */