From patchwork Tue Jun 21 08:45:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 1645928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=b4/3t6q4; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LS0VG4ZNcz9sjJ for ; Tue, 21 Jun 2022 18:46:13 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1o3ZWO-0000ss-Ia; Tue, 21 Jun 2022 08:46:04 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1o3ZWJ-0000ri-DO for kernel-team@lists.ubuntu.com; Tue, 21 Jun 2022 08:45:59 +0000 Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 39FD43F210 for ; Tue, 21 Jun 2022 08:45:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1655801159; bh=GZ8zgz7kuk2revdHfrgt7AMgLW/pxJ/308XuMss2GC8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=b4/3t6q4EkiPdGGy7XEulU3ylGq9bVDGeR1OgEdBm1UjzbWQ+WJsuwQYlbRMdgkhr AVNA1hswKPdJjDHn19PA+v5fPTJSsAcK8QIjbVT/2X2nIvhAmRC/i2/to+LrrLFAns xyZJnEBQ58p1RDI34oDKUORB2rOo9iedkTc+rPcF43lUvocv1Xp/AOnfn644iFGXuF 8JKFILpbk8OrCboezpEWrPS90uJHFCj4atXQbOje6zbSmh7GUaaqTPRAw6Js07nu9z ldvErurRUZhJ9EWJmnXYty9uBNjo2XCZNIqCNZQN55g3+2+g1zGfdL4tZGY+2x8115 TLCtZ0h8BPuRQ== Received: by mail-pl1-f200.google.com with SMTP id t24-20020a170902b21800b00168e27c3c2aso8133244plr.18 for ; Tue, 21 Jun 2022 01:45:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GZ8zgz7kuk2revdHfrgt7AMgLW/pxJ/308XuMss2GC8=; b=sp0jM11S1X5/Un+p+2oVLZOhw0CKcjC0Jv+W8xnLAl5nHko7UWX1nD33l0/IyDjizI 0f3EfZmQArH9AKBC5RPg4D0JurKrUs7xvkSZ4l6ije+9HRYBwhrrjJwEQ/me6hqVaXee EF2QzY9s59jEmeVXSakjqPFBhBEaPwf81TGkgN25F+bfC0vw57vL3ZKMwjiQioGAz0RH K7Glmhj9CKqeSWuSBI0hSg+9Rqu1PhF6rdpm2Qkm5KhqXwHm32P/dvxAB795L0QUMuzR ZXKKmp1PiMFAdc9ogln4CSOED+97ib+6q/qr2Th9fHFoz6TU3+XJhdSf42VxJ58Dbn/C 0Uxg== X-Gm-Message-State: AJIora/AAWGXopizfPIR7oruWH1EBk3+G857DgvuGcTmsnNT+PsnNd6S 6AH+bhKWTNn+JoP9QInMML/QGbaGi8CtPHmUhcKe+OwfMHo/NZ5/Nm6L0Vmh9zfHluDGOr1s3wx dEbtyfI63G32Q6+exmIXgxr8P8v1Fdf+EuOddsO/UVA== X-Received: by 2002:a63:511e:0:b0:405:12c1:6e13 with SMTP id f30-20020a63511e000000b0040512c16e13mr25836924pgb.260.1655801157552; Tue, 21 Jun 2022 01:45:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u7/YmP/ui8M2pGra0KPJwaGbdPWGi5TNGbJChsWxD2izRfNY/KBcTut/EATdWG77NtsZUgKA== X-Received: by 2002:a63:511e:0:b0:405:12c1:6e13 with SMTP id f30-20020a63511e000000b0040512c16e13mr25836902pgb.260.1655801157005; Tue, 21 Jun 2022 01:45:57 -0700 (PDT) Received: from u-Precision-5560.lan (59-115-197-125.dynamic-ip.hinet.net. [59.115.197.125]) by smtp.gmail.com with ESMTPSA id s3-20020a170903200300b0016a11750b50sm6011358pla.16.2022.06.21.01.45.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jun 2022 01:45:55 -0700 (PDT) From: Chris Chiu To: kernel-team@lists.ubuntu.com Subject: [PATCH 2/2][SRU][J][OEM-5.14] mt76: mt7921: fix command timeout in AP stop period Date: Tue, 21 Jun 2022 16:45:49 +0800 Message-Id: <20220621084549.666846-3-chris.chiu@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220621084549.666846-1-chris.chiu@canonical.com> References: <20220621084549.666846-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Deren Wu BugLink: https://bugs.launchpad.net/bugs/1979173 Due to AP stop improperly, mt7921 driver would face random command timeout by chip fw problem. Migrate AP start/stop process to .start_ap/.stop_ap and congiure BSS network settings in both hooks. The new flow is shown below. * AP start .start_ap() configure BSS network resource set BSS to connected state .bss_info_changed() enable fw beacon offload * AP stop .bss_info_changed() disable fw beacon offload (skip this command) .stop_ap() set BSS to disconnected state (beacon offload disabled automatically) destroy BSS network resource Fixes: 116c69603b01 ("mt76: mt7921: Add AP mode support") Signed-off-by: Sean Wang Signed-off-by: Deren Wu (backported from https://patchwork.kernel.org/project/linux-wireless/patch/21366e8bc70573794b5f12372f2e55e9059d8457.1654691030.git.deren.wu@mediatek.com/) [Chris: ignore the mt7921_mcu_set_bss_pm() which is yet in 5.14/15] Signed-off-by: Chris Chiu --- .../wireless/mediatek/mt76/mt76_connac_mcu.c | 2 + .../net/wireless/mediatek/mt76/mt7921/main.c | 49 +++++++++++++++---- 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 017bd59c4ea8..d81558a439c6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1293,6 +1293,8 @@ int mt76_connac_mcu_uni_add_bss(struct mt76_phy *phy, else conn_type = CONNECTION_INFRA_AP; basic_req.basic.conn_type = cpu_to_le32(conn_type); + /* Fully active/deactivate BSS network in AP mode only */ + basic_req.basic.active = enable; break; case NL80211_IFTYPE_STATION: if (vif->p2p) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c index c92c8addcc6f..5bb30b6cec2e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c @@ -607,15 +607,6 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw, } } - if (changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon) { - struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; - - mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, - true); - mt7921_mcu_sta_update(dev, NULL, vif, true, - MT76_STA_INFO_STATE_NONE); - } - if (changed & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED)) mt7921_mcu_uni_add_beacon_offload(dev, hw, vif, @@ -1223,6 +1214,44 @@ mt7921_channel_switch_beacon(struct ieee80211_hw *hw, mt7921_mutex_release(dev); } +static int +mt7921_start_ap(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) +{ + struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; + struct mt7921_phy *phy = mt7921_hw_phy(hw); + struct mt7921_dev *dev = mt7921_hw_dev(hw); + int err; + + err = mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, + true); + if (err) + return err; + + err = mt7921_mcu_set_bss_pm(dev, vif, true); + if (err) + return err; + + return mt7921_mcu_sta_update(dev, NULL, vif, true, + MT76_STA_INFO_STATE_NONE); +} + +static void +mt7921_stop_ap(struct ieee80211_hw *hw, + struct ieee80211_vif *vif) +{ + struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv; + struct mt7921_phy *phy = mt7921_hw_phy(hw); + struct mt7921_dev *dev = mt7921_hw_dev(hw); + int err; + + err = mt7921_mcu_set_bss_pm(dev, vif, false); + if (err) + return; + + mt76_connac_mcu_uni_add_bss(phy->mt76, vif, &mvif->sta.wcid, false); +} + const struct ieee80211_ops mt7921_ops = { .tx = mt7921_tx, .start = mt7921_start, @@ -1233,6 +1262,8 @@ const struct ieee80211_ops mt7921_ops = { .conf_tx = mt7921_conf_tx, .configure_filter = mt7921_configure_filter, .bss_info_changed = mt7921_bss_info_changed, + .start_ap = mt7921_start_ap, + .stop_ap = mt7921_stop_ap, .sta_state = mt7921_sta_state, .sta_pre_rcu_remove = mt76_sta_pre_rcu_remove, .set_key = mt7921_set_key,