1

wifi: mt76: mt7925: add link handling in mt7925_set_key

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>
Link: https://patch.msgid.link/164608d96ce10a40e673bc6f252189c94bc48da7.1720248331.git.sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Sean Wang 2024-07-06 01:27:52 -07:00 committed by Felix Fietkau
parent ebb1406813
commit 3e758e9f77

View File

@ -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);