linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 16/17] wifi: mt76: mt7925: Cleanup MLO settings post-disconnection
Date: Tue, 10 Dec 2024 17:19:25 -0800	[thread overview]
Message-ID: <20241211011926.5002-16-sean.wang@kernel.org> (raw)
In-Reply-To: <20241211011926.5002-1-sean.wang@kernel.org>

From: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>

Clean up MLO settings after disconnection.

Fixes: 86c051f2c418 ("wifi: mt76: mt7925: enabling MLO when the firmware supports it")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 .../net/wireless/mediatek/mt76/mt7925/main.c  | 37 ++++++++++++++++++-
 .../net/wireless/mediatek/mt76/mt7925/mcu.c   |  4 +-
 .../net/wireless/mediatek/mt76/mt7925/mcu.h   |  2 +-
 3 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index da7a2a798545..9c43437ad9d0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1149,8 +1149,7 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
 		struct mt792x_bss_conf *mconf;
 
 		mconf = mt792x_link_conf_to_mconf(link_conf);
-		mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf,
-					link_sta, false);
+		mt792x_mac_link_bss_remove(dev, mconf, mlink);
 	}
 
 	spin_lock_bh(&mdev->sta_poll_lock);
@@ -1208,12 +1207,46 @@ 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 {
+		struct {
+			u8 omac_idx;
+			u8 band_idx;
+			__le16 pad;
+		} __packed hdr;
+		struct req_tlv {
+			__le16 tag;
+			__le16 len;
+			u8 active;
+			u8 link_idx; /* hw link idx */
+			u8 omac_addr[ETH_ALEN];
+		} __packed tlv;
+	} dev_req = {
+		.hdr = {
+			.omac_idx = 0,
+			.band_idx = 0,
+		},
+		.tlv = {
+			.tag = cpu_to_le16(DEV_INFO_ACTIVE),
+			.len = cpu_to_le16(sizeof(struct req_tlv)),
+			.active = true,
+		},
+	};
 	unsigned long rem;
 
 	rem = ieee80211_vif_is_mld(vif) ? msta->valid_links : BIT(0);
 
 	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);
+
+	}
+
 	if (vif->type == NL80211_IFTYPE_STATION) {
 		struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 551b1827bb40..6675492ec9a8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -2662,7 +2662,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
 				     MCU_UNI_CMD(BSS_INFO_UPDATE), true);
 }
 
-int mt7925_mcu_set_dbdc(struct mt76_phy *phy)
+int mt7925_mcu_set_dbdc(struct mt76_phy *phy, bool enable)
 {
 	struct mt76_dev *mdev = phy->dev;
 
@@ -2682,7 +2682,7 @@ int mt7925_mcu_set_dbdc(struct mt76_phy *phy)
 	tlv = mt76_connac_mcu_add_tlv(skb, UNI_MBMC_SETTING, sizeof(*conf));
 	conf = (struct mbmc_conf_tlv *)tlv;
 
-	conf->mbmc_en = 1;
+	conf->mbmc_en = enable;
 	conf->band = 0; /* unused */
 
 	err = mt76_mcu_skb_send_msg(mdev, skb, MCU_UNI_CMD(SET_DBDC_PARMS),
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index 31bb8ed2ec51..fe6a613ba008 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -616,7 +616,7 @@ mt7925_mcu_get_cipher(int cipher)
 	}
 }
 
-int mt7925_mcu_set_dbdc(struct mt76_phy *phy);
+int mt7925_mcu_set_dbdc(struct mt76_phy *phy, bool enable);
 int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,
 		       struct ieee80211_scan_request *scan_req);
 int mt7925_mcu_cancel_hw_scan(struct mt76_phy *phy,
-- 
2.25.1


  parent reply	other threads:[~2024-12-11  1:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11  1:19 [PATCH 01/17] wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO sean.wang
2024-12-11  1:19 ` [PATCH 02/17] wifi: mt76: mt7925: Fix incorrect MLD address in bss_mld_tlv for MLO support sean.wang
2024-12-11  1:19 ` [PATCH 03/17] wifi: mt76: mt7925: Fix incorrect WCID assignment for MLO sean.wang
2024-12-11  1:19 ` [PATCH 04/17] wifi: mt76: mt7925: Fix incorrect band_idx setting when enabling sniffer mode sean.wang
2024-12-11  1:19 ` [PATCH 05/17] wifi: mt76: mt7925: Fix incorrect WCID phy_idx assignment sean.wang
2024-12-12 10:38   ` Kalle Valo
2024-12-11  1:19 ` [PATCH 06/17] wifi: mt76: mt7925: fix wrong parameter for related cmd of chan info sean.wang
2024-12-11  1:19 ` [PATCH 07/17] wifi: mt76: mt7925: Fix CNM Timeout with Single Active Link in MLO sean.wang
2024-12-11  1:19 ` [PATCH 08/17] wifi: mt76: mt7925: Enhance mt7925_mac_link_bss_add to support MLO sean.wang
2024-12-11  1:19 ` [PATCH 09/17] wifi: mt76: Enhance mt7925_mac_link_sta_add " sean.wang
2024-12-11  1:19 ` [PATCH 10/17] wifi: mt76: mt7925: Update mt7925_mcu_sta_update for BC in ASSOC state sean.wang
2024-12-11  1:19 ` [PATCH 11/17] wifi: mt76: mt7925: Update mt792x_rx_get_wcid for per-link STA sean.wang
2024-12-11  1:19 ` [PATCH 12/17] wifi: mt76: mt7925: Update mt7925_unassign_vif_chanctx for per-link BSS sean.wang
2024-12-12  4:30   ` kernel test robot
2024-12-11  1:19 ` [PATCH 13/17] wifi: mt76: mt7925: Update secondary link PS flow sean.wang
2024-12-11  1:19 ` [PATCH 14/17] wifi: mt76: mt7925: Init secondary link PM state sean.wang
2024-12-11  1:19 ` [PATCH 15/17] wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO sean.wang
2024-12-11  1:19 ` sean.wang [this message]
2024-12-11  1:19 ` [PATCH 17/17] wifi: mt76: mt7925: Properly handle responses for commands with events sean.wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241211011926.5002-16-sean.wang@kernel.org \
    --to=sean.wang@kernel.org \
    --cc=deren.wu@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=mingyen.hsieh@mediatek.com \
    --cc=nbd@nbd.name \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).