[rdkb][common][bsp][Refactor and sync wifi from openwrt]
[Description]
3a2eef0b [MAC80211][Release][Update release note for Filogic 880/860 MLO Beta release]
cfbd2411 [MAC80211][Release][Filogic 880/860 MLO Beta release]
6c180e3f [MAC80211][WiFi7][misc][Add Eagle BE14000 efem default bin]
a55f34db [MAC80211][Release][Prepare for Filogic 880/860 release]
5b45ebca [MAC80211][WiFi7][hostapd][Add puncture bitmap to ucode]
95bbea73 [MAC80211][WiFi6][mt76][Add PID to only report data-frame TX rate]
b15ced26 [MAC80211][WiFi6][hostapd][Fix DFS channel selection issue]
d59133cb [MAC80211][WiFi6][mt76][Fix pse info not correct information]
3921b4b2 [MAC80211][WiFi6][mt76][Fix incomplete QoS-map setting to FW]
4e7690c7 [MAC80211][WiFi6/7][app][Change ATECHANNEL mapping cmd]
eb37af90 [MAC80211][WiFi7][app][Add support for per-packet bw & primary selection]
0ea82adf [MAC80211][WiFi6][core][Fix DFS CAC issue after CSA]
[Release-log]
Change-Id: I9bec97ec1b2e1c49ed43a812a07a5b21fcbb70a6
diff --git a/recipes-wifi/linux-mt76/files/patches-3.x/0095-mtk-mt76-mt7996-support-multi-link-sta-links-and-MLO.patch b/recipes-wifi/linux-mt76/files/patches-3.x/0095-mtk-mt76-mt7996-support-multi-link-sta-links-and-MLO.patch
new file mode 100644
index 0000000..1338a68
--- /dev/null
+++ b/recipes-wifi/linux-mt76/files/patches-3.x/0095-mtk-mt76-mt7996-support-multi-link-sta-links-and-MLO.patch
@@ -0,0 +1,589 @@
+From 9fb46d0e65f5f37975a71ad433db8290ee586566 Mon Sep 17 00:00:00 2001
+From: Shayne Chen <shayne.chen@mediatek.com>
+Date: Wed, 29 Nov 2023 10:12:39 +0800
+Subject: [PATCH 095/199] mtk: mt76: mt7996: support multi-link sta links and
+ MLO sta callbacks
+
+Rework add_sta functions to add_link_sta functions, and support
+.change_sta_links callback.
+This is a preliminary patch to add MLO support for mt7996 chipsets.
+
+Co-developed-by: Bo Jiao <Bo.Jiao@mediatek.com>
+Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
+Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
+---
+ mt7996/main.c | 309 +++++++++++++++++++++++++++++++++++++-----------
+ mt7996/mcu.c | 117 ++++++++++++++++++
+ mt7996/mcu.h | 29 +++++
+ mt7996/mt7996.h | 7 ++
+ 4 files changed, 396 insertions(+), 66 deletions(-)
+
+diff --git a/mt7996/main.c b/mt7996/main.c
+index 3abae2fe..e850942f 100644
+--- a/mt7996/main.c
++++ b/mt7996/main.c
+@@ -932,42 +932,234 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
+ mutex_unlock(&dev->mt76.mutex);
+ }
+
++static void mt7996_remove_link_sta(struct mt7996_dev *dev,
++ struct ieee80211_bss_conf *conf,
++ struct mt7996_bss_conf *mconf,
++ struct ieee80211_link_sta *link_sta,
++ struct mt7996_link_sta *mlink)
++{
++ struct ieee80211_sta *sta = link_sta->sta;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ int i;
++
++ if (!mlink)
++ return;
++
++ for (i = 0; i < ARRAY_SIZE(mlink->wcid.aggr); i++)
++ mt76_rx_aggr_stop(&dev->mt76, &mlink->wcid, i);
++
++ if (sta->mlo)
++ mt7996_mcu_teardown_mld_sta(dev, mconf, mlink);
++ else
++ mt7996_mcu_add_sta(dev, conf, mconf, link_sta, mlink, false, false);
++
++ mt7996_mac_wtbl_update(dev, mlink->wcid.idx,
++ MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
++
++ for (i = 0; i < ARRAY_SIZE(mlink->twt.flow); i++)
++ mt7996_mac_twt_teardown_flow(dev, mlink, i);
++
++ rcu_assign_pointer(mlink->sta->link[mlink->wcid.link_id], NULL);
++
++ spin_lock_bh(&dev->mt76.sta_poll_lock);
++ if (!list_empty(&mlink->wcid.poll_list))
++ list_del_init(&mlink->wcid.poll_list);
++ if (!list_empty(&mlink->rc_list))
++ list_del_init(&mlink->rc_list);
++ spin_unlock_bh(&dev->mt76.sta_poll_lock);
++
++ /* TODO: update primary link */
++ if (sta->valid_links) {
++ if (mlink->wcid.link_id == msta->pri_link)
++ msta->pri_link = msta->sec_link;
++
++ if (sta->valid_links & ~(BIT(msta->pri_link)))
++ msta->sec_link = __ffs(sta->valid_links & ~(BIT(msta->pri_link)));
++ else
++ msta->sec_link = msta->pri_link;
++ }
++
++ mt76_wcid_cleanup(&dev->mt76, &mlink->wcid);
++ mt76_wcid_mask_clear(dev->mt76.wcid_mask, mlink->wcid.idx);
++ mt76_wcid_mask_clear(dev->mt76.wcid_phy_mask, mlink->wcid.idx);
++
++ if (mlink != &msta->deflink)
++ kfree(mlink);
++}
++
++static int mt7996_add_link_sta(struct mt7996_dev *dev,
++ struct ieee80211_bss_conf *conf,
++ struct mt7996_bss_conf *mconf,
++ struct ieee80211_link_sta *link_sta, bool assoc)
++{
++ struct ieee80211_sta *sta = link_sta->sta;
++ struct mt7996_vif *mvif = (struct mt7996_vif *)conf->vif->drv_priv;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ u8 link_id = link_sta->link_id;
++ struct mt7996_link_sta *mlink = NULL;
++ int idx, ret;
++
++ if (!rcu_access_pointer(msta->link[link_id])) {
++ idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA);
++ if (idx < 0)
++ return -ENOSPC;
++
++ if (sta->mlo) {
++ mlink = kzalloc(sizeof(*mlink), GFP_KERNEL);
++ if (!mlink)
++ return -ENOMEM;
++ } else {
++ mlink = &msta->deflink;
++ }
++
++ INIT_LIST_HEAD(&mlink->rc_list);
++ INIT_LIST_HEAD(&mlink->wcid.poll_list);
++ msta->vif = mvif;
++ mlink->wcid.sta = 1;
++ mlink->wcid.idx = idx;
++ mlink->wcid.phy_idx = mconf->phy->mt76->band_idx;
++ mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET;
++ mlink->wcid.def_wcid = &msta->deflink.wcid;
++ mlink->sta = msta;
++ if (sta->valid_links) {
++ mlink->wcid.link_valid = true;
++ mlink->wcid.link_id = link_id;
++ if (sta->valid_links & ~(BIT(msta->pri_link)))
++ msta->sec_link = __ffs(sta->valid_links &
++ ~(BIT(msta->pri_link)));
++ else
++ msta->sec_link = msta->pri_link;
++ }
++
++ rcu_assign_pointer(msta->link[link_id], mlink);
++
++ ewma_signal_init(&mlink->wcid.rssi);
++ if (mconf->phy->mt76->band_idx == MT_BAND1)
++ mt76_wcid_mask_set(dev->mt76.wcid_phy_mask, idx);
++ rcu_assign_pointer(dev->mt76.wcid[idx], &mlink->wcid);
++ mt76_wcid_init(&mlink->wcid);
++ }
++
++ if (!assoc)
++ return 0;
++
++ if (!mlink)
++ mlink = mlink_dereference_protected(msta, link_id);
++ mt7996_mac_wtbl_update(dev, mlink->wcid.idx,
++ MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
++
++ ret = mt7996_mcu_add_sta(dev, conf, mconf, link_sta, mlink, true, true);
++ if (ret)
++ goto error;
++
++ ret = mt7996_mcu_add_rate_ctrl(dev, conf, mconf, link_sta, mlink, false);
++ if (ret)
++ goto error;
++
++ ewma_avg_signal_init(&mlink->avg_ack_signal);
++
++ return 0;
++error:
++ mt7996_remove_link_sta(dev, conf, mconf, link_sta, mlink);
++ return ret;
++}
++
++static void
++mt7996_mac_sta_remove_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta, unsigned long rem)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ unsigned int link_id;
++
++ for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, link_id);
++ struct mt7996_link_sta *mlink =
++ mlink_dereference_protected(msta, link_id);
++ struct ieee80211_bss_conf *conf =
++ link_conf_dereference_protected(vif, link_id);
++ struct ieee80211_link_sta *link_sta =
++ link_sta_dereference_protected(sta, link_id);
++
++ mt7996_remove_link_sta(dev, conf, mconf, link_sta, mlink);
++ }
++}
++
++static int
++mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta, unsigned long add,
++ bool assoc)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ struct mt7996_link_sta *mlink;
++ unsigned int link_id;
++ int i, ret;
++
++ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, link_id);
++ struct ieee80211_bss_conf *conf =
++ link_conf_dereference_protected(vif, link_id);
++ struct ieee80211_link_sta *link_sta =
++ link_sta_dereference_protected(sta, link_id);
++
++ ret = mt7996_add_link_sta(dev, conf, mconf, link_sta, assoc);
++ if (ret)
++ goto error;
++ }
++
++ if (!assoc)
++ return 0;
++
++ mlink = mlink_dereference_protected(msta, msta->pri_link);
++ for (i = 0; i < ARRAY_SIZE(sta->txq); i++) {
++ struct mt76_txq *mtxq;
++
++ if (!sta->txq[i])
++ continue;
++ mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv;
++ mtxq->wcid = mlink->wcid.idx;
++ }
++
++ ret = mt7996_mcu_add_mld_sta(dev, vif, sta, add);
++ if (ret)
++ goto error;
++
++ return 0;
++error:
++ mt7996_mac_sta_remove_links(dev, vif, sta, add);
++ return ret;
++}
++
+ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+ {
+ struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
+- struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+- struct mt7996_bss_conf *mconf = mconf_dereference_protected(mvif, 0);
+- struct mt7996_link_sta *mlink = &msta->deflink;
+- u8 band_idx = mconf->phy->mt76->band_idx;
+- int idx;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ struct mt7996_bss_conf *mconf;
++ u8 link_id = sta->valid_links ? __ffs(sta->valid_links) : 0;
++ unsigned long add = BIT(link_id);
++ int ret;
+
+ #ifdef CONFIG_MTK_VENDOR
+ struct mt7996_phy *phy = &dev->phy;
+ #endif
+
+- idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA);
+- if (idx < 0)
+- return -ENOSPC;
+-
+- INIT_LIST_HEAD(&mlink->rc_list);
+- INIT_LIST_HEAD(&mlink->wcid.poll_list);
+- msta->vif = mvif;
+- mlink->wcid.sta = 1;
+- mlink->wcid.idx = idx;
+- mlink->wcid.phy_idx = band_idx;
+- mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET;
+- mlink->sta = msta;
+-
+- rcu_assign_pointer(msta->link[0], mlink);
++ msta->pri_link = link_id;
++ ret = mt7996_mac_sta_add_links(dev, vif, sta, add, false);
++ if (ret)
++ return ret;
+
+ #ifdef CONFIG_MTK_VENDOR
++ mconf = mconf_dereference_protected(mvif, link_id);
+ mt7996_vendor_amnt_sta_remove(mconf->phy, sta);
+ #endif
+
+ #ifdef CONFIG_MTK_VENDOR
+- switch (band_idx) {
++ switch (mconf->phy->mt76->band_idx) {
+ case MT_BAND1:
+ phy = mt7996_phy2(dev);
+ break;
+@@ -990,28 +1182,11 @@ void mt7996_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+ {
+ struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
+- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+- struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+- struct mt7996_bss_conf *mconf;
+- struct mt7996_link_sta *mlink;
+- struct ieee80211_bss_conf *conf;
+- struct ieee80211_link_sta *link_sta;
++ unsigned long add = sta->valid_links ?: BIT(0);
+
+ mutex_lock(&dev->mt76.mutex);
+
+- conf = link_conf_dereference_protected(vif, 0);
+- mconf = mconf_dereference_protected(mvif, 0);
+- link_sta = link_sta_dereference_protected(sta, 0);
+- mlink = mlink_dereference_protected(msta, 0);
+-
+- mt7996_mac_wtbl_update(dev, mlink->wcid.idx,
+- MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
+-
+- mt7996_mcu_add_sta(dev, conf, mconf, link_sta, mlink, true, true);
+- mt7996_mcu_add_rate_ctrl(dev, conf, mconf, link_sta, mlink, false);
+- mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET;
+-
+- ewma_avg_signal_init(&mlink->avg_ack_signal);
++ mt7996_mac_sta_add_links(dev, vif, sta, add, true);
+
+ mutex_unlock(&dev->mt76.mutex);
+ }
+@@ -1020,34 +1195,9 @@ void mt7996_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+ {
+ struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
+- struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+- struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
+- struct mt7996_bss_conf *mconf;
+- struct mt7996_link_sta *mlink;
+- struct ieee80211_bss_conf *conf;
+- struct ieee80211_link_sta *link_sta;
+- int i;
+-
+- conf = link_conf_dereference_protected(vif, 0);
+- mconf = mconf_dereference_protected(mvif, 0);
+- link_sta = link_sta_dereference_protected(sta, 0);
+- mlink = mlink_dereference_protected(msta, 0);
+- mt7996_mcu_add_sta(dev, conf, mconf, link_sta, mlink, false, false);
+-
+- mt7996_mac_wtbl_update(dev, mlink->wcid.idx,
+- MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
+-
+- for (i = 0; i < ARRAY_SIZE(mlink->twt.flow); i++)
+- mt7996_mac_twt_teardown_flow(dev, mlink, i);
++ unsigned long rem = sta->valid_links ?: BIT(0);
+
+- spin_lock_bh(&mdev->sta_poll_lock);
+- if (!list_empty(&mlink->wcid.poll_list))
+- list_del_init(&mlink->wcid.poll_list);
+- if (!list_empty(&mlink->rc_list))
+- list_del_init(&mlink->rc_list);
+- spin_unlock_bh(&mdev->sta_poll_lock);
+-
+- rcu_assign_pointer(msta->link[0], NULL);
++ mt7996_mac_sta_remove_links(dev, vif, sta, rem);
+ }
+
+ static void mt7996_tx(struct ieee80211_hw *hw,
+@@ -2162,6 +2312,32 @@ mt7996_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ return ret;
+ }
+
++static int
++mt7996_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta, u16 old_links, u16 new_links)
++{
++ struct mt7996_dev *dev = mt7996_hw_dev(hw);
++ unsigned long add = new_links & ~old_links;
++ unsigned long rem = old_links & ~new_links;
++ int ret = 0;
++
++ mutex_lock(&dev->mt76.mutex);
++
++ if (rem)
++ mt7996_mac_sta_remove_links(dev, vif, sta, rem);
++
++ ret = mt7996_mac_sta_add_links(dev, vif, sta, add, false);
++ if (ret)
++ goto remove;
++
++ goto out;
++remove:
++ mt7996_mac_sta_remove_links(dev, vif, sta, add);
++out:
++ mutex_unlock(&dev->mt76.mutex);
++ return ret;
++}
++
+ const struct ieee80211_ops mt7996_ops = {
+ .add_chanctx = ieee80211_emulate_add_chanctx,
+ .remove_chanctx = ieee80211_emulate_remove_chanctx,
+@@ -2223,4 +2399,5 @@ const struct ieee80211_ops mt7996_ops = {
+ .unassign_vif_chanctx = mt7996_unassign_vif_chanctx,
+ .switch_vif_chanctx = mt7996_switch_vif_chanctx,
+ .change_vif_links = mt7996_change_vif_links,
++ .change_sta_links = mt7996_change_sta_links,
+ };
+diff --git a/mt7996/mcu.c b/mt7996/mcu.c
+index d3e244ee..7138230e 100644
+--- a/mt7996/mcu.c
++++ b/mt7996/mcu.c
+@@ -2426,6 +2426,123 @@ out:
+ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
+ }
+
++static void
++mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
++ struct ieee80211_sta *sta)
++{
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ struct sta_rec_mld_setup *mld_setup;
++ struct mld_setup_link *mld_setup_link;
++ struct mt7996_link_sta *mlink;
++ struct mt7996_bss_conf *mconf;
++ struct tlv *tlv;
++ unsigned long valid_links = sta->valid_links;
++ unsigned int link_id;
++
++ mlink = mlink_dereference_protected(msta, msta->pri_link);
++ if (!mlink)
++ return;
++
++ tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_MLD,
++ sizeof(*mld_setup) +
++ sizeof(struct mld_setup_link) *
++ hweight16(sta->valid_links));
++
++ mld_setup = (struct sta_rec_mld_setup *)tlv;
++ memcpy(mld_setup->mld_addr, sta->addr, ETH_ALEN);
++ mld_setup->setup_wcid = cpu_to_le16(mlink->wcid.idx);
++ mld_setup->primary_id = cpu_to_le16(mlink->wcid.idx);
++ if (msta->sec_link != msta->pri_link) {
++ mlink = mlink_dereference_protected(msta, msta->sec_link);
++ if (!mlink)
++ return;
++ }
++ mld_setup->seconed_id = cpu_to_le16(mlink->wcid.idx);
++ mld_setup->link_num = hweight16(sta->valid_links);
++
++ mld_setup_link = (struct mld_setup_link *)mld_setup->link_info;
++ for_each_set_bit(link_id, &valid_links, IEEE80211_MLD_MAX_NUM_LINKS) {
++ mlink = mlink_dereference_protected(msta, link_id);
++ mconf = mconf_dereference_protected(msta->vif, link_id);
++
++ mld_setup_link->wcid = cpu_to_le16(mlink->wcid.idx);
++ mld_setup_link->bss_idx = mconf->mt76.idx;
++ mld_setup_link++;
++ }
++}
++
++static void
++mt7996_mcu_sta_eht_mld_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
++ struct ieee80211_sta *sta)
++{
++ struct sta_rec_eht_mld *eht_mld;
++ struct tlv *tlv;
++ int i;
++
++ tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EHT_MLD, sizeof(*eht_mld));
++ eht_mld = (struct sta_rec_eht_mld *)tlv;
++
++ for (i = 0; i < ARRAY_SIZE(eht_mld->str_cap); i++)
++ eht_mld->str_cap[i] = 0x7;
++ /* TODO:
++ eht_mld->nsep = ;
++ eht_mld->eml_cap = cpu_to_le16()
++ */
++}
++
++int mt7996_mcu_add_mld_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta, unsigned long add)
++{
++ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
++ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
++ unsigned int link_id;
++
++ if (!sta->mlo)
++ return 0;
++
++ for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) {
++ struct mt7996_bss_conf *mconf =
++ mconf_dereference_protected(mvif, link_id);
++ struct mt7996_link_sta *mlink =
++ mlink_dereference_protected(msta, link_id);
++ struct sk_buff *skb;
++ int ret;
++
++ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
++ &mlink->wcid,
++ MT7996_STA_UPDATE_MAX_SIZE);
++ if (IS_ERR(skb))
++ return PTR_ERR(skb);
++ /* starec mld setup */
++ mt7996_mcu_sta_mld_setup_tlv(dev, skb, sta);
++ /* starec eht mld */
++ mt7996_mcu_sta_eht_mld_tlv(dev, skb, sta);
++ ret = mt76_mcu_skb_send_msg(&dev->mt76, skb,
++ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
++ if (ret)
++ return ret;
++ }
++ return 0;
++}
++int mt7996_mcu_teardown_mld_sta(struct mt7996_dev *dev,
++ struct mt7996_bss_conf *mconf,
++ struct mt7996_link_sta *mlink)
++{
++ struct sk_buff *skb;
++
++ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76,
++ &mconf->mt76,
++ &mlink->wcid,
++ MT7996_STA_UPDATE_MAX_SIZE);
++ if (IS_ERR(skb))
++ return PTR_ERR(skb);
++
++ mt76_connac_mcu_add_tlv(skb, STA_REC_MLD_OFF, sizeof(struct tlv));
++
++ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
++ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
++}
++
+ static int
+ mt7996_mcu_sta_key_tlv(struct mt76_wcid *wcid,
+ struct sk_buff *skb,
+diff --git a/mt7996/mcu.h b/mt7996/mcu.h
+index b15796dc..23d44cd3 100644
+--- a/mt7996/mcu.h
++++ b/mt7996/mcu.h
+@@ -692,6 +692,35 @@ struct sta_rec_hdr_trans {
+ u8 mesh;
+ } __packed;
+
++struct sta_rec_mld_setup {
++ __le16 tag;
++ __le16 len;
++ u8 mld_addr[ETH_ALEN];
++ __le16 primary_id;
++ __le16 seconed_id;
++ __le16 setup_wcid;
++ u8 link_num;
++ u8 info;
++ u8 __rsv[2];
++ u8 link_info[];
++} __packed;
++
++struct mld_setup_link {
++ __le16 wcid;
++ u8 bss_idx;
++ u8 __rsv[1];
++} __packed;
++
++struct sta_rec_eht_mld {
++ __le16 tag;
++ __le16 len;
++ u8 nsep;
++ u8 __rsv1[2];
++ u8 str_cap[__MT_MAX_BAND];
++ __le16 eml_cap;
++ u8 __rsv2[4];
++} __packed;
++
+ struct hdr_trans_en {
+ __le16 tag;
+ __le16 len;
+diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
+index 09b1088e..4775e1f8 100644
+--- a/mt7996/mt7996.h
++++ b/mt7996/mt7996.h
+@@ -330,6 +330,8 @@ struct mt7996_sta {
+ struct mt7996_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
+
+ struct mt7996_vif *vif;
++ u8 pri_link;
++ u8 sec_link;
+ };
+
+ struct mt7996_bss_conf {
+@@ -857,6 +859,9 @@ int mt7996_mcu_add_sta(struct mt7996_dev *dev, struct ieee80211_bss_conf *conf,
+ struct mt7996_bss_conf *mconf,
+ struct ieee80211_link_sta *link_sta,
+ struct mt7996_link_sta *mlink, bool enable, bool newly);
++int mt7996_mcu_teardown_mld_sta(struct mt7996_dev *dev,
++ struct mt7996_bss_conf *mconf,
++ struct mt7996_link_sta *mlink);
+ int mt7996_mcu_add_tx_ba(struct mt7996_dev *dev,
+ struct ieee80211_ampdu_params *params,
+ bool add);
+@@ -880,6 +885,8 @@ int mt7996_mcu_add_rate_ctrl(struct mt7996_dev *dev,
+ struct mt7996_bss_conf *mconf,
+ struct ieee80211_link_sta *link_sta,
+ struct mt7996_link_sta *mlink, bool changed);
++int mt7996_mcu_add_mld_sta(struct mt7996_dev *dev, struct ieee80211_vif *vif,
++ struct ieee80211_sta *sta, unsigned long add);
+ int mt7996_set_channel(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef);
+ int mt7996_mcu_set_chan_info(struct mt7996_phy *phy, u16 tag);
+ int mt7996_mcu_set_tx(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf);
+--
+2.18.0
+