blob: 9d09a4f5992e4014001d0f57f326436efeda4e3c [file] [log] [blame]
developerd0c89452024-10-11 16:53:27 +08001From 848a43638c737f72cf30a53b855f0f09ee7be729 Mon Sep 17 00:00:00 2001
developer05f3b2b2024-08-19 19:17:34 +08002From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Mon, 22 Jul 2024 10:47:45 +0800
developerd0c89452024-10-11 16:53:27 +08004Subject: [PATCH 174/223] mtk: mt76: mt7996: add mcu command to set bssid
developer05f3b2b2024-08-19 19:17:34 +08005 mapping address
6
7When receiving 4 address non-amsdu packet, there is no bssid in the address
8field. Set mcu command to use A1 as bssid when receiving 4 address non-amsdu
9packet.
10
developerd0c89452024-10-11 16:53:27 +080011Change-Id: I599c9ea5a1a7cecc206b099ea13c583d71fd274b
developer05f3b2b2024-08-19 19:17:34 +080012Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
13---
14 mt7996/init.c | 7 +++++++
15 mt7996/mcu.c | 26 ++++++++++++++++++++++++++
16 mt7996/mcu.h | 1 +
17 mt7996/mt7996.h | 1 +
18 4 files changed, 35 insertions(+)
19
20diff --git a/mt7996/init.c b/mt7996/init.c
developerd0c89452024-10-11 16:53:27 +080021index 18847ff5..d7a1d7cd 100644
developer05f3b2b2024-08-19 19:17:34 +080022--- a/mt7996/init.c
23+++ b/mt7996/init.c
24@@ -539,6 +539,9 @@ mt7996_mac_init_band(struct mt7996_dev *dev, u8 band)
25 {
26 u32 mask, set;
27
28+ if (!mt7996_band_valid(dev, band))
29+ return;
30+
31 /* clear estimated value of EIFS for Rx duration & OBSS time */
32 mt76_wr(dev, MT_WF_RMAC_RSVD0(band), MT_WF_RMAC_RSVD0_EIFS_CLR);
33
34@@ -566,6 +569,10 @@ mt7996_mac_init_band(struct mt7996_dev *dev, u8 band)
35 * MT_AGG_ACR_PPDU_TXS2H (PPDU format) even though ACR bit is set.
36 */
37 mt76_set(dev, MT_AGG_ACR4(band), MT_AGG_ACR_PPDU_TXS2H);
38+
39+
40+ if (!is_mt7996(&dev->mt76))
41+ mt7996_mcu_set_bssid_mapping_addr(&dev->mt76, band);
42 }
43
44 static void mt7996_mac_init_basic_rates(struct mt7996_dev *dev)
45diff --git a/mt7996/mcu.c b/mt7996/mcu.c
developerd0c89452024-10-11 16:53:27 +080046index b47aa7d6..dc1af0be 100644
developer05f3b2b2024-08-19 19:17:34 +080047--- a/mt7996/mcu.c
48+++ b/mt7996/mcu.c
developerd0c89452024-10-11 16:53:27 +080049@@ -6127,6 +6127,32 @@ int mt7996_mcu_twt_agrt_update(struct mt7996_dev *dev,
developer05f3b2b2024-08-19 19:17:34 +080050 &req, sizeof(req), true);
51 }
52
53+int mt7996_mcu_set_bssid_mapping_addr(struct mt76_dev *dev, u8 band_idx)
54+{
55+ enum {
56+ BSSID_MAPPING_ADDR1,
57+ BSSID_MAPPING_ADDR2,
58+ BSSID_MAPPING_ADDR3,
59+ };
60+ struct {
61+ u8 band_idx;
62+ u8 _rsv1[3];
63+
64+ __le16 tag;
65+ __le16 len;
66+ u8 addr;
67+ u8 _rsv2[3];
68+ } __packed req = {
69+ .band_idx = band_idx,
70+ .tag = cpu_to_le16(UNI_BAND_CONFIG_BSSID_MAPPING_ADDR),
71+ .len = cpu_to_le16(sizeof(req) - 4),
72+ .addr = BSSID_MAPPING_ADDR1,
73+ };
74+
75+ return mt76_mcu_send_msg(dev, MCU_WM_UNI_CMD(BAND_CONFIG),
76+ &req, sizeof(req), true);
77+}
78+
79 int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val)
80 {
81 struct {
82diff --git a/mt7996/mcu.h b/mt7996/mcu.h
83index ffa574b8..5d4625c8 100644
84--- a/mt7996/mcu.h
85+++ b/mt7996/mcu.h
86@@ -1067,6 +1067,7 @@ enum {
87 UNI_BAND_CONFIG_RTS_THRESHOLD = 0x08,
88 UNI_BAND_CONFIG_RTS_SIGTA_EN = 0x09,
89 UNI_BAND_CONFIG_DIS_SECCH_CCA_DET = 0x0a,
90+ UNI_BAND_CONFIG_BSSID_MAPPING_ADDR = 0x12,
91 };
92
93 enum {
94diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
developerd0c89452024-10-11 16:53:27 +080095index 21019bc2..b9b52d17 100644
developer05f3b2b2024-08-19 19:17:34 +080096--- a/mt7996/mt7996.h
97+++ b/mt7996/mt7996.h
developerd0c89452024-10-11 16:53:27 +080098@@ -1112,6 +1112,7 @@ int mt7996_mcu_set_radar_th(struct mt7996_dev *dev, int index,
developer05f3b2b2024-08-19 19:17:34 +080099 const struct mt7996_dfs_pattern *pattern);
100 int mt7996_mcu_set_radio_en(struct mt7996_phy *phy, bool enable);
101 int mt7996_mcu_set_rts_thresh(struct mt7996_phy *phy, u32 val);
102+int mt7996_mcu_set_bssid_mapping_addr(struct mt76_dev *dev, u8 band);
103 int mt7996_mcu_set_timing(struct mt7996_phy *phy, struct mt7996_bss_conf *mconf);
104 int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch);
105 int mt7996_mcu_get_temperature(struct mt7996_phy *phy);
106--
developerd0c89452024-10-11 16:53:27 +08001072.45.2
developer05f3b2b2024-08-19 19:17:34 +0800108