From patchwork Mon May 10 15:14:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248485 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 B1A8EC43611 for ; Mon, 10 May 2021 15:15:29 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2D76061493 for ; Mon, 10 May 2021 15:15:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D76061493 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=/DPEurBHlhtj/v3/kCfE1vXrcXJ9kBIFwSc1iGgVTcY=; b=T9/qSm5DBPFteHPYuzvd6QR0s5 rj8gBlcpn7HmaVZp7Xzd6H8jpMRuzyIbEZDxwB32idvE30pbjT0/Kc04Zh+gmmdTYMuYBYig/KzMJ LKFeDWw7y+XyXnSW4SCkS3bfxGqsSmQSKDL8EKU6EIseje/6ZOCmHE+qM9bhS14VIGnk/ceK+luTG 0cEmytjGywQWDzZmITUzdFsrtYKn8hj9MdGLxt3TuiJ8r0DQS4THorqCVloBtK87wnsxUe61rB5i0 ZyWYubBaVylP6XPaKkDpuMtidrZTk4LNbRcBQpneWBF3bzJlDsaj6zG8MPB1tavt/IONibrqcS/QB miEXA/wA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cl-00ElMI-Qw; Mon, 10 May 2021 15:15:11 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cj-00ElLh-Gy for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:15:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=OyJ2QstMf311/CPHWgZQBj56MIf3t/hCD2ihcdvp/AE=; b=MVa3uR9OqlQ+sONY9qydwSq3aM K7mxyEQZQj0+yUFCUGDdzS8xt9R7mubroGRGpafwCRbXuUJwtX2WsiT5LsWBXVBR4OGSulcge183Y TOrj0uUWYW1RcC5abAt7ayWc3nhdRmOnsX+yMlnS/YizSvGCwklORXEIisJtmcLqp+cGt67zA41aY JuQDcqGIKa2XhGO3lOEeJ+FUJif6Rpd59D2Bg10teW7hxixvsm2MGrWLGTMawMP9dLqMuxc+F4zEE XyTaKFoxBj9eiNR1bUhXHupqVtXk42KHKJGTA20XMhGXl7DCg/67b+aHDRWF0VNb89DCsCiNA1y3N aCADjk8Q==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cg-008rIR-EW for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:15:08 +0000 X-UUID: dc7b2a3585024f319739441f556309e1-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=OyJ2QstMf311/CPHWgZQBj56MIf3t/hCD2ihcdvp/AE=; b=GUlYQ+90A1U/ih8lHB0kIg5MdyiTluITkUXw8CE25iHla24aTfOry+SPwUbnIhl5CRf6Iy5S0qug0zaSKCpT6ZBQ1pUGWOwQkt4UCN++X3Ju8fyZ0NNtGB5+bDox/WosPrO7f9t70AkMLv+c2pKcQw6jaPrt8hsa21h6/94JtNs=; X-UUID: dc7b2a3585024f319739441f556309e1-20210510 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 21231030; Mon, 10 May 2021 08:15:01 -0700 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:14:59 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:14:58 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:58 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH 1/9] mt76: mt7921: fix mt7921_wfsys_reset sequence Date: Mon, 10 May 2021 23:14:49 +0800 Message-ID: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_081506_977958_5F63D78D X-CRM114-Status: UNSURE ( 9.93 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang WiFi subsytem reset should control MT_WFSYS_SW_RST_B and then poll the same register until the bit WFSYS_SW_INIT_DONE bit is set. Fixes: 0c1ce9884607 ("mt76: mt7921: add wifi reset support") Reviewed-by: Lorenzo Bianconi Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7921/dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/dma.c b/drivers/net/wireless/mediatek/mt76/mt7921/dma.c index 71e664ee7652..bd9143dc865f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/dma.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/dma.c @@ -313,9 +313,9 @@ static int mt7921_dma_reset(struct mt7921_dev *dev, bool force) int mt7921_wfsys_reset(struct mt7921_dev *dev) { - mt76_set(dev, 0x70002600, BIT(0)); - msleep(200); - mt76_clear(dev, 0x70002600, BIT(0)); + mt76_clear(dev, MT_WFSYS_SW_RST_B, WFSYS_SW_RST_B); + msleep(50); + mt76_set(dev, MT_WFSYS_SW_RST_B, WFSYS_SW_RST_B); if (!__mt76_poll_msec(&dev->mt76, MT_WFSYS_SW_RST_B, WFSYS_SW_INIT_DONE, WFSYS_SW_INIT_DONE, 500)) From patchwork Mon May 10 15:14:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248489 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 574D7C4363E for ; Mon, 10 May 2021 15:15:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B85F06023E for ; Mon, 10 May 2021 15:15:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B85F06023E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UkRFByyOr+wsGwIBV4fzhK8TLGvfUV/G4qvJw551hY4=; b=bd/+iomGyR4GBWshFwQpUKPtG wU3X+JA+bdDPVW/i8HAO4UJ3PYKF9woKqB4SVFBAZzsUK6tp12eWBCDi2DRKwZQJXa68iuRSYFAVx Hpnsxi02EiRyI0LxZIrxToKKiwjfo1YreGD0DpZNC2KQHg8v+vP1onRiR1XVWX60WIhZubJXa9hsK HzHTIUCn0f+tj/Y4TWqYbVkc91rSwtEriSFkRScDkbjG5pNZXTZOIPZSE6xkplTMZ+PEDn87pYWcx OjsbaypisNDFiHq12Iydj9GHBzzU1km+pmNql7kQMDxADDwdZE7EWRAvetUehcHUHSd36xjiStrux IKGzZ/dMg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7ct-00ElP7-Kf; Mon, 10 May 2021 15:15:19 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cm-00ElMG-GN for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:15:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=tDvCbom4XPPk+ke1f1jTWA3Kwkl581/IlqYmpvLAEPo=; b=XoavanEaCjkb5xzMtpIvN/lk1z ebJA3AHmtR+HBq+J14QzQ7eXA0JFVyk1cMrGK66VaMukc/mdOPi9RH8xnWwI1tGNoiY2E0nUsHjoB 2X6LC7KndHx64Pba9VtLkvpeJGT/ZOCChk3N5tlblT7+shNAcnULoLPeMrDdr/utQ6Es9G6gbWAbM 1cymCz+d+Rifxh+0OuwBWcULom7mIwYBYIrzP87aZC0PCwq1FTg/tgp1MiRX86MxRKTJLwwSpCDoA j+v+3XNS26lsBVqATXwubCiTE+EuQc8s8b8sRLvz5J/UBm/cU7XSxLaCSGYhCMMBsTTZ8WItZz1Z7 JL8K2tpg==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cj-008rIR-O4 for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:15:11 +0000 X-UUID: ac42fae3fc1a4279806db48cbce11acc-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=tDvCbom4XPPk+ke1f1jTWA3Kwkl581/IlqYmpvLAEPo=; b=lKtAr/QPIkOCFnEdXUB994nV08jl0HEW+xr4niIvhyUiJ7qivDY7WKAS7Aa6P5IVCpM1X3/26u9WOvOvdKDwhJwcmO+1QTocDyfhqrOtEd9q45hN3Gh1QdSTHOXDjl6LeN5GFzT0Sf3HIe+B60wi8sUFqVnWZ6ZDC+z4ft5tntw=; X-UUID: ac42fae3fc1a4279806db48cbce11acc-20210510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 97087803; Mon, 10 May 2021 08:15:02 -0700 Received: from MTKMBS06N2.mediatek.inc (172.21.101.130) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:15:01 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:14:58 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:58 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH 2/9] mt76: mt7921: Don't alter Rx path classifier Date: Mon, 10 May 2021 23:14:50 +0800 Message-ID: <1620659697-12048-2-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> References: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 3886F8F6554AC4F76625E046C0B15BE9936678AC567C95A67B719FE920DD7D132000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_081509_819299_F8AE365A X-CRM114-Status: UNSURE ( 6.61 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Keep Rx path classifier the mt7921 firmware prefers to allow frames pass through MCU. Fixes: 5c14a5f944b9 ("mt76: mt7921: introduce mt7921e support") Reviewed-by: Lorenzo Bianconi Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7921/init.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 1d4ba5d0166a..6947d98287c0 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -118,30 +118,12 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) static void mt7921_mac_init_band(struct mt7921_dev *dev, u8 band) { - u32 mask, set; - mt76_rmw_field(dev, MT_TMAC_CTCR0(band), MT_TMAC_CTCR0_INS_DDLMT_REFTIME, 0x3f); mt76_set(dev, MT_TMAC_CTCR0(band), MT_TMAC_CTCR0_INS_DDLMT_VHT_SMPDU_EN | MT_TMAC_CTCR0_INS_DDLMT_EN); - mask = MT_MDP_RCFR0_MCU_RX_MGMT | - MT_MDP_RCFR0_MCU_RX_CTL_NON_BAR | - MT_MDP_RCFR0_MCU_RX_CTL_BAR; - set = FIELD_PREP(MT_MDP_RCFR0_MCU_RX_MGMT, MT_MDP_TO_HIF) | - FIELD_PREP(MT_MDP_RCFR0_MCU_RX_CTL_NON_BAR, MT_MDP_TO_HIF) | - FIELD_PREP(MT_MDP_RCFR0_MCU_RX_CTL_BAR, MT_MDP_TO_HIF); - mt76_rmw(dev, MT_MDP_BNRCFR0(band), mask, set); - - mask = MT_MDP_RCFR1_MCU_RX_BYPASS | - MT_MDP_RCFR1_RX_DROPPED_UCAST | - MT_MDP_RCFR1_RX_DROPPED_MCAST; - set = FIELD_PREP(MT_MDP_RCFR1_MCU_RX_BYPASS, MT_MDP_TO_HIF) | - FIELD_PREP(MT_MDP_RCFR1_RX_DROPPED_UCAST, MT_MDP_TO_HIF) | - FIELD_PREP(MT_MDP_RCFR1_RX_DROPPED_MCAST, MT_MDP_TO_HIF); - mt76_rmw(dev, MT_MDP_BNRCFR1(band), mask, set); - mt76_set(dev, MT_WF_RMAC_MIB_TIME0(band), MT_WF_RMAC_MIB_RXTIME_EN); mt76_set(dev, MT_WF_RMAC_MIB_AIRTIME0(band), MT_WF_RMAC_MIB_RXTIME_EN); From patchwork Mon May 10 15:14:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248507 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 0C8EAC433ED for ; Mon, 10 May 2021 15:18:57 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72ECB6101B for ; Mon, 10 May 2021 15:18:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 72ECB6101B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZY6xJBtU55X6quD3/A909qs9AKmdt03lCh5Sgi422As=; b=nh6IY9yz7QrlVl/C9dBoocUpd QdaMMvNWszNszpXf6Vc2krem+H0+BBxbktk8OgkY0G3mQvv2hjMHeX0e4MLt8EyC/kE53M7g0MFCL YOSfMNxGCv19LLnesQke9gDKvwpEsOJ8+9a7ccihIoG/xsa9lZjCw4rPGIqwrXDpCgLM2MYVUHD5T Zxw6q+p9bZ/QLRA7fLIf3zOiUZQuueLvocQ2u9HC7UL0kjeM41v3MvXAffH4LKiuUSZ73of9RiIWm ZfdtqIvWtwVg5JUgcNeKvZzUyL+fSdKi4yX165r/NUqAEYqx8ZSKEQKo0sZf6x9EXeNvjNI4Ls8lK WeO04FO2Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7g9-00Elv6-1P; Mon, 10 May 2021 15:18:41 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7g7-00Eluj-B1 for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:18:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=DmRvMDY2k8k26zx+jt/S9pkJMFjpFtKIY0EDaYaPOoI=; b=Bp2/YvVy5OfpSevm3hUazSKyUS pcAbWh4wuRwLALua2BTuyFaFlkPpxdlF2WmOSt+AZQZ8PuZEpel1A2GFkI1j5xHHSSYkMXTD8B7Tr oj1sUqCeG5fz1bX/JPsveMAl32jdUaP2rDJh/AwEpUSMVnyUrQwruJrQph1gyrcTwSHJ5aQ3VA+M7 pNXEOvMU1krVFJAcA305HHlZpZKHERlgL5fD6r8RNGVpytvktmD5n+PyZ7WITvqPvO5W+1Wwzb+Tr Faj1ZYBN35sGCznU1NhY00e7D9csrjOXwR15nceP+UZqc9P/P3FxWGLSpEagmYJ2SzlAomBVB2rjp 18ahcIFw==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7g4-008rUZ-F0 for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:18:37 +0000 X-UUID: 51665c4021e741cb8973b3baaa25fab6-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=DmRvMDY2k8k26zx+jt/S9pkJMFjpFtKIY0EDaYaPOoI=; b=RwXGxP675pnrDSdgdsLIUGUBkyxtABLL/8mfwxvnsnF6OtlS04gF5IxvBPEteMY8kv0JpOokZ6EngjWlenRxwzzVi3Y4JxHIF3nEaYB+fHJtgC65WK7om0RrrdG0+waaYcD9M4SMAnL5RL1gqvNVdIQhXyadqloaEALIj3Ftwjk=; X-UUID: 51665c4021e741cb8973b3baaa25fab6-20210510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 462482650; Mon, 10 May 2021 08:18:34 -0700 Received: from MTKMBS02N1.mediatek.inc (172.21.101.77) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:15:06 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:14:58 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:58 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH 3/9] mt76: connac: fw_own rely on all packet memory all being free Date: Mon, 10 May 2021 23:14:51 +0800 Message-ID: <1620659697-12048-3-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> References: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_081836_530209_4F40099F X-CRM114-Status: GOOD ( 10.05 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang If the device is MMIO-based, we must ensure all TxD/TxP on the host memory all being consumed by the device prior to safely switching to fw_own state. Fixes: ec7bd7b4a9c0 ("mt76: connac: check wake refcount in mcu_fw_pmctrl") Reviewed-by: Lorenzo Bianconi Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt76_connac.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac.h b/drivers/net/wireless/mediatek/mt76/mt76_connac.h index 2b1150bf8d3d..a588d2c39870 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac.h @@ -133,8 +133,12 @@ mt76_connac_pm_unref(struct mt76_connac_pm *pm) static inline bool mt76_connac_skip_fw_pmctrl(struct mt76_phy *phy, struct mt76_connac_pm *pm) { + struct mt76_dev *dev = phy->dev; bool ret; + if (dev->token_count) + return true; + spin_lock_bh(&pm->wake.lock); ret = pm->wake.count || test_and_set_bit(MT76_STATE_PM, &phy->state); spin_unlock_bh(&pm->wake.lock); From patchwork Mon May 10 15:14:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248481 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 6F8B7C43461 for ; Mon, 10 May 2021 15:15:29 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E54206120D for ; Mon, 10 May 2021 15:15:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E54206120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kej2lms//OOWGikt+KRMOzuU8jNlqsPVbeMGFhoJpt4=; b=pnA48eXght59AopekLujyg0wi GpnjFbXFWnLWJkK8V5KBDPsc7L0y2ntZv0mJyhA1KZ5LeIFfQ6MaGKry7IxN80MDho+IX3E7e+GOv +l0Rt/58JmL6emQJ9J702PCC7GcSwWWxXYJOgYiI0YfwKlHlr1B27oupYbrElMJULX3J9mCzcc1rQ YcP3ExXjro2UvWlsQ1QKiTd62yJIXMzIPX+1VSOFIgBDidfZ1MftrfM2IHMVGfY7E0gXWZrltr0xI LlNj4lm+8+WqjFGeaQczLAFEEXojp6+kIsY4jqNFbPZ7A/iBRpIIV9+3yIclkiwavgIrCclQysJPj 3TIDdGLog==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cn-00ElMl-4G; Mon, 10 May 2021 15:15:13 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cj-00ElLj-L9 for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:15:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=xmabILoTJH3OmG7WWafK+etxjnw0OPuyBx4jO3M86XM=; b=CklsmkVhY6+bBGuT6OAoDDAHbL ryX7XEVaa0xyMHrNmzUihyaki+BY97DHYM6Iq+f7NjM03xO/X8DMppdO3WoSGqcOqpmQ4gzUB70tD JhUNFTjs05x0eRGonBWsViOQfLkEGzjf0axfoyovnEiH/hhFK25nMonGeK15cWIpWtbmkKZbsosWD 5aVEaSoYUYTSb1A3mgApxS94a/J5Mbprxo7ZWjJ7ZV81mnS9qBRVjTyiMIftzFed/U9L1XTcnk03S 7kGIwXLPojlltPnXhnFcb2JDovX9Zx+q6vcjk6xRGY0m+id871XZLjMMTmoC1KxcRQ2q3j8HYeD7c VjsTMMwg==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cf-008rIT-G0 for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:15:08 +0000 X-UUID: 4d6c0d498a734169b3b06df99e629c70-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=xmabILoTJH3OmG7WWafK+etxjnw0OPuyBx4jO3M86XM=; b=pSHBO0+bggwnM4H9R6F2152H70GE+jj88wQL0dsgRwpwNUWp4pXfqgLQj7FT7UPvZyjDCTGjf9BVllOMyBoBwe4X99PsJ4PWWcSYd79zoMWjTyR6yTAlyAX151W8qATSacS9ySMoT9Fz4lK/EJES/+RU53aRpzFLtvngE1otU5s=; X-UUID: 4d6c0d498a734169b3b06df99e629c70-20210510 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 813699646; Mon, 10 May 2021 08:15:01 -0700 Received: from MTKMBS01N1.mediatek.inc (172.21.101.68) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:15:00 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:14:58 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:58 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH 4/9] mt76: mt7921: enable deep sleep at runtime Date: Mon, 10 May 2021 23:14:52 +0800 Message-ID: <1620659697-12048-4-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> References: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_081506_983998_73D3E9EC X-CRM114-Status: GOOD ( 15.76 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Enable the deep sleep mode with that firmware is able to trap into the doze state at runtime to reduce the power consumption further. The deep sleep mode is not allowed in the STA state transition with the firmware to have the fast connection experience as we've done in the full power mode Reviewed-by: Lorenzo Bianconi Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 20 +++++++++++++ .../wireless/mediatek/mt76/mt76_connac_mcu.h | 3 ++ .../net/wireless/mediatek/mt76/mt7921/init.c | 6 +++- .../net/wireless/mediatek/mt76/mt7921/main.c | 28 +++++++++++++++++-- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 7b8f8e6f431d..542d7d9f1f52 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1596,6 +1596,26 @@ int mt76_connac_mcu_set_deep_sleep(struct mt76_dev *dev, bool enable) } EXPORT_SYMBOL_GPL(mt76_connac_mcu_set_deep_sleep); +int mt76_connac_sta_state_dp(struct mt76_dev *dev, + enum ieee80211_sta_state old_state, + enum ieee80211_sta_state new_state) +{ + if ((old_state == IEEE80211_STA_ASSOC && + new_state == IEEE80211_STA_AUTHORIZED) || + (old_state == IEEE80211_STA_NONE && + new_state == IEEE80211_STA_NOTEXIST)) + mt76_connac_mcu_set_deep_sleep(dev, true); + + if ((old_state == IEEE80211_STA_NOTEXIST && + new_state == IEEE80211_STA_NONE) || + (old_state == IEEE80211_STA_AUTHORIZED && + new_state == IEEE80211_STA_ASSOC)) + mt76_connac_mcu_set_deep_sleep(dev, false); + + return 0; +} +EXPORT_SYMBOL_GPL(mt76_connac_sta_state_dp); + void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb, struct mt76_connac_coredump *coredump) { diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 01fc9f2c2f4a..3ed2fb5e1389 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1032,6 +1032,9 @@ int mt76_connac_mcu_update_gtk_rekey(struct ieee80211_hw *hw, int mt76_connac_mcu_set_hif_suspend(struct mt76_dev *dev, bool suspend); void mt76_connac_mcu_set_suspend_iter(void *priv, u8 *mac, struct ieee80211_vif *vif); +int mt76_connac_sta_state_dp(struct mt76_dev *dev, + enum ieee80211_sta_state old_state, + enum ieee80211_sta_state new_state); int mt76_connac_mcu_chip_config(struct mt76_dev *dev); int mt76_connac_mcu_set_deep_sleep(struct mt76_dev *dev, bool enable); void mt76_connac_mcu_coredump_event(struct mt76_dev *dev, struct sk_buff *skb, diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index 6947d98287c0..cd68721314fa 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -250,7 +250,11 @@ int mt7921_register_device(struct mt7921_dev *dev) if (ret) return ret; - return mt7921_init_debugfs(dev); + ret = mt7921_init_debugfs(dev); + if (ret) + return ret; + + return mt76_connac_mcu_set_deep_sleep(&dev->mt76, dev->pm.enable); } void mt7921_unregister_device(struct mt7921_dev *dev) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index 39b3e769925e..5dbccbefe047 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -848,6 +848,31 @@ mt7921_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, IEEE80211_STA_NOTEXIST); } +static int mt7921_sta_state(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *sta, + enum ieee80211_sta_state old_state, + enum ieee80211_sta_state new_state) +{ + struct mt7921_dev *dev = mt7921_hw_dev(hw); + + if (dev->pm.enable) { + mt7921_mutex_acquire(dev); + mt76_connac_sta_state_dp(&dev->mt76, old_state, new_state); + mt7921_mutex_release(dev); + } + + if (old_state == IEEE80211_STA_AUTH && + new_state == IEEE80211_STA_ASSOC) { + return mt7921_sta_add(hw, vif, sta); + } else if (old_state == IEEE80211_STA_ASSOC && + new_state == IEEE80211_STA_AUTH) { + return mt7921_sta_remove(hw, vif, sta); + } + + return 0; +} + static int mt7921_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats) @@ -1191,8 +1216,7 @@ const struct ieee80211_ops mt7921_ops = { .conf_tx = mt7921_conf_tx, .configure_filter = mt7921_configure_filter, .bss_info_changed = mt7921_bss_info_changed, - .sta_add = mt7921_sta_add, - .sta_remove = mt7921_sta_remove, + .sta_state = mt7921_sta_state, .sta_pre_rcu_remove = mt76_sta_pre_rcu_remove, .set_key = mt7921_set_key, .sta_set_decap_offload = mt7921_sta_set_decap_offload, From patchwork Mon May 10 15:14:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248529 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 24A31C43460 for ; Mon, 10 May 2021 15:25:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A47C611BE for ; Mon, 10 May 2021 15:25:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A47C611BE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6Q06jsMlv9plgJaLS0u3KU2jgrTKZ5QVcPC2Q0sl/24=; b=jA23y8EiOUs2rte8uVtAPjWam lN5sbmAm0pwgDzK3F+NnGDFgmf0ZKsqSeU2ExbnUaGPAQxK895FHGBCZ6gOetEmHLy9qY9mtKabC7 pma640ribY3X43BBl/Z09Lqz/YXyCedBxhAWaLk275lgo+d6YBRXHRuYruu+l4WqNRDLaWsjnTZjU XkUkg2Xt8LtzycAQgvKfEJYexGE2rIWsl/FjDLfd51nlrgb73wPYR35f+y3DBcZuXS1hoHtPtyx26 IUysvbts+nKN3EQjyLYQ7zrCgnYtsemY4BaNpROX9SZl63W215h0ixU7mJECJFn+SJv/QnvKsGTDJ S2vYYl/vg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7mX-00EmLz-NT; Mon, 10 May 2021 15:25:17 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7mV-00EmLX-Ab for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:25:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=aapmB1vT7DiHVfrB3QXwCLGrCo3mQjhDvFxIcQ146+k=; b=S1r3oOkqhdgbjHTZW8pVQRHUw/ tOvKbPa67JOXcZvQbePXf464EcdJs0NUfA4HPie1N4SIOLAAtEc8LGjhXmx96pXHuFFzxhSPfS3Fn H7DW4oZyxgXjUVZ7msb2F30eRkpbWbXNyiukPIp55cgdc0lNx6/pN1Gsx8ZOa25PPHYrpgaIm0j30 ZDjQrnXVLO9OvAmvGO4m5N6roAQtgYMXWZk7TRGlZ8hcWb2EdJ3r8vEBaKTXsJkcZAoCb9sdkrbeQ bJCAtDthorrvzPldnSFFfJZLLtzPXh8TwJ0mPi5IN+6NC2YY3NWnxeQ4/4Miayv2iqzcEfEC6ahn1 QnanjlCg==; Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7mR-008rpG-6J for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:25:13 +0000 X-UUID: 90f245f6139447d4988cddaa78b291d3-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=aapmB1vT7DiHVfrB3QXwCLGrCo3mQjhDvFxIcQ146+k=; b=PvhNPaD7X5uSnrsUTqKjWClx+K0xpBJyvh36dSfKC3OWyu53TYELuhR+FFZ8IUCBZTYGnsi12rs1JlyKcKMz4Ka0mTCxIPj3EWNhic8HmHtrmogMYCfLK/ZQocje6dbMQyAhEvbO/49Ajf7WbtZQ0NAkmuUfQ7Zsh2hqQuGuDRY=; X-UUID: 90f245f6139447d4988cddaa78b291d3-20210510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1555336688; Mon, 10 May 2021 08:25:09 -0700 Received: from MTKMBS02N2.mediatek.inc (172.21.101.101) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:15:07 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:14:59 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:58 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH 5/9] mt76: mt7921: add deep sleep control to runtime-pm knob Date: Mon, 10 May 2021 23:14:53 +0800 Message-ID: <1620659697-12048-5-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> References: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: CCBB3211708E0EF760A2CB976ADB5631F7BA46BBC0C58AF42C74A748AE02A7212000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_082511_266119_956FBC5E X-CRM114-Status: GOOD ( 10.25 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Add addtional the deep sleep control to runtime-pm knob to allow us to control driver switching between the full power mode and the deep sleep mode the firmware is able to support. Reviewed-by: Lorenzo Bianconi Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt7921/debugfs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c index 6ee423dd4027..b41d70be948b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c @@ -247,6 +247,9 @@ mt7921_pm_set(void *data, u64 val) ieee80211_iterate_active_interfaces(mphy->hw, IEEE80211_IFACE_ITER_RESUME_ALL, mt7921_pm_interface_iter, mphy->priv); + + mt76_connac_mcu_set_deep_sleep(&dev->mt76, !!pm->enable); + mt7921_mutex_release(dev); return 0; @@ -264,6 +267,20 @@ mt7921_pm_get(void *data, u64 *val) DEFINE_DEBUGFS_ATTRIBUTE(fops_pm, mt7921_pm_get, mt7921_pm_set, "%lld\n"); +static int +mt7921_deep_sleep_set(void *data, u64 val) +{ + struct mt7921_dev *dev = data; + + mt7921_mutex_acquire(dev); + mt76_connac_mcu_set_deep_sleep(&dev->mt76, !!val); + mt7921_mutex_release(dev); + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(fops_ds, NULL, mt7921_deep_sleep_set, "%lld\n"); + static int mt7921_pm_stats(struct seq_file *s, void *data) { @@ -355,6 +372,7 @@ int mt7921_init_debugfs(struct mt7921_dev *dev) debugfs_create_file("chip_reset", 0600, dir, dev, &fops_reset); debugfs_create_devm_seqfile(dev->mt76.dev, "runtime_pm_stats", dir, mt7921_pm_stats); + debugfs_create_file("deep-sleep", 0600, dir, dev, &fops_ds); return 0; } From patchwork Mon May 10 15:14:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248487 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 7F12FC43618 for ; Mon, 10 May 2021 15:15:32 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E2AF96120D for ; Mon, 10 May 2021 15:15:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2AF96120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cCZ8Ue47bWBZQtsOeUFpSPYAL8lGkuXg8OhA/wA9WSg=; b=m72PQ+VCnfO2Wjm67XtkICjpV tdO5I2IBhZCl1DDVo2+dwtfLT26GipqDOi2t4RiAyJCRxVI3PoPtLZnY/lCgESVVE4VaEg1NjVq9j 0I4sKo00tWT6T84EUxM8Fy1AfmzkdOezPS8fvlIPVocrz6+TVc3MICsh9mx7sxu4AYtf2tPbmwBT3 8QfJf95yXMSMbY7/v31MtWIE4gJix/EUekWvA6qtXwK1MvtAbpuiH1JJZ5OWkVq1okrw37mNCIlEo RCWgj3+Kit4RkNCSV24fAJAOHDYqJB3vz5klRoa6oMhTWVu16JJKZ2bVjZQiSv61x6/94sk2B+A4O DI8ZrtxBQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cs-00ElOn-O1; Mon, 10 May 2021 15:15:18 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cl-00ElM0-5s for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:15:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=QJwYec6xJ0LSNIBGpFWyX8aFSE35uVEbqazvMZ8CKQk=; b=b4QvhKxnxzVhf0/MMQcWKImSUy YYNRvsyfWhNsFH02u7eSgmAxo/bSLQ85/T9C0yeA3llHovPOzRgtcMRRo6HMitWkjhxNQxPjLCfXJ g+iduAXWjIuot1DReF/GNiAFMFV13mdkFYd8P20opK3zScaT3e6GTACeI3HQI0uoaswJy1i10lo1l ysS6q6D7MUB+dVdoXHRZMtMV3zDaUPXetSGu/wRH7XXNoUZPmrjBHLwuAaP6bYnyojkSOqfYL+znb RQxyXnK7qIHFK31wxzmZZFcvN9/bmZh1av7zj/Px+5cxpsMANsenrqhc6NnxzCnu0sAFanc+8l+ee bdT7pSTw==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7ci-008rIT-F6 for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:15:09 +0000 X-UUID: 6fc9089f4f664c38bac883d96f5178e3-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=QJwYec6xJ0LSNIBGpFWyX8aFSE35uVEbqazvMZ8CKQk=; b=DfZUYghCWZJVh6Khf4HBrTPcF91D4OIZsp9AaFZIMypoa+zVtAfqL362k07uaL63V5n6Jr3yffdde2vRsoWhsYhWPkLSnZBj+q00r6Lel+5jRZ3u4gVXKmLRRlzRTb//JmnfEuMmfF/h1ssxdot84yP8K+LJPuIjFDCFeOM5w4c=; X-UUID: 6fc9089f4f664c38bac883d96f5178e3-20210510 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1188738284; Mon, 10 May 2021 08:15:01 -0700 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:15:00 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:14:59 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:59 +0800 From: To: , CC: , , , , , , , , , , , , , , , , YN Chen Subject: [PATCH 6/9] mt76: connac: fix WoW with disconnetion and bitmap pattern Date: Mon, 10 May 2021 23:14:54 +0800 Message-ID: <1620659697-12048-6-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> References: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_081508_536576_E546FC80 X-CRM114-Status: GOOD ( 10.19 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: YN Chen Update MCU command usage to fix WoW configuration with disconnection and bitmap pattern and to avoid magic number. Fixes: ffa1bf97425 ("mt76: mt7921: introduce PM support") Reviewed-by: Lorenzo Bianconi Signed-off-by: YN Chen Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 11 +++++++---- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 8 ++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 542d7d9f1f52..6ffe4b91d567 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1999,7 +1999,7 @@ mt76_connac_mcu_set_wow_pattern(struct mt76_dev *dev, ptlv->index = index; memcpy(ptlv->pattern, pattern->pattern, pattern->pattern_len); - memcpy(ptlv->mask, pattern->mask, pattern->pattern_len / 8); + memcpy(ptlv->mask, pattern->mask, DIV_ROUND_UP(pattern->pattern_len, 8)); return mt76_mcu_skb_send_msg(dev, skb, MCU_UNI_CMD_SUSPEND, true); } @@ -2034,14 +2034,17 @@ mt76_connac_mcu_set_wow_ctrl(struct mt76_phy *phy, struct ieee80211_vif *vif, }; if (wowlan->magic_pkt) - req.wow_ctrl_tlv.trigger |= BIT(0); + req.wow_ctrl_tlv.trigger |= UNI_WOW_DETECT_TYPE_MAGIC; if (wowlan->disconnect) - req.wow_ctrl_tlv.trigger |= BIT(2); + req.wow_ctrl_tlv.trigger |= (UNI_WOW_DETECT_TYPE_DISCONNECT | + UNI_WOW_DETECT_TYPE_BCN_LOST); if (wowlan->nd_config) { mt76_connac_mcu_sched_scan_req(phy, vif, wowlan->nd_config); - req.wow_ctrl_tlv.trigger |= BIT(5); + req.wow_ctrl_tlv.trigger |= UNI_WOW_DETECT_TYPE_SCH_SCAN_HIT; mt76_connac_mcu_sched_scan_enable(phy, vif, suspend); } + if (wowlan->n_patterns) + req.wow_ctrl_tlv.trigger |= UNI_WOW_DETECT_TYPE_BITMAP; if (mt76_is_mmio(dev)) req.wow_ctrl_tlv.wakeup_hif = WOW_PCIE; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 3ed2fb5e1389..8f4d85b148fb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -590,6 +590,14 @@ enum { UNI_OFFLOAD_OFFLOAD_BMC_RPY_DETECT, }; +#define UNI_WOW_DETECT_TYPE_MAGIC BIT(0) +#define UNI_WOW_DETECT_TYPE_ANY BIT(1) +#define UNI_WOW_DETECT_TYPE_DISCONNECT BIT(2) +#define UNI_WOW_DETECT_TYPE_GTK_REKEY_FAIL BIT(3) +#define UNI_WOW_DETECT_TYPE_BCN_LOST BIT(4) +#define UNI_WOW_DETECT_TYPE_SCH_SCAN_HIT BIT(5) +#define UNI_WOW_DETECT_TYPE_BITMAP BIT(6) + enum { UNI_SUSPEND_MODE_SETTING, UNI_SUSPEND_WOW_CTRL, From patchwork Mon May 10 15:14:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248491 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 4628DC433B4 for ; Mon, 10 May 2021 15:15:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9F7996120D for ; Mon, 10 May 2021 15:15:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9F7996120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kZZz9xI6e/ECZjt5/Oll+WPu5Ov77p9ZgBFCoAodUWg=; b=angG10iec3Tv59iBrN0stsnfL 4vs233NuMqLGnsfZ3+/ZzlgHtnbB8oieWwrYn4SPb8gZLGUzNM5UYoP5SYUBhjvzCELFKEr+e1scx t9av4y/mvfYREk8Rd06BV5s6rQrCY1+7monkYK9bkd+cxnsBZnHaCUDL/Ql0gyd4AgUx2IgsHGdzH 0sO4lbRNKxuYDVYQPkpBU1bxRdZaEHKuGes7uTadO1kR2DBjm4eS2GSUlQCfBYXfv+JfcH5H9GXGl biVvmXtzxv14gnN9yKCb/seT/LjRn+4Yo80FhLtw85elt7scT2VUX0bX23mK0F5LIjny2OtCHzUfb VDk4vhPvg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cv-00ElPX-DA; Mon, 10 May 2021 15:15:21 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cm-00ElML-Nk for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:15:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=WL7b2gGCV44hU7tJFOIqNWD+EHk9YOJJLXizxJctCpo=; b=b8UquDM5JeLlxG/kBbpHhng7xB 4rmFB9qMpnBsYWX4Tf1RQjQz4intsQXlg8HOVryvQVrrM2IxSTXtkze82Tcj89cp5xLOBwzKSosN3 850Ct7Hgm4wQAnGjHAJ2+C82FBSgwlBfurCCU33q3Fy/y3/mvo1BakEOZKYqZjjZ5mdwiFk/Bg34x qKVQx4T1tvGU1Ue1CuBinUPgXNZlWuxRDcMuDCLfZiuJQOVN48J1liiQfY3v5YV8TdOVensxyG0V9 OcPh6WPQKl6WTozEwv6SJn4QMyzfBHr1Pct7Ef+CXidSo7r6miFZdbMudf5egvKwDQnsyXo4wZTpq w52hmpzg==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cj-008rIT-V6 for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:15:11 +0000 X-UUID: 4eadc5558a2c4b77a6da64c1d7c6794c-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=WL7b2gGCV44hU7tJFOIqNWD+EHk9YOJJLXizxJctCpo=; b=Wkxv4MWbMiL0/gVg1qVo9SzihnALGw5ZKhLmhPy8dkvOP59cOgk5dYzgYHAcKvADq6p4YTwB23FZoqLTdTQZQFmXGiuyncKQImEiM+uu2cefKg9ibBm5lNrpMc5HZwobD6RwPirCD9cwsGRcSthq1ZxdzWgGWGXvU8uEV9yR+7M=; X-UUID: 4eadc5558a2c4b77a6da64c1d7c6794c-20210510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1438578646; Mon, 10 May 2021 08:15:02 -0700 Received: from MTKMBS06N2.mediatek.inc (172.21.101.130) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:15:01 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:14:59 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:59 +0800 From: To: , CC: , , , , , , , , , , , , , , , Subject: [PATCH 7/9] mt76: mt7921: consider the invalid value for to_rssi Date: Mon, 10 May 2021 23:14:55 +0800 Message-ID: <1620659697-12048-7-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> References: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 3C9240EF2573B67657F9ED857479D90467E4CC8D7E534F832002A2DEABEF7E0B2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_081510_045366_1996495A X-CRM114-Status: GOOD ( 12.08 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang It is possible the RCPI from the certain antenna is an invalid value, especially packets are receiving while the system is frequently entering deep sleep mode, so consider calculating RSSI with the reasonable upper bound to avoid report the wrong value to the mac80211 layer. Fixes: 163f4d22c118 ("mt76: mt7921: add MAC support") Reviewed-by: Lorenzo Bianconi Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c index 44b8918db95b..89a09381cfe4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c @@ -461,16 +461,19 @@ int mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb) status->chain_signal[1] = to_rssi(MT_PRXV_RCPI1, v1); status->chain_signal[2] = to_rssi(MT_PRXV_RCPI2, v1); status->chain_signal[3] = to_rssi(MT_PRXV_RCPI3, v1); - status->signal = status->chain_signal[0]; - - for (i = 1; i < hweight8(mphy->antenna_mask); i++) { - if (!(status->chains & BIT(i))) + status->signal = -128; + for (i = 0; i < hweight8(mphy->antenna_mask); i++) { + if (!(status->chains & BIT(i)) || + status->chain_signal[i] >= 0) continue; status->signal = max(status->signal, status->chain_signal[i]); } + if (status->signal == -128) + status->flag |= RX_FLAG_NO_SIGNAL_VAL; + stbc = FIELD_GET(MT_PRXV_STBC, v0); gi = FIELD_GET(MT_PRXV_SGI, v0); cck = false; From patchwork Mon May 10 15:14:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248505 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 4AA05C433B4 for ; Mon, 10 May 2021 15:18:57 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B613461139 for ; Mon, 10 May 2021 15:18:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B613461139 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UoMFs6VInp1BpscTMI+saTZ1U7O5nnGnhhi9l93f1CE=; b=G9J24fx0XgsvsX8WeLnRlTPHo lFVP+pGI03sCIKb1sw2V5/oZAtCxhdX8qC8PQH6/DeWwzPh78YqIZdKl2YeUpXZfaOIPGurWqV+1L jVWaHduIsCsG/FhJq45QjRmCSqsFNI3Tlhl/BTye3c0ogi6MrMemiRDFQvOk/0DZGnpWlTHXo0AdH VpqjEwhicR8vz5CqCg+eS1eAUxQdBuXcPx+rxdgXW1sI241yS1q3ixtX7p0jrqSCksFOKktKme3Su twowtIVVMGp8k5kZhARhcpp/9i51yTBWdNBKQi6UYNaW3nbBaXiwyrnVoAWTLWYsCcFh16+TIdLyF 2+tOUQK4g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7gA-00ElvP-DB; Mon, 10 May 2021 15:18:42 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7g8-00Eluq-AM for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:18:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=71JKofg4V/PxlQ9DDuyab7uZqZ4cHiTtqzqmRJplN5Q=; b=p5rSb6Bs7c8oWa9uHltzuHuiVg QtmyBsz9fsrm3xM812lc0C7yE4Y8xnJSWkiqT1+mEQr+rZKNsoKTtXW/gC/zE5VuSMgI6rMBaPKGc glE63p0tawo2AuFiIfzuGTc7MUMXCGGg8Lnmz9x7A7kjJD7ztPp35H78/cECNzo1NKDGdvLMfAL3w 4W03H69HLyDHNMvwhGd0Ez1025MgxrTd1fEPI9TvH+8mUmovuNY9l9ESu9kDFvUSNDEXrI246808i mmHOcSiop4VhA8x6aZm8+ZOs3RaWutxnR0dJdLUlsCmnpHR8clwUB4cagqA/0yztxzRrCGFtV3zNV xdRlDt8g==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7g5-008rUZ-OA for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:18:39 +0000 X-UUID: 2eab5e8e7e714cd8b66cc4439237e821-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=71JKofg4V/PxlQ9DDuyab7uZqZ4cHiTtqzqmRJplN5Q=; b=bSpBceQ/wNY/9TquqJZo6QGIbN5xkxe6i44A6IEZOBoIth1DhjbPuoFWBCDmJJM6Km3qtwm7aasYKPdNvHURi3+dINw+p/DqCSqb5haNz/bFxcpyGUwYF6ckWZ1cU7xtwaiF0Kz48gCRp0FzW1av31QVEXA0WsQc+eTdCOGr1to=; X-UUID: 2eab5e8e7e714cd8b66cc4439237e821-20210510 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 616960740; Mon, 10 May 2021 08:18:34 -0700 Received: from MTKMBS02N1.mediatek.inc (172.21.101.77) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:15:07 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:14:59 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:59 +0800 From: To: , CC: , , , , , , , , , , , , , , , , YN Chen , Jayden.Kuo Subject: [PATCH 8/9] mt76: connac: add bss color support for sta mode Date: Mon, 10 May 2021 23:14:56 +0800 Message-ID: <1620659697-12048-8-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> References: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_081837_815796_B4091BA4 X-CRM114-Status: GOOD ( 11.13 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: YN Chen Add bss color support for sta mode Reviewed-by: Lorenzo Bianconi Signed-off-by: Jayden.Kuo Signed-off-by: YN Chen Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt76_connac_mcu.c | 14 ++++++++++++++ .../net/wireless/mediatek/mt76/mt76_connac_mcu.h | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 6ffe4b91d567..8ebcbb5ea51c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1311,6 +1311,7 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, u8 pad[3]; } __packed hdr; struct bss_info_uni_he he; + struct bss_info_uni_bss_color bss_color; } he_req = { .hdr = { .bss_idx = mvif->idx, @@ -1319,8 +1320,21 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, .tag = cpu_to_le16(UNI_BSS_INFO_HE_BASIC), .len = cpu_to_le16(sizeof(struct bss_info_uni_he)), }, + .bss_color = { + .tag = cpu_to_le16(UNI_BSS_INFO_BSS_COLOR), + .len = cpu_to_le16(sizeof(struct bss_info_uni_bss_color)), + .enable = 0, + .bss_color = 0, + }, }; + if (enable) { + he_req.bss_color.enable = + vif->bss_conf.he_bss_color.enabled; + he_req.bss_color.bss_color = + vif->bss_conf.he_bss_color.color; + } + mt76_connac_mcu_uni_bss_he_tlv(phy, vif, (struct tlv *)&he_req.he); err = mt76_mcu_send_msg(mdev, MCU_UNI_CMD_BSS_INFO_UPDATE, diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 8f4d85b148fb..d64b8058b744 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -575,6 +575,7 @@ enum { enum { UNI_BSS_INFO_BASIC = 0, UNI_BSS_INFO_RLM = 2, + UNI_BSS_INFO_BSS_COLOR = 4, UNI_BSS_INFO_HE_BASIC = 5, UNI_BSS_INFO_BCN_CONTENT = 7, UNI_BSS_INFO_QBSS = 15, @@ -789,6 +790,14 @@ struct mt76_connac_sched_scan_done { __le16 pad; } __packed; +struct bss_info_uni_bss_color { + __le16 tag; + __le16 len; + u8 enable; + u8 bss_color; + u8 rsv[2]; +} __packed; + struct bss_info_uni_he { __le16 tag; __le16 len; From patchwork Mon May 10 15:14:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 12248483 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 47F58C43617 for ; Mon, 10 May 2021 15:15:30 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA4236023E for ; Mon, 10 May 2021 15:15:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA4236023E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aATwLx2D3LdCotp7SZKxv030s6Uct8aPfWa6EvVnGRE=; b=caKFVAyPrT4H/XjywokZT2jo/ Yse5/b9Ww9pDSKnZ71nagKV22lKtM6/yQQCXUnoH7+Glrh2l3oJuUwHO8Ln3LcPKQ0+Eo676I08pQ nA5mTbD4houb+YCZ/Zha8VLkbleA0ggcflFMte3ty4RUPHrphx+NwmJMFL9l8CoriyHWFH4POgAqN BCHE3AvRSq23CS4DA4lPugBgkwk+aCik1j+O5Xys8l15bPrHePH+MSQFs2Oob1m2FJLukZkjkkG5l HK2ZkQ6C0lt9zGtaa6n5YTBlveyO/LxAJxW9LXlhmK0D8MZqE9Nt+/jSvatXWJwxvxi9LM03XDhA0 706gOJPvA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lg7cr-00ElOT-NG; Mon, 10 May 2021 15:15:17 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7ck-00ElLz-Ui for linux-mediatek@desiato.infradead.org; Mon, 10 May 2021 15:15:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=CdlSP5sar+14tPyIMdY4cTvE+b2/79Yvzw9H8+869v4=; b=IfbPk1r6MCP7Ciy45QRVJpSidb DAGEBA+ij5DFrh9g2kOu0FkoQuTKbvwjl/KHvETDAHrB+yoZphrDbWldiHSwx+a7BdJwRlFqLkk0X 07nGRKkZTs0mWlPlBGcxCZbx1J2PmostPkuAdHPV9RaFHn3ZZEMCAWHy1m93/r/5Ye2VdgcQ08CFZ E3qlWbbrk0ykPgGJLswT1bGHIdvjE1YDmJ6Lul9rQf2LYI2QgN1RF4Jhfe9ZVISI3n9iptf34BgRZ r+HYIb/eM6SivzSQxXFPYbjxj5LaSQDS+0ssruxc8TUUfMGwy8JYSg7P3Snx907mQMFJa2ZHs1n3Z zMKceeAw==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lg7ci-008rIR-76 for linux-mediatek@lists.infradead.org; Mon, 10 May 2021 15:15:09 +0000 X-UUID: dde54503fd4c47deb69540d53c8006bf-20210510 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=CdlSP5sar+14tPyIMdY4cTvE+b2/79Yvzw9H8+869v4=; b=GCjDh4ToYAxE2gTN39uH9t1/H9aSuWIeRtcXFJi2e+YBMCMrIYkTlJN4MXKM2QN/ewT5l5gmpICBlkpWG8tmZOdsV+AwpncJOgNYG8gD3q6HaU0Xk3tfTyzoPzutU6L2BfAdBA+di5X73w2+LC6U/fbH94aUIz7nR2qttYpyxso=; X-UUID: dde54503fd4c47deb69540d53c8006bf-20210510 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 96937685; Mon, 10 May 2021 08:15:01 -0700 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 08:15:00 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 May 2021 23:15:00 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 May 2021 23:14:59 +0800 From: To: , CC: , , , , , , , , , , , , , , , , Deren Wu , "YN Chen" Subject: [PATCH 9/9] mt76: mt7921: add back connection monitor support Date: Mon, 10 May 2021 23:14:57 +0800 Message-ID: <1620659697-12048-9-git-send-email-sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> References: <1620659697-12048-1-git-send-email-sean.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210510_081508_293354_2D0646CA X-CRM114-Status: GOOD ( 15.14 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Sean Wang Hw beacon cmd to the mt7921 firmware doesn't only filter out the beacon, but also performs its own connection monitoring, including periodic keep-alives to the AP and probing the AP on beacon loss. Will indicate the host with the event when the firmware detects the connection is lost. Fixes: 1d8efc741df8 ("mt76: mt7921: introduce Runtime PM support") Reviewed-by: Lorenzo Bianconi Signed-off-by: Deren Wu Signed-off-by: YN Chen Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7921/init.c | 4 +++ .../net/wireless/mediatek/mt76/mt7921/mcu.c | 32 +++++++++++++------ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net/wireless/mediatek/mt76/mt7921/init.c index cd68721314fa..cbb1d432a591 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -73,6 +73,7 @@ static void mt7921_init_wiphy(struct ieee80211_hw *hw) { struct mt7921_phy *phy = mt7921_hw_phy(hw); + struct mt7921_dev *dev = phy->dev; struct wiphy *wiphy = hw->wiphy; hw->queues = 4; @@ -112,6 +113,9 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) ieee80211_hw_set(hw, SUPPORTS_PS); ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS); + if (dev->pm.enable) + ieee80211_hw_set(hw, CONNECTION_MONITOR); + hw->max_tx_fragments = 4; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c index 67dc4b4cc094..7c68182cad55 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c @@ -450,22 +450,33 @@ mt7921_mcu_scan_event(struct mt7921_dev *dev, struct sk_buff *skb) } static void -mt7921_mcu_beacon_loss_event(struct mt7921_dev *dev, struct sk_buff *skb) +mt7921_mcu_connection_loss_iter(void *priv, u8 *mac, + struct ieee80211_vif *vif) +{ + struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt76_connac_beacon_loss_event *event = priv; + + if (mvif->idx != event->bss_idx) + return; + + if (!(vif->driver_flags & IEEE80211_VIF_BEACON_FILTER)) + return; + + ieee80211_connection_loss(vif); +} + +static void +mt7921_mcu_connection_loss_event(struct mt7921_dev *dev, struct sk_buff *skb) { struct mt76_connac_beacon_loss_event *event; - struct mt76_phy *mphy; - u8 band_idx = 0; /* DBDC support */ + struct mt76_phy *mphy = &dev->mt76.phy; skb_pull(skb, sizeof(struct mt7921_mcu_rxd)); event = (struct mt76_connac_beacon_loss_event *)skb->data; - if (band_idx && dev->mt76.phy2) - mphy = dev->mt76.phy2; - else - mphy = &dev->mt76.phy; ieee80211_iterate_active_interfaces_atomic(mphy->hw, IEEE80211_IFACE_ITER_RESUME_ALL, - mt76_connac_mcu_beacon_loss_iter, event); + mt7921_mcu_connection_loss_iter, event); } static void @@ -530,7 +541,7 @@ mt7921_mcu_rx_unsolicited_event(struct mt7921_dev *dev, struct sk_buff *skb) switch (rxd->eid) { case MCU_EVENT_BSS_BEACON_LOSS: - mt7921_mcu_beacon_loss_event(dev, skb); + mt7921_mcu_connection_loss_event(dev, skb); break; case MCU_EVENT_SCHED_SCAN_DONE: case MCU_EVENT_SCAN_DONE: @@ -1368,6 +1379,7 @@ mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) { struct mt7921_phy *phy = priv; struct mt7921_dev *dev = phy->dev; + struct ieee80211_hw *hw = mt76_hw(dev); int ret; if (dev->pm.enable) @@ -1380,9 +1392,11 @@ mt7921_pm_interface_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) if (dev->pm.enable) { vif->driver_flags |= IEEE80211_VIF_BEACON_FILTER; + ieee80211_hw_set(hw, CONNECTION_MONITOR); mt76_set(dev, MT_WF_RFCR(0), MT_WF_RFCR_DROP_OTHER_BEACON); } else { vif->driver_flags &= ~IEEE80211_VIF_BEACON_FILTER; + __clear_bit(IEEE80211_HW_CONNECTION_MONITOR, hw->flags); mt76_clear(dev, MT_WF_RFCR(0), MT_WF_RFCR_DROP_OTHER_BEACON); } }