wifi: mt76: mt7996: fix updating beacon protection with beacons enabled

Disable and re-enable beacon after beacon protection key change, in order
to fully apply the changes.

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2025-09-10 17:59:04 +02:00
parent e995f6198d
commit 5b0cbb0580
4 changed files with 26 additions and 17 deletions
+2 -1
View File
@@ -2176,7 +2176,8 @@ mt7996_update_vif_beacon(void *priv, u8 *mac, struct ieee80211_vif *vif)
if (!link || link->phy != phy)
continue;
mt7996_mcu_add_beacon(dev->mt76.hw, vif, link_conf);
mt7996_mcu_add_beacon(dev->mt76.hw, vif, link_conf,
link_conf->enable_beacon);
}
}
+22 -13
View File
@@ -185,10 +185,13 @@ mt7996_set_hw_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
unsigned int link_id, struct ieee80211_key_conf *key)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct ieee80211_bss_conf *link_conf;
struct mt7996_sta_link *msta_link;
struct mt7996_vif_link *link;
int idx = key->keyidx;
u8 *wcid_keyidx;
bool is_bigtk;
int err;
link = mt7996_vif_link(dev, vif, link_id);
if (!link)
@@ -213,12 +216,13 @@ mt7996_set_hw_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
}
wcid_keyidx = &msta_link->wcid.hw_key_idx;
is_bigtk = key->keyidx == 6 || key->keyidx == 7;
switch (key->cipher) {
case WLAN_CIPHER_SUITE_AES_CMAC:
case WLAN_CIPHER_SUITE_BIP_CMAC_256:
case WLAN_CIPHER_SUITE_BIP_GMAC_128:
case WLAN_CIPHER_SUITE_BIP_GMAC_256:
if (key->keyidx == 6 || key->keyidx == 7) {
if (is_bigtk) {
wcid_keyidx = &msta_link->wcid.hw_key_idx2;
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIE;
}
@@ -227,14 +231,11 @@ mt7996_set_hw_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
break;
}
link_conf = link_conf_dereference_protected(vif, link_id);
if (!link_conf)
link_conf = &vif->bss_conf;
if (cmd == SET_KEY && !sta && !link->mt76.cipher) {
struct ieee80211_bss_conf *link_conf;
link_conf = link_conf_dereference_protected(vif,
link_id);
if (!link_conf)
link_conf = &vif->bss_conf;
link->mt76.cipher =
mt76_connac_mcu_get_cipher(key->cipher);
mt7996_mcu_add_bss_info(link->phy, vif, link_conf,
@@ -251,9 +252,17 @@ mt7996_set_hw_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
mt76_wcid_key_setup(&dev->mt76, &msta_link->wcid, key);
return mt7996_mcu_add_key(&dev->mt76, vif, key,
MCU_WMWA_UNI_CMD(STA_REC_UPDATE),
&msta_link->wcid, cmd);
err = mt7996_mcu_add_key(&dev->mt76, vif, key,
MCU_WMWA_UNI_CMD(STA_REC_UPDATE),
&msta_link->wcid, cmd);
/* remove and add beacon in order to enable beacon protection */
if (cmd == SET_KEY && is_bigtk && link_conf->enable_beacon) {
mt7996_mcu_add_beacon(hw, vif, link_conf, false);
mt7996_mcu_add_beacon(hw, vif, link_conf, true);
}
return err;
}
struct mt7996_key_iter_data {
@@ -899,7 +908,7 @@ mt7996_link_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
link->mt76.beacon_rates_idx =
mt7996_get_rates_table(phy, info, true, false);
mt7996_mcu_add_beacon(hw, vif, info);
mt7996_mcu_add_beacon(hw, vif, info, info->enable_beacon);
}
if (changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
@@ -927,7 +936,7 @@ mt7996_channel_switch_beacon(struct ieee80211_hw *hw,
struct mt7996_dev *dev = mt7996_hw_dev(hw);
mutex_lock(&dev->mt76.mutex);
mt7996_mcu_add_beacon(hw, vif, &vif->bss_conf);
mt7996_mcu_add_beacon(hw, vif, &vif->bss_conf, vif->bss_conf.enable_beacon);
mutex_unlock(&dev->mt76.mutex);
}
+1 -2
View File
@@ -2760,7 +2760,7 @@ mt7996_mcu_beacon_cont(struct mt7996_dev *dev,
}
int mt7996_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf)
struct ieee80211_bss_conf *link_conf, bool enabled)
{
struct mt7996_dev *dev = mt7996_hw_dev(hw);
struct mt7996_vif_link *link = mt7996_vif_conf_link(dev, vif, link_conf);
@@ -2771,7 +2771,6 @@ int mt7996_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct tlv *tlv;
struct bss_bcn_content_tlv *bcn;
int len, extra_len = 0;
bool enabled = link_conf->enable_beacon;
if (link_conf->nontransmitted)
return 0;
+1 -1
View File
@@ -682,7 +682,7 @@ int mt7996_mcu_update_bss_color(struct mt7996_dev *dev,
struct mt76_vif_link *mlink,
struct cfg80211_he_bss_color *he_bss_color);
int mt7996_mcu_add_beacon(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_bss_conf *link_conf);
struct ieee80211_bss_conf *link_conf, bool enabled);
int mt7996_mcu_beacon_inband_discov(struct mt7996_dev *dev,
struct ieee80211_bss_conf *link_conf,
struct mt7996_vif_link *link, u32 changed);