Skip to content

Commit 34a41bf

Browse files
committed
wifi: mt76: mt7996: prepare mt7996_mcu_add_dev/bss_info for MLO support
Add extra arguments for struct ieee80211_bss_conf and mt76_vif_link. Link: https://patch.msgid.link/[email protected] Signed-off-by: Felix Fietkau <[email protected]>
1 parent 0b57e94 commit 34a41bf

File tree

3 files changed

+99
-96
lines changed

3 files changed

+99
-96
lines changed

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

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ mt7996_vif_link_add(struct mt7996_phy *phy, struct ieee80211_vif *vif,
204204
mlink->mt76.wmm_idx = vif->type == NL80211_IFTYPE_AP ? 0 : 3;
205205
mlink->mt76.wcid = &mlink->sta.wcid;
206206

207-
ret = mt7996_mcu_add_dev_info(phy, vif, true);
207+
ret = mt7996_mcu_add_dev_info(phy, vif, link_conf, &mlink->mt76, true);
208208
if (ret)
209209
return ret;
210210

@@ -237,12 +237,13 @@ mt7996_vif_link_add(struct mt7996_phy *phy, struct ieee80211_vif *vif,
237237

238238
mt7996_init_bitrate_mask(vif, mlink);
239239

240-
mt7996_mcu_add_bss_info(phy, vif, true);
240+
mt7996_mcu_add_bss_info(phy, vif, link_conf, &mlink->mt76, true);
241241
/* defer the first STA_REC of BMC entry to BSS_CHANGED_BSSID for STA
242242
* interface, since firmware only records BSSID when the entry is new
243243
*/
244244
if (vif->type != NL80211_IFTYPE_STATION)
245-
mt7996_mcu_add_sta(dev, vif, NULL, CONN_STATE_PORT_SECURE, true);
245+
mt7996_mcu_add_sta(dev, vif, &mlink->mt76, NULL,
246+
CONN_STATE_PORT_SECURE, true);
246247
rcu_assign_pointer(dev->mt76.wcid[idx], &mlink->sta.wcid);
247248

248249
return 0;
@@ -264,10 +265,11 @@ mt7996_vif_link_remove(struct mt7996_phy *phy, struct ieee80211_vif *vif,
264265
mlink->phy = NULL;
265266
msta = &mlink->sta;
266267
idx = msta->wcid.idx;
267-
mt7996_mcu_add_sta(dev, vif, NULL, CONN_STATE_DISCONNECT, false);
268-
mt7996_mcu_add_bss_info(phy, vif, false);
268+
mt7996_mcu_add_sta(dev, vif, &mlink->mt76, NULL, CONN_STATE_DISCONNECT,
269+
false);
270+
mt7996_mcu_add_bss_info(phy, vif, link_conf, &mlink->mt76, false);
269271

270-
mt7996_mcu_add_dev_info(phy, vif, false);
272+
mt7996_mcu_add_dev_info(phy, vif, link_conf, &mlink->mt76, false);
271273

272274
rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
273275

@@ -397,7 +399,8 @@ static int mt7996_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
397399

398400
if (cmd == SET_KEY && !sta && !mlink->mt76.cipher) {
399401
mlink->mt76.cipher = mt76_connac_mcu_get_cipher(key->cipher);
400-
mt7996_mcu_add_bss_info(phy, vif, true);
402+
mt7996_mcu_add_bss_info(phy, vif, &vif->bss_conf, &mlink->mt76,
403+
true);
401404
}
402405

403406
if (cmd == SET_KEY) {
@@ -626,8 +629,8 @@ static void mt7996_bss_info_changed(struct ieee80211_hw *hw,
626629
if ((changed & BSS_CHANGED_BSSID && !is_zero_ether_addr(info->bssid)) ||
627630
(changed & BSS_CHANGED_ASSOC && vif->cfg.assoc) ||
628631
(changed & BSS_CHANGED_BEACON_ENABLED && info->enable_beacon)) {
629-
mt7996_mcu_add_bss_info(phy, vif, true);
630-
mt7996_mcu_add_sta(dev, vif, NULL, CONN_STATE_PORT_SECURE,
632+
mt7996_mcu_add_bss_info(phy, vif, info, mvif, true);
633+
mt7996_mcu_add_sta(dev, vif, mvif, NULL, CONN_STATE_PORT_SECURE,
631634
!!(changed & BSS_CHANGED_BSSID));
632635
}
633636

@@ -697,7 +700,8 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
697700
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
698701
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
699702
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
700-
u8 band_idx = mvif->deflink.phy->mt76->band_idx;
703+
struct mt7996_vif_link *link = &mvif->deflink;
704+
u8 band_idx = link->phy->mt76->band_idx;
701705
int idx;
702706

703707
idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7996_WTBL_STA);
@@ -715,7 +719,8 @@ int mt7996_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
715719

716720
mt7996_mac_wtbl_update(dev, idx,
717721
MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
718-
mt7996_mcu_add_sta(dev, vif, sta, CONN_STATE_DISCONNECT, true);
722+
mt7996_mcu_add_sta(dev, vif, &link->mt76, sta, CONN_STATE_DISCONNECT,
723+
true);
719724

720725
return 0;
721726
}
@@ -725,11 +730,14 @@ int mt7996_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif,
725730
{
726731
struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);
727732
struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
733+
struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
734+
struct mt7996_vif_link *link = &mvif->deflink;
728735
int i, ret;
729736

730737
switch (ev) {
731738
case MT76_STA_EVENT_ASSOC:
732-
ret = mt7996_mcu_add_sta(dev, vif, sta, CONN_STATE_CONNECT, true);
739+
ret = mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
740+
CONN_STATE_CONNECT, true);
733741
if (ret)
734742
return ret;
735743

@@ -743,13 +751,15 @@ int mt7996_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif,
743751
return 0;
744752

745753
case MT76_STA_EVENT_AUTHORIZE:
746-
return mt7996_mcu_add_sta(dev, vif, sta, CONN_STATE_PORT_SECURE, false);
754+
return mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
755+
CONN_STATE_PORT_SECURE, false);
747756

748757
case MT76_STA_EVENT_DISASSOC:
749758
for (i = 0; i < ARRAY_SIZE(msta->twt.flow); i++)
750759
mt7996_mac_twt_teardown_flow(dev, msta, i);
751760

752-
mt7996_mcu_add_sta(dev, vif, sta, CONN_STATE_DISCONNECT, false);
761+
mt7996_mcu_add_sta(dev, vif, &link->mt76, sta,
762+
CONN_STATE_DISCONNECT, false);
753763
msta->wcid.sta_disabled = 1;
754764
msta->wcid.sta = 0;
755765

0 commit comments

Comments
 (0)