* [PATCH 00/29] Enabling MT7925 MLO Mode Support
@ 2024-07-03 21:42 sean.wang
2024-07-03 21:42 ` [PATCH 01/29] wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO sean.wang
` (28 more replies)
0 siblings, 29 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek, Sean Wang
From: Sean Wang <sean.wang@kernel.org>
This patchset introduces comprehensive support for MLO (Multi-Link-
Operation) mode on the MT7925 Wi-Fi driver. It includes driver
modifications to ensure seamless operation specifically with MLO-enabled
firmware environments. The patches included are:
1) Enable the link handling in the existing neccessary functions
in the driver for MLO mode.
2) Add MCU TLV handling tailored for the MLO-enabled firmware.
3) Implement .change_vif_links and .change_sta_links callbacks for MLO
mode.
4) Register the MLO capability with mac80211 when the driver is operating
with the MLO-enabled firmware.
These changes maintain compatibility with non-MLO mode and the older
firmware versions.
Sean Wang (29):
wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO
wifi: mt76: mt7925: update mt7925_mac_link_sta_[add, remove] for MLO
wifi: mt76: mt7925: set Tx queue parameters according to link id
wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv according to link id
wifi: mt76: mt7925: add mt7925_set_link_key
wifi: mt76: mt7925: extend mt7925_mcu_uni_roc_event
wifi: mt76: mt7925: add mt7925_change_vif_links
wifi: mt76: mt7925: add mt7925_change_sta_links
wifi: mt76: mt7925: add link handling in mt7925_mac_sta_add
wifi: mt76: mt7925: add link handling in mt7925_mac_sta_remove
wifi: mt76: mt7925: add link handling to txwi
wifi: mt76: mt7925: add link handling in mt7925_set_key
wifi: mt76: mt7925: add link handling to mt7925_change_chanctx
wifi: mt76: mt7925: add link handling in the BSS_CHANGED_PS handler
wifi: mt76: mt7925: add link handling in mt7925_mcu_set_beacon_filter
wifi: mt76: mt7925: add link handling in mt7925_txwi_free
wifi: mt76: mt7925: add link handling in mt7925_mac_sta_assoc
wifi: mt76: mt7925: add link handling in mt7925_sta_set_decap_offload
wifi: mt76: mt7925: update rate index according to link id
wifi: mt76: mt7925: report link information in rx status
wifi: mt76: add def_wcid to struct mt76_wcid
wifi: mt76: mt7925: add mt7925_[assign,unassign]_vif_chanctx
wifi: mt76: mt7925: update mt7925_mcu_sta_mld_tlv for MLO
wifi: mt76: mt7925: update mt7925_mcu_bss_mld_tlv for MLO
wifi: mt76: mt7925: update mt7925_mcu_add_bss_info for MLO
wifi: mt76: mt7925: update mt7925_mcu_sta_update for MLO
wifi: mt76: mt7925: add mt7925_mcu_sta_eht_mld_tlv for MLO
wifi: mt76: mt7925: update mt7925_mcu_sta_rate_ctrl_tlv for MLO
wifi: mt76: mt7925: enabling MLO when the firmware supports it
drivers/net/wireless/mediatek/mt76/mac80211.c | 5 +
drivers/net/wireless/mediatek/mt76/mt76.h | 7 +
.../wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +-
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 11 +
.../net/wireless/mediatek/mt76/mt7925/init.c | 6 +
.../net/wireless/mediatek/mt76/mt7925/mac.c | 66 +-
.../net/wireless/mediatek/mt76/mt7925/main.c | 660 ++++++++++++++++--
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 397 +++++++++--
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 40 +-
.../wireless/mediatek/mt76/mt7925/mt7925.h | 13 +-
drivers/net/wireless/mediatek/mt76/mt792x.h | 26 +
.../net/wireless/mediatek/mt76/mt792x_core.c | 49 +-
12 files changed, 1134 insertions(+), 148 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 01/29] wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 02/29] wifi: mt76: mt7925: update mt7925_mac_link_sta_[add, remove] " sean.wang
` (27 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Set OMAC address with the per-link BSS. The change remains compatible with
the non-MLO mode and the older firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
index 4e3c8af98fe7..4dce03ddbfa4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c
@@ -1214,7 +1214,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, bss_conf->vif->addr, ETH_ALEN);
+ memcpy(dev_req.tlv.omac_addr, bss_conf->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;
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 02/29] wifi: mt76: mt7925: update mt7925_mac_link_sta_[add, remove] for MLO
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
2024-07-03 21:42 ` [PATCH 01/29] wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 03/29] wifi: mt76: mt7925: set Tx queue parameters according to link id sean.wang
` (26 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
[add, remove] the per-link STA from the corresponding to per-link BSS with
the same link id. The change remains compatible with the non-MLO mode.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 24 ++++++++++++-------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 8b10b63bc98d..1c8a44789e51 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -728,12 +728,13 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct ieee80211_bss_conf *link_conf;
+ u8 link_id = link_sta->link_id;
struct mt792x_link_sta *mlink;
struct mt792x_sta *msta;
int ret, idx;
msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
- mlink = mt792x_sta_to_link(msta, link_sta->link_id);
+ mlink = mt792x_sta_to_link(msta, link_id);
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1);
if (idx < 0)
@@ -753,12 +754,16 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,
mt7925_mac_wtbl_update(dev, idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
- link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id);
+ link_conf = mt792x_vif_to_bss_conf(vif, link_id);
/* should update bss info before STA add */
- if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls)
- mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx,
+ if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) {
+ struct mt792x_bss_conf *mconf;
+
+ mconf = mt792x_vif_to_link(mvif, link_id);
+ mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx,
link_conf, link_sta, false);
+ }
ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
MT76_STA_INFO_STATE_NONE);
@@ -830,11 +835,12 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
{
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
struct ieee80211_bss_conf *link_conf;
+ u8 link_id = link_sta->link_id;
struct mt792x_link_sta *mlink;
struct mt792x_sta *msta;
msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
- mlink = mt792x_sta_to_link(msta, link_sta->link_id);
+ mlink = mt792x_sta_to_link(msta, link_id);
mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid);
mt76_connac_pm_wake(&dev->mphy, &dev->pm);
@@ -844,12 +850,14 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
mt7925_mac_wtbl_update(dev, mlink->wcid.idx,
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
- link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id);
+ link_conf = mt792x_vif_to_bss_conf(vif, link_id);
if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- mt7925_mcu_add_bss_info(&dev->phy,
- mvif->bss_conf.mt76.ctx, link_conf,
+ struct mt792x_bss_conf *mconf;
+
+ mconf = mt792x_vif_to_link(mvif, link_id);
+ mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf,
link_sta, false);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 03/29] wifi: mt76: mt7925: set Tx queue parameters according to link id
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
2024-07-03 21:42 ` [PATCH 01/29] wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO sean.wang
2024-07-03 21:42 ` [PATCH 02/29] wifi: mt76: mt7925: update mt7925_mac_link_sta_[add, remove] " sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 04/29] wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv " sean.wang
` (25 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Configure TX queue parameters according to link id.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 1c8a44789e51..4e5868cd2a97 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1306,6 +1306,7 @@ mt7925_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
const struct ieee80211_tx_queue_params *params)
{
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, link_id);
static const u8 mq_to_aci[] = {
[IEEE80211_AC_VO] = 3,
[IEEE80211_AC_VI] = 2,
@@ -1314,7 +1315,7 @@ mt7925_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
};
/* firmware uses access class index */
- mvif->bss_conf.queue_params[mq_to_aci[queue]] = *params;
+ mconf->queue_params[mq_to_aci[queue]] = *params;
return 0;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 04/29] wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv according to link id
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (2 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 03/29] wifi: mt76: mt7925: set Tx queue parameters according to link id sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 05/29] wifi: mt76: mt7925: add mt7925_set_link_key sean.wang
` (24 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
configure mt7925_mcu_sta_key_tlv according to link id
We created a link id field in the common structure mt76_wcid so that
mt7925_mcu_sta_key_tlv can access per-link STA/BSS. Additionally,
.link_id will be required when reporting the link information of Rx status
to mac80211. We will submit the changes for reporting the Rx status in
a separate patch.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt76.h | 1 +
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 1 +
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 15 +++++++++++----
drivers/net/wireless/mediatek/mt76/mt792x.h | 11 +++++++++++
4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 11b9f22ca7f3..01646538087a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -349,6 +349,7 @@ struct mt76_wcid {
u8 sta:1;
u8 amsdu:1;
u8 phy_idx:2;
+ u8 link_id:4;
u8 rx_check_pn;
u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6];
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 4e5868cd2a97..0b486afe9352 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -746,6 +746,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,
mlink->wcid.phy_idx = mvif->bss_conf.mt76.band_idx;
mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET;
mlink->last_txs = jiffies;
+ mlink->wcid.link_id = link_sta->link_id;
ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm);
if (ret)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index a67d8dd6075f..ba91c8e37dff 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -967,6 +967,7 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid,
struct mt792x_sta *msta = container_of(mlink, struct mt792x_sta, deflink);
struct sta_rec_sec_uni *sec;
struct mt792x_vif *mvif = msta->vif;
+ struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, wcid->link_id);
struct ieee80211_sta *sta;
struct ieee80211_vif *vif;
struct tlv *tlv;
@@ -978,17 +979,23 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid,
tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_KEY_V3, sizeof(*sec));
sec = (struct sta_rec_sec_uni *)tlv;
- sec->bss_idx = mvif->bss_conf.mt76.idx;
+ sec->bss_idx = mconf->mt76.idx;
sec->is_authenticator = 0;
- sec->mgmt_prot = 0;
+ sec->mgmt_prot = 1; /* only used in MLO mode */
sec->wlan_idx = (u8)wcid->idx;
if (sta) {
+ struct ieee80211_link_sta *link_sta;
+
sec->tx_key = 1;
sec->key_type = 1;
- memcpy(sec->peer_addr, sta->addr, ETH_ALEN);
+ link_sta = mt792x_sta_to_link_sta(vif, sta, wcid->link_id);
+ memcpy(sec->peer_addr, link_sta->addr, ETH_ALEN);
} else {
- memcpy(sec->peer_addr, vif->bss_conf.bssid, ETH_ALEN);
+ struct ieee80211_bss_conf *link_conf;
+
+ link_conf = mt792x_vif_to_bss_conf(vif, wcid->link_id);
+ memcpy(sec->peer_addr, link_conf->bssid, ETH_ALEN);
}
if (cmd == SET_KEY) {
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index 69eb8dac0b70..fe5a6c932705 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -273,6 +273,17 @@ mt792x_vif_to_bss_conf(struct ieee80211_vif *vif, unsigned int link_id)
return link_conf_dereference_protected(vif, link_id);
}
+static inline struct ieee80211_link_sta *
+mt792x_sta_to_link_sta(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
+ unsigned int link_id)
+{
+ if (!ieee80211_vif_is_mld(vif) ||
+ link_id >= IEEE80211_LINK_UNSPECIFIED)
+ return &sta->deflink;
+
+ return link_sta_dereference_protected(sta, link_id);
+}
+
static inline struct mt792x_dev *
mt792x_hw_dev(struct ieee80211_hw *hw)
{
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 05/29] wifi: mt76: mt7925: add mt7925_set_link_key
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (3 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 04/29] wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv " sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 06/29] wifi: mt76: mt7925: extend mt7925_mcu_uni_roc_event sean.wang
` (23 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add mt7925_set_link_key to set up the key according to the link id
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 66 ++++++++++++-------
1 file changed, 42 insertions(+), 24 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 0b486afe9352..264517fd3bf7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -499,31 +499,28 @@ static int mt7925_cancel_remain_on_channel(struct ieee80211_hw *hw,
return mt7925_abort_roc(phy, &mvif->bss_conf);
}
-static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
- struct ieee80211_vif *vif, struct ieee80211_sta *sta,
- struct ieee80211_key_conf *key)
+static int mt7925_set_link_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+ struct ieee80211_vif *vif, struct ieee80211_sta *sta,
+ struct ieee80211_key_conf *key, int link_id)
{
struct mt792x_dev *dev = mt792x_hw_dev(hw);
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv :
&mvif->sta;
- struct ieee80211_link_sta *link_sta = sta ? &sta->deflink : NULL;
- struct mt76_wcid *wcid = &msta->deflink.wcid;
struct ieee80211_bss_conf *link_conf;
- u8 *wcid_keyidx = &wcid->hw_key_idx;
+ struct ieee80211_link_sta *link_sta;
int idx = key->keyidx, err = 0;
+ struct mt792x_link_sta *mlink;
+ struct mt792x_bss_conf *mconf;
+ struct mt76_wcid *wcid;
+ u8 *wcid_keyidx;
- link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id);
-
- /* The hardware does not support per-STA RX GTK, fallback
- * to software mode for these.
- */
- if ((vif->type == NL80211_IFTYPE_ADHOC ||
- vif->type == NL80211_IFTYPE_MESH_POINT) &&
- (key->cipher == WLAN_CIPHER_SUITE_TKIP ||
- key->cipher == WLAN_CIPHER_SUITE_CCMP) &&
- !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
- return -EOPNOTSUPP;
+ link_conf = mt792x_vif_to_bss_conf(vif, link_id);
+ link_sta = sta ? mt792x_sta_to_link_sta(vif, sta, link_id) : NULL;
+ mconf = mt792x_vif_to_link(mvif, link_id);
+ mlink = mt792x_sta_to_link(msta, link_id);
+ wcid = &mlink->wcid;
+ wcid_keyidx = &wcid->hw_key_idx;
/* fall back to sw encryption for unsupported ciphers */
switch (key->cipher) {
@@ -547,12 +544,10 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
return -EOPNOTSUPP;
}
- mt792x_mutex_acquire(dev);
-
- if (cmd == SET_KEY && !mvif->bss_conf.mt76.cipher) {
+ if (cmd == SET_KEY && !mconf->mt76.cipher) {
struct mt792x_phy *phy = mt792x_hw_phy(hw);
- mvif->bss_conf.mt76.cipher = mt7925_mcu_get_cipher(key->cipher);
+ mconf->mt76.cipher = mt7925_mcu_get_cipher(key->cipher);
mt7925_mcu_add_bss_info(phy, mvif->bss_conf.mt76.ctx, link_conf,
link_sta, true);
}
@@ -567,9 +562,9 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
mt76_wcid_key_setup(&dev->mt76, wcid,
cmd == SET_KEY ? key : NULL);
- err = mt7925_mcu_add_key(&dev->mt76, vif, &msta->deflink.bip,
+ err = mt7925_mcu_add_key(&dev->mt76, vif, &mlink->bip,
key, MCU_UNI_CMD(STA_REC_UPDATE),
- &msta->deflink.wcid, cmd);
+ &mlink->wcid, cmd);
if (err)
goto out;
@@ -579,8 +574,31 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
err = mt7925_mcu_add_key(&dev->mt76, vif, &mvif->wep_sta->deflink.bip,
key, MCU_WMWA_UNI_CMD(STA_REC_UPDATE),
&mvif->wep_sta->deflink.wcid, cmd);
-
out:
+ return err;
+}
+
+static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
+ struct ieee80211_vif *vif, struct ieee80211_sta *sta,
+ struct ieee80211_key_conf *key)
+{
+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ int err;
+
+ /* The hardware does not support per-STA RX GTK, fallback
+ * to software mode for these.
+ */
+ if ((vif->type == NL80211_IFTYPE_ADHOC ||
+ vif->type == NL80211_IFTYPE_MESH_POINT) &&
+ (key->cipher == WLAN_CIPHER_SUITE_TKIP ||
+ key->cipher == WLAN_CIPHER_SUITE_CCMP) &&
+ !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE))
+ return -EOPNOTSUPP;
+
+ mt792x_mutex_acquire(dev);
+
+ err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id);
+
mt792x_mutex_release(dev);
return err;
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 06/29] wifi: mt76: mt7925: extend mt7925_mcu_uni_roc_event
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (4 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 05/29] wifi: mt76: mt7925: add mt7925_set_link_key sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 07/29] wifi: mt76: mt7925: add mt7925_change_vif_links sean.wang
` (22 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
We extended the function to be able multiple pieces of information
in a single event, supporting the future MLO-enabled firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 31 ++++++++++++++++---
.../wireless/mediatek/mt76/mt7925/mt7925.h | 1 +
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index ba91c8e37dff..5693c21bfb4a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -313,16 +313,14 @@ mt7925_mcu_roc_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
mvif->band_idx = grant->dbdcband;
}
-static void
-mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb)
+static void mt7925_mcu_roc_handle_grant(struct mt792x_dev *dev,
+ struct tlv *tlv)
{
struct ieee80211_hw *hw = dev->mt76.hw;
struct mt7925_roc_grant_tlv *grant;
- struct mt7925_mcu_rxd *rxd;
int duration;
- rxd = (struct mt7925_mcu_rxd *)skb->data;
- grant = (struct mt7925_roc_grant_tlv *)(rxd->tlv + 4);
+ grant = (struct mt7925_roc_grant_tlv *)tlv;
/* should never happen */
WARN_ON_ONCE((le16_to_cpu(grant->tag) != UNI_EVENT_ROC_GRANT));
@@ -340,6 +338,29 @@ mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb)
jiffies + msecs_to_jiffies(duration));
}
+static void
+mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb)
+{
+ struct tlv *tlv;
+ int i = 0;
+
+ skb_pull(skb, sizeof(struct mt7925_mcu_rxd) + 4);
+
+ while (i < skb->len) {
+ tlv = (struct tlv *)(skb->data + i);
+
+ switch (le16_to_cpu(tlv->tag)) {
+ case UNI_EVENT_ROC_GRANT:
+ mt7925_mcu_roc_handle_grant(dev, tlv);
+ break;
+ case UNI_EVENT_ROC_GRANT_SUB_LINK:
+ break;
+ }
+
+ i += tlv->len;
+ }
+}
+
static void
mt7925_mcu_scan_event(struct mt792x_dev *dev, struct sk_buff *skb)
{
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
index 8ec5a3a20202..2de1e38689e7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
@@ -41,6 +41,7 @@ enum mt7925_roc_req {
enum {
UNI_EVENT_ROC_GRANT = 0,
+ UNI_EVENT_ROC_GRANT_SUB_LINK = 4,
UNI_EVENT_ROC_TAG_NUM
};
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 07/29] wifi: mt76: mt7925: add mt7925_change_vif_links
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (5 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 06/29] wifi: mt76: mt7925: extend mt7925_mcu_uni_roc_event sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 08/29] wifi: mt76: mt7925: add mt7925_change_sta_links sean.wang
` (21 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Add mt7925_change_vif_links to change the valid links on an interface,
supporting the MLO-enabled firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 130 ++++++++++++++++++
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 117 +++++++++++++---
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 20 +++
.../wireless/mediatek/mt76/mt7925/mt7925.h | 6 +
drivers/net/wireless/mediatek/mt76/mt792x.h | 5 +
.../net/wireless/mediatek/mt76/mt792x_core.c | 23 +++-
6 files changed, 275 insertions(+), 26 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 264517fd3bf7..c9119a222427 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -472,6 +472,33 @@ static int mt7925_set_roc(struct mt792x_phy *phy,
return err;
}
+static int mt7925_set_mlo_roc(struct mt792x_phy *phy,
+ struct mt792x_bss_conf *mconf,
+ u16 sel_links)
+{
+ int err;
+
+ if (WARN_ON_ONCE(test_and_set_bit(MT76_STATE_ROC, &phy->mt76->state)))
+ return -EBUSY;
+
+ phy->roc_grant = false;
+
+ err = mt7925_mcu_set_mlo_roc(mconf, sel_links, 5, ++phy->roc_token_id);
+ if (err < 0) {
+ clear_bit(MT76_STATE_ROC, &phy->mt76->state);
+ goto out;
+ }
+
+ if (!wait_event_timeout(phy->roc_wait, phy->roc_grant, 4 * HZ)) {
+ mt7925_mcu_abort_roc(phy, mconf, phy->roc_token_id);
+ clear_bit(MT76_STATE_ROC, &phy->mt76->state);
+ err = -ETIMEDOUT;
+ }
+
+out:
+ return err;
+}
+
static int mt7925_remain_on_channel(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_channel *chan,
@@ -1521,6 +1548,108 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw,
mt792x_mutex_release(dev);
}
+static int
+mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ u16 old_links, u16 new_links,
+ struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS])
+{
+ struct mt792x_bss_conf *mconfs[IEEE80211_MLD_MAX_NUM_LINKS] = {}, *mconf;
+ struct mt792x_link_sta *mlinks[IEEE80211_MLD_MAX_NUM_LINKS] = {}, *mlink;
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ unsigned long add = new_links & ~old_links;
+ unsigned long rem = old_links & ~new_links;
+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ struct mt792x_phy *phy = mt792x_hw_phy(hw);
+ struct ieee80211_bss_conf *link_conf;
+ unsigned int link_id;
+ int err;
+
+ if (old_links == new_links)
+ return 0;
+
+ mt792x_mutex_acquire(dev);
+
+ for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) {
+ mconf = mt792x_vif_to_link(mvif, link_id);
+ mlink = mt792x_sta_to_link(&mvif->sta, link_id);
+
+ if (!mconf || !mlink)
+ continue;
+
+ if (mconf != &mvif->bss_conf) {
+ mt792x_mac_link_bss_remove(dev, mconf, mlink);
+ devm_kfree(dev->mt76.dev, mconf);
+ devm_kfree(dev->mt76.dev, mlink);
+ }
+
+ rcu_assign_pointer(mvif->link_conf[link_id], NULL);
+ rcu_assign_pointer(mvif->sta.link[link_id], NULL);
+ }
+
+ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
+ if (!old_links) {
+ mconf = &mvif->bss_conf;
+ mlink = &mvif->sta.deflink;
+ } else {
+ mconf = devm_kzalloc(dev->mt76.dev, sizeof(*mconf),
+ GFP_KERNEL);
+ mlink = devm_kzalloc(dev->mt76.dev, sizeof(*mlink),
+ GFP_KERNEL);
+ }
+
+ mconfs[link_id] = mconf;
+ mlinks[link_id] = mlink;
+ mconf->link_id = link_id;
+ mconf->vif = mvif;
+ mlink->wcid.link_id = link_id;
+ }
+
+ if (hweight16(mvif->valid_links) == 0)
+ mt792x_mac_link_bss_remove(dev, &mvif->bss_conf,
+ &mvif->sta.deflink);
+
+ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
+ mconf = mconfs[link_id];
+ mlink = mlinks[link_id];
+ link_conf = mt792x_vif_to_bss_conf(vif, link_id);
+
+ rcu_assign_pointer(mvif->link_conf[link_id], mconf);
+ rcu_assign_pointer(mvif->sta.link[link_id], mlink);
+
+ err = mt7925_mac_link_bss_add(dev, link_conf, mlink);
+ if (err < 0)
+ goto free;
+
+ if (mconf != &mvif->bss_conf) {
+ err = mt7925_set_mlo_roc(phy, &mvif->bss_conf,
+ vif->active_links);
+ if (err < 0)
+ goto free;
+ }
+ }
+
+ mvif->valid_links = new_links;
+
+ mt792x_mutex_release(dev);
+
+ return 0;
+
+free:
+ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
+ rcu_assign_pointer(mvif->link_conf[link_id], NULL);
+ rcu_assign_pointer(mvif->sta.link[link_id], NULL);
+
+ if (mconf != &mvif->bss_conf)
+ devm_kfree(dev->mt76.dev, mconfs[link_id]);
+ if (mlink != &mvif->sta.deflink)
+ devm_kfree(dev->mt76.dev, mlinks[link_id]);
+ }
+
+ mt792x_mutex_release(dev);
+
+ return err;
+}
+
const struct ieee80211_ops mt7925_ops = {
.tx = mt792x_tx,
.start = mt7925_start,
@@ -1579,6 +1708,7 @@ const struct ieee80211_ops mt7925_ops = {
.mgd_complete_tx = mt7925_mgd_complete_tx,
.vif_cfg_changed = mt7925_vif_cfg_changed,
.link_info_changed = mt7925_link_info_changed,
+ .change_vif_links = mt7925_change_vif_links,
};
EXPORT_SYMBOL_GPL(mt7925_ops);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 5693c21bfb4a..b62153671350 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -307,6 +307,9 @@ mt7925_mcu_roc_iter(void *priv, u8 *mac, struct ieee80211_vif *vif)
struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
struct mt7925_roc_grant_tlv *grant = priv;
+ if (ieee80211_vif_is_mld(vif) && vif->type == NL80211_IFTYPE_STATION)
+ return;
+
if (mvif->idx != grant->bss_idx)
return;
@@ -1079,6 +1082,100 @@ int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
return mt76_mcu_skb_send_msg(dev, skb, mcu_cmd, true);
}
+int mt7925_mcu_set_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links,
+ int duration, u8 token_id)
+{
+ struct mt792x_vif *mvif = mconf->vif;
+ struct ieee80211_vif *vif = container_of((void *)mvif,
+ struct ieee80211_vif, drv_priv);
+ struct ieee80211_bss_conf *link_conf;
+ struct ieee80211_channel *chan;
+ const u8 ch_band[] = {
+ [NL80211_BAND_2GHZ] = 1,
+ [NL80211_BAND_5GHZ] = 2,
+ [NL80211_BAND_6GHZ] = 3,
+ };
+ enum mt7925_roc_req type;
+ int center_ch, i = 0;
+ bool is_AG_band = false;
+ struct {
+ u8 id;
+ u8 bss_idx;
+ u16 tag;
+ struct mt792x_bss_conf *mconf;
+ struct ieee80211_channel *chan;
+ } links[2];
+
+ struct {
+ struct {
+ u8 rsv[4];
+ } __packed hdr;
+ struct roc_acquire_tlv roc[2];
+ } __packed req;
+
+ if (!mconf || hweight16(vif->valid_links) < 2 ||
+ hweight16(sel_links) != 2)
+ return -EPERM;
+
+ for (i = 0; i < ARRAY_SIZE(links); i++) {
+ links[i].id = i ? __ffs(~BIT(mconf->link_id) & sel_links) :
+ mconf->link_id;
+ link_conf = mt792x_vif_to_bss_conf(vif, links[i].id);
+ if (WARN_ON_ONCE(!link_conf))
+ return -EPERM;
+
+ links[i].chan = link_conf->chanreq.oper.chan;
+ if (WARN_ON_ONCE(!links[i].chan))
+ return -EPERM;
+
+ links[i].mconf = mt792x_vif_to_link(mvif, links[i].id);
+ links[i].tag = links[i].id == mconf->link_id ?
+ UNI_ROC_ACQUIRE : UNI_ROC_SUB_LINK;
+
+ is_AG_band |= links[i].chan->band == NL80211_BAND_2GHZ;
+ }
+
+ if (vif->cfg.eml_cap & IEEE80211_EML_CAP_EMLSR_SUPP)
+ type = is_AG_band ? MT7925_ROC_REQ_MLSR_AG :
+ MT7925_ROC_REQ_MLSR_AA;
+ else
+ type = MT7925_ROC_REQ_JOIN;
+
+ for (i = 0; i < ARRAY_SIZE(links) && i < hweight16(vif->active_links); i++) {
+ if (WARN_ON_ONCE(!links[i].mconf || !links[i].chan))
+ continue;
+
+ chan = links[i].chan;
+ center_ch = ieee80211_frequency_to_channel(chan->center_freq);
+ req.roc[i].len = cpu_to_le16(sizeof(struct roc_acquire_tlv));
+ req.roc[i].tag = cpu_to_le16(links[i].tag);
+ req.roc[i].tokenid = token_id;
+ req.roc[i].reqtype = type;
+ req.roc[i].maxinterval = cpu_to_le32(duration);
+ req.roc[i].bss_idx = links[i].mconf->mt76.idx;
+ req.roc[i].control_channel = chan->hw_value;
+ req.roc[i].bw = CMD_CBW_20MHZ;
+ req.roc[i].bw_from_ap = CMD_CBW_20MHZ;
+ req.roc[i].center_chan = center_ch;
+ req.roc[i].center_chan_from_ap = center_ch;
+
+ /* STR : 0xfe indicates BAND_ALL with enabling DBDC
+ * EMLSR : 0xff indicates (BAND_AUTO) without DBDC
+ */
+ req.roc[i].dbdcband = type == MT7925_ROC_REQ_JOIN ? 0xfe : 0xff;
+
+ if (chan->hw_value < center_ch)
+ req.roc[i].sco = 1; /* SCA */
+ else if (chan->hw_value > center_ch)
+ req.roc[i].sco = 3; /* SCB */
+
+ req.roc[i].band = ch_band[chan->band];
+ }
+
+ return mt76_mcu_send_msg(&mvif->phy->dev->mt76, MCU_UNI_CMD(ROC),
+ &req, sizeof(req), false);
+}
+
int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
struct ieee80211_channel *chan, int duration,
enum mt7925_roc_req type, u8 token_id)
@@ -1089,25 +1186,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
struct {
u8 rsv[4];
} __packed hdr;
- struct roc_acquire_tlv {
- __le16 tag;
- __le16 len;
- u8 bss_idx;
- u8 tokenid;
- u8 control_channel;
- u8 sco;
- u8 band;
- u8 bw;
- u8 center_chan;
- u8 center_chan2;
- u8 bw_from_ap;
- u8 center_chan_from_ap;
- u8 center_chan2_from_ap;
- u8 reqtype;
- __le32 maxinterval;
- u8 dbdcband;
- u8 rsv[3];
- } __packed roc;
+ struct roc_acquire_tlv roc;
} __packed req = {
.roc = {
.tag = cpu_to_le16(UNI_ROC_ACQUIRE),
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index da4e84f468d2..fefb6ab384bb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -554,6 +554,26 @@ struct mt7925_wow_pattern_tlv {
u8 rsv[7];
} __packed;
+struct roc_acquire_tlv {
+ __le16 tag;
+ __le16 len;
+ u8 bss_idx;
+ u8 tokenid;
+ u8 control_channel;
+ u8 sco;
+ u8 band;
+ u8 bw;
+ u8 center_chan;
+ u8 center_chan2;
+ u8 bw_from_ap;
+ u8 center_chan_from_ap;
+ u8 center_chan2_from_ap;
+ u8 reqtype;
+ __le32 maxinterval;
+ u8 dbdcband;
+ u8 rsv[3];
+} __packed;
+
static inline enum connac3_mcu_cipher_type
mt7925_mcu_get_cipher(int cipher)
{
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
index 2de1e38689e7..54693624b182 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
@@ -30,12 +30,16 @@
enum {
UNI_ROC_ACQUIRE,
UNI_ROC_ABORT,
+ UNI_ROC_SUB_LINK = 3,
UNI_ROC_NUM
};
enum mt7925_roc_req {
MT7925_ROC_REQ_JOIN,
MT7925_ROC_REQ_ROC,
+ MT7925_ROC_REQ_SUB_LINK,
+ MT7925_ROC_REQ_MLSR_AG = 10,
+ MT7925_ROC_REQ_MLSR_AA,
MT7925_ROC_REQ_NUM
};
@@ -295,6 +299,8 @@ int mt7925_set_tx_sar_pwr(struct ieee80211_hw *hw,
int mt7925_mcu_regval(struct mt792x_dev *dev, u32 regidx, u32 *val, bool set);
int mt7925_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
enum environment_cap env_cap);
+int mt7925_mcu_set_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links,
+ int duration, u8 token_id);
int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
struct ieee80211_channel *chan, int duration,
enum mt7925_roc_req type, u8 token_id);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index fe5a6c932705..9a7443a8a951 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -112,6 +112,7 @@ struct mt792x_bss_conf {
struct mt792x_vif *vif;
struct ewma_rssi rssi;
struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];
+ unsigned int link_id;
};
struct mt792x_vif {
@@ -122,6 +123,7 @@ struct mt792x_vif {
struct mt792x_sta *wep_sta;
struct mt792x_phy *phy;
+ u16 valid_links;
};
struct mt792x_phy {
@@ -398,6 +400,9 @@ mt792x_get_mac80211_ops(struct device *dev,
int mt792x_init_wcid(struct mt792x_dev *dev);
int mt792x_mcu_drv_pmctrl(struct mt792x_dev *dev);
int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev);
+void mt792x_mac_link_bss_remove(struct mt792x_dev *dev,
+ struct mt792x_bss_conf *mconf,
+ struct mt792x_link_sta *mlink);
static inline char *mt792x_ram_name(struct mt792x_dev *dev)
{
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index 813296fad0ed..62f471b5498f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -113,14 +113,17 @@ void mt792x_stop(struct ieee80211_hw *hw, bool suspend)
}
EXPORT_SYMBOL_GPL(mt792x_stop);
-static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev,
- struct ieee80211_bss_conf *link_conf,
- struct mt792x_link_sta *mlink)
+void mt792x_mac_link_bss_remove(struct mt792x_dev *dev,
+ struct mt792x_bss_conf *mconf,
+ struct mt792x_link_sta *mlink)
{
- struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf);
+ struct ieee80211_vif *vif = container_of((void *)mconf->vif,
+ struct ieee80211_vif, drv_priv);
+ struct ieee80211_bss_conf *link_conf;
int idx = mlink->wcid.idx;
- mt792x_mutex_acquire(dev);
+ link_conf = mt792x_vif_to_bss_conf(vif, mconf->link_id);
+
mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid);
mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, &mlink->wcid, false);
@@ -128,7 +131,6 @@ static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev,
dev->mt76.vif_mask &= ~BIT_ULL(mconf->mt76.idx);
mconf->vif->phy->omac_mask &= ~BIT_ULL(mconf->mt76.omac_idx);
- mt792x_mutex_release(dev);
spin_lock_bh(&dev->mt76.sta_poll_lock);
if (!list_empty(&mlink->wcid.poll_list))
@@ -137,14 +139,21 @@ static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev,
mt76_wcid_cleanup(&dev->mt76, &mlink->wcid);
}
+EXPORT_SYMBOL_GPL(mt792x_mac_link_bss_remove);
void mt792x_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ struct mt792x_bss_conf *mconf;
- mt792x_mac_link_bss_remove(dev, &vif->bss_conf, &mvif->sta.deflink);
+ mt792x_mutex_acquire(dev);
+
+ mconf = mt792x_link_conf_to_mconf(&vif->bss_conf);
+ mt792x_mac_link_bss_remove(dev, mconf, &mvif->sta.deflink);
+
+ mt792x_mutex_release(dev);
}
EXPORT_SYMBOL_GPL(mt792x_remove_interface);
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 08/29] wifi: mt76: mt7925: add mt7925_change_sta_links
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (6 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 07/29] wifi: mt76: mt7925: add mt7925_change_vif_links sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 09/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_add sean.wang
` (20 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add mt7925_change_sta_links to change the valid links of a station,
supporting the MLO-enabled firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 142 +++++++++++++++++-
drivers/net/wireless/mediatek/mt76/mt792x.h | 7 +
2 files changed, 145 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index c9119a222427..0e554b21692e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -811,16 +811,79 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,
link_conf, link_sta, false);
}
- ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
- MT76_STA_INFO_STATE_NONE);
- if (ret)
- return ret;
+ if (ieee80211_vif_is_mld(vif) &&
+ link_sta == mlink->pri_link) {
+ ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
+ MT76_STA_INFO_STATE_NONE);
+ if (ret)
+ return ret;
+ } else if (ieee80211_vif_is_mld(vif) &&
+ link_sta != mlink->pri_link) {
+ ret = mt7925_mcu_sta_update(dev, mlink->pri_link, vif,
+ true, MT76_STA_INFO_STATE_ASSOC);
+ if (ret)
+ return ret;
+
+ ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
+ MT76_STA_INFO_STATE_ASSOC);
+ if (ret)
+ return ret;
+ } else {
+ ret = mt7925_mcu_sta_update(dev, link_sta, vif, true,
+ MT76_STA_INFO_STATE_NONE);
+ if (ret)
+ return ret;
+ }
mt76_connac_power_save_sched(&dev->mphy, &dev->pm);
return 0;
}
+static int
+mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, unsigned long new_links)
+{
+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
+ struct mt76_wcid *wcid;
+ unsigned int link_id;
+ int err = 0;
+
+ for_each_set_bit(link_id, &new_links, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct ieee80211_link_sta *link_sta;
+ struct mt792x_link_sta *mlink;
+
+ if (msta->deflink_id == IEEE80211_LINK_UNSPECIFIED) {
+ mlink = &msta->deflink;
+ msta->deflink_id = link_id;
+ } else {
+ mlink = devm_kzalloc(dev->mt76.dev, sizeof(*mlink), GFP_KERNEL);
+ if (!mlink) {
+ err = -ENOMEM;
+ break;
+ }
+
+ wcid = &mlink->wcid;
+ ewma_signal_init(&wcid->rssi);
+ rcu_assign_pointer(dev->mt76.wcid[wcid->idx], wcid);
+ mt76_wcid_init(wcid);
+ ewma_avg_signal_init(&mlink->avg_ack_signal);
+ memset(mlink->airtime_ac, 0,
+ sizeof(msta->deflink.airtime_ac));
+ }
+
+ msta->valid_links |= BIT(link_id);
+ rcu_assign_pointer(msta->link[link_id], mlink);
+ mlink->sta = msta;
+ mlink->pri_link = &sta->deflink;
+
+ link_sta = mt792x_sta_to_link_sta(vif, sta, link_id);
+ mt7925_mac_link_sta_add(&dev->mt76, vif, link_sta);
+ }
+
+ return err;
+}
+
int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
@@ -915,6 +978,48 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
mt76_connac_power_save_sched(&dev->mphy, &dev->pm);
}
+static int
+mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, unsigned long old_links)
+{
+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
+ struct mt76_dev *mdev = &dev->mt76;
+ struct mt76_wcid *wcid;
+ unsigned int link_id;
+
+ for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct ieee80211_link_sta *link_sta;
+ 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;
+
+ mt7925_mac_link_sta_remove(&dev->mt76, vif, link_sta);
+
+ wcid = &mlink->wcid;
+ rcu_assign_pointer(msta->link[link_id], NULL);
+ msta->valid_links &= ~BIT(link_id);
+ mlink->sta = NULL;
+ mlink->pri_link = NULL;
+
+ if (link_sta != mlink->pri_link) {
+ mt76_wcid_cleanup(mdev, wcid);
+ mt76_wcid_mask_clear(mdev->wcid_mask, wcid->idx);
+ mt76_wcid_mask_clear(mdev->wcid_phy_mask, wcid->idx);
+ }
+
+ if (msta->deflink_id == link_id)
+ msta->deflink_id = IEEE80211_LINK_UNSPECIFIED;
+ }
+
+ return 0;
+}
+
void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
@@ -1650,6 +1755,34 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return err;
}
+static int
+mt7925_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta, u16 old_links, u16 new_links)
+{
+ unsigned long add = new_links & ~old_links;
+ unsigned long rem = old_links & ~new_links;
+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ int err = 0;
+
+ if (old_links == new_links)
+ return 0;
+
+ mt792x_mutex_acquire(dev);
+
+ err = mt7925_mac_sta_remove_links(dev, vif, sta, rem);
+ if (err < 0)
+ goto out;
+
+ err = mt7925_mac_sta_add_links(dev, vif, sta, add);
+ if (err < 0)
+ goto out;
+
+out:
+ mt792x_mutex_release(dev);
+
+ return err;
+}
+
const struct ieee80211_ops mt7925_ops = {
.tx = mt792x_tx,
.start = mt7925_start,
@@ -1709,6 +1842,7 @@ const struct ieee80211_ops mt7925_ops = {
.vif_cfg_changed = mt7925_vif_cfg_changed,
.link_info_changed = mt7925_link_info_changed,
.change_vif_links = mt7925_change_vif_links,
+ .change_sta_links = mt7925_change_sta_links,
};
EXPORT_SYMBOL_GPL(mt7925_ops);
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index 9a7443a8a951..af9a103dc7f4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -92,6 +92,10 @@ struct mt792x_link_sta {
unsigned long last_txs;
struct mt76_connac_sta_key_conf bip;
+
+ struct mt792x_sta *sta;
+
+ struct ieee80211_link_sta *pri_link;
};
struct mt792x_sta {
@@ -99,6 +103,9 @@ struct mt792x_sta {
struct mt792x_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
struct mt792x_vif *vif;
+
+ u16 valid_links;
+ u8 deflink_id;
};
DECLARE_EWMA(rssi, 10, 8);
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 09/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_add
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (7 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 08/29] wifi: mt76: mt7925: add mt7925_change_sta_links sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 10/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_remove sean.wang
` (19 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Added link handling to mt7925_mac_sta_add to support MLD devices.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 0e554b21692e..82d16208764f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -887,15 +887,25 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
+ int err;
msta->vif = mvif;
if (vif->type == NL80211_IFTYPE_STATION)
mvif->wep_sta = msta;
- return mt7925_mac_link_sta_add(mdev, vif, &sta->deflink);
+ if (ieee80211_vif_is_mld(vif)) {
+ msta->deflink_id = IEEE80211_LINK_UNSPECIFIED;
+
+ err = mt7925_mac_sta_add_links(dev, vif, sta, sta->valid_links);
+ } else {
+ err = mt7925_mac_link_sta_add(mdev, vif, &sta->deflink);
+ }
+
+ return err;
}
EXPORT_SYMBOL_GPL(mt7925_mac_sta_add);
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 10/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_remove
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (8 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 09/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_add sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 11/29] wifi: mt76: mt7925: add link handling to txwi sean.wang
` (18 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Added link handling to mt7925_mac_sta_remove, supporting the MLO-enabled
firmware. The change remains comptabile with the non-MLO mode.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 82d16208764f..5360f8a71655 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1033,7 +1033,13 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
- mt7925_mac_link_sta_remove(mdev, vif, &sta->deflink);
+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
+ unsigned long rem;
+
+ rem = ieee80211_vif_is_mld(vif) ? msta->valid_links : BIT(0);
+
+ mt7925_mac_sta_remove_links(dev, vif, sta, rem);
if (vif->type == NL80211_IFTYPE_STATION) {
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 11/29] wifi: mt76: mt7925: add link handling to txwi
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (9 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 10/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_remove sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 12/29] wifi: mt76: mt7925: add link handling in mt7925_set_key sean.wang
` (17 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add link handling to mt792x_tx and writing txwi.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/mac.c | 12 ++++++---
.../net/wireless/mediatek/mt76/mt792x_core.c | 26 +++++++++++++++++--
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
index 2be2ab914411..6f5f2130420e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
@@ -740,8 +740,12 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
BSS_CHANGED_BEACON_ENABLED));
bool inband_disc = !!(changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
BSS_CHANGED_FILS_DISCOVERY));
+ struct mt792x_bss_conf *mconf;
+
+ mconf = vif ? mt792x_vif_to_link((struct mt792x_vif *)vif->drv_priv,
+ wcid->link_id) : NULL;
+ mvif = mconf ? (struct mt76_vif *)&mconf->mt76 : NULL;
- mvif = vif ? (struct mt76_vif *)vif->drv_priv : NULL;
if (mvif) {
omac_idx = mvif->omac_idx;
wmm_idx = mvif->wmm_idx;
@@ -802,8 +806,10 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
txwi[5] = cpu_to_le32(val);
- val = MT_TXD6_DIS_MAT | MT_TXD6_DAS |
- FIELD_PREP(MT_TXD6_MSDU_CNT, 1);
+ val = MT_TXD6_DAS | FIELD_PREP(MT_TXD6_MSDU_CNT, 1);
+ if (!ieee80211_vif_is_mld(vif) ||
+ (q_idx >= MT_LMAC_ALTX0 && q_idx <= MT_LMAC_BCN0))
+ val |= MT_TXD6_DIS_MAT;
txwi[6] = cpu_to_le32(val);
txwi[7] = 0;
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
index 62f471b5498f..ae2ac146a7f7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c
+++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c
@@ -59,13 +59,17 @@ void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
struct ieee80211_vif *vif = info->control.vif;
struct mt76_wcid *wcid = &dev->mt76.global_wcid;
+ u8 link_id;
int qid;
if (control->sta) {
+ struct mt792x_link_sta *mlink;
struct mt792x_sta *sta;
-
+ link_id = u32_get_bits(info->control.flags,
+ IEEE80211_TX_CTRL_MLO_LINK);
sta = (struct mt792x_sta *)control->sta->drv_priv;
- wcid = &sta->deflink.wcid;
+ mlink = mt792x_sta_to_link(sta, link_id);
+ wcid = &mlink->wcid;
}
if (vif && !control->sta) {
@@ -75,6 +79,24 @@ void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control,
wcid = &mvif->sta.deflink.wcid;
}
+ if (vif && control->sta && ieee80211_vif_is_mld(vif)) {
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+ struct ieee80211_link_sta *link_sta;
+ struct ieee80211_bss_conf *conf;
+
+ link_id = wcid->link_id;
+ rcu_read_lock();
+ conf = rcu_dereference(vif->link_conf[link_id]);
+ memcpy(hdr->addr2, conf->addr, ETH_ALEN);
+
+ link_sta = rcu_dereference(control->sta->link[link_id]);
+ memcpy(hdr->addr1, link_sta->addr, ETH_ALEN);
+
+ if (vif->type == NL80211_IFTYPE_STATION)
+ memcpy(hdr->addr3, conf->bssid, ETH_ALEN);
+ rcu_read_unlock();
+ }
+
if (mt76_connac_pm_ref(mphy, &dev->pm)) {
mt76_tx(mphy, control->sta, wcid, skb);
mt76_connac_pm_unref(mphy, &dev->pm);
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 12/29] wifi: mt76: mt7925: add link handling in mt7925_set_key
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (10 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 11/29] wifi: mt76: mt7925: add link handling to txwi sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 13/29] wifi: mt76: mt7925: add link handling to mt7925_change_chanctx sean.wang
` (16 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add link handling in mt7925_set_key to support MLO-enabled
firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 5360f8a71655..f85f7ea01f67 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -610,6 +610,9 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
struct ieee80211_key_conf *key)
{
struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv :
+ &mvif->sta;
int err;
/* The hardware does not support per-STA RX GTK, fallback
@@ -624,7 +627,20 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
mt792x_mutex_acquire(dev);
- err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id);
+ if (ieee80211_vif_is_mld(vif)) {
+ unsigned int link_id;
+ unsigned long add;
+
+ add = key->link_id != -1 ? BIT(key->link_id) : msta->valid_links;
+
+ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
+ err = mt7925_set_link_key(hw, cmd, vif, sta, key, link_id);
+ if (err < 0)
+ break;
+ }
+ } else {
+ err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id);
+ }
mt792x_mutex_release(dev);
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 13/29] wifi: mt76: mt7925: add link handling to mt7925_change_chanctx
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (11 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 12/29] wifi: mt76: mt7925: add link handling in mt7925_set_key sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 14/29] wifi: mt76: mt7925: add link handling in the BSS_CHANGED_PS handler sean.wang
` (15 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add link handling to mt7925_change_chanctx
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index f85f7ea01f67..69849146610e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1571,6 +1571,7 @@ mt7925_change_chanctx(struct ieee80211_hw *hw,
{
struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv;
struct mt792x_phy *phy = mt792x_hw_phy(hw);
+ struct mt792x_bss_conf *mconf;
struct ieee80211_vif *vif;
struct mt792x_vif *mvif;
@@ -1585,7 +1586,22 @@ mt7925_change_chanctx(struct ieee80211_hw *hw,
mt7925_mcu_set_sniffer(mvif->phy->dev, vif, true);
mt7925_mcu_config_sniffer(mvif, ctx);
} else {
- mt7925_mcu_set_chctx(mvif->phy->mt76, &mvif->bss_conf.mt76, ctx);
+ if (ieee80211_vif_is_mld(vif)) {
+ unsigned long valid = mvif->valid_links;
+ u8 i;
+
+ for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) {
+ mconf = mt792x_vif_to_link(mvif, i);
+ if (mconf && mconf->mt76.ctx == ctx)
+ break;
+ }
+
+ } else {
+ mconf = &mvif->bss_conf;
+ }
+
+ if (mconf)
+ mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76, ctx);
}
mt792x_mutex_release(phy->dev);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 14/29] wifi: mt76: mt7925: add link handling in the BSS_CHANGED_PS handler
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (12 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 13/29] wifi: mt76: mt7925: add link handling to mt7925_change_chanctx sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 15/29] wifi: mt76: mt7925: add link handling in mt7925_mcu_set_beacon_filter sean.wang
` (14 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Added link handling in the BSS_CHANGED_PS handler.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 69849146610e..46ce23c7ec27 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1635,6 +1635,7 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u64 changed)
{
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt792x_hw_dev(hw);
mt792x_mutex_acquire(dev);
@@ -1651,8 +1652,17 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw,
mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76);
}
- if (changed & BSS_CHANGED_PS)
- mt7925_mcu_uni_bss_ps(dev, &vif->bss_conf);
+ if (changed & BSS_CHANGED_PS) {
+ unsigned long valid = ieee80211_vif_is_mld(vif) ?
+ mvif->valid_links : BIT(0);
+ struct ieee80211_bss_conf *bss_conf;
+ int i;
+
+ 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);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 15/29] wifi: mt76: mt7925: add link handling in mt7925_mcu_set_beacon_filter
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (13 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 14/29] wifi: mt76: mt7925: add link handling in the BSS_CHANGED_PS handler sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 16/29] wifi: mt76: mt7925: add link handling in mt7925_txwi_free sean.wang
` (13 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add link handling in mt7925_mcu_set_beacon_filter
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index b62153671350..cf0377d26752 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1814,11 +1814,20 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,
#define MT7925_FIF_BIT_CLR BIT(1)
#define MT7925_FIF_BIT_SET BIT(0)
int err = 0;
+ int i;
if (enable) {
- err = mt7925_mcu_uni_bss_bcnft(dev, &vif->bss_conf, true);
- if (err)
- return err;
+ 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;
+
+ for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) {
+ bss_conf = mt792x_vif_to_bss_conf(vif, i);
+ err = mt7925_mcu_uni_bss_bcnft(dev, bss_conf, true);
+ if (err < 0)
+ return err;
+ }
return mt7925_mcu_set_rxfilter(dev, 0,
MT7925_FIF_BIT_SET,
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 16/29] wifi: mt76: mt7925: add link handling in mt7925_txwi_free
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (14 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 15/29] wifi: mt76: mt7925: add link handling in mt7925_mcu_set_beacon_filter sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 17/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_assoc sean.wang
` (12 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add link handling in mt7925_txwi_free.
MT7996 should have the similar the logic, we try to copy from there to
ensure consistency between both.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/mac.c | 54 +++++++++++++------
.../wireless/mediatek/mt76/mt7925/mt7925.h | 2 +-
2 files changed, 40 insertions(+), 16 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
index 6f5f2130420e..0cb9031e9fdd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c
@@ -839,27 +839,53 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
}
EXPORT_SYMBOL_GPL(mt7925_mac_write_txwi);
-static void mt7925_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi)
+static void mt7925_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb,
+ struct mt76_wcid *wcid)
{
+ struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+ struct ieee80211_link_sta *link_sta;
+ struct mt792x_link_sta *mlink;
struct mt792x_sta *msta;
+ bool is_8023;
u16 fc, tid;
- u32 val;
- if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he))
+ link_sta = rcu_dereference(sta->link[wcid->link_id]);
+ if (!link_sta)
return;
- tid = le32_get_bits(txwi[1], MT_TXD1_TID);
- if (tid >= 6) /* skip VO queue */
+ if (!sta || !(link_sta->ht_cap.ht_supported || link_sta->he_cap.has_he))
return;
- val = le32_to_cpu(txwi[2]);
- fc = FIELD_GET(MT_TXD2_FRAME_TYPE, val) << 2 |
- FIELD_GET(MT_TXD2_SUB_TYPE, val) << 4;
+ tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK;
+ is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
+
+ if (is_8023) {
+ fc = IEEE80211_FTYPE_DATA |
+ (sta->wme ? IEEE80211_STYPE_QOS_DATA :
+ IEEE80211_STYPE_DATA);
+ } else {
+ /* No need to get precise TID for Action/Management Frame,
+ * since it will not meet the following Frame Control
+ * condition anyway.
+ */
+
+ struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+
+ fc = le16_to_cpu(hdr->frame_control) &
+ (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE);
+ }
+
if (unlikely(fc != (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA)))
return;
msta = (struct mt792x_sta *)sta->drv_priv;
- if (!test_and_set_bit(tid, &msta->deflink.wcid.ampdu_state))
+
+ if (sta->mlo && msta->deflink_id != IEEE80211_LINK_UNSPECIFIED)
+ mlink = rcu_dereference(msta->link[msta->deflink_id]);
+ else
+ mlink = &msta->deflink;
+
+ if (!test_and_set_bit(tid, &mlink->wcid.ampdu_state))
ieee80211_start_tx_ba_session(sta, tid, 0);
}
@@ -1039,7 +1065,7 @@ void mt7925_mac_add_txs(struct mt792x_dev *dev, void *data)
}
void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t,
- struct ieee80211_sta *sta, bool clear_status,
+ struct ieee80211_sta *sta, struct mt76_wcid *wcid,
struct list_head *free_list)
{
struct mt76_dev *mdev = &dev->mt76;
@@ -1052,10 +1078,8 @@ void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t,
txwi = (__le32 *)mt76_get_txwi_ptr(mdev, t);
if (sta) {
- struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
-
if (likely(t->skb->protocol != cpu_to_be16(ETH_P_PAE)))
- mt7925_tx_check_aggr(sta, txwi);
+ mt7925_tx_check_aggr(sta, t->skb, wcid);
wcid_idx = wcid->idx;
} else {
@@ -1140,7 +1164,7 @@ mt7925_mac_tx_free(struct mt792x_dev *dev, void *data, int len)
if (!txwi)
continue;
- mt7925_txwi_free(dev, txwi, sta, 0, &free_list);
+ mt7925_txwi_free(dev, txwi, sta, wcid, &free_list);
}
}
@@ -1426,7 +1450,7 @@ void mt7925_usb_sdio_tx_complete_skb(struct mt76_dev *mdev,
sta = wcid_to_sta(wcid);
if (sta && likely(e->skb->protocol != cpu_to_be16(ETH_P_PAE)))
- mt7925_tx_check_aggr(sta, txwi);
+ mt76_connac2_tx_check_aggr(sta, txwi);
skb_pull(e->skb, headroom);
mt76_tx_complete_skb(mdev, e->wcid, e->skb);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
index 54693624b182..252d9de81d99 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
@@ -260,7 +260,7 @@ void mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi,
struct ieee80211_key_conf *key, int pid,
enum mt76_txq_id qid, u32 changed);
void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t,
- struct ieee80211_sta *sta, bool clear_status,
+ struct ieee80211_sta *sta, struct mt76_wcid *wcid,
struct list_head *free_list);
int mt7925_mcu_parse_response(struct mt76_dev *mdev, int cmd,
struct sk_buff *skb, int seq);
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 17/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_assoc
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (15 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 16/29] wifi: mt76: mt7925: add link handling in mt7925_txwi_free sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 18/29] wifi: mt76: mt7925: add link handling in mt7925_sta_set_decap_offload sean.wang
` (11 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add links handling in mt7925_mac_sta_assoc
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 90 ++++++++++++++++++-
drivers/net/wireless/mediatek/mt76/mt792x.h | 1 +
2 files changed, 89 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 46ce23c7ec27..3a9d526f8085 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -387,6 +387,7 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
mvif->phy = phy;
mvif->bss_conf.vif = mvif;
mvif->sta.vif = mvif;
+ mvif->deflink_id = IEEE80211_LINK_UNSPECIFIED;
ret = mt7925_mac_link_bss_add(dev, &vif->bss_conf, &mvif->sta.deflink);
if (ret < 0)
@@ -925,6 +926,75 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
}
EXPORT_SYMBOL_GPL(mt7925_mac_sta_add);
+static u16
+mt7925_mac_select_links(struct mt76_dev *mdev, struct ieee80211_vif *vif)
+{
+ unsigned long usable_links = ieee80211_vif_usable_links(vif);
+ struct {
+ enum nl80211_band band;
+ } data[IEEE80211_MLD_MAX_NUM_LINKS];
+ u16 sel_links = 0;
+ u8 link_id;
+ int i = -1;
+
+ if (vif->active_links == usable_links)
+ return vif->active_links;
+
+ rcu_read_lock();
+ for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct ieee80211_bss_conf *link_conf =
+ rcu_dereference(vif->link_conf[link_id]);
+
+ if (!link_conf)
+ continue;
+
+ if (!(BIT(link_id) & vif->active_links))
+ continue;
+
+ if (i == -1 || data[i].band != link_conf->chanreq.oper.chan->band) {
+ i = i + 1;
+ data[i].band = link_conf->chanreq.oper.chan->band;
+ sel_links |= link_id;
+ }
+ }
+ rcu_read_unlock();
+
+ return sel_links;
+}
+
+static void
+mt7925_mac_set_links(struct mt76_dev *mdev, struct ieee80211_vif *vif)
+{
+ struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ struct ieee80211_bss_conf *link_conf =
+ mt792x_vif_to_bss_conf(vif, mvif->deflink_id);
+ struct cfg80211_chan_def *chandef = &link_conf->chanreq.oper;
+ enum nl80211_band band = chandef->chan->band, secondary_band;
+
+ u16 sel_links = mt7925_mac_select_links(mdev, vif);
+ u8 secondary_link_id = __ffs(~BIT(mvif->deflink_id) & sel_links);
+
+ if (!ieee80211_vif_is_mld(vif) || hweight16(sel_links) < 2)
+ return;
+
+ link_conf = mt792x_vif_to_bss_conf(vif, secondary_link_id);
+ secondary_band = link_conf->chanreq.oper.chan->band;
+
+ if (band == NL80211_BAND_2GHZ ||
+ (band == NL80211_BAND_5GHZ && secondary_band == NL80211_BAND_6GHZ)) {
+ mt7925_abort_roc(mvif->phy, &mvif->bss_conf);
+
+ mt792x_mutex_acquire(dev);
+
+ mt7925_set_mlo_roc(mvif->phy, &mvif->bss_conf, sel_links);
+
+ mt792x_mutex_release(dev);
+ }
+
+ ieee80211_set_active_links_async(vif, sel_links);
+}
+
static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev,
struct ieee80211_vif *vif,
struct ieee80211_link_sta *link_sta)
@@ -940,7 +1010,11 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev,
mt792x_mutex_acquire(dev);
- link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id);
+ if (ieee80211_vif_is_mld(vif)) {
+ link_conf = mt792x_vif_to_bss_conf(vif, msta->deflink_id);
+ } else {
+ link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id);
+ }
if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls)
mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx,
@@ -960,7 +1034,18 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev,
void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
- mt7925_mac_link_sta_assoc(mdev, vif, &sta->deflink);
+ if (ieee80211_vif_is_mld(vif)) {
+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
+ struct ieee80211_link_sta *link_sta;
+
+ link_sta = mt792x_sta_to_link_sta(vif, sta, msta->deflink_id);
+
+ mt7925_mac_set_links(mdev, vif);
+
+ mt7925_mac_link_sta_assoc(mdev, vif, link_sta);
+ } else {
+ mt7925_mac_link_sta_assoc(mdev, vif, &sta->deflink);
+ }
}
EXPORT_SYMBOL_GPL(mt7925_mac_sta_assoc);
@@ -1751,6 +1836,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
if (!old_links) {
+ mvif->deflink_id = link_id;
mconf = &mvif->bss_conf;
mlink = &mvif->sta.deflink;
} else {
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index af9a103dc7f4..5ede24116748 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -131,6 +131,7 @@ struct mt792x_vif {
struct mt792x_phy *phy;
u16 valid_links;
+ u8 deflink_id;
};
struct mt792x_phy {
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 18/29] wifi: mt76: mt7925: add link handling in mt7925_sta_set_decap_offload
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (16 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 17/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_assoc sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 19/29] wifi: mt76: mt7925: update rate index according to link id sean.wang
` (10 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add link handling in mt7925_sta_set_decap_offload
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 21 ++++++++++++----
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 24 ++++++++++++++-----
.../wireless/mediatek/mt76/mt7925/mt7925.h | 3 ++-
3 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 3a9d526f8085..265ef7ade6e4 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1450,16 +1450,27 @@ static void mt7925_sta_set_decap_offload(struct ieee80211_hw *hw,
bool enabled)
{
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ unsigned long valid = mvif->valid_links;
+ u8 i;
mt792x_mutex_acquire(dev);
- if (enabled)
- set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags);
- else
- clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags);
+ valid = ieee80211_vif_is_mld(vif) ? mvif->valid_links : BIT(0);
+
+ for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct mt792x_link_sta *mlink;
- mt7925_mcu_wtbl_update_hdr_trans(dev, vif, sta);
+ mlink = mt792x_sta_to_link(msta, i);
+
+ if (enabled)
+ set_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags);
+ else
+ clear_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags);
+
+ mt7925_mcu_wtbl_update_hdr_trans(dev, vif, sta, i);
+ }
mt792x_mutex_release(dev);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index cf0377d26752..75149baab7e5 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -887,10 +887,15 @@ mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb,
else
hdr_trans->from_ds = true;
- if (link_sta)
- wcid = (struct mt76_wcid *)link_sta->sta->drv_priv;
- else
+ if (link_sta) {
+ struct mt792x_sta *msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
+ struct mt792x_link_sta *mlink;
+
+ mlink = mt792x_sta_to_link(msta, link_sta->link_id);
+ wcid = &mlink->wcid;
+ } else {
wcid = &mvif->sta.deflink.wcid;
+ }
if (!wcid)
return;
@@ -904,17 +909,24 @@ mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb,
int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev,
struct ieee80211_vif *vif,
- struct ieee80211_sta *sta)
+ struct ieee80211_sta *sta,
+ int link_id)
{
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct ieee80211_link_sta *link_sta = sta ? &sta->deflink : NULL;
+ struct mt792x_link_sta *mlink;
+ struct mt792x_bss_conf *mconf;
struct mt792x_sta *msta;
struct sk_buff *skb;
msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta;
- skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->bss_conf.mt76,
- &msta->deflink.wcid,
+ mlink = mt792x_sta_to_link(msta, link_id);
+ link_sta = mt792x_sta_to_link_sta(vif, sta, link_id);
+ mconf = mt792x_vif_to_link(mvif, link_id);
+
+ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
+ &mlink->wcid,
MT7925_STA_UPDATE_MAX_SIZE);
if (IS_ERR(skb))
return PTR_ERR(skb);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
index 252d9de81d99..4c0ecae8e49b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
@@ -315,6 +315,7 @@ int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
int mt7925_mcu_set_rts_thresh(struct mt792x_phy *phy, u32 val);
int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev,
struct ieee80211_vif *vif,
- struct ieee80211_sta *sta);
+ struct ieee80211_sta *sta,
+ int link_id);
#endif
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 19/29] wifi: mt76: mt7925: update rate index according to link id
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (17 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 18/29] wifi: mt76: mt7925: add link handling in mt7925_sta_set_decap_offload sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 20/29] wifi: mt76: mt7925: report link information in rx status sean.wang
` (9 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Update rate index according to link id.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 265ef7ade6e4..173934ec1e71 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1768,9 +1768,12 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw,
struct ieee80211_bss_conf *info,
u64 changed)
{
- struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv;
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_phy *phy = mt792x_hw_phy(hw);
struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ struct mt792x_bss_conf *mconf;
+
+ mconf = mt792x_vif_to_link(mvif, info->link_id);
mt792x_mutex_acquire(dev);
@@ -1784,16 +1787,16 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw,
}
if (changed & BSS_CHANGED_MCAST_RATE)
- mvif->mcast_rates_idx =
+ mconf->mt76.mcast_rates_idx =
mt7925_get_rates_table(hw, vif, false, true);
if (changed & BSS_CHANGED_BASIC_RATES)
- mvif->basic_rates_idx =
+ mconf->mt76.basic_rates_idx =
mt7925_get_rates_table(hw, vif, false, false);
if (changed & (BSS_CHANGED_BEACON |
BSS_CHANGED_BEACON_ENABLED)) {
- mvif->beacon_rates_idx =
+ mconf->mt76.beacon_rates_idx =
mt7925_get_rates_table(hw, vif, true, false);
mt7925_mcu_uni_add_beacon_offload(dev, hw, vif,
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 20/29] wifi: mt76: mt7925: report link information in rx status
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (18 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 19/29] wifi: mt76: mt7925: update rate index according to link id sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 21/29] wifi: mt76: add def_wcid to struct mt76_wcid sean.wang
` (8 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
report link information in rx status
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mac80211.c | 5 +++++
drivers/net/wireless/mediatek/mt76/mt76.h | 1 +
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++
3 files changed, 8 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index e8ba2e4e8484..bb291fe314fb 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -1125,6 +1125,11 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb,
memcpy(status->chain_signal, mstat.chain_signal,
sizeof(mstat.chain_signal));
+ if (mstat.wcid) {
+ status->link_valid = mstat.wcid->link_valid;
+ status->link_id = mstat.wcid->link_id;
+ }
+
*sta = wcid_to_sta(mstat.wcid);
*hw = mt76_phy_hw(dev, mstat.phy_idx);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index 01646538087a..c0e529d0b3ef 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -350,6 +350,7 @@ struct mt76_wcid {
u8 amsdu:1;
u8 phy_idx:2;
u8 link_id:4;
+ bool link_valid;
u8 rx_check_pn;
u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6];
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 173934ec1e71..c3ce57d36168 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -809,6 +809,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,
mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET;
mlink->last_txs = jiffies;
mlink->wcid.link_id = link_sta->link_id;
+ mlink->wcid.link_valid = !!link_sta->sta->valid_links;
ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm);
if (ret)
@@ -1865,6 +1866,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mconf->link_id = link_id;
mconf->vif = mvif;
mlink->wcid.link_id = link_id;
+ mlink->wcid.link_valid = !!vif->valid_links;
}
if (hweight16(mvif->valid_links) == 0)
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 21/29] wifi: mt76: add def_wcid to struct mt76_wcid
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (19 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 20/29] wifi: mt76: mt7925: report link information in rx status sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 22/29] wifi: mt76: mt7925: add mt7925_[assign,unassign]_vif_chanctx sean.wang
` (7 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add def_wcid to struct mt76_wcid to allow per-link wcid to retrieve the
struct ieee80211_sta structure.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt76.h | 5 +++++
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++
2 files changed, 7 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index c0e529d0b3ef..f8431b889c78 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -368,6 +368,8 @@ struct mt76_wcid {
struct mt76_sta_stats stats;
struct list_head poll_list;
+
+ struct mt76_wcid *def_wcid;
};
struct mt76_txq {
@@ -1258,6 +1260,9 @@ wcid_to_sta(struct mt76_wcid *wcid)
if (!wcid || !wcid->sta)
return NULL;
+ if (wcid->def_wcid)
+ ptr = wcid->def_wcid;
+
return container_of(ptr, struct ieee80211_sta, drv_priv);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index c3ce57d36168..339888086076 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -894,6 +894,7 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
rcu_assign_pointer(msta->link[link_id], mlink);
mlink->sta = msta;
mlink->pri_link = &sta->deflink;
+ mlink->wcid.def_wcid = &msta->deflink.wcid;
link_sta = mt792x_sta_to_link_sta(vif, sta, link_id);
mt7925_mac_link_sta_add(&dev->mt76, vif, link_sta);
@@ -1867,6 +1868,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mconf->vif = mvif;
mlink->wcid.link_id = link_id;
mlink->wcid.link_valid = !!vif->valid_links;
+ mlink->wcid.def_wcid = &mvif->sta.deflink.wcid;
}
if (hweight16(mvif->valid_links) == 0)
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 22/29] wifi: mt76: mt7925: add mt7925_[assign,unassign]_vif_chanctx
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (20 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 21/29] wifi: mt76: add def_wcid to struct mt76_wcid sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 23/29] wifi: mt76: mt7925: update mt7925_mcu_sta_mld_tlv for MLO sean.wang
` (6 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add mt7925_[assign,unassign]_vif_chanctx to assign and unassign
chanctx to the specific link configuration. If the chctx is not
pass in the parameter, we will look up the channel information
from link_conf->chanreq.oper.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/main.c | 75 ++++++++++++++++++-
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 17 +++--
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 1 +
3 files changed, 82 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 339888086076..13b40032cd72 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1698,8 +1698,13 @@ mt7925_change_chanctx(struct ieee80211_hw *hw,
mconf = &mvif->bss_conf;
}
- if (mconf)
- mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76, ctx);
+ if (mconf) {
+ struct ieee80211_bss_conf *link_conf;
+
+ link_conf = mt792x_vif_to_bss_conf(vif, mconf->link_id);
+ mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76,
+ link_conf, ctx);
+ }
}
mt792x_mutex_release(phy->dev);
}
@@ -1945,6 +1950,68 @@ mt7925_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
return err;
}
+static int mt7925_assign_vif_chanctx(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *link_conf,
+ struct ieee80211_chanctx_conf *ctx)
+{
+ struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv;
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ struct ieee80211_bss_conf *pri_link_conf;
+ struct mt792x_bss_conf *mconf;
+
+ mutex_lock(&dev->mt76.mutex);
+
+ if (ieee80211_vif_is_mld(vif)) {
+ mconf = mt792x_vif_to_link(mvif, link_conf->link_id);
+ pri_link_conf = mt792x_vif_to_bss_conf(vif, mvif->deflink_id);
+
+ if (vif->type == NL80211_IFTYPE_STATION &&
+ mconf == &mvif->bss_conf)
+ mt7925_mcu_add_bss_info(&dev->phy, NULL, pri_link_conf,
+ NULL, true);
+ } else {
+ mconf = &mvif->bss_conf;
+ }
+
+ mconf->mt76.ctx = ctx;
+ mctx->bss_conf = &mvif->bss_conf;
+ mutex_unlock(&dev->mt76.mutex);
+
+ return 0;
+}
+
+static void mt7925_unassign_vif_chanctx(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ struct ieee80211_bss_conf *link_conf,
+ struct ieee80211_chanctx_conf *ctx)
+{
+ struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv;
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ struct mt792x_dev *dev = mt792x_hw_dev(hw);
+ struct ieee80211_bss_conf *pri_link_conf;
+ struct mt792x_bss_conf *mconf;
+
+ mutex_lock(&dev->mt76.mutex);
+
+ if (ieee80211_vif_is_mld(vif)) {
+ mconf = mt792x_vif_to_link(mvif, link_conf->link_id);
+ pri_link_conf = mt792x_vif_to_bss_conf(vif, mvif->deflink_id);
+
+ if (vif->type == NL80211_IFTYPE_STATION &&
+ mconf == &mvif->bss_conf)
+ mt7925_mcu_add_bss_info(&dev->phy, NULL, pri_link_conf,
+ NULL, false);
+ } else {
+ mconf = &mvif->bss_conf;
+ }
+
+ mctx->bss_conf = NULL;
+ mconf->mt76.ctx = NULL;
+ mutex_unlock(&dev->mt76.mutex);
+}
+
const struct ieee80211_ops mt7925_ops = {
.tx = mt792x_tx,
.start = mt7925_start,
@@ -1997,8 +2064,8 @@ const struct ieee80211_ops mt7925_ops = {
.add_chanctx = mt7925_add_chanctx,
.remove_chanctx = mt7925_remove_chanctx,
.change_chanctx = mt7925_change_chanctx,
- .assign_vif_chanctx = mt792x_assign_vif_chanctx,
- .unassign_vif_chanctx = mt792x_unassign_vif_chanctx,
+ .assign_vif_chanctx = mt7925_assign_vif_chanctx,
+ .unassign_vif_chanctx = mt7925_unassign_vif_chanctx,
.mgd_prepare_tx = mt7925_mgd_prepare_tx,
.mgd_complete_tx = mt7925_mgd_complete_tx,
.vif_cfg_changed = mt7925_vif_cfg_changed,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 75149baab7e5..3f0ceebed2f8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -2074,9 +2074,11 @@ mt7925_mcu_uni_add_beacon_offload(struct mt792x_dev *dev,
static
void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy,
+ struct ieee80211_bss_conf *link_conf,
struct ieee80211_chanctx_conf *ctx)
{
- struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef;
+ struct cfg80211_chan_def *chandef = ctx ? &ctx->def :
+ &link_conf->chanreq.oper;
int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2;
enum nl80211_band band = chandef->chan->band;
struct bss_rlm_tlv *req;
@@ -2143,6 +2145,7 @@ __mt7925_mcu_alloc_bss_req(struct mt76_dev *dev, struct mt76_vif *mvif, int len)
}
int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif,
+ struct ieee80211_bss_conf *link_conf,
struct ieee80211_chanctx_conf *ctx)
{
struct sk_buff *skb;
@@ -2152,7 +2155,7 @@ int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif,
if (IS_ERR(skb))
return PTR_ERR(skb);
- mt7925_mcu_bss_rlm_tlv(skb, phy, ctx);
+ mt7925_mcu_bss_rlm_tlv(skb, phy, link_conf, ctx);
return mt76_mcu_skb_send_msg(phy->dev, skb,
MCU_UNI_CMD(BSS_INFO_UPDATE), true);
@@ -2214,7 +2217,8 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb,
{
struct ieee80211_vif *vif = link_conf->vif;
struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf);
- struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef;
+ struct cfg80211_chan_def *chandef = ctx ? &ctx->def :
+ &link_conf->chanreq.oper;
enum nl80211_band band = chandef->chan->band;
struct mt76_connac_bss_basic_tlv *basic_req;
struct mt792x_link_sta *mlink;
@@ -2339,7 +2343,8 @@ mt7925_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt792x_phy *phy,
struct ieee80211_chanctx_conf *ctx,
struct ieee80211_bss_conf *link_conf)
{
- struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->mt76->chandef;
+ struct cfg80211_chan_def *chandef = ctx ? &ctx->def :
+ &link_conf->chanreq.oper;
struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf);
enum nl80211_band band = chandef->chan->band;
struct mt76_vif *mvif = &mconf->mt76;
@@ -2479,8 +2484,6 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
int enable)
{
struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv;
- struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif,
- link_conf->link_id);
struct mt792x_dev *dev = phy->dev;
struct sk_buff *skb;
@@ -2504,7 +2507,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
mt7925_mcu_bss_color_tlv(skb, link_conf, enable);
}
- mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, mconf->mt76.ctx);
+ mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx);
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD(BSS_INFO_UPDATE), true);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index fefb6ab384bb..f0b890ad43e7 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -623,6 +623,7 @@ int mt7925_mcu_set_deep_sleep(struct mt792x_dev *dev, bool enable);
int mt7925_mcu_set_channel_domain(struct mt76_phy *phy);
int mt7925_mcu_set_radio_en(struct mt792x_phy *phy, bool enable);
int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif,
+ struct ieee80211_bss_conf *link_conf,
struct ieee80211_chanctx_conf *ctx);
int mt7925_mcu_set_rate_txpower(struct mt76_phy *phy);
int mt7925_mcu_update_arp_filter(struct mt76_dev *dev,
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 23/29] wifi: mt76: mt7925: update mt7925_mcu_sta_mld_tlv for MLO
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (21 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 22/29] wifi: mt76: mt7925: add mt7925_[assign,unassign]_vif_chanctx sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 24/29] wifi: mt76: mt7925: update mt7925_mcu_bss_mld_tlv " sean.wang
` (5 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Update mt7925_mcu_sta_mld_tlv for the MLO-enabled firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 29 ++++++++++++++-----
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 3f0ceebed2f8..71f1fb9fbe2f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1735,19 +1735,34 @@ static void
mt7925_mcu_sta_mld_tlv(struct sk_buff *skb,
struct ieee80211_vif *vif, struct ieee80211_sta *sta)
{
- struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv;
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
+ unsigned long valid = mvif->valid_links;
+ struct mt792x_bss_conf *mconf;
+ struct mt792x_link_sta *mlink;
struct sta_rec_mld *mld;
struct tlv *tlv;
+ int i, cnt = 0;
tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_MLD, sizeof(*mld));
mld = (struct sta_rec_mld *)tlv;
- memcpy(mld->mac_addr, vif->addr, ETH_ALEN);
- mld->primary_id = cpu_to_le16(wcid->idx);
- mld->wlan_id = cpu_to_le16(wcid->idx);
+ memcpy(mld->mac_addr, sta->addr, ETH_ALEN);
+ mld->primary_id = cpu_to_le16(msta->deflink.wcid.idx);
+ mld->wlan_id = cpu_to_le16(msta->deflink.wcid.idx);
+ mld->link_num = min_t(u8, hweight16(mvif->valid_links), 2);
- /* TODO: 0 means deflink only, add secondary link(1) later */
- mld->link_num = !!(hweight8(vif->active_links) > 1);
- WARN_ON_ONCE(mld->link_num);
+ for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) {
+ if (cnt == mld->link_num)
+ break;
+
+ mconf = mt792x_vif_to_link(mvif, i);
+ mlink = mt792x_sta_to_link(msta, i);
+ mld->link[cnt].wlan_id = cpu_to_le16(mlink->wcid.idx);
+ mld->link[cnt++].bss_idx = cpu_to_le16(mconf->mt76.idx);
+
+ if (mlink != &msta->deflink)
+ mld->secondary_id = cpu_to_le16(mlink->wcid.idx);
+ }
}
static int
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 24/29] wifi: mt76: mt7925: update mt7925_mcu_bss_mld_tlv for MLO
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (22 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 23/29] wifi: mt76: mt7925: update mt7925_mcu_sta_mld_tlv for MLO sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 25/29] wifi: mt76: mt7925: update mt7925_mcu_add_bss_info " sean.wang
` (4 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
update mt7925_mcu_bss_mld_tlv for the MLO-enabled firmware,
the change remains compatible with the non-MLO mode and the
older firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 19 +++++++++++--------
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 5 ++++-
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 71f1fb9fbe2f..8e36fb211dcc 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -2384,24 +2384,28 @@ mt7925_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt792x_phy *phy,
static void
mt7925_mcu_bss_mld_tlv(struct sk_buff *skb,
- struct ieee80211_bss_conf *link_conf,
- struct ieee80211_link_sta *link_sta)
+ struct ieee80211_bss_conf *link_conf)
{
struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf);
- bool is_mld = ieee80211_vif_is_mld(link_conf->vif);
+ struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv;
struct bss_mld_tlv *mld;
struct tlv *tlv;
+ bool is_mld;
+
+ is_mld = ieee80211_vif_is_mld(link_conf->vif) ||
+ (hweight16(mvif->valid_links) > 1);
tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_MLD, sizeof(*mld));
mld = (struct bss_mld_tlv *)tlv;
- mld->link_id = link_sta ? (is_mld ? link_conf->link_id : 0) : 0xff;
+ mld->link_id = is_mld ? link_conf->link_id : 0xff;
mld->group_mld_id = is_mld ? mconf->mt76.idx : 0xff;
mld->own_mld_id = mconf->mt76.idx + 32;
mld->remap_idx = 0xff;
+ mld->eml_enable = !!(link_conf->vif->cfg.eml_cap &
+ IEEE80211_EML_CAP_EMLSR_SUPP);
- if (link_sta)
- memcpy(mld->mac_addr, link_sta->addr, ETH_ALEN);
+ memcpy(mld->mac_addr, link_conf->addr, ETH_ALEN);
}
static void
@@ -2511,10 +2515,9 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
mt7925_mcu_bss_basic_tlv(skb, link_conf, link_sta, ctx, phy->mt76,
mvif->sta.deflink.wcid.idx, enable);
mt7925_mcu_bss_sec_tlv(skb, link_conf);
-
mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf);
mt7925_mcu_bss_qos_tlv(skb, link_conf);
- mt7925_mcu_bss_mld_tlv(skb, link_conf, link_sta);
+ mt7925_mcu_bss_mld_tlv(skb, link_conf);
mt7925_mcu_bss_ifs_tlv(skb, link_conf);
if (link_conf->he_support) {
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index f0b890ad43e7..545f6b2d524c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -366,7 +366,10 @@ struct bss_mld_tlv {
u8 mac_addr[ETH_ALEN];
u8 remap_idx;
u8 link_id;
- u8 __rsv[2];
+ u8 eml_enable;
+ u8 max_link_num;
+ u8 hybrid_mode;
+ u8 __rsv[3];
} __packed;
struct sta_rec_ba_uni {
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 25/29] wifi: mt76: mt7925: update mt7925_mcu_add_bss_info for MLO
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (23 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 24/29] wifi: mt76: mt7925: update mt7925_mcu_bss_mld_tlv " sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 26/29] wifi: mt76: mt7925: update mt7925_mcu_sta_update " sean.wang
` (3 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Update mt7925_mcu_bss_mld_tlv for the MLO-enabled firmware
The change remains compatible with the non-MLO mode and the
older firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 8e36fb211dcc..218efe543dbb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -2525,7 +2525,8 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
mt7925_mcu_bss_color_tlv(skb, link_conf, enable);
}
- mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx);
+ if (enable)
+ mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx);
return mt76_mcu_skb_send_msg(&dev->mt76, skb,
MCU_UNI_CMD(BSS_INFO_UPDATE), true);
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 26/29] wifi: mt76: mt7925: update mt7925_mcu_sta_update for MLO
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (24 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 25/29] wifi: mt76: mt7925: update mt7925_mcu_add_bss_info " sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 27/29] wifi: mt76: mt7925: add mt7925_mcu_sta_eht_mld_tlv " sean.wang
` (2 subsequent siblings)
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
update mt7925_mcu_sta_update for the MLO-enabled firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 9 +++
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 65 ++++++++++++++++++-
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 +-
3 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index e636b033b87e..9329c959674f 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -545,6 +545,13 @@ struct sta_rec_muru {
} mimo_ul;
} __packed;
+struct sta_rec_remove {
+ __le16 tag;
+ __le16 len;
+ u8 action;
+ u8 pad[3];
+} __packed;
+
struct sta_phy {
u8 type;
u8 flag;
@@ -814,6 +821,8 @@ enum {
STA_REC_HE_V2 = 0x19,
STA_REC_MLD = 0x20,
STA_REC_EHT = 0x22,
+ STA_REC_MLD_OFF = 0x23,
+ STA_REC_REMOVE = 0x25,
STA_REC_PN_INFO = 0x26,
STA_REC_KEY_V3 = 0x27,
STA_REC_HDRT = 0x28,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 218efe543dbb..dcb8c506543b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1805,6 +1805,63 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy,
return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true);
}
+static void
+mt7925_mcu_sta_remove_tlv(struct sk_buff *skb)
+{
+ struct sta_rec_remove *rem;
+ struct tlv *tlv;
+
+ tlv = mt76_connac_mcu_add_tlv(skb, 0x25, sizeof(*rem));
+ rem = (struct sta_rec_remove *)tlv;
+ rem->action = 0;
+}
+
+static int
+mt7925_mcu_mlo_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;
+
+ skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, info->wcid,
+ MT7925_STA_UPDATE_MAX_SIZE);
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
+ if (info->enable)
+ 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);
+ 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);
+ if (info->state != MT76_STA_INFO_STATE_NONE)
+ mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta);
+ mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta);
+ }
+
+ if (!info->enable) {
+ mt7925_mcu_sta_remove_tlv(skb);
+ mt76_connac_mcu_add_tlv(skb, STA_REC_MLD_OFF,
+ sizeof(struct tlv));
+ }
+
+ return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true);
+}
+
int mt7925_mcu_sta_update(struct mt792x_dev *dev,
struct ieee80211_link_sta *link_sta,
struct ieee80211_vif *vif, bool enable,
@@ -1823,6 +1880,7 @@ 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;
@@ -1831,7 +1889,12 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev,
info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid;
info.newly = link_sta ? state != MT76_STA_INFO_STATE_ASSOC : true;
- return mt7925_mcu_sta_cmd(&dev->mphy, &info);
+ 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;
}
int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index 545f6b2d524c..8a0196699230 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -492,7 +492,8 @@ struct bss_rlm_tlv {
sizeof(struct sta_rec_eht) + \
sizeof(struct sta_rec_hdr_trans) + \
sizeof(struct sta_rec_mld) + \
- sizeof(struct tlv))
+ sizeof(struct tlv) * 2 + \
+ sizeof(struct sta_rec_remove))
#define MT7925_BSS_UPDATE_MAX_SIZE (sizeof(struct bss_req_hdr) + \
sizeof(struct mt76_connac_bss_basic_tlv) + \
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 27/29] wifi: mt76: mt7925: add mt7925_mcu_sta_eht_mld_tlv for MLO
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (25 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 26/29] wifi: mt76: mt7925: update mt7925_mcu_sta_update " sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 28/29] wifi: mt76: mt7925: update mt7925_mcu_sta_rate_ctrl_tlv " sean.wang
2024-07-03 21:42 ` [PATCH 29/29] wifi: mt76: mt7925: enabling MLO when the firmware supports it sean.wang
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
add mt7925_mcu_sta_eht_mld_tlv for the MLO-enabled firmware.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 +
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 42 ++++++++++++++++++-
.../net/wireless/mediatek/mt76/mt7925/mcu.h | 11 +++++
3 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index 9329c959674f..d6882c9fd6bc 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -820,6 +820,7 @@ enum {
STA_REC_HE_6G = 0x17,
STA_REC_HE_V2 = 0x19,
STA_REC_MLD = 0x20,
+ STA_REC_EHT_MLD = 0x21,
STA_REC_EHT = 0x22,
STA_REC_MLD_OFF = 0x23,
STA_REC_REMOVE = 0x25,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index dcb8c506543b..36ddc64ed7d6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1731,6 +1731,42 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb,
HT_MCS_MASK_NUM);
}
+static void
+mt7925_mcu_sta_eht_mld_tlv(struct sk_buff *skb,
+ struct ieee80211_vif *vif, struct ieee80211_sta *sta)
+{
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ struct wiphy *wiphy = mvif->phy->mt76->hw->wiphy;
+ const struct wiphy_iftype_ext_capab *ext_capa;
+ struct sta_rec_eht_mld *eht_mld;
+ struct tlv *tlv;
+ u16 eml_cap;
+
+ tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EHT_MLD, sizeof(*eht_mld));
+ eht_mld = (struct sta_rec_eht_mld *)tlv;
+ eht_mld->mld_type = 0xff;
+
+ if (!ieee80211_vif_is_mld(vif))
+ return;
+
+ ext_capa = cfg80211_get_iftype_ext_capa(wiphy,
+ ieee80211_vif_type_p2p(vif));
+ if (!ext_capa)
+ return;
+
+ eml_cap = (vif->cfg.eml_cap & (IEEE80211_EML_CAP_EMLSR_SUPP |
+ IEEE80211_EML_CAP_TRANSITION_TIMEOUT)) |
+ (ext_capa->eml_capabilities & (IEEE80211_EML_CAP_EMLSR_PADDING_DELAY |
+ IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY));
+
+ if (eml_cap & IEEE80211_EML_CAP_EMLSR_SUPP) {
+ eht_mld->eml_cap[0] = u16_get_bits(eml_cap, GENMASK(7, 0));
+ eht_mld->eml_cap[1] = u16_get_bits(eml_cap, GENMASK(15, 8));
+ } else {
+ eht_mld->str_cap[0] = BIT(1);
+ }
+}
+
static void
mt7925_mcu_sta_mld_tlv(struct sk_buff *skb,
struct ieee80211_vif *vif, struct ieee80211_sta *sta)
@@ -1848,8 +1884,12 @@ mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy,
mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta,
info->vif, info->rcpi,
info->state);
- if (info->state != MT76_STA_INFO_STATE_NONE)
+
+ if (info->state != MT76_STA_INFO_STATE_NONE) {
mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta);
+ mt7925_mcu_sta_eht_mld_tlv(skb, info->vif, info->link_sta->sta);
+ }
+
mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta);
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
index 8a0196699230..5703176056db 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h
@@ -443,6 +443,17 @@ struct sta_rec_mld {
} __packed link[2];
} __packed;
+struct sta_rec_eht_mld {
+ __le16 tag;
+ __le16 len;
+ u8 nsep;
+ u8 mld_type;
+ u8 __rsv1[1];
+ u8 str_cap[3];
+ u8 eml_cap[3];
+ u8 __rsv2[3];
+} __packed;
+
struct bss_ifs_time_tlv {
__le16 tag;
__le16 len;
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 28/29] wifi: mt76: mt7925: update mt7925_mcu_sta_rate_ctrl_tlv for MLO
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (26 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 27/29] wifi: mt76: mt7925: add mt7925_mcu_sta_eht_mld_tlv " sean.wang
@ 2024-07-03 21:42 ` sean.wang
2024-07-03 21:42 ` [PATCH 29/29] wifi: mt76: mt7925: enabling MLO when the firmware supports it sean.wang
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Get band information from the per-link BSS.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 36ddc64ed7d6..829d87d4eb95 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -1707,7 +1707,9 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb,
struct ieee80211_link_sta *link_sta)
{
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
- struct cfg80211_chan_def *chandef = &mvif->bss_conf.mt76.ctx->def;
+ struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif,
+ link_sta->link_id);
+ struct cfg80211_chan_def *chandef = &mconf->mt76.ctx->def;
enum nl80211_band band = chandef->chan->band;
struct sta_rec_ra_info *ra_info;
struct tlv *tlv;
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 29/29] wifi: mt76: mt7925: enabling MLO when the firmware supports it
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
` (27 preceding siblings ...)
2024-07-03 21:42 ` [PATCH 28/29] wifi: mt76: mt7925: update mt7925_mcu_sta_rate_ctrl_tlv " sean.wang
@ 2024-07-03 21:42 ` sean.wang
28 siblings, 0 replies; 30+ messages in thread
From: sean.wang @ 2024-07-03 21:42 UTC (permalink / raw)
To: nbd, lorenzo.bianconi
Cc: sean.wang, deren.wu, mingyen.hsieh, linux-wireless,
linux-mediatek
From: Sean Wang <sean.wang@mediatek.com>
Register MLD capability for the firmware supporting MLO.
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
.../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 +
.../net/wireless/mediatek/mt76/mt7925/init.c | 6 ++++
.../net/wireless/mediatek/mt76/mt7925/main.c | 29 +++++++++++++++++++
.../net/wireless/mediatek/mt76/mt7925/mcu.c | 20 +++++++++++++
.../wireless/mediatek/mt76/mt7925/mt7925.h | 1 +
drivers/net/wireless/mediatek/mt76/mt792x.h | 2 ++
6 files changed, 59 insertions(+)
diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
index d6882c9fd6bc..4242d436de26 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h
@@ -1402,6 +1402,7 @@ enum {
MT_NIC_CAP_WFDMA_REALLOC,
MT_NIC_CAP_6G,
MT_NIC_CAP_CHIP_CAP = 0x20,
+ MT_NIC_CAP_EML_CAP = 0x22,
};
#define UNI_WOW_DETECT_TYPE_MAGIC BIT(0)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/init.c b/drivers/net/wireless/mediatek/mt76/mt7925/init.c
index c4cbc8976046..039949b344b9 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/init.c
@@ -179,6 +179,12 @@ static void mt7925_init_work(struct work_struct *work)
mt76_set_stream_caps(&dev->mphy, true);
mt7925_set_stream_he_eht_caps(&dev->phy);
+ ret = mt7925_init_mlo_caps(&dev->phy);
+ if (ret) {
+ dev_err(dev->mt76.dev, "MLO init failed\n");
+ return;
+ }
+
ret = mt76_register_device(&dev->mt76, true, mt76_rates,
ARRAY_SIZE(mt76_rates));
if (ret) {
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 13b40032cd72..213331a92166 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -236,6 +236,35 @@ mt7925_init_eht_caps(struct mt792x_phy *phy, enum nl80211_band band,
eht_nss->bw._160.rx_tx_mcs13_max_nss = val;
}
+int mt7925_init_mlo_caps(struct mt792x_phy *phy)
+{
+ struct wiphy *wiphy = phy->mt76->hw->wiphy;
+ static const u8 ext_capa_sta[] = {
+ [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
+ };
+ static struct wiphy_iftype_ext_capab ext_capab[] = {
+ {
+ .iftype = NL80211_IFTYPE_STATION,
+ .extended_capabilities = ext_capa_sta,
+ .extended_capabilities_mask = ext_capa_sta,
+ .extended_capabilities_len = sizeof(ext_capa_sta),
+ },
+ };
+
+ if (!(phy->chip_cap & MT792x_CHIP_CAP_MLO_EVT_EN))
+ return 0;
+
+ 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);
+
+ wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO;
+ wiphy->iftype_ext_capab = ext_capab;
+ wiphy->num_iftype_ext_capab = ARRAY_SIZE(ext_capab);
+
+ return 0;
+}
+
static void
__mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy,
struct ieee80211_supported_band *sband,
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
index 829d87d4eb95..d4b020b50be1 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
@@ -749,6 +749,20 @@ mt7925_mcu_parse_phy_cap(struct mt792x_dev *dev, char *data)
dev->has_eht = cap->eht;
}
+static void
+mt7925_mcu_parse_eml_cap(struct mt792x_dev *dev, char *data)
+{
+ struct mt7925_mcu_eml_cap {
+ u8 rsv[4];
+ __le16 eml_cap;
+ u8 rsv2[6];
+ } __packed * cap;
+
+ cap = (struct mt7925_mcu_eml_cap *)data;
+
+ dev->phy.eml_cap = le16_to_cpu(cap->eml_cap);
+}
+
static int
mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)
{
@@ -803,6 +817,12 @@ mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)
case MT_NIC_CAP_PHY:
mt7925_mcu_parse_phy_cap(dev, tlv->data);
break;
+ case MT_NIC_CAP_CHIP_CAP:
+ memcpy(&dev->phy.chip_cap, (void *)skb->data, sizeof(u64));
+ break;
+ case MT_NIC_CAP_EML_CAP:
+ mt7925_mcu_parse_eml_cap(dev, tlv->data);
+ break;
default:
break;
}
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
index 4c0ecae8e49b..d51cc8a02b9e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h
@@ -235,6 +235,7 @@ void mt7925_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
struct sk_buff *skb, u32 *info);
void mt7925_stats_work(struct work_struct *work);
void mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy);
+int mt7925_init_mlo_caps(struct mt792x_phy *phy);
int mt7925_init_debugfs(struct mt792x_dev *dev);
int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,
diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h
index 5ede24116748..30635aeba363 100644
--- a/drivers/net/wireless/mediatek/mt76/mt792x.h
+++ b/drivers/net/wireless/mediatek/mt76/mt792x.h
@@ -27,6 +27,7 @@
#define MT792x_CHIP_CAP_CLC_EVT_EN BIT(0)
#define MT792x_CHIP_CAP_RSSI_NOTIFY_EVT_EN BIT(1)
+#define MT792x_CHIP_CAP_MLO_EVT_EN BIT(2)
/* NOTE: used to map mt76_rates. idx may change if firmware expands table */
#define MT792x_BASIC_RATES_TBL 11
@@ -163,6 +164,7 @@ struct mt792x_phy {
#endif
void *clc[MT792x_CLC_MAX_NUM];
u64 chip_cap;
+ u16 eml_cap;
struct work_struct roc_work;
struct timer_list roc_timer;
--
2.25.1
^ permalink raw reply related [flat|nested] 30+ messages in thread
end of thread, other threads:[~2024-07-03 21:43 UTC | newest]
Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03 21:42 [PATCH 00/29] Enabling MT7925 MLO Mode Support sean.wang
2024-07-03 21:42 ` [PATCH 01/29] wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO sean.wang
2024-07-03 21:42 ` [PATCH 02/29] wifi: mt76: mt7925: update mt7925_mac_link_sta_[add, remove] " sean.wang
2024-07-03 21:42 ` [PATCH 03/29] wifi: mt76: mt7925: set Tx queue parameters according to link id sean.wang
2024-07-03 21:42 ` [PATCH 04/29] wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv " sean.wang
2024-07-03 21:42 ` [PATCH 05/29] wifi: mt76: mt7925: add mt7925_set_link_key sean.wang
2024-07-03 21:42 ` [PATCH 06/29] wifi: mt76: mt7925: extend mt7925_mcu_uni_roc_event sean.wang
2024-07-03 21:42 ` [PATCH 07/29] wifi: mt76: mt7925: add mt7925_change_vif_links sean.wang
2024-07-03 21:42 ` [PATCH 08/29] wifi: mt76: mt7925: add mt7925_change_sta_links sean.wang
2024-07-03 21:42 ` [PATCH 09/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_add sean.wang
2024-07-03 21:42 ` [PATCH 10/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_remove sean.wang
2024-07-03 21:42 ` [PATCH 11/29] wifi: mt76: mt7925: add link handling to txwi sean.wang
2024-07-03 21:42 ` [PATCH 12/29] wifi: mt76: mt7925: add link handling in mt7925_set_key sean.wang
2024-07-03 21:42 ` [PATCH 13/29] wifi: mt76: mt7925: add link handling to mt7925_change_chanctx sean.wang
2024-07-03 21:42 ` [PATCH 14/29] wifi: mt76: mt7925: add link handling in the BSS_CHANGED_PS handler sean.wang
2024-07-03 21:42 ` [PATCH 15/29] wifi: mt76: mt7925: add link handling in mt7925_mcu_set_beacon_filter sean.wang
2024-07-03 21:42 ` [PATCH 16/29] wifi: mt76: mt7925: add link handling in mt7925_txwi_free sean.wang
2024-07-03 21:42 ` [PATCH 17/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_assoc sean.wang
2024-07-03 21:42 ` [PATCH 18/29] wifi: mt76: mt7925: add link handling in mt7925_sta_set_decap_offload sean.wang
2024-07-03 21:42 ` [PATCH 19/29] wifi: mt76: mt7925: update rate index according to link id sean.wang
2024-07-03 21:42 ` [PATCH 20/29] wifi: mt76: mt7925: report link information in rx status sean.wang
2024-07-03 21:42 ` [PATCH 21/29] wifi: mt76: add def_wcid to struct mt76_wcid sean.wang
2024-07-03 21:42 ` [PATCH 22/29] wifi: mt76: mt7925: add mt7925_[assign,unassign]_vif_chanctx sean.wang
2024-07-03 21:42 ` [PATCH 23/29] wifi: mt76: mt7925: update mt7925_mcu_sta_mld_tlv for MLO sean.wang
2024-07-03 21:42 ` [PATCH 24/29] wifi: mt76: mt7925: update mt7925_mcu_bss_mld_tlv " sean.wang
2024-07-03 21:42 ` [PATCH 25/29] wifi: mt76: mt7925: update mt7925_mcu_add_bss_info " sean.wang
2024-07-03 21:42 ` [PATCH 26/29] wifi: mt76: mt7925: update mt7925_mcu_sta_update " sean.wang
2024-07-03 21:42 ` [PATCH 27/29] wifi: mt76: mt7925: add mt7925_mcu_sta_eht_mld_tlv " sean.wang
2024-07-03 21:42 ` [PATCH 28/29] wifi: mt76: mt7925: update mt7925_mcu_sta_rate_ctrl_tlv " sean.wang
2024-07-03 21:42 ` [PATCH 29/29] wifi: mt76: mt7925: enabling MLO when the firmware supports it sean.wang
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.