Skip to content

Commit 86dca1c

Browse files
Ming Yen Hsiehgregkh
authored andcommitted
wifi: mt76: mt7925: adjust rm BSS flow to prevent next connection failure
[ Upstream commit 0ebb60d ] Removing BSS without removing STAREC first will cause firmware abnormal and next connection fail. Fixes: 8161610 ("wifi: mt76: mt7925: Cleanup MLO settings post-disconnection") Cc: [email protected] Co-developed-by: Sean Wang <[email protected]> Signed-off-by: Sean Wang <[email protected]> Tested-by: Caleb Jorden <[email protected]> Signed-off-by: Ming Yen Hsieh <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Felix Fietkau <[email protected]> [ struct mt76_vif_link -> struct mt792x_vif ] Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b63eb95 commit 86dca1c

File tree

3 files changed

+91
-33
lines changed

3 files changed

+91
-33
lines changed

drivers/net/wireless/mediatek/mt76/mt7925/main.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,12 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
11551155
struct mt792x_bss_conf *mconf;
11561156

11571157
mconf = mt792x_link_conf_to_mconf(link_conf);
1158-
mt792x_mac_link_bss_remove(dev, mconf, mlink);
1158+
1159+
if (ieee80211_vif_is_mld(vif))
1160+
mt792x_mac_link_bss_remove(dev, mconf, mlink);
1161+
else
1162+
mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf,
1163+
link_sta, false);
11591164
}
11601165

11611166
spin_lock_bh(&mdev->sta_poll_lock);
@@ -1175,6 +1180,31 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
11751180
struct mt76_wcid *wcid;
11761181
unsigned int link_id;
11771182

1183+
/* clean up bss before starec */
1184+
for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) {
1185+
struct ieee80211_link_sta *link_sta;
1186+
struct ieee80211_bss_conf *link_conf;
1187+
struct mt792x_bss_conf *mconf;
1188+
struct mt792x_link_sta *mlink;
1189+
1190+
link_sta = mt792x_sta_to_link_sta(vif, sta, link_id);
1191+
if (!link_sta)
1192+
continue;
1193+
1194+
mlink = mt792x_sta_to_link(msta, link_id);
1195+
if (!mlink)
1196+
continue;
1197+
1198+
link_conf = mt792x_vif_to_bss_conf(vif, link_id);
1199+
if (!link_conf)
1200+
continue;
1201+
1202+
mconf = mt792x_link_conf_to_mconf(link_conf);
1203+
1204+
mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf,
1205+
link_sta, false);
1206+
}
1207+
11781208
for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) {
11791209
struct ieee80211_link_sta *link_sta;
11801210
struct mt792x_link_sta *mlink;
@@ -1213,44 +1243,14 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
12131243
{
12141244
struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
12151245
struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
1216-
struct {
1217-
struct {
1218-
u8 omac_idx;
1219-
u8 band_idx;
1220-
__le16 pad;
1221-
} __packed hdr;
1222-
struct req_tlv {
1223-
__le16 tag;
1224-
__le16 len;
1225-
u8 active;
1226-
u8 link_idx; /* hw link idx */
1227-
u8 omac_addr[ETH_ALEN];
1228-
} __packed tlv;
1229-
} dev_req = {
1230-
.hdr = {
1231-
.omac_idx = 0,
1232-
.band_idx = 0,
1233-
},
1234-
.tlv = {
1235-
.tag = cpu_to_le16(DEV_INFO_ACTIVE),
1236-
.len = cpu_to_le16(sizeof(struct req_tlv)),
1237-
.active = true,
1238-
},
1239-
};
12401246
unsigned long rem;
12411247

12421248
rem = ieee80211_vif_is_mld(vif) ? msta->valid_links : BIT(0);
12431249

12441250
mt7925_mac_sta_remove_links(dev, vif, sta, rem);
12451251

1246-
if (ieee80211_vif_is_mld(vif)) {
1247-
mt7925_mcu_set_dbdc(&dev->mphy, false);
1248-
1249-
/* recovery omac address for the legacy interface */
1250-
memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN);
1251-
mt76_mcu_send_msg(mdev, MCU_UNI_CMD(DEV_INFO_UPDATE),
1252-
&dev_req, sizeof(dev_req), true);
1253-
}
1252+
if (ieee80211_vif_is_mld(vif))
1253+
mt7925_mcu_del_dev(mdev, vif);
12541254

12551255
if (vif->type == NL80211_IFTYPE_STATION) {
12561256
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;

drivers/net/wireless/mediatek/mt76/mt7925/mcu.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,6 +2662,62 @@ int mt7925_mcu_set_timing(struct mt792x_phy *phy,
26622662
MCU_UNI_CMD(BSS_INFO_UPDATE), true);
26632663
}
26642664

2665+
void mt7925_mcu_del_dev(struct mt76_dev *mdev,
2666+
struct ieee80211_vif *vif)
2667+
{
2668+
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
2669+
struct {
2670+
struct {
2671+
u8 omac_idx;
2672+
u8 band_idx;
2673+
__le16 pad;
2674+
} __packed hdr;
2675+
struct req_tlv {
2676+
__le16 tag;
2677+
__le16 len;
2678+
u8 active;
2679+
u8 link_idx; /* hw link idx */
2680+
u8 omac_addr[ETH_ALEN];
2681+
} __packed tlv;
2682+
} dev_req = {
2683+
.tlv = {
2684+
.tag = cpu_to_le16(DEV_INFO_ACTIVE),
2685+
.len = cpu_to_le16(sizeof(struct req_tlv)),
2686+
.active = true,
2687+
},
2688+
};
2689+
struct {
2690+
struct {
2691+
u8 bss_idx;
2692+
u8 pad[3];
2693+
} __packed hdr;
2694+
struct mt76_connac_bss_basic_tlv basic;
2695+
} basic_req = {
2696+
.basic = {
2697+
.tag = cpu_to_le16(UNI_BSS_INFO_BASIC),
2698+
.len = cpu_to_le16(sizeof(struct mt76_connac_bss_basic_tlv)),
2699+
.active = true,
2700+
.conn_state = 1,
2701+
},
2702+
};
2703+
2704+
dev_req.hdr.omac_idx = mvif->bss_conf.mt76.omac_idx;
2705+
dev_req.hdr.band_idx = mvif->bss_conf.mt76.band_idx;
2706+
2707+
basic_req.hdr.bss_idx = mvif->bss_conf.mt76.idx;
2708+
basic_req.basic.omac_idx = mvif->bss_conf.mt76.omac_idx;
2709+
basic_req.basic.band_idx = mvif->bss_conf.mt76.band_idx;
2710+
basic_req.basic.link_idx = mvif->bss_conf.mt76.link_idx;
2711+
2712+
mt76_mcu_send_msg(mdev, MCU_UNI_CMD(BSS_INFO_UPDATE),
2713+
&basic_req, sizeof(basic_req), true);
2714+
2715+
/* recovery omac address for the legacy interface */
2716+
memcpy(dev_req.tlv.omac_addr, vif->addr, ETH_ALEN);
2717+
mt76_mcu_send_msg(mdev, MCU_UNI_CMD(DEV_INFO_UPDATE),
2718+
&dev_req, sizeof(dev_req), true);
2719+
}
2720+
26652721
int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
26662722
struct ieee80211_chanctx_conf *ctx,
26672723
struct ieee80211_bss_conf *link_conf,

drivers/net/wireless/mediatek/mt76/mt7925/mcu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,8 @@ int mt7925_mcu_sched_scan_req(struct mt76_phy *phy,
627627
int mt7925_mcu_sched_scan_enable(struct mt76_phy *phy,
628628
struct ieee80211_vif *vif,
629629
bool enable);
630+
void mt7925_mcu_del_dev(struct mt76_dev *mdev,
631+
struct ieee80211_vif *vif);
630632
int mt7925_mcu_add_bss_info(struct mt792x_phy *phy,
631633
struct ieee80211_chanctx_conf *ctx,
632634
struct ieee80211_bss_conf *link_conf,

0 commit comments

Comments
 (0)