blob: 2b18cc37467020e53931d4dff85af2c3ea362969 [file] [log] [blame]
developer1f55fcf2024-10-17 14:52:33 +08001From c338f3a5a47c2bbb7c4654e558ad0a73c84c38e0 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
developer1f55fcf2024-10-17 14:52:33 +08004Subject: [PATCH 172/193] 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
developer1f55fcf2024-10-17 14:52:33 +080023index 18758ff..69c8389 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
developer1f55fcf2024-10-17 14:52:33 +080035index 972023c..79334a7 100644
developer05f3b2b2024-08-19 19:17:34 +080036--- a/mt7996/main.c
37+++ b/mt7996/main.c
developer1f55fcf2024-10-17 14:52:33 +080038@@ -2080,6 +2080,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
developer1f55fcf2024-10-17 14:52:33 +080049index 2ab7377..faf7477 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
developer1f55fcf2024-10-17 14:52:33 +080078index 0f2695e..ffa574b 100644
developer05f3b2b2024-08-19 19:17:34 +080079--- 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
developer1f55fcf2024-10-17 14:52:33 +080095index 15c4e55..21019bc 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