blob: f7fb35f62c7be357bde36339781fc1f85c98bbd2 [file] [log] [blame]
developerd0c89452024-10-11 16:53:27 +08001From 4b29092cc31d34967152a3062966d987fc5352eb Mon Sep 17 00:00:00 2001
developer05f3b2b2024-08-19 19:17:34 +08002From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Thu, 18 Jul 2024 10:29:22 +0800
developerd0c89452024-10-11 16:53:27 +08004Subject: [PATCH 172/223] mtk: mt76: mt7996: leave ps when 4 address is
developer05f3b2b2024-08-19 19:17:34 +08005 established
6
7Because the 4 address non-amsdu packet does not have bssid field, the
8hardware cannot get the bssid. Without bssid, the station's are not able
9leave PS mode due to HW design. Wake up non-setup link when receiving
104 address null data to prevent this issue.
11
developerd0c89452024-10-11 16:53:27 +080012Change-Id: I94308432b73e647363fd0e2db281c54becdf1ec8
developer05f3b2b2024-08-19 19:17:34 +080013Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
14---
15 mt76_connac_mcu.h | 1 +
16 mt7996/main.c | 3 +++
17 mt7996/mcu.c | 18 ++++++++++++++++++
18 mt7996/mcu.h | 6 ++++++
19 mt7996/mt7996.h | 2 ++
20 5 files changed, 30 insertions(+)
21
22diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
developerd0c89452024-10-11 16:53:27 +080023index 18758ff2..69c8389f 100644
developer05f3b2b2024-08-19 19:17:34 +080024--- a/mt76_connac_mcu.h
25+++ b/mt76_connac_mcu.h
developerd0c89452024-10-11 16:53:27 +080026@@ -843,6 +843,7 @@ enum {
developer05f3b2b2024-08-19 19:17:34 +080027 STA_REC_EML_OP = 0x29,
28 STA_REC_HDR_TRANS = 0x2B,
29 STA_REC_TX_CAP = 0x2f,
30+ STA_REC_PS_LEAVE = 0x45,
31 STA_REC_MAX_NUM
32 };
33
34diff --git a/mt7996/main.c b/mt7996/main.c
developerd0c89452024-10-11 16:53:27 +080035index c6cb5104..21d65f78 100644
developer05f3b2b2024-08-19 19:17:34 +080036--- a/mt7996/main.c
37+++ b/mt7996/main.c
developerd0c89452024-10-11 16:53:27 +080038@@ -2081,6 +2081,9 @@ static void mt7996_sta_set_4addr(struct ieee80211_hw *hw,
developer05f3b2b2024-08-19 19:17:34 +080039 clear_bit(MT_WCID_FLAG_4ADDR, &mlink->wcid.flags);
40
41 mt7996_mcu_wtbl_update_hdr_trans(dev, vif, mconf, mlink);
42+
43+ if (msta->pri_link != link_id && is_mt7996(&dev->mt76))
44+ mt7996_mcu_ps_leave(dev, mconf, mlink);
45 }
46 mutex_unlock(&dev->mt76.mutex);
47 }
48diff --git a/mt7996/mcu.c b/mt7996/mcu.c
developerd0c89452024-10-11 16:53:27 +080049index 0e8e2c06..b47aa7d6 100644
developer05f3b2b2024-08-19 19:17:34 +080050--- a/mt7996/mcu.c
51+++ b/mt7996/mcu.c
developerd0c89452024-10-11 16:53:27 +080052@@ -6257,6 +6257,24 @@ int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
developer05f3b2b2024-08-19 19:17:34 +080053 MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
54 }
55
56+int mt7996_mcu_ps_leave(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf,
57+ struct mt7996_link_sta *mlink)
58+{
59+ struct sk_buff *skb;
60+
61+ skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76,
62+ &mlink->wcid,
63+ MT7996_STA_UPDATE_MAX_SIZE);
64+ if (IS_ERR(skb))
65+ return PTR_ERR(skb);
66+
67+ mt76_connac_mcu_add_tlv(skb, STA_REC_PS_LEAVE,
68+ sizeof(struct sta_rec_ps_leave));
69+
70+ return mt76_mcu_skb_send_msg(&dev->mt76, skb,
71+ MCU_WMWA_UNI_CMD(STA_REC_UPDATE), true);
72+}
73+
74 int mt7996_mcu_set_fixed_rate_table(struct mt7996_phy *phy, u8 table_idx,
75 u16 rate_idx, bool beacon)
76 {
77diff --git a/mt7996/mcu.h b/mt7996/mcu.h
78index 0f2695eb..ffa574b8 100644
79--- a/mt7996/mcu.h
80+++ b/mt7996/mcu.h
81@@ -775,6 +775,12 @@ struct sta_rec_hdr_trans {
82 u8 mesh;
83 } __packed;
84
85+struct sta_rec_ps_leave {
86+ __le16 tag;
87+ __le16 len;
88+ u8 __rsv[4];
89+} __packed;
90+
91 struct sta_rec_mld_setup {
92 __le16 tag;
93 __le16 len;
94diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
developerd0c89452024-10-11 16:53:27 +080095index 15c4e557..21019bc2 100644
developer05f3b2b2024-08-19 19:17:34 +080096--- a/mt7996/mt7996.h
97+++ b/mt7996/mt7996.h
developerd0c89452024-10-11 16:53:27 +080098@@ -1281,6 +1281,8 @@ int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
developer05f3b2b2024-08-19 19:17:34 +080099 struct ieee80211_vif *vif,
100 struct mt7996_bss_conf *mconf,
101 struct mt7996_link_sta *mlink);
102+int mt7996_mcu_ps_leave(struct mt7996_dev *dev, struct mt7996_bss_conf *mconf,
103+ struct mt7996_link_sta *mlink);
104 int mt7996_mcu_cp_support(struct mt7996_dev *dev, u8 mode);
105 int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, u8 mode, u16 bitmap);
106 int mt7996_mcu_set_pp_sta_dscb(struct mt7996_phy *phy, struct cfg80211_chan_def *chandef,
107--
developerd0c89452024-10-11 16:53:27 +08001082.45.2
developer05f3b2b2024-08-19 19:17:34 +0800109