blob: 0b179f4efb18f5cd69b257e9592c6be558537170 [file] [log] [blame]
developer483388c2023-03-08 13:52:15 +08001From b4af2c843368e7a787fc02ebde5a8ff41edf0a76 Mon Sep 17 00:00:00 2001
2From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Thu, 2 Mar 2023 15:44:52 +0800
4Subject: [PATCH 17/19] wifi: mt76: mt7996: fix icv error when enable AP and
5 STA simultaneously
6
7Fix mcu command content to prevent ICV error
81. The legacy mld index needs to start from 16.
92. The bmc_tx_wlan_idx needs to be the vif index rather
10than peer AP's index.
11
12Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
13---
14 mt7996/mcu.c | 12 +++++++++---
15 1 file changed, 9 insertions(+), 3 deletions(-)
16
17diff --git a/mt7996/mcu.c b/mt7996/mcu.c
18index 09800ff2..829f7be6 100644
19--- a/mt7996/mcu.c
20+++ b/mt7996/mcu.c
21@@ -664,6 +664,7 @@ mt7996_mcu_bss_txcmd_tlv(struct sk_buff *skb, bool en)
22 static void
23 mt7996_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
24 {
25+#define MT7996_LEGACY_MLD_IDX_START 16
26 struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
27 struct bss_mld_tlv *mld;
28 struct tlv *tlv;
29@@ -672,8 +673,12 @@ mt7996_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif)
30
31 mld = (struct bss_mld_tlv *)tlv;
32 mld->group_mld_id = 0xff;
33- mld->own_mld_id = mvif->mt76.idx;
34+ mld->own_mld_id = MT7996_LEGACY_MLD_IDX_START + mvif->mt76.idx;
35 mld->remap_idx = 0xff;
36+ if (vif->type == NL80211_IFTYPE_AP) {
37+ mld->group_mld_id = MT7996_LEGACY_MLD_IDX_START + mvif->mt76.idx;
38+ memcpy(mld->mac_addr, vif->bss_conf.bssid, ETH_ALEN);
39+ }
40 }
41
42 static void
43@@ -744,6 +749,7 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
44 struct cfg80211_chan_def *chandef = &phy->chandef;
45 struct mt76_connac_bss_basic_tlv *bss;
46 u32 type = CONNECTION_INFRA_AP;
47+ u16 sta_wlan_idx = wlan_idx;
48 struct tlv *tlv;
49 int idx;
50
51@@ -763,7 +769,7 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
52 struct mt76_wcid *wcid;
53
54 wcid = (struct mt76_wcid *)sta->drv_priv;
55- wlan_idx = wcid->idx;
56+ sta_wlan_idx = wcid->idx;
57 }
58 rcu_read_unlock();
59 }
60@@ -783,7 +789,7 @@ mt7996_mcu_bss_basic_tlv(struct sk_buff *skb,
61 bss->bcn_interval = cpu_to_le16(vif->bss_conf.beacon_int);
62 bss->dtim_period = vif->bss_conf.dtim_period;
63 bss->bmc_tx_wlan_idx = cpu_to_le16(wlan_idx);
64- bss->sta_idx = cpu_to_le16(wlan_idx);
65+ bss->sta_idx = cpu_to_le16(sta_wlan_idx);
66 bss->conn_type = cpu_to_le32(type);
67 bss->omac_idx = mvif->omac_idx;
68 bss->band_idx = mvif->band_idx;
69--
702.39.2
71