From patchwork Wed Jan 8 02:25:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13930061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D17BE77198 for ; Wed, 8 Jan 2025 02:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=BhbyaXxuLen6UsaEx6i7KpQ3aLFkLB03k9wqAxgSbCY=; b=3MtK19I8Tdy8R6wyeEB2ZV1lKe qJo03nuAHiknciLss+fwC6YOv0bChmWZGsD/9vDLpKzSN31A3warNBjIYdlELinktPuqZx4vkjol/ iT82D1ILGXjHkB+ttisUGdZN6KWVRtFW7F56e+ZinDT65QMVimSK9KRETCjTGJI7BoyXTCHAYOGXr Y5soDiogGva7ozfNEw25h0HqPJ+Zpezmq0rOcM9OtKCUR8MXf3rD37LYTebciet4zaaqphWhkplNo OaSXopdAxV74KpdL03e3A8Xt9CSpyyK5/la03J0Oz6kk906L+aOJwBEO1fzIxE2+jZJoHDBX+A0Cg lFoJb23g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVLqw-00000006urn-3gQT; Wed, 08 Jan 2025 02:31:27 +0000 Received: from mail-oi1-f172.google.com ([209.85.167.172]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVLky-00000006tEU-12Vs for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2025 02:25:17 +0000 Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3eb8db8ae9aso7444812b6e.1 for ; Tue, 07 Jan 2025 18:25:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736303114; x=1736907914; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BhbyaXxuLen6UsaEx6i7KpQ3aLFkLB03k9wqAxgSbCY=; b=XTyGcqASDz2zlKK/xhVTAGGF/SCet5nfkmQx43fMQt1fmJwo1Ptw3ON5AXZYhFUsjh cXMfWAL44oem6Wimk9Sc0s9/0auRo9xC9nbXWKxr5Ksun7r1bWEStMkMvrDLEkq6610H WUEHqr9UpIMwEpW+wV7lcFHJpippq8c6OmwCpwHMUgnBuZLcFb7UbJ3pGo/0AQt16loJ 4x64swiAYwuHyXgeRjQ76hDDxge3pigRd0onPulXhuY2OsMsKTXLO9f3RLYF2DhhRCvN M2ktNh6BlkvZCTdn/khuz47kNyXj6h9/rmHlJrIVYp6TYAlMs8djkWlLeyM4ZBHuAW2Y xA1w== X-Forwarded-Encrypted: i=1; AJvYcCULxefHNdyx9cku/xIjSm6ViyT4vqLVYNUpxsOVAU+MxhX6T6e8RlsgayYt3QJpkcvyy8nq38GLY0cYUHQmAQ==@lists.infradead.org X-Gm-Message-State: AOJu0Yw913FAe7MbcVlCXwpIBcOLRn8Qt4IH7F9itJyKijpiNEX2Jp+J Jb0tMkvgSkZBpSsy/Lf1H2YWvau5ex5qUHfvFgW0GTcoYRuK3mQi X-Gm-Gg: ASbGncsZiqcvNLPDbVl6nbdAilaJ1mHAL56S6pHuRNmO85dqW8VEbHaNLbjYq0NTXrI Xxj9yhNFDWSlx/WCX3PXtuACiyL3PxsVaycIj1o+jRrWM0RqCCgMSrC+6isZmFJCun96k9SI+d4 qzxUP0Mr+0m0yUEWWcMoUFv+hlTf0Qg3OyEk4NpvQctzqAJHPNOrba/4qrgRKjw3OpFLwLUPAH+ CoUwyqdRRvkPQZdlDvr5kSKo9l2YSKEagmBLDZGcOqiIXzxbKgH8vWIAIQ6mt5tR3SC7X1xzQ== X-Google-Smtp-Source: AGHT+IH2y2CCxc4rq2oQ6OMP4eCATznit6B+40FYwNWMLmwpNZmThlvbVkfzcD9ewkj+botlKquFZg== X-Received: by 2002:a05:6871:8112:b0:29e:2bbd:51ba with SMTP id 586e51a60fabf-2aa0654e068mr643644fac.9.1736303114515; Tue, 07 Jan 2025 18:25:14 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2a7d77f6340sm13072862fac.48.2025.01.07.18.25.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 18:25:13 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 1/6] Revert "wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO" Date: Tue, 7 Jan 2025 18:25:04 -0800 Message-Id: <20250108022509.217803-1-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_182516_309307_CBEFAB8B X-CRM114-Status: GOOD ( 10.82 ) 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: Ming Yen Hsieh This reverts commit 3cc610e9069db69e4a0f6304993f4c98db52c3c7. Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 10 ++-- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 50 ++++--------------- .../wireless/mediatek/mt76/mt7925/mt7925.h | 2 - 3 files changed, 14 insertions(+), 48 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index a6944de712cc..0904d8f109b3 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1290,22 +1290,22 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case IEEE80211_AMPDU_RX_START: mt76_rx_aggr_start(&dev->mt76, &msta->deflink.wcid, tid, ssn, params->buf_size); - mt7925_mcu_uni_rx_ba(dev, vif, params, true); + mt7925_mcu_uni_rx_ba(dev, params, true); break; case IEEE80211_AMPDU_RX_STOP: mt76_rx_aggr_stop(&dev->mt76, &msta->deflink.wcid, tid); - mt7925_mcu_uni_rx_ba(dev, vif, params, false); + mt7925_mcu_uni_rx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_OPERATIONAL: mtxq->aggr = true; mtxq->send_bar = false; - mt7925_mcu_uni_tx_ba(dev, vif, params, true); + mt7925_mcu_uni_tx_ba(dev, params, true); break; case IEEE80211_AMPDU_TX_STOP_FLUSH: case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: mtxq->aggr = false; clear_bit(tid, &msta->deflink.wcid.ampdu_state); - mt7925_mcu_uni_tx_ba(dev, vif, params, false); + mt7925_mcu_uni_tx_ba(dev, params, false); break; case IEEE80211_AMPDU_TX_START: set_bit(tid, &msta->deflink.wcid.ampdu_state); @@ -1314,7 +1314,7 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, case IEEE80211_AMPDU_TX_STOP_CONT: mtxq->aggr = false; clear_bit(tid, &msta->deflink.wcid.ampdu_state); - mt7925_mcu_uni_tx_ba(dev, vif, params, false); + mt7925_mcu_uni_tx_ba(dev, params, false); ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid); break; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index d4d3ecf863c4..ad6174c07fe5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -529,10 +529,10 @@ void mt7925_mcu_rx_event(struct mt792x_dev *dev, struct sk_buff *skb) static int mt7925_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif, - struct mt76_wcid *wcid, struct ieee80211_ampdu_params *params, bool enable, bool tx) { + struct mt76_wcid *wcid = (struct mt76_wcid *)params->sta->drv_priv; struct sta_rec_ba_uni *ba; struct sk_buff *skb; struct tlv *tlv; @@ -560,60 +560,28 @@ mt7925_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif, /** starec & wtbl **/ int mt7925_mcu_uni_tx_ba(struct mt792x_dev *dev, - struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params, bool enable) { struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv; - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct mt792x_link_sta *mlink; - struct mt792x_bss_conf *mconf; - unsigned long usable_links = ieee80211_vif_usable_links(vif); - struct mt76_wcid *wcid; - u8 link_id, ret; - - for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { - mconf = mt792x_vif_to_link(mvif, link_id); - mlink = mt792x_sta_to_link(msta, link_id); - wcid = &mlink->wcid; - - if (enable && !params->amsdu) - mlink->wcid.amsdu = false; + struct mt792x_vif *mvif = msta->vif; - ret = mt7925_mcu_sta_ba(&dev->mt76, &mconf->mt76, wcid, params, - enable, true); - if (ret < 0) - break; - } + if (enable && !params->amsdu) + msta->deflink.wcid.amsdu = false; - return ret; + return mt7925_mcu_sta_ba(&dev->mt76, &mvif->bss_conf.mt76, params, + enable, true); } int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, - struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params, bool enable) { struct mt792x_sta *msta = (struct mt792x_sta *)params->sta->drv_priv; - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct mt792x_link_sta *mlink; - struct mt792x_bss_conf *mconf; - unsigned long usable_links = ieee80211_vif_usable_links(vif); - struct mt76_wcid *wcid; - u8 link_id, ret; - - for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { - mconf = mt792x_vif_to_link(mvif, link_id); - mlink = mt792x_sta_to_link(msta, link_id); - wcid = &mlink->wcid; - - ret = mt7925_mcu_sta_ba(&dev->mt76, &mconf->mt76, wcid, params, - enable, false); - if (ret < 0) - break; - } + struct mt792x_vif *mvif = msta->vif; - return ret; + return mt7925_mcu_sta_ba(&dev->mt76, &mvif->bss_conf.mt76, params, + enable, false); } static int mt7925_load_clc(struct mt792x_dev *dev, const char *fw_name) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index df3c705d1cb3..f5c02e5f5066 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -242,11 +242,9 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, struct ieee80211_vif *vif, bool enable); int mt7925_mcu_uni_tx_ba(struct mt792x_dev *dev, - struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params, bool enable); int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, - struct ieee80211_vif *vif, struct ieee80211_ampdu_params *params, bool enable); void mt7925_scan_work(struct work_struct *work); From patchwork Wed Jan 8 02:25:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13930062 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4042CE77197 for ; Wed, 8 Jan 2025 02:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5poZd8Omf8mHChDNYxqQRYDNiHz9Uqz2gbs5vpo4Wko=; b=BveHKlt1UObvC26cqTaJAz1a6J VyVzl3X2+U8vGhpNQ8lWrozfdlBtnyZJZCMyth+r7VSvVe30hB/9v5flYbgc+xlato2RfTDZpa7F+ KtXMGsatTq00V/UPRjkcldpV/vL6qVrCcbfnIJ2gr1xTRuFQJKaIkFNyjOcHQa6Ko+GGv60CKWSzT islyJrWCC53HDJFHINmB1BShVf9Y/E1ExDr6VF+tuB9XyMlztJ+QSDs2x38jZKyc7fD3Mx9BYhG7P gFrXi1kmy8Ixbu/ieWnwvv67UnGZKgwCqBo4A3Ap9NrOZ+gLyswSUjKdzYXLGLH8g4cvIJRNfAY6R /B+2LwgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVLqx-00000006usT-1sUb; Wed, 08 Jan 2025 02:31:27 +0000 Received: from mail-oo1-f44.google.com ([209.85.161.44]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVLl1-00000006tFg-10KR for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2025 02:25:20 +0000 Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5f4cc48ab37so4519907eaf.1 for ; Tue, 07 Jan 2025 18:25:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736303118; x=1736907918; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5poZd8Omf8mHChDNYxqQRYDNiHz9Uqz2gbs5vpo4Wko=; b=lWKHabJpkLYZ2DaQDFg85iQjxcmcCSEO0/I8Do8Uk9PIl8s46oO9yIB3xPCGPW8HM8 SD2D6Bs9RQbztDQOPiR3Ov8rEERYLqzVOGoZJqQ2Pi72SXxmd5ffTUI/Hz4cRmfWLBkv n2whw15QNmYqA1oYYVml5E+rtS85Hy8MH77IimoXKCFzpV9zgC5AXTsO+tZTkOICXfT/ /S9dLpMYpDLQYnaooV4SH5v/xPQ7pm8EuHZnOFjmyf4RMY83YrG23xHrSYw1rSiWpxBt L1URu/WcVfVwGlpdVlAU4q8HkJVsL1d0zVzp/yMJL/8rD7jhWcSVcLDZJraIEOYsrR9I DLAg== X-Forwarded-Encrypted: i=1; AJvYcCX4zj+qPC70RCAoxp8wwTeGvW9svBAQbBK87xA1Ud/DuFn3BYOxuZ8gudxDkU2X8uSXr2UyB0sbN/y6xaHBVg==@lists.infradead.org X-Gm-Message-State: AOJu0YxGS7h01zwbk3DI4Z4pztsrencpe6S+/hbexZ3tlsm2GPgN6fTz zEJW8/WiNm8Kx2q/qYVBqTYkYsD60EJcPzlU7vlTkD108uJ3cgl4 X-Gm-Gg: ASbGncsBgBV3+w4am8hUzxfilhQEYU9/HB6hfqYFCw593dwTmbvkOijkyXjeLEcSuCT Q+XGAuGpc33T/IiryEy7l78WbuRRtO9DkCN+FIbnKaa++hV2VcSbJA1+JV4oRVCeZeJ89UVuob3 a40BpQ9EXG8R1xs3sVPRCKPPP16yUTeeg+x7JoxSyQYFk1nciS/RRPWbJpI4Gj77deH5vI3XQhK IpcoSBD5Siu7dqlfU45aTb4srYlyLzr9RAY19HAvq3Roxus/yQPGbXWKL2iO4rHpMDXRF4cow== X-Google-Smtp-Source: AGHT+IG1BSmYd4o29NQKBDCMXyMov8UepAnYwvWRgzA22SOmjxDtFJ2VtJgIvbRKdY+vAbn4xOmQhA== X-Received: by 2002:a05:6871:800f:b0:29e:3701:47c3 with SMTP id 586e51a60fabf-2aa069c550fmr609205fac.42.1736303118142; Tue, 07 Jan 2025 18:25:18 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2a7d77f6340sm13072862fac.48.2025.01.07.18.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 18:25:16 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 2/6] wifi: mt76: mt7925: fix the wrong link_idx when has p2p_device Date: Tue, 7 Jan 2025 18:25:05 -0800 Message-Id: <20250108022509.217803-2-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250108022509.217803-1-sean.wang@kernel.org> References: <20250108022509.217803-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_182519_284214_8A4AED26 X-CRM114-Status: GOOD ( 13.24 ) 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: Ming Yen Hsieh When the p2p device and MLO station concurrent, the p2p device will occupy the wrong link_idx when the MLO secondary link is added. Fixes: e38a82d25b08 ("wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + .../net/wireless/mediatek/mt76/mt76_connac_mcu.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 14 ++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 34b6b094b8eb..a131d671ed56 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -756,6 +756,7 @@ struct mt76_testmode_data { struct mt76_vif { u8 idx; + u8 link_idx; u8 omac_idx; u8 band_idx; u8 wmm_idx; diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 4171710d645c..f95ae7a2eb0e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1164,7 +1164,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, .tag = cpu_to_le16(DEV_INFO_ACTIVE), .len = cpu_to_le16(sizeof(struct req_tlv)), .active = enable, - .link_idx = mvif->idx, + .link_idx = mvif->link_idx, }, }; struct { @@ -1187,7 +1187,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, .bmc_tx_wlan_idx = cpu_to_le16(wcid->idx), .sta_idx = cpu_to_le16(wcid->idx), .conn_state = 1, - .link_idx = mvif->idx, + .link_idx = mvif->link_idx, }, }; int err, idx, cmd, len; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 0904d8f109b3..6c8a9ebfbe5b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -356,10 +356,15 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, struct mt76_txq *mtxq; int idx, ret = 0; - mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask); - if (mconf->mt76.idx >= MT792x_MAX_INTERFACES) { - ret = -ENOSPC; - goto out; + if (vif->type == NL80211_IFTYPE_P2P_DEVICE) { + mconf->mt76.idx = MT792x_MAX_INTERFACES; + } else { + mconf->mt76.idx = __ffs64(~dev->mt76.vif_mask); + + if (mconf->mt76.idx >= MT792x_MAX_INTERFACES) { + ret = -ENOSPC; + goto out; + } } mconf->mt76.omac_idx = ieee80211_vif_is_mld(vif) ? @@ -367,6 +372,7 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, mconf->mt76.band_idx = 0xff; mconf->mt76.wmm_idx = ieee80211_vif_is_mld(vif) ? 0 : mconf->mt76.idx % MT76_CONNAC_MAX_WMM_SETS; + mconf->mt76.link_idx = hweight16(mvif->valid_links); if (mvif->phy->mt76->chandef.chan->band != NL80211_BAND_2GHZ) mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL + 4; From patchwork Wed Jan 8 02:25:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13930065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D6716E77199 for ; Wed, 8 Jan 2025 02:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=or6qBsvvHcTCXq0k3fSdgM/Qe5pV/yxt5yjVz1LHWzA=; b=IAlocn5T5SRMKD4g2oyBTMwCb2 /lM8RB83uE6qDF8DlQMRUBgyB8UEZ83dQoxRvB4pPY0UuDAuVWO7Pp2s8qDoF3LQu+X+tqNwv3dI+ 03Q13YwbLxBkPK8cj92pqWjmFJj4v5gpIzbZ1B9HVMfTdjBkkDONu1orVsI3lWXtJ/V5eorv5NRuO P9eZQlKYWC90dDnzWyLCRbsdVS95ogMASQMlU1Q45rRbcDFCjpOzxciFHqEXx+y7FlNyH2+a1Bi0K LvvBNkAzUTeV10z5KEDnyC7h4GcUsyexwgCtOlMYUu4T/X4Mw/fVAYicSvzE/9YX5tywnLmQ/Mcvx uYuk5QeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVLqx-00000006usk-3AEg; Wed, 08 Jan 2025 02:31:27 +0000 Received: from mail-oa1-f42.google.com ([209.85.160.42]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVLl6-00000006tH0-06Mp for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2025 02:25:25 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-29ff8053384so7424427fac.3 for ; Tue, 07 Jan 2025 18:25:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736303123; x=1736907923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=or6qBsvvHcTCXq0k3fSdgM/Qe5pV/yxt5yjVz1LHWzA=; b=UMWJlNUnPckgmdTBJJpmsEtzqDeFb7zJzPgNayXAqHTd8AqpNIBsADfeYDD288Dk9W 6Vtu6DrnHFxoNl7wPrD7A69Nw7PPqmtz1FDSKT1cKBFAd6qsBTokKKXhmtydMNtbHSHi sdvAk3hxJrEc0LXCbFeBQuIULpaTOfsKby18p90AxLgcTvmTbefkEW2KY+ymk0HW4GN7 EURn9qJQciTAyLwywPmJntSk3nxc1CKaWK5CSiE2uh2SsYP7XOZWpNj2tfn7pm+xJ93I Gy9L/YRiBPicCEW6MHD7k07ZNun+p58QxdBBSxupByCbhM5m6FZNj+ya119DtAaBe8B4 /OSA== X-Forwarded-Encrypted: i=1; AJvYcCVIVtUXIx0ZCbluwOy9zxdnak3vzJEhiFwAjY4iPxH9GEQw+0UZfu2yLmUaWQZOY4f/ht8JV9zcaQesE4vTLQ==@lists.infradead.org X-Gm-Message-State: AOJu0Yy+uLk/DDvj6Lw/pt9OGR+xNdBZXqeKh3N3U16asutJqXW2XMZi OXYGjqPGL46AV8gq7xuNj+QTZjOXjr7TjYMtinBiEcnswyzOj8mZ5yf1EZ0Y X-Gm-Gg: ASbGncuN53wRbjMD3h+mzNToUnP9kAgSa86U4osPfbP9bNZ0b6vZicbenImyZiNlN5e /qDgqC6Kt1oSbLcJ6VG9/0tLziNFahZthW2NE3hMTt8zc0KD6wl6lM2B6xhc2vMn2e4UGTd4B03 gsldxIAHaHsoBC/dkQQhEI3XPpUKsnWq8lNhkvc5IQrYSLkzEsGmwufcJM1MiSdbSnRjIdI06Ol y0/zCIdhO7uS++FnTaD++wgU0guXIUNKzYtPNyaoGzOPh+R5A3rYqX9qzyJ/8AU33gE7e5g5g== X-Google-Smtp-Source: AGHT+IFmVeZA7a04nKu5uP3hkyO3yyT9r9H8R4UMIdEmCc8mPaH6OfXpUfFd9SGnpKj4tZzw3EWF2w== X-Received: by 2002:a05:6870:d0f:b0:29e:48d6:2e62 with SMTP id 586e51a60fabf-2aa0652ce6cmr643330fac.9.1736303122595; Tue, 07 Jan 2025 18:25:22 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2a7d77f6340sm13072862fac.48.2025.01.07.18.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 18:25:21 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 3/6] wifi: mt76: mt7925: fix the wrong simultaneous cap for MLO Date: Tue, 7 Jan 2025 18:25:06 -0800 Message-Id: <20250108022509.217803-3-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250108022509.217803-1-sean.wang@kernel.org> References: <20250108022509.217803-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_182524_114735_0D6994CE X-CRM114-Status: UNSURE ( 9.86 ) 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: Ming Yen Hsieh The mt7925 chip is only support a single radio, so the maximum number of simultaneous should be 0. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 6c8a9ebfbe5b..35dede041248 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -256,7 +256,7 @@ int mt7925_init_mlo_caps(struct mt792x_phy *phy) ext_capab[0].eml_capabilities = phy->eml_cap; ext_capab[0].mld_capa_and_ops = - u16_encode_bits(1, IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS); + u16_encode_bits(0, IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS); wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; wiphy->iftype_ext_capab = ext_capab; From patchwork Wed Jan 8 02:25:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13930063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 300A4E7719A for ; Wed, 8 Jan 2025 02:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5KdsPIydIRIbKmfDENt47w2PJVUxUaEb2n4hB8nXzq8=; b=C490gpxNkqwNGVYUqCxYCIuchB GBWwGXpl/wCNEN3o6CrYVJzH4Jw9GY8kjXNByWfVRaeGwgVWICBimGbbzHnpvfXZtxGzLd2U4+vHr JswHsw8chd5RvebjnKOJmQiLz3/9uNT9ZPN1DEDvUEulKjVfpt0zn6DopZyWShyCWXxRAvR/Zv39H a73hsjVyjsWAbr6bULJdgeVtCOicrXEga/J4na0sldUgQ6zZO+qsxolb8qY1BJI95tfSdqqXmkeU6 9a9Q/CJfevoKiNxYBqDrTMjXM2ss1Zhf1frYpKkS8KykTrfsXzWnhTXftmpRUFgEGEFwGURvU9klX TpTXoAyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVLqy-00000006utP-0Lfq; Wed, 08 Jan 2025 02:31:28 +0000 Received: from mail-oo1-f49.google.com ([209.85.161.49]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVLl9-00000006tHR-04VG for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2025 02:25:28 +0000 Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5f2e2608681so8093628eaf.1 for ; Tue, 07 Jan 2025 18:25:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736303126; x=1736907926; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5KdsPIydIRIbKmfDENt47w2PJVUxUaEb2n4hB8nXzq8=; b=CRxnjrEHck4mIUXZrJf9/QfU39Waqha1ZgGqmh6QzoF7EcsyM6cdFl7yThGfFnbTV+ G7vVmaEx5JUQT1KOB2N0Ot3oi/J2sv9dYDednEPsJWwh+/vViRETmckjBHCZQHQqgfyY wkkSQ22uK26Eqah5c5Sn0vitK54X01Yr5b5dBwlDhobrcqoSlgiHZR7B7m+0/+/zRlLU POYMAsiRvZRPZekvZ1TqGHFaZSrhLmuQo4fdPHxt2KOsxEj+kuZjuRAwPSkuahnGHSpc XZQQrG7ET8sXSQ6Egs0zsL6MUSWhkntKK9upY4Q8+hruBvoR2/eN1lYQXMwF4CKHal/0 wFqw== X-Forwarded-Encrypted: i=1; AJvYcCU0bfH6s5YWuxfh+b/v3dOrv+2B/ZPRHFsyAMcI23SrVptZTp0+I7Vou99cV4ZB5BmSkxKdfefSnkAhA321hA==@lists.infradead.org X-Gm-Message-State: AOJu0Yw6I60HFGH+ZrJyLWznHmAaoxeDANh5skbVGiecWTo/bHTUSSB6 TxB2jD1sZ8aA1T+PDJ9oZBEVQH465n5S0OEGhcEBRJKLPFNTuVYq X-Gm-Gg: ASbGnctzPHmfXYVsmbTI34sG6BAPHBU7uznZ9dkWrkd8PFKZKgj6cKSDruScV07m7az DCXsV5expSLUs5d4UkVr4Nz1Xo3r/XfGBCx4Ag7HTWRzqGWvGEUr37NsCH1PqtLdDg64vAsmPBE 7rP7MBjmP7XFWAr2BNNxWJZjKKKg8YL6RWZVL/qS47sAjjTb7jCZh69nBVb7A+Nfhg/oMeWULRm PojIvzuF0rYy93QB8urI1NtcNKVLTZc6pHAXd+y14WUbCwYQa39ryUoZU0KoOXsc258YZBvdg== X-Google-Smtp-Source: AGHT+IGs582Bl+Jd+5X8M124/0pd+re+wzXpkBHMXYifN5VHFiYiOQ31GhLfhoJ5EGcBMXMot1q0Fw== X-Received: by 2002:a05:6870:2007:b0:29e:5297:a2a7 with SMTP id 586e51a60fabf-2aa068d657fmr703235fac.30.1736303126104; Tue, 07 Jan 2025 18:25:26 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2a7d77f6340sm13072862fac.48.2025.01.07.18.25.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 18:25:24 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 4/6] wifi: mt76: mt7925: adjust rm BSS flow to prevent next connection failure Date: Tue, 7 Jan 2025 18:25:07 -0800 Message-Id: <20250108022509.217803-4-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250108022509.217803-1-sean.wang@kernel.org> References: <20250108022509.217803-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_182527_059196_94C33399 X-CRM114-Status: GOOD ( 12.96 ) 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: Ming Yen Hsieh Removing BSS without removing STAREC first will cause firmware abnormal and next connection fail. Fixes: f8797298565e ("wifi: mt76: mt7925: Cleanup MLO settings post-disconnection") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 35dede041248..4714c07cfbfe 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1155,7 +1155,12 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, struct mt792x_bss_conf *mconf; mconf = mt792x_link_conf_to_mconf(link_conf); - mt792x_mac_link_bss_remove(dev, mconf, mlink); + + if (ieee80211_vif_is_mld(vif)) + mt792x_mac_link_bss_remove(dev, mconf, mlink); + else + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, + link_sta, false); } spin_lock_bh(&mdev->sta_poll_lock); @@ -1175,6 +1180,31 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, struct mt76_wcid *wcid; unsigned int link_id; + /* clean up bss before starec */ + for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) { + struct ieee80211_link_sta *link_sta; + struct ieee80211_bss_conf *link_conf; + struct mt792x_bss_conf *mconf; + struct mt792x_link_sta *mlink; + + link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); + if (!link_sta) + continue; + + mlink = mt792x_sta_to_link(msta, link_id); + if (!mlink) + continue; + + link_conf = mt792x_vif_to_bss_conf(vif, link_id); + if (!link_conf) + continue; + + mconf = mt792x_link_conf_to_mconf(link_conf); + + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, + link_sta, false); + } + for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) { struct ieee80211_link_sta *link_sta; struct mt792x_link_sta *mlink; @@ -1213,6 +1243,7 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct { struct { u8 omac_idx; @@ -1243,14 +1274,10 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, mt7925_mac_sta_remove_links(dev, vif, sta, rem); - if (ieee80211_vif_is_mld(vif)) { - mt7925_mcu_set_dbdc(&dev->mphy, false); - - /* recovery omac address for the legacy interface */ - memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN); - mt76_mcu_send_msg(mdev, MCU_UNI_CMD(DEV_INFO_UPDATE), - &dev_req, sizeof(dev_req), true); - } + /* recovery omac address for the legacy interface */ + memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN); + mt76_mcu_send_msg(mdev, MCU_UNI_CMD(DEV_INFO_UPDATE), + &dev_req, sizeof(dev_req), true); if (vif->type == NL80211_IFTYPE_STATION) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; From patchwork Wed Jan 8 02:25:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13930064 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0949E7719B for ; Wed, 8 Jan 2025 02:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9stJebzoNziG0WiLpxtOlGj1x2TuJPr5flN8guCLCsI=; b=DKSERDxHZsZ+mgQZ8EmYK3X7Aa EpU2pLqtHpULr7jGEW3qF/h6fsRfb+PnZmoKGbuQZ5UalvmXMqK7NtLG3U2T/RMzxsyTZRd+pgpku vEQWke3pENRt1C5fvlUEtnCHrLwYsDZYLV/ZUTnKsHffiK06DVbiNRKZDTLRyc9NdzYMcq2WXgtLJ MKku3DY/XTgZNkIlhiVpV7YxECZOAoWpJDHAdeQC1h7ZKf/nc1n1UalOZ7R/9ns+ZVRRiMPA5HtfG Ht/7QpSIgIYHYlLb5IZrMvFU3HmhrtJwPAo4IFpzmhSKINy/8h2fHGYwiHH5n2phiQXEnDhqhrpOX 35Xs9wqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVLqy-00000006utw-2DXA; Wed, 08 Jan 2025 02:31:28 +0000 Received: from mail-oa1-f43.google.com ([209.85.160.43]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVLlC-00000006tKs-2JND for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2025 02:25:31 +0000 Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-29fb5257e05so5044818fac.0 for ; Tue, 07 Jan 2025 18:25:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736303129; x=1736907929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9stJebzoNziG0WiLpxtOlGj1x2TuJPr5flN8guCLCsI=; b=FSww1dw18xfgb8dT55dHweS7wIs9HShUnbcKuMn5QJSPxc7di9Jo9LdDO3vcpL13A3 RDBunNwLw/SgRcfzPbZ2LaFqKyaxSR38bTlKbQ77ztDrElQemj+DCpTK9yvZyesvwLmW ID/PYqKTeU6tNQqmoZF140GTJi5gZaFs+V6BQ8IMc2SW4uyyFy/htVZUWxEwOfIzmwbd 4MWMWDCDPlVhkMMjpAD/qSXXajdheeCtT2Z6zcBlEGzA6lyE76n7GeERxj8u4sCySi8j +7Y4uXYhcSQwuqgCPPiM4uDO4BGuf+VgjeoEvxzGOpMpw0aU+cg6fkDrPArT9ZMVoLbB T9cg== X-Forwarded-Encrypted: i=1; AJvYcCWP4sKvKaw1qYIceZAjDuvNxXk0y72BU2HTiz/Gd/DxTbBrXtSdr1nRiAY3P1i82aXrFTim/QOQQdOasR2CmQ==@lists.infradead.org X-Gm-Message-State: AOJu0YwH1M7Qp68gpBu09Y9hJ4azHeM7YyGYiKwMktBS9roMA6vGv0+k WQMu65h5ml0aTDqAdhMzd5ec/Y5O0nXUCK3WcnNpKoEwuddEqE+T X-Gm-Gg: ASbGncu4w5hs1z5ODugre85Cg1QFHhNo8Txm4sNWSrBomOQK5x1CPxM817RQDTXhVvO QbnCj4yalY1Bd+PTcnoCxvqSj4ZQHe10aud+P1QV4CLxmMTkL2RUOyxAD6PByLpL3CH+Pxoe0Mo rGOzI27yGpiKjGixpidxwpO5SOkqhPXXDyDY0qOa0+RitFl3EaX3IHmepWABKWIB/c0TjbAg826 hLM/bq0iJKIvOwc5Vda/+crgHqXlRvQFrNQJdE0SDx3CtGt/+ckoSFJj7tEP3HsvYusfYTUXg== X-Google-Smtp-Source: AGHT+IF7R/DBuJXSH1eYBsGIosh+Urgb9KslzXHh+w0QlXaYbxMxDbthj6GNEsubQTP51gSeFHxYOQ== X-Received: by 2002:a05:6870:9c83:b0:259:88b4:976 with SMTP id 586e51a60fabf-2aa069c9598mr557803fac.43.1736303129588; Tue, 07 Jan 2025 18:25:29 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2a7d77f6340sm13072862fac.48.2025.01.07.18.25.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 18:25:28 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 5/6] wifi: mt76: mt7925: integrate *mlo_sta_cmd and *sta_cmd Date: Tue, 7 Jan 2025 18:25:08 -0800 Message-Id: <20250108022509.217803-5-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250108022509.217803-1-sean.wang@kernel.org> References: <20250108022509.217803-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250107_182530_599742_D3D19F14 X-CRM114-Status: GOOD ( 11.15 ) 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: Ming Yen Hsieh Integrate *mlo_sta_cmd and *sta_cmd for the MLO firmware. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 64 ++----------------- 1 file changed, 4 insertions(+), 60 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index ad6174c07fe5..2fb8a6a7d252 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1771,49 +1771,6 @@ mt7925_mcu_sta_mld_tlv(struct sk_buff *skb, } } -static int -mt7925_mcu_sta_cmd(struct mt76_phy *phy, - struct mt76_sta_cmd_info *info) -{ - struct mt76_vif *mvif = (struct mt76_vif *)info->vif->drv_priv; - struct mt76_dev *dev = phy->dev; - struct sk_buff *skb; - int conn_state; - - skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, info->wcid, - MT7925_STA_UPDATE_MAX_SIZE); - if (IS_ERR(skb)) - return PTR_ERR(skb); - - conn_state = info->enable ? CONN_STATE_PORT_SECURE : - CONN_STATE_DISCONNECT; - if (info->link_sta) - mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, - info->link_sta, - conn_state, info->newly); - if (info->link_sta && info->enable) { - mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); - mt7925_mcu_sta_ht_tlv(skb, info->link_sta); - mt7925_mcu_sta_vht_tlv(skb, info->link_sta); - mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); - mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta); - mt7925_mcu_sta_he_tlv(skb, info->link_sta); - mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta); - mt7925_mcu_sta_eht_tlv(skb, info->link_sta); - mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif, - info->link_sta); - mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta, - info->vif, info->rcpi, - info->state); - mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta); - } - - if (info->enable) - mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta); - - return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true); -} - static void mt7925_mcu_sta_remove_tlv(struct sk_buff *skb) { @@ -1826,8 +1783,8 @@ mt7925_mcu_sta_remove_tlv(struct sk_buff *skb) } static int -mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy, - struct mt76_sta_cmd_info *info) +mt7925_mcu_sta_cmd(struct mt76_phy *phy, + struct mt76_sta_cmd_info *info) { struct mt792x_vif *mvif = (struct mt792x_vif *)info->vif->drv_priv; struct mt76_dev *dev = phy->dev; @@ -1841,12 +1798,10 @@ mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy, if (IS_ERR(skb)) return PTR_ERR(skb); - if (info->enable) + if (info->enable && info->link_sta) { mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, info->link_sta, info->enable, info->newly); - - if (info->enable && info->link_sta) { mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); mt7925_mcu_sta_ht_tlv(skb, info->link_sta); mt7925_mcu_sta_vht_tlv(skb, info->link_sta); @@ -1896,7 +1851,6 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, }; struct mt792x_sta *msta; struct mt792x_link_sta *mlink; - int err; if (link_sta) { msta = (struct mt792x_sta *)link_sta->sta->drv_priv; @@ -1904,17 +1858,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, } info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid; - if (link_sta) - info.newly = state != MT76_STA_INFO_STATE_ASSOC; - else - info.newly = state == MT76_STA_INFO_STATE_ASSOC ? false : true; - - if (ieee80211_vif_is_mld(vif)) - err = mt7925_mcu_mlo_sta_cmd(&dev->mphy, &info); - else - err = mt7925_mcu_sta_cmd(&dev->mphy, &info); - - return err; + return mt7925_mcu_sta_cmd(&dev->mphy, &info); } int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, From patchwork Wed Jan 8 02:25:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 13930088 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED921E77197 for ; Wed, 8 Jan 2025 03:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mMHTVC5omCIzKCyWSVas6ETdrQO9DyIoTSLU4TpmV5k=; b=UznzX/D+iF/QOhw1LGvwT3BuKi Mpp1pO1RHB/NgFnVogEH581/fhOf0f4Nv0xaLPILneg4pwvBdEgWNRq177pGp3gSid+m/C5HLxxWQ j44Zt1cuJrrE1m2G6QvE0B5kyA0/N3fUQXv/6S73cIWStpy31rjl+F6ghv5ZNu9yyRZglsAqTeeft cMnLzp92e+bxl0arV5qJMVv5oHRdlBE0NoX3yCuoKYa9gdSS9hfRqKot6ESADQ2UPpJVaBWCo1+OR sWUidp4NCAL7DC4vBwSxwGKUGf+3rKHThd5RIpjaDWu5FieCD5CKW1HBKptFHbGvw398E3XIQI/MZ 7RbydG0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tVMRz-00000006ysg-2EFP; Wed, 08 Jan 2025 03:09:43 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVMRy-00000006ysW-0z8d for linux-mediatek@bombadil.infradead.org; Wed, 08 Jan 2025 03:09:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=mMHTVC5omCIzKCyWSVas6ETdrQO9DyIoTSLU4TpmV5k=; b=IgXfCJvQzQYD6bxywI994XzT20 9ueb3xbMMOKQ1R/9dXQ3o6o0xOlDfC4Y+BjBdWIjvqHKhOYtEZp+vPGx1CbiVucfCnQFE64LO5J/X GfWkHpLdYShFPO2YClECTXc3sBBpz1nvoPal5VlV7vIBpLNQCFIV5EK36tUUUssvNA+RLUUek/D8K eeagILWjvLSKBz1Y0o0zZnU2qAT3efK/4ELJKkE1tCJ4iTGnevYj6bdvDgOVLeKo6mToLAeqfwci9 +DRvBjvOYMhyFLckJqEMVOqMccTDvKmAk8hzppq1OQH77YzOtkPK+loOreR5yqK5L9rj4IRWveHsr hm70treA==; Received: from mail-oa1-f46.google.com ([209.85.160.46]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tVLlJ-00000009F61-11IV for linux-mediatek@lists.infradead.org; Wed, 08 Jan 2025 02:25:39 +0000 Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-29e5aedbebdso7547448fac.0 for ; Tue, 07 Jan 2025 18:25:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736303133; x=1736907933; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mMHTVC5omCIzKCyWSVas6ETdrQO9DyIoTSLU4TpmV5k=; b=W3NOsNC3LWKbox87Q71c4QRbMEjc/0cwLdDUiVoNQlmGJzF/GOs6xyA6c/yZwF7pwu UXdY4NwTCFlF+JMPWHb/snePRfZYR+pbESa5tu5uKXD8pACKrMv+RI9s1ixC2WPVfyXj 1CXX3kUTL35njhbXwnQ+xMvIqkkmD3vNG8sAl6XQCtDxPJ3qy97oknMj66elms7qYdwi ZjQQzus9zZVKEjcHfTGNkaZqvnizAdffYyaUvpUkDOD2T9lTf57JfFJ9XtXp12LzMcCG vTgKCEfF69oK+eJjJwcLrXZ6ZWWSUarQUL0YnA1uhQXmAjG2PqvBT8ypge5eaTCr/8DV 5+aQ== X-Forwarded-Encrypted: i=1; AJvYcCVP6p8PUNT/g8fc8TA99SPpKgUGS+7kLwVGrw/UBm2tQEl177G/ZvHhY1Mnb89iZiVhuyL3/ZQPZmMJqy0dKw==@lists.infradead.org X-Gm-Message-State: AOJu0YxNmTtOTJzZE932HQTc+FQswAjW/GFALGChhlZa95T9OIxHLfPw 5ywhwBRgZecUxD5a7rPJGPGjLNEc954eB8qEnxBaZaeDKDim97TBXWPRS/lP X-Gm-Gg: ASbGncsprdRux1+CzPNtbJSDjytBKbolc2qsyCMeirP+8mBRLFpcy2pRuaT6VIa/wXq c6q3qZaYUbzS/x5xTdRwZqfkZ3847isZYmPMUoidF4KecxgEX9ynxcZS799eml0H0trkAXARyNF 5C07ke38cOxpTESy1oRJd2frcfyJM67y7RpUuiU3iFjQF0fBqcLsrdBCYomLJbR5FH/APwetcC7 ml5z+Z0vY/wNwXtq4XydRBPcek3OJ/0olBs878biLCIk7U9bqSaEAUCliLIc2ldBKjt/B4smA== X-Google-Smtp-Source: AGHT+IGQa9k57yYFrsV2kb30+Ip/UeVPsLJ/gjUXW4EJquDZ30xFTxjbTqu4fk9CYmLSYObCuskDOA== X-Received: by 2002:a05:6870:ce07:b0:29e:24c7:2861 with SMTP id 586e51a60fabf-2aa066abf1bmr581936fac.13.1736303133345; Tue, 07 Jan 2025 18:25:33 -0800 (PST) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-2a7d77f6340sm13072862fac.48.2025.01.07.18.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 18:25:31 -0800 (PST) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 6/6] wifi: mt76: mt7925: update the power-saving flow Date: Tue, 7 Jan 2025 18:25:09 -0800 Message-Id: <20250108022509.217803-6-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250108022509.217803-1-sean.wang@kernel.org> References: <20250108022509.217803-1-sean.wang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250108_022537_686798_5B95D8F6 X-CRM114-Status: GOOD ( 16.69 ) 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: Ming Yen Hsieh After joining MLO, ensure that all links are setup before enabling power-saving. Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it") Signed-off-by: Ming Yen Hsieh Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/init.c | 1 + .../net/wireless/mediatek/mt76/mt7925/main.c | 65 ++++++++++++++++--- .../wireless/mediatek/mt76/mt7925/mt7925.h | 1 + drivers/net/wireless/mediatek/mt76/mt792x.h | 9 +++ 4 files changed, 67 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/init.c b/drivers/net/wireless/mediatek/mt76/mt7925/init.c index ddc654b9ea5e..7d829b511846 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/init.c @@ -222,6 +222,7 @@ int mt7925_register_device(struct mt792x_dev *dev) dev->mt76.tx_worker.fn = mt792x_tx_worker; INIT_DELAYED_WORK(&dev->pm.ps_work, mt792x_pm_power_save_work); + INIT_DELAYED_WORK(&dev->mlo_pm_work, mt7925_mlo_pm_work); INIT_WORK(&dev->pm.wake_work, mt792x_pm_wake_work); spin_lock_init(&dev->pm.wake.lock); mutex_init(&dev->pm.mutex); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 4714c07cfbfe..ffe783b4fb71 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -426,6 +426,7 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->bss_conf.vif = mvif; mvif->sta.vif = mvif; mvif->deflink_id = IEEE80211_LINK_UNSPECIFIED; + mvif->mlo_pm_state = MT792x_MLO_LINK_DISASSOC; ret = mt7925_mac_link_bss_add(dev, &vif->bss_conf, &mvif->sta.deflink); if (ret < 0) @@ -1285,6 +1286,8 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, mvif->wep_sta = NULL; ewma_rssi_init(&mvif->bss_conf.rssi); } + + mvif->mlo_pm_state = MT792x_MLO_LINK_DISASSOC; } EXPORT_SYMBOL_GPL(mt7925_mac_sta_remove); @@ -1356,6 +1359,38 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return ret; } +static void +mt7925_mlo_pm_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) +{ + struct mt792x_dev *dev = priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); + struct ieee80211_bss_conf *bss_conf; + int i; + + if (mvif->mlo_pm_state != MT792x_MLO_CHANGED_PS) + return; + + mt792x_mutex_acquire(dev); + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + mt7925_mcu_uni_bss_ps(dev, bss_conf); + } + mt792x_mutex_release(dev); +} + +void mt7925_mlo_pm_work(struct work_struct *work) +{ + struct mt792x_dev *dev = container_of(work, struct mt792x_dev, + mlo_pm_work.work); + struct ieee80211_hw *hw = mt76_hw(dev); + + ieee80211_iterate_active_interfaces(hw, + IEEE80211_IFACE_ITER_RESUME_ALL, + mt7925_mlo_pm_iter, dev); +} + static bool is_valid_alpha2(const char *alpha2) { if (!alpha2) @@ -1905,6 +1940,9 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, mt7925_mcu_sta_update(dev, NULL, vif, true, MT76_STA_INFO_STATE_ASSOC); mt7925_mcu_set_beacon_filter(dev, vif, vif->cfg.assoc); + + if (ieee80211_vif_is_mld(vif)) + mvif->mlo_pm_state = MT792x_MLO_LINK_ASSOC; } if (changed & BSS_CHANGED_ARP_FILTER) { @@ -1915,9 +1953,19 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, } if (changed & BSS_CHANGED_PS) { - for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { - bss_conf = mt792x_vif_to_bss_conf(vif, i); + if (hweight16(mvif->valid_links) < 2) { + /* legacy */ + bss_conf = &vif->bss_conf; mt7925_mcu_uni_bss_ps(dev, bss_conf); + } else { + if (mvif->mlo_pm_state == MT792x_MLO_LINK_ASSOC) { + mvif->mlo_pm_state = MT792x_MLO_CHANGED_PS_PENDING; + } else if (mvif->mlo_pm_state == MT792x_MLO_CHANGED_PS) { + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + mt7925_mcu_uni_bss_ps(dev, bss_conf); + } + } } } @@ -1968,11 +2016,12 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED)) mt7925_mcu_set_tx(dev, info); - if (changed & BSS_CHANGED_BSSID) { - if (ieee80211_vif_is_mld(vif) && - hweight16(mvif->valid_links) == 2) - /* Indicate the secondary setup done */ - mt7925_mcu_uni_bss_bcnft(dev, info, true); + if (mvif->mlo_pm_state == MT792x_MLO_CHANGED_PS_PENDING) { + /* Indicate the secondary setup done */ + mt7925_mcu_uni_bss_bcnft(dev, info, true); + + ieee80211_queue_delayed_work(hw, &dev->mlo_pm_work, 5 * HZ); + mvif->mlo_pm_state = MT792x_MLO_CHANGED_PS; } mt792x_mutex_release(dev); @@ -2056,8 +2105,6 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto free; if (mconf != &mvif->bss_conf) { - mt7925_mcu_set_bss_pm(dev, link_conf, true); - err = mt7925_set_mlo_roc(phy, &mvif->bss_conf, vif->active_links); if (err < 0) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index f5c02e5f5066..cd7a7c293018 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -247,6 +247,7 @@ int mt7925_mcu_uni_tx_ba(struct mt792x_dev *dev, int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, struct ieee80211_ampdu_params *params, bool enable); +void mt7925_mlo_pm_work(struct work_struct *work); void mt7925_scan_work(struct work_struct *work); void mt7925_roc_work(struct work_struct *work); int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 3f989e83f252..20d8b02d1b6f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -81,6 +81,13 @@ enum mt792x_reg_power_type { MT_AP_VLP, }; +enum mt792x_mlo_pm_state { + MT792x_MLO_LINK_DISASSOC, + MT792x_MLO_LINK_ASSOC, + MT792x_MLO_CHANGED_PS_PENDING, + MT792x_MLO_CHANGED_PS, +}; + DECLARE_EWMA(avg_signal, 10, 8) struct mt792x_link_sta { @@ -134,6 +141,7 @@ struct mt792x_vif { struct mt792x_phy *phy; u16 valid_links; u8 deflink_id; + enum mt792x_mlo_pm_state mlo_pm_state; struct work_struct csa_work; struct timer_list csa_timer; @@ -235,6 +243,7 @@ struct mt792x_dev { const struct mt792x_irq_map *irq_map; struct work_struct ipv6_ns_work; + struct delayed_work mlo_pm_work; /* IPv6 addresses for WoWLAN */ struct sk_buff_head ipv6_ns_list;