developer | f8871e8 | 2023-03-08 17:22:32 +0800 | [diff] [blame^] | 1 | From b4af2c843368e7a787fc02ebde5a8ff41edf0a76 Mon Sep 17 00:00:00 2001 |
| 2 | From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 3 | Date: Thu, 2 Mar 2023 15:44:52 +0800 |
| 4 | Subject: [PATCH 17/19] wifi: mt76: mt7996: fix icv error when enable AP and |
| 5 | STA simultaneously |
| 6 | |
| 7 | Fix mcu command content to prevent ICV error |
| 8 | 1. The legacy mld index needs to start from 16. |
| 9 | 2. The bmc_tx_wlan_idx needs to be the vif index rather |
| 10 | than peer AP's index. |
| 11 | |
| 12 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 13 | --- |
| 14 | mt7996/mcu.c | 12 +++++++++--- |
| 15 | 1 file changed, 9 insertions(+), 3 deletions(-) |
| 16 | |
| 17 | diff --git a/mt7996/mcu.c b/mt7996/mcu.c |
| 18 | index 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 | -- |
| 70 | 2.39.2 |
| 71 | |