MCU_UNI_CMD_ASSERT_DUMP = 0x6f,
MCU_UNI_CMD_EXT_EEPROM_CTRL = 0x74,
MCU_UNI_CMD_RADIO_STATUS = 0x80,
+ MCU_UNI_CMD_MLD = 0x82,
MCU_UNI_CMD_SDO = 0x88,
};
UNI_BSS_INFO_MLD = 26,
UNI_BSS_INFO_PM_DISABLE = 27,
UNI_BSS_INFO_EHT = 30,
+ UNI_BSS_INFO_MLD_LINK_OP = 36,
};
enum {
int mld_idx, idx, ret;
if ((mvif->mt76.valid_links & BIT(link_conf->link_id)) &&
- !mlink->offchannel)
+ !mlink->offchannel) {
+ if (vif->type == NL80211_IFTYPE_AP)
+ return mt7996_mcu_mld_link_oper(dev, link_conf, link,
+ true);
return 0;
+ }
mlink->idx = __ffs64(~dev->mt76.vif_mask);
if (mlink->idx >= mt7996_max_interface_num(dev))
struct mt7996_vif_link *link = container_of(mlink, struct mt7996_vif_link, mt76);
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
struct mt7996_sta_link *msta_link = &link->msta_link;
+ unsigned int link_id = msta_link->wcid.link_id;
struct mt7996_phy *phy = mphy->priv;
/* Hw requires to destroy active links tearing down the interface, so
*/
if (mlink->wcid->offchannel) {
mt7996_vif_link_destroy(phy, link, vif, link_conf);
- } else if (vif->txq &&
- mvif->mt76.deflink_id == msta_link->wcid.link_id) {
- struct ieee80211_bss_conf *iter;
- struct mt76_txq *mtxq;
- unsigned int link_id;
-
- mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
- mtxq = (struct mt76_txq *)vif->txq->drv_priv;
- /* Primary link will be removed, look for a new one */
- for_each_vif_active_link(vif, iter, link_id) {
- if (link_id == msta_link->wcid.link_id)
- continue;
+ } else {
+ if (vif->type == NL80211_IFTYPE_AP) {
+ mt7996_mcu_mld_reconf_stop_link(phy->dev, vif,
+ BIT(link_id));
+ mt7996_mcu_mld_link_oper(phy->dev, link_conf, link,
+ false);
+ }
- link = mt7996_vif_link(phy->dev, vif, link_id);
- if (!link)
- continue;
+ if (vif->txq && mvif->mt76.deflink_id == link_id) {
+ struct ieee80211_bss_conf *iter;
+ struct mt76_txq *mtxq;
- mtxq->wcid = link->msta_link.wcid.idx;
- mvif->mt76.deflink_id = link_id;
- break;
+ mvif->mt76.deflink_id = IEEE80211_LINK_UNSPECIFIED;
+ mtxq = (struct mt76_txq *)vif->txq->drv_priv;
+ /* Primary link will be removed, look for a new one */
+ for_each_vif_active_link(vif, iter, link_id) {
+ if (link_id == msta_link->wcid.link_id)
+ continue;
+
+ link = mt7996_vif_link(phy->dev, vif, link_id);
+ if (!link)
+ continue;
+
+ mtxq->wcid = link->msta_link.wcid.idx;
+ mvif->mt76.deflink_id = link_id;
+ break;
+ }
}
}
}
sizeof(req), true);
}
+int mt7996_mcu_mld_reconf_stop_link(struct mt7996_dev *dev,
+ struct ieee80211_vif *vif,
+ u16 removed_links)
+{
+ unsigned long rem_links = removed_links;
+ struct mld_reconf_stop_link *sl;
+ struct mld_req_hdr hdr = {};
+ unsigned int link_id;
+ struct sk_buff *skb;
+ struct tlv *tlv;
+
+ skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, sizeof(hdr) + sizeof(*sl));
+ if (!skb)
+ return -ENOMEM;
+
+ memcpy(hdr.mld_addr, vif->addr, ETH_ALEN);
+ skb_put_data(skb, &hdr, sizeof(hdr));
+
+ tlv = mt7996_mcu_add_uni_tlv(skb, UNI_CMD_MLD_RECONF_STOP_LINK,
+ sizeof(*sl));
+ sl = (struct mld_reconf_stop_link *)tlv;
+ sl->link_bitmap = cpu_to_le16(removed_links);
+
+ for_each_set_bit(link_id, &rem_links, IEEE80211_MLD_MAX_NUM_LINKS) {
+ struct mt7996_vif_link *link;
+
+ link = mt7996_vif_link(dev, vif, link_id);
+ if (!link)
+ continue;
+
+ sl->bss_idx[link_id] = link->mt76.idx;
+ }
+
+ return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_WM_UNI_CMD(MLD),
+ true);
+}
+
+int mt7996_mcu_mld_link_oper(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *link_conf,
+ struct mt7996_vif_link *link, bool add)
+{
+ struct ieee80211_vif *vif = link_conf->vif;
+ struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
+ struct bss_mld_link_op_tlv *mld_op;
+ struct sk_buff *skb;
+ struct tlv *tlv;
+
+ skb = __mt7996_mcu_alloc_bss_req(&dev->mt76, &link->mt76,
+ MT7996_BSS_UPDATE_MAX_SIZE);
+ if (IS_ERR(skb))
+ return PTR_ERR(skb);
+
+ tlv = mt7996_mcu_add_uni_tlv(skb, UNI_BSS_INFO_MLD_LINK_OP,
+ sizeof(*mld_op));
+ mld_op = (struct bss_mld_link_op_tlv *)tlv;
+ mld_op->link_operation = add;
+ mld_op->own_mld_id = link->mld_idx;
+ mld_op->link_id = link_conf->link_id;
+ mld_op->group_mld_id = add ? mvif->mld_group_idx : 0xff;
+ mld_op->remap_idx = add ? mvif->mld_remap_idx : 0xff;
+ memcpy(mld_op->mac_addr, vif->addr, ETH_ALEN);
+
+ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
+ MCU_WMWA_UNI_CMD(BSS_INFO_UPDATE), true);
+}
+
static void
mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,
struct ieee80211_vif *vif,
__le32 prot_mode;
} __packed;
+struct bss_mld_link_op_tlv {
+ __le16 tag;
+ __le16 len;
+ u8 group_mld_id;
+ u8 own_mld_id;
+ u8 mac_addr[ETH_ALEN];
+ u8 remap_idx;
+ u8 link_operation;
+ u8 link_id;
+ u8 rsv[2];
+} __packed;
+
struct sta_rec_ht_uni {
__le16 tag;
__le16 len;
u8 __rsv;
} __packed;
+struct mld_req_hdr {
+ u8 ver;
+ u8 mld_addr[ETH_ALEN];
+ u8 mld_idx;
+ u8 flag;
+ u8 rsv[3];
+ u8 buf[];
+} __packed;
+
+struct mld_reconf_stop_link {
+ __le16 tag;
+ __le16 len;
+ __le16 link_bitmap;
+ u8 rsv[2];
+ u8 bss_idx[16];
+} __packed;
+
+enum {
+ UNI_CMD_MLD_RECONF_AP_REM_TIMER = 0x03,
+ UNI_CMD_MLD_RECONF_STOP_LINK = 0x04,
+};
+
struct hdr_trans_en {
__le16 tag;
__le16 len;
int mt7996_mcu_wed_rro_reset_sessions(struct mt7996_dev *dev, u16 id);
int mt7996_mcu_set_sniffer_mode(struct mt7996_phy *phy, bool enabled);
int mt7996_mcu_set_dup_wtbl(struct mt7996_dev *dev);
+int mt7996_mcu_mld_reconf_stop_link(struct mt7996_dev *dev,
+ struct ieee80211_vif *vif,
+ u16 removed_links);
+int mt7996_mcu_mld_link_oper(struct mt7996_dev *dev,
+ struct ieee80211_bss_conf *link_conf,
+ struct mt7996_vif_link *link, bool add);
static inline bool mt7996_has_hwrro(struct mt7996_dev *dev)
{