From patchwork Thu Apr 15 13:41:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12205501 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=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, 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 7448CC433B4 for ; Thu, 15 Apr 2021 13:41:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4044661249 for ; Thu, 15 Apr 2021 13:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233136AbhDONmP (ORCPT ); Thu, 15 Apr 2021 09:42:15 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:58835 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S232795AbhDONmO (ORCPT ); Thu, 15 Apr 2021 09:42:14 -0400 X-UUID: ce74301250ce4b03b59d43ad9619cc96-20210415 X-UUID: ce74301250ce4b03b59d43ad9619cc96-20210415 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1957360891; Thu, 15 Apr 2021 21:41:49 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 15 Apr 2021 21:41:46 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 15 Apr 2021 21:41:46 +0800 From: To: , CC: , , , , , , , , , Subject: [PATCH 2/2] mt76: mt7921: abort uncompleted scan by wifi reset Date: Thu, 15 Apr 2021 21:41:45 +0800 Message-ID: <1618494105-5462-2-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1618494105-5462-1-git-send-email-sean.wang@mediatek.com> References: <1618494105-5462-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 1BE1986FC84855AB1F926A97F52A7D3E2F4FF6FC6031C2B8B5F8008F5C18C4212000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Sean Wang Scan abort should be required for the uncompleted hardware scan interrupted by wifi reset. Otherwise, it is possible that the scan request after wifi reset gets error code -EBUSY from mac80211 and then blocks the reconnectting to the access point. Fixes: 215bb6737bef ("mt76: mt7921: add wifi reset support") Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 572bab82315a..3145880df6e7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -1413,6 +1413,14 @@ void mt7921_mac_reset_work(struct work_struct *work) if (i == 10) dev_err(dev->mt76.dev, "chip reset failed\n"); + if (test_and_clear_bit(MT76_HW_SCANNING, &dev->mphy.state)) { + struct cfg80211_scan_info info = { + .aborted = true, + }; + + ieee80211_scan_completed(dev->mphy.hw, &info); + } + ieee80211_wake_queues(hw); ieee80211_iterate_active_interfaces(hw, IEEE80211_IFACE_ITER_RESUME_ALL,