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: 13930013 X-Patchwork-Delegate: nbd@nbd.name Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com [209.85.167.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C7BA33062 for ; Wed, 8 Jan 2025 02:25:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303117; cv=none; b=nJMc12K6UEW+0xeihWjRMQ6WIRogADqbrPk42RwCVpwXPEySQYnp7b1ijujIGgvKS1i+6nmFcPqoYAsXhzKlMixyye3xp25fj8cKOkAq6qRNJrAACHZxZS1CEad4VzMU2rGTdYzAEMWCyqzlzKJM4bXNzR8lSUNCOLkeij/BEOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303117; c=relaxed/simple; bh=1bNWoKCImEtRvjsxwngw+rf9Aj3G/KUrqgc7ueNtkVU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=QtWZiMH8EPhGAGeU/kgGbQfbB4U0QK5AZSYRqb87C8EsOekenW2bvVGCJQjFQd3ap5Kx72P+3xwNk1dDJTUe6ZehAJuwXAwFJr4m2u+e6O7zmNXjmGDKzb5Vh/0Ng8OmK/V8y7pzEW2rIGj8/mJv9UYLPGVnoQP/1e7qt8DoO5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f175.google.com with SMTP id 5614622812f47-3eb7e725aa0so6059856b6e.0 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=xFbm5fzMb16ebiqWSChlAzQqsFZd1ypckV2qikTKIKnwCk9qOQQMGhma5lIhYo6XqP xJd4Y7cpEG2oGnAM5l0emtnJiNUNjJNlzvf1zZL4VRUzCcrYCQwo8z49oseXxKafBlQa HljILDhdMZUgMGpj7GIimAQo8qFklO9mpEXvCZrP7GhwbJtElvMbRt63q2SmPVS+NxLW /JiZyqgwLQohvcvrfdxv/Cq2I44DU54+MLt8i71Zsz50pPW5CTN2SicE/nFuxDpMWg7u 6sAOgI8sqFpZXnDkwjWR6SQNAJV8lt1geB7l9Ge0rAhjbgRb8h1CCfRTTa4BNHYRYXNP EqAQ== X-Forwarded-Encrypted: i=1; AJvYcCUjiSWvgyV0fIyUrNTqBFWtfjPJEzST/vjuwDHLOVFQV065MfaBfP2b86JC6YZGpGX9Ugc+2zGWxJxSH+aZLg==@vger.kernel.org X-Gm-Message-State: AOJu0YwC7vK35djduLVajF8SFyDG3gFZ/Fb2PJvjDS3VZ2B2dJIISVQg nUj5if0skO2A38dLk6w+3cPoWln9hqZFw5G7sgqmB4M+gwn7C+9ybJFsHIWB X-Gm-Gg: ASbGncvwZV9gMQQ9fqCBeqGXFnaFQQop5kOIv6MD7yI9qnRNAWMsQA/UrDVkhh/SKh6 QXAjeQQQLUO5S5dPSBIyppPdef+kbAKHKbCXvmPgchtcZIcTwyYACpKvD+8eg5wD0C8iWOszUyB hp8VoGLSbzXY6tVsefffPbcpceSl06b1wqYsRQfdnW0griEM4QB0X+6rNRIpKvnNpkqHEqiRjkn DgakofBw3TRjNTCEf/7UClepG8YOD+ycEiNfppFQ4go8G/shIUiTtFpDWXXoFr09AnOcZVZKA== 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 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13930014 X-Patchwork-Delegate: nbd@nbd.name Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11BD315FD13 for ; Wed, 8 Jan 2025 02:25:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303121; cv=none; b=acMpFADp0wCtqy1eqgtN3Np8BC3u5DYc9Oz8pHOt5lIGu9OzpZQaIaQCR/kkRB+J/gAKAi7VcoLVq14iZCvgaLWRcdo8q2OU9vG+hAW5iltK9SSD95C56Cn08ZzKhP8dwXmWP8LjTlFrWulcoPIbcymcMX2ekKrgyjx6/DB5VK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303121; c=relaxed/simple; bh=h215dTe9o1S+cb0jeevWHj//dg5y8VUwboCEN1SVWh8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BE2muoM/H1NhmU/xIEH0iTOJZu5SOLuLUmjnqC0YGt7htDGfO2SQmzjtLaVEM2BDh2/C7CSx0Qc849XabkYqYrZfk0E4uLxR4jOD/vVnHYDoaWQiPEV7ApfCvIsb1Y0KURrnoo9a2PKPR7hhvps5bHeiURKINlapwlH4GLMtWsI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-29f7b5fbc9aso4785587fac.3 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=RbY71BRN2k0/w70MZvYNaSa8zNIYMrMTARbr3mmXjjAPsQBKW/OpYsbMcz9yaS5Rjy qvWS+4KX8Ty+qGSxOew/xK/czPG35gMNddWorLlKhq0BiLTXX1Rd6LquSBOPzwrqQ+hy CFSF3cBiWV2NKGJPAPNynI3lL0c3ifPrD2X5aaV9xok2ZLoffu5+PZpiddN3GmzGvZFW CEwB3JvIoqG3YKAJfX/d3g1cqfBi9QjUNTML26XkT2XVx/gzBmPkzsKXfn4Lc/zO4Zg8 6TfZ6oShIBdOYaaxpKFv8/OiNK6bImYFIOxuYnAmSjFLqCNO2yrxQ6lAkxBhMrBXDO7K 0ZTQ== X-Forwarded-Encrypted: i=1; AJvYcCXOOwMdFjlxNzxPgBbkpQb6rFs/KUmkJwJkwZdWz+Np0pe+etmwVMQ30dvoA7NLOSqqeXB5NvHwzsERh4oddw==@vger.kernel.org X-Gm-Message-State: AOJu0Ywh1ID083j0xnEDXmyDKiJx3OczZT17NTE1N8xqK6F9Uzl03F1C EjkQFl0NhxRBHHddKr6Uao7DDps1wPZAkx/V9wWYRbY3KxBKOvss X-Gm-Gg: ASbGncvMO9sGqTkF4agLdW+4M0vPW/1MM+dWPu1sTt9NE8bdwQG9PEo7OEt8HOTRrkE uBelV9TB7ezmCmH/XM6kaSv7hwhpx5xEBaqeoLRx/QmiXrYK1mZzJ+oYG61mQfLPjGgRKU4mA9S KElgdrBFNIg8pGhckhXkg4EvN9QSwpD0hna8d1iubVaibTI+LBEnL0oZlZdm2WL/QXfRRpqiLuK 5KTQgOWTEhqR4LlEKzCA2vRUt9b/aGkAucnkESBfKX5yb5AnV8u42v6RtGxEXm0NkcXTb0TZg== 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> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13930015 X-Patchwork-Delegate: nbd@nbd.name Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5D5A33062 for ; Wed, 8 Jan 2025 02:25:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303125; cv=none; b=g6EuU4V7FaBgZjCKTq5hSrH9rtc9OwHlHnzrn8yHJEIK/P5o/WZE5oCeLH1OZiqkDvLqFtZaF3toTquZjfVvk5Z1R0Y1mjEwLH9lOVqvqCrZHlNt1id7jQn9o/NgF4Fo2T/tC+yEls9OvhBrp4v3KT1UyKQg0N876gcNxwnO/TU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303125; c=relaxed/simple; bh=Mlu4f7UY84mpSAeX3roP6mRteL0VDztOjWLDfmscYiw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r+DEd4uAwipHS4SzE2FX1FAtYZ7FKy2nXvFeFwQ5Hv3F2Yy8H/bPqJgfYjClZeZFd7uswy4iV9sQAi3uCMRcxqBbN84cj/yi5qCbHiT3FjM7NRUYH66FEsq1vI0LjRO7Fu4o/bPCFm4cLSWc/eC7+boAw/US7I+rguTsCwmtYys= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-2a3d8857a2bso7470931fac.1 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=xQ9GoCAWSWtoBaoxfOTcmqqA1dPDy7kzZ6wdjoCSFHz8fxWfKyDm46gBGW7VimA2ON Qpq8QsFBPYnFEt3IDw0I4gZ5UWXafB+BI/4uL8D2/BXLKJ39xIcfDClO9f22Z+n1eW7C AphxMEQ/kHR+GeSSyQTmPa67rFEnjWGFEykUPZk8Jxab7BHlAnvmM4ADAlgtNHYLdoEt VGextchaIY/MkUdxPdJsmuRJUSrr5jRM6JSynS+pD9bz7u6B+E0SdpjfZfLRnH3cXVxy MhMhNrK90yysBIcsOiArDzqa+RsiL8J+U9tgLSFfxN31igPkQgnv5FsCHMyiUcVgawPR JpFw== X-Forwarded-Encrypted: i=1; AJvYcCWD3kxYKjVAQw+QbcEr5auExNRmNP2jx8ZSsGPy0YI+rzX4FUnyj0AkQMLN2GCNIXD0m7orhN3GipgfPRCOgg==@vger.kernel.org X-Gm-Message-State: AOJu0YwIslmmZxJurKND+QbEhHgDq9xZNzsskzMDQqb6gVph+8GPdMpr wZWInH4acRe8j1G/hsDT1WZgD2CXF4cp+DyI7rz35rHkR5wZsOd+ X-Gm-Gg: ASbGncvTSWoUX/bZzeGLqQvhMb/I8uh6qqpAB+92l3t3qPE+ZMMV3b6gqRPEyv2IvD1 BD24Kk1nE5fORPCEJecR2FClr6VDam4EPkKoQV8fpLp44OUvzFFpoGm6hOtqvZM2tEgO3gMvxLJ NesGkgR4NsWyzaIup8lHPJ4gFowy7PMG3I+hJMKSrOuo51dw/QIgX6EPEoNSP5bWxRaQXY/UqWn 8RL7NDFzXyj03/sYj42HNZBUmogQ/bwb9KdG7G12/U+MdnwwQ+MF58rSxoOv/09NlWip7jsUQ== 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> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13930016 X-Patchwork-Delegate: nbd@nbd.name Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F26B183CB0 for ; Wed, 8 Jan 2025 02:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303129; cv=none; b=PQfdxpWB3tXHcKMCKcdi2558TJNbTgasY50zZTp0Td/LlRM3pybdsXjC6VxllLWbu50jmA66yKJHb5RvvYDpfxLyaSGfgBHLkOvhkIejvvXmqhSHqgtZGmr109MnSSkwIAkH6eRr0hQ8imE7l60faoNlmhoPpvIlfGbuBh3dsIk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303129; c=relaxed/simple; bh=jQ03YfZAry7lW/sU3FE6/IKz5I4+xG0gsL50TyuxTxM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RRWgg3oz0VkTx4ok0LpI41pAirZ9AKxviz7DC9t5++MRuIG7Hn/85udVeb1MfX+I9veBoHQMEvAqA5IxLmjFxV3L7jUPvWfgPayKG02frPdYSbtv1RRBVIjeLX5QuzZvae29pj+X6g6tir54QVoPmF8Phxz0EqFsgEY+K8k56IA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.161.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-5f6ab7e0bd6so3285547eaf.0 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=p7hjwZjB6sWlbDey7fAl0jZk7c2whI9ekid0D+P8R+MSCjNy65eVO/ipLgIu1KUaRX m58Z6y5Tnz+Zx2UIDU1N1yoOd4V41lLuQ+CvSyhGILUi/+1RAzcWypoQmUvY0bqbAA/7 Ddc5/Tz7F8eVUHqnwD4IAvB9lSpWbfViJ4baFIRtQZnBeBd5HCHP9H+WXFoAWEUyIs1x eTl+b9JSo3PP2RZGhrgfc+WACU7odmnqZopDrj3VceYftvlN1hgV6YjdThJvGCPthUsr fVUYA6eQM5KZtwYutDbjtBfERCihDpotmsoN9gpbSRU6luC21mEDpz3fiuA/j0F2lYQt 7fUg== X-Forwarded-Encrypted: i=1; AJvYcCVTMZfqvL4RjyLnh282kP0iHkPthtegPHEbOFh09g1/hdARHxkqlr/k+F36zk4KMeeywd5UV/FobboiRunkMw==@vger.kernel.org X-Gm-Message-State: AOJu0Yz/o0xFnhMajnt822Xh3rKZD1eHXef6qeiiQmIx8wFczOTMVuP9 mXAfr9wdidBrizNYJt0Ql5ClnoSZ9a7HWfz4BCPi0Vxl6/HpOGMDsT+NUGSr X-Gm-Gg: ASbGncskVj8Z+DOWFSCy8w+hB/8xW8NeuxSwHQlK+6eOd5WWZVYp0jAYcr73vJoxpNQ hyOGDg5iaX9v4lRL8NRy2EiYaHXrYCdwwQmsn5cPD8EjW3kO5MN5eN8k2tbLhjPZCLW8pHlkOU6 NcsEBpcVh0Q6HoPLOx6VExf+++G0nzlAiYqYDuooPuh6WgvcVgyR7twtr67Wo0g1YTykLGC3zrz L4451R1f+Yp/q7xK78KxMb0y9WURVbpR3OmHXc7IOfgbGTGluQF9n3mfDESATfJoTbZ6e/EWA== 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> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13930017 X-Patchwork-Delegate: nbd@nbd.name Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A197118F2EF for ; Wed, 8 Jan 2025 02:25:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303132; cv=none; b=mBQstJLn9Idb1N3P48S0tGXLvYwiRj2reQzLkEs2xElNLwbf9QhP4XmRhaXJOvJl3li+MT+w8EXc7hssMu1BFMzcuCr6rPLjDAtI3glRp+tnU5JfeENGEtzR/yeLTx6taHGANDknt55AHkCtz+rJixUJ27QdcHQROZZs4LJAGSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303132; c=relaxed/simple; bh=v7iAjK9sTwkWI816wvLAaEWO0xC+oVi8HjC0AWEIRCs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RxP2+aQrnNjBfZ1ZHt/CDcEkpDXpfCl6SjYOlSTcm0ODTKbqAaGrat+xxG1rk5utytClClqJUiQnTvI9ar9ByIyCDtHh6OrU8eOVuxhioEgpGWkkIS7aaCfw0QHSt20USZfXW+U4H+lQz2jM03is/OvoSchfjxkW16aVLNUqZ28= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.161.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-5f31e8c2bfaso3535824eaf.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=cL1gt41y1Iwzr7nGvWnxwlvoOM3kf6yPPElAbJJb9doswRUHb/VGgFkoA49iThf24d kRmTMi2H+puY3PeHunQHD6LRcBAsh7k+YrN7frkCiVhloVzlBriJtzqJ09KMdi7iYHCH dDyP5zuUOheDsfq707ak79evE9KKwM/jkjZwaqyH3ywzrbIRJvZgjKztgmj3dM/uQAlJ 99aFtNV3PqmalJY+UHStccwOpmDkUqeAAfUx8uqnUyEWTHrGEZwrb6ZWLQChjaUnSQaC 2CuOWsWQVAwdTtU2Wlnc4RphcHChWwB0zBv2zNVcKGwLIJmK+p9VPUMcN+J4PPAjBlzy Zpgw== X-Forwarded-Encrypted: i=1; AJvYcCXNK0aSAemj20f11VBF0T7OvUvz50x+b30dDN9jup+vswFw6tuZ7iQ/mAjctEeYemg43VhJxnj3TbKBOowxtA==@vger.kernel.org X-Gm-Message-State: AOJu0Yx47IIKr0Kf+q0rXsyNhk7iFlJJBP+kNMhfqG6K3o99zQb5iWXX z+V+othwYHnK0dbwAIeAnImJGasQ3Edo3WnPsBBK+LM2HwtntK3D X-Gm-Gg: ASbGncvo9w+N0GzTm4ONY1F8KlQVMkkpHSmLq/gvU57mY4dk8jSnV4uVd8lDp1EJKjE KF6D9XFfaVsZ6S2ofT6AzVyeyPjr4garYjqZBppF/vCbM9UlDsa6LV8AS1SPae8D2CRnzf01fuT xec6yIf3yz7Qd9VDS910nM2Gvk/iup18Nc0QW93vTQdhbf2AjvYZC3qP2n/I1E+vQYjNLj78S6g kAmyBRnZRrBtTuGSPUBk8mjqvkXBF8bjhVeyvd7NdYUFLCUz6AopERFMkKcCoDq7Qnv+BkzPA== 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> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 13930018 X-Patchwork-Delegate: nbd@nbd.name Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 598C71DFFD for ; Wed, 8 Jan 2025 02:25:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303136; cv=none; b=iuoSZ7MLmB5i+y5Ld+T0+lX9wLdalWnI+EzP7eP7TVPFpYTZi2/C0u2P75vLnkmoZU+suCyXjfcbI3LKAkJkULmlQa36i1YYdivgiSJ6DSj8qC5qRZnFEPt08vOB9IpHtBB18GH0toyMJ6BDoTJOEC/qqqCOIIC/bTwlIgRC/2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736303136; c=relaxed/simple; bh=IHkXeQel1Q2+5E9CuXQlGmVXXtVn0dDhdkgxQPhctyU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jYgR+MSuqHC5NbLX+jjiUDt4LtzWaZQMa+g5JduQT3vRXwkkjo2lVP09IL7y6YSYTT7MwtZu3oMXkVZC9UWrHSZQG7Z5lcWQ8/1YIoln2HQgywvSi7G7rUMqsS7I548BUkCGLT4bexWSM+iZ5tyQgd76whL/typnj9TrpHDvShg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.161.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5f2dee7d218so7293410eaf.2 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=w+8UfjQwwg+nt8ktaYOk/W96AJ3A+HoihLhiHzWAMw651lByN2vM8VTGH+5jVk0k3g Ie9LS299gcR04rJUG459rOkXTgT3693Uj/lLZEjL1t8R9iJA9xhlyEnhrsgUBCft2Icx Tww5FjMj/w3olL0V/GmvcMQdQr2nQVQr7xy155R53x8StnJrggxe4Eb3EiJLFI1MFKpa RU2H7veBWlf3dgzYJRb9tILgPRTyV9yDgSurF5s6RDfkBlRmZCkegaQ7SUps2+ZGN7c8 KHm49xeEoS9yDY9lywmJ1LY4YM4V8H+KAGoqW+OjA1EGdVf/1PTRF7nEI0NMyxV3RwXT 6Z0Q== X-Forwarded-Encrypted: i=1; AJvYcCV62HXzYzC79T6NWgLNYwcNVa7bKWcTO9uzfCYtfzBZhKJ9u6+h6rGgXzSwU/dzNAdspK1qnjxzPeXJKOuqpg==@vger.kernel.org X-Gm-Message-State: AOJu0YwidX1gODNUFtRcqGn4To2ABsnXBVUpEpJAWwknJ2croN/rxYSd bja8yMJmj+YaDZPVSq7byJjg47aSi9BzvZUzp3PhAK8XfSBl6hpp X-Gm-Gg: ASbGncsxiJZsfCeplZRKOfr2Fiv99654Zg8RSF5FH8sxFwE3owtQEeDVDzAl+dNmhdG wwibCljFUKNlg/rBem2JKhVgw2KScz1UOoR421H5IHueezYxBy2EGPc8xsXrAJnr1WSpG9mIojD QbE7nZzZxoPsPrf5jyDwXki/iWCx+frOQhkMMg7+a8C5p9Q0UXo51HqRIylU+QfjW7qrNey1g/O kETzIpb6ZY5dazf1M0gBiktjyOg02qG4QKfpMiE8fY+CZEp+05Q3S5p3ZhtqVpmlk/hPhc1gQ== 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> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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;