All of lore.kernel.org
 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 05/47] wifi: mt76: mt792x: extend mt76_connac_mcu_uni_add_dev for per-link BSS
Date: Wed, 12 Jun 2024 20:01:59 -0700	[thread overview]
Message-ID: <20240613030241.5771-6-sean.wang@kernel.org> (raw)
In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org>

From: Sean Wang <sean.wang@mediatek.com>

Extend mt76_connac_mcu_uni_add_dev with per-link BSS configuration.

The patch we created is a prerequisite to enable the MLO function in the
driver. It is purely a refactoring patch so the functionality should
remain unchanged.

We also extend link_idx field in mt76_connac_bss_basic_tlv for the firmware
to able to identify the link index in the MLO mode that is not harmful
for the current non-MLO mode.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7615/mcu.c      |  4 ++--
 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 12 +++++++-----
 drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h |  4 ++--
 drivers/net/wireless/mediatek/mt76/mt7921/mac.c      |  3 ++-
 drivers/net/wireless/mediatek/mt76/mt7921/main.c     |  4 ++--
 drivers/net/wireless/mediatek/mt76/mt7925/mac.c      |  3 ++-
 drivers/net/wireless/mediatek/mt76/mt7925/main.c     |  4 ++--
 drivers/net/wireless/mediatek/mt76/mt792x_core.c     |  2 +-
 8 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index c807bd8d928d..792ae41f7c69 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -1109,8 +1109,8 @@ mt7615_mcu_uni_add_dev(struct mt7615_phy *phy, struct ieee80211_vif *vif,
 {
 	struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
 
-	return mt76_connac_mcu_uni_add_dev(phy->mt76, vif, &mvif->sta.wcid,
-					   enable);
+	return mt76_connac_mcu_uni_add_dev(phy->mt76, &vif->bss_conf,
+					   &mvif->sta.wcid, enable);
 }
 
 static int
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index fb8bd50eb7de..87f918461051 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -1125,11 +1125,11 @@ void mt76_connac_mcu_wtbl_ba_tlv(struct mt76_dev *dev, struct sk_buff *skb,
 EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_ba_tlv);
 
 int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
-				struct ieee80211_vif *vif,
+				struct ieee80211_bss_conf *bss_conf,
 				struct mt76_wcid *wcid,
 				bool enable)
 {
-	struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
+	struct mt76_vif *mvif = (struct mt76_vif *)bss_conf->vif->drv_priv;
 	struct mt76_dev *dev = phy->dev;
 	struct {
 		struct {
@@ -1141,7 +1141,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
 			__le16 tag;
 			__le16 len;
 			u8 active;
-			u8 pad;
+			u8 link_idx; /* not link_id */
 			u8 omac_addr[ETH_ALEN];
 		} __packed tlv;
 	} dev_req = {
@@ -1153,6 +1153,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,
 		},
 	};
 	struct {
@@ -1175,12 +1176,13 @@ 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,
 		},
 	};
 	int err, idx, cmd, len;
 	void *data;
 
-	switch (vif->type) {
+	switch (bss_conf->vif->type) {
 	case NL80211_IFTYPE_MESH_POINT:
 	case NL80211_IFTYPE_MONITOR:
 	case NL80211_IFTYPE_AP:
@@ -1200,7 +1202,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
 	idx = mvif->omac_idx > EXT_BSSID_START ? HW_BSSID_0 : mvif->omac_idx;
 	basic_req.basic.hw_bss_idx = idx;
 
-	memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN);
+	memcpy(dev_req.tlv.omac_addr, bss_conf->vif->addr, ETH_ALEN);
 
 	cmd = enable ? MCU_UNI_CMD(DEV_INFO_UPDATE) : MCU_UNI_CMD(BSS_INFO_UPDATE);
 	data = enable ? (void *)&dev_req : (void *)&basic_req;
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index 4d83ec2a0f9a..e6e8824c828e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -1436,7 +1436,7 @@ struct mt76_connac_bss_basic_tlv {
 	__le16 sta_idx;
 	__le16 nonht_basic_phy;
 	u8 phymode_ext; /* bit(0) AX_6G */
-	u8 pad[1];
+	u8 link_idx;
 } __packed;
 
 struct mt76_connac_bss_qos_tlv {
@@ -1910,7 +1910,7 @@ void mt76_connac_mcu_sta_ba_tlv(struct sk_buff *skb,
 				struct ieee80211_ampdu_params *params,
 				bool enable, bool tx);
 int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy,
-				struct ieee80211_vif *vif,
+				struct ieee80211_bss_conf *bss_conf,
 				struct mt76_wcid *wcid,
 				bool enable);
 int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 5ea01c39e2e1..101cac747f9f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -646,7 +646,8 @@ mt7921_vif_connect_iter(void *priv, u8 *mac,
 	if (vif->type == NL80211_IFTYPE_STATION)
 		ieee80211_disconnect(vif, true);
 
-	mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true);
+	mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+				    &mvif->sta.deflink.wcid, true);
 	mt7921_mcu_set_tx(dev, vif);
 
 	if (vif->type == NL80211_IFTYPE_AP) {
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 89d47cce9e8b..c7e71043c257 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -306,8 +306,8 @@ mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 	mvif->bss_conf.mt76.band_idx = 0;
 	mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx % MT76_CONNAC_MAX_WMM_SETS;
 
-	ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid,
-					  true);
+	ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+					  &mvif->sta.deflink.wcid, true);
 	if (ret)
 		goto out;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
index 88e7b2ff4593..48425fc4e7fe 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
@@ -1243,7 +1243,8 @@ mt7925_vif_connect_iter(void *priv, u8 *mac,
 	if (vif->type == NL80211_IFTYPE_STATION)
 		ieee80211_disconnect(vif, true);
 
-	mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, true);
+	mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+				    &mvif->sta.deflink.wcid, true);
 	mt7925_mcu_set_tx(dev, vif);
 
 	if (vif->type == NL80211_IFTYPE_AP) {
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 397776ddf01a..b0c8b090d2ce 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -344,8 +344,8 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
 	else
 		mvif->bss_conf.mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL;
 
-	ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid,
-					  true);
+	ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+					  &mvif->sta.deflink.wcid, true);
 	if (ret)
 		goto out;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index a189ae38f2d0..222204916b73 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -124,7 +124,7 @@ void mt792x_remove_interface(struct ieee80211_hw *hw,
 
 	mt792x_mutex_acquire(dev);
 	mt76_connac_free_pending_tx_skbs(&dev->pm, &msta->deflink.wcid);
-	mt76_connac_mcu_uni_add_dev(&dev->mphy, vif, &mvif->sta.deflink.wcid, false);
+	mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf, &mvif->sta.deflink.wcid, false);
 
 	rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
 
-- 
2.34.1



  parent reply	other threads:[~2024-06-13  3:03 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  3:01 [PATCH 00/47] Prerequisite Refactoring for Enabling MLO on MT7925 sean.wang
2024-06-13  3:01 ` [PATCH 01/47] wifi: mt76: mt792x: add struct mt792x_bss_conf sean.wang
2024-06-13  3:01 ` [PATCH 02/47] wifi: mt76: mt792x: add struct mt792x_link_sta sean.wang
2024-06-13  3:01 ` [PATCH 03/47] wifi: mt76: mt792x: add struct mt792x_chanctx sean.wang
2024-06-13  3:01 ` [PATCH 04/47] wifi: mt76: mt7925: support for split bss_info_changed method sean.wang
2024-06-13  3:01 ` sean.wang [this message]
2024-06-13  3:02 ` [PATCH 06/47] wifi: mt76: mt7925: extend mt7925_mcu_set_tx with for per-link BSS sean.wang
2024-06-13  3:02 ` [PATCH 07/47] wifi: mt76: mt7925: extend mt7925_mcu_add_bss_info " sean.wang
2024-06-13  3:02 ` [PATCH 08/47] wifi: mt76: mt7925: extend mt7925_mcu_set_timing " sean.wang
2024-06-13  3:02 ` [PATCH 09/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_ifs_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 10/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_color_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 11/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_he_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 12/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_qos_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 13/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_mld_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 14/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_bmc_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 15/47] wifi: mt76: mt7925: remove unused parameters in mt7925_mcu_bss_bmc_tlv sean.wang
2024-06-13  3:02 ` [PATCH 16/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_sec_tlv for per-link BSS sean.wang
2024-06-13  3:02 ` [PATCH 17/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_basic_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 18/47] wifi: mt76: mt7925: extend mt7925_mcu_set_bss_pm " sean.wang
2024-06-13  3:02 ` [PATCH 19/47] wifi: mt76: mt7925: extend mt7925_mcu_[abort, set]_roc " sean.wang
2024-06-13  3:02 ` [PATCH 20/47] wifi: mt76: mt7925: extend mt7925_mcu_uni_bss_bcnft " sean.wang
2024-06-13  3:02 ` [PATCH 21/47] wifi: mt76: mt7925: extend mt7925_mcu_uni_bss_ps " sean.wang
2024-06-13  3:02 ` [PATCH 22/47] wifi: mt76: mt7925: add mt7925_mcu_bss_rlm_tlv to constitue the RLM TLV sean.wang
2024-06-13  3:02 ` [PATCH 23/47] wifi: mt76: mt7925: mt7925_mcu_set_chctx rely on mt7925_mcu_bss_rlm_tlv sean.wang
2024-06-13  3:02 ` [PATCH 24/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_update for per-link STA sean.wang
2024-06-13  3:02 ` [PATCH 25/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_state_v2_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 26/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_rate_ctrl_tlv with " sean.wang
2024-06-13  3:02 ` [PATCH 27/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_eht_tlv for " sean.wang
2024-06-13  3:02 ` [PATCH 28/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_he_6g_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 29/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_he_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 30/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_amsdu_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 31/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_vht_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 32/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_ht_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 33/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_phy_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 34/47] wifi: mt76: mt7925: extend mt7925_get_phy_mode_ext " sean.wang
2024-06-13  3:02 ` [PATCH 35/47] wifi: mt76: mt7925: extend mt7925_get_phy_mode " sean.wang
2024-06-13  3:02 ` [PATCH 36/47] wifi: mt76: mt792x: extend mt76_connac_get_phy_mode_v2 " sean.wang
2024-06-13  3:02 ` [PATCH 37/47] wifi: mt76: mt762x: extend mt76_connac_mcu_sta_basic_tlv " sean.wang
2024-06-24 17:44   ` Felix Fietkau
2024-06-24 19:03     ` Felix Fietkau
2024-06-25 20:10       ` Sean Wang
2024-06-13  3:02 ` [PATCH 38/47] wifi: mt76: mt7925: extend mt7925_mcu_sta_hdr_trans_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 39/47] wifi: mt76: mt7925: extend mt7925_mcu_add_bss_info " sean.wang
2024-06-13  3:02 ` [PATCH 40/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_mld_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 41/47] wifi: mt76: mt7925: extend mt7925_mcu_bss_basic_tlv " sean.wang
2024-06-13  3:02 ` [PATCH 42/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_add to create " sean.wang
2024-06-13  3:02 ` [PATCH 43/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_assoc to associate " sean.wang
2024-06-13  3:02 ` [PATCH 44/47] wifi: mt76: mt7925: add mt7925_mac_link_sta_remove to remove " sean.wang
2024-06-13  3:02 ` [PATCH 45/47] wifi: mt76: mt7925: add mt7925_mac_link_bss_add to create per-link BSS sean.wang
2024-06-13  3:02 ` [PATCH 46/47] wifi: mt76: mt7925: add mt7925_mac_link_bss_remove to remove " sean.wang
2024-06-13  3:02 ` [PATCH 47/47] wifi: mt76: mt7925: simpify mt7925_mcu_sta_cmd logic by removing fw_offload 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=20240613030241.5771-6-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.